diff options
author | James M Snell <jasnell@gmail.com> | 2016-10-25 14:50:32 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-10-28 12:58:31 -0700 |
commit | 2bd850b370cee688aaf377bde41f1b0a0cb19edd (patch) | |
tree | 8f9d9e4de32a2ec255fa4afbf662d62e0b3f9599 /src/node_i18n.cc | |
parent | 758ca8d179dd2ddf22c680d812870a12fc9430cd (diff) | |
download | android-node-v8-2bd850b370cee688aaf377bde41f1b0a0cb19edd.tar.gz android-node-v8-2bd850b370cee688aaf377bde41f1b0a0cb19edd.tar.bz2 android-node-v8-2bd850b370cee688aaf377bde41f1b0a0cb19edd.zip |
src: fix use of uninitialized variable
Variable was uninitialized in 72547fe28d
Initialize the variable and add a static_check
PR-URL: https://github.com/nodejs/node/pull/9281
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node_i18n.cc')
-rw-r--r-- | src/node_i18n.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 282575b3c3..bab06cfcdf 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -586,7 +586,9 @@ static void GetStringWidth(const FunctionCallbackInfo<Value>& args) { TwoByteValue value(env->isolate(), args[0]); // reinterpret_cast is required by windows to compile UChar* str = reinterpret_cast<UChar*>(*value); - UChar32 c; + static_assert(sizeof(*str) == sizeof(**value), + "sizeof(*str) == sizeof(**value)"); + UChar32 c = 0; UChar32 p; size_t n = 0; uint32_t width = 0; |