From 5ab172ee8ff2726a57b0d27f63944b8d8f8cb0ae Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 25 Oct 2016 14:50:32 -0700 Subject: [PATCH] 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 --- src/node_i18n.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 282575b3c3cc5d..bab06cfcdfc41a 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -586,7 +586,9 @@ static void GetStringWidth(const FunctionCallbackInfo& args) { TwoByteValue value(env->isolate(), args[0]); // reinterpret_cast is required by windows to compile UChar* str = reinterpret_cast(*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;