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>
This commit is contained in:
James M Snell 2016-10-25 14:50:32 -07:00
parent 758ca8d179
commit 2bd850b370

View File

@ -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;