summaryrefslogtreecommitdiff
path: root/src/node_i18n.cc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2016-10-25 14:50:32 -0700
committerJames M Snell <jasnell@gmail.com>2016-10-28 12:58:31 -0700
commit2bd850b370cee688aaf377bde41f1b0a0cb19edd (patch)
tree8f9d9e4de32a2ec255fa4afbf662d62e0b3f9599 /src/node_i18n.cc
parent758ca8d179dd2ddf22c680d812870a12fc9430cd (diff)
downloadandroid-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.cc4
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;