From 267ddffa7f3b89529ccf40a4faf38189db76241f Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Tue, 18 May 2021 20:56:53 +0530 Subject: [PATCH] src: fix compiler warnings in node_buffer.cc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The variables could be initialized to `0` to avoid the warnings from `-Wmaybe-uninitialized`. Fixes: https://github.com/nodejs/node/issues/38718 PR-URL: https://github.com/nodejs/node/pull/38722 Reviewed-By: Anna Henningsen Reviewed-By: Michaƫl Zasso Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Minwoo Jung --- src/node_buffer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 4e44f0b47f0c03..f1a266fd1c396d 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -557,7 +557,7 @@ void Fill(const FunctionCallbackInfo& args) { THROW_AND_RETURN_UNLESS_BUFFER(env, args[0]); SPREAD_BUFFER_ARG(args[0], ts_obj); - size_t start; + size_t start = 0; THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[2], 0, &start)); size_t end; THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[3], 0, &end)); @@ -658,8 +658,8 @@ void StringWrite(const FunctionCallbackInfo& args) { Local str = args[0]->ToString(env->context()).ToLocalChecked(); - size_t offset; - size_t max_length; + size_t offset = 0; + size_t max_length = 0; THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[1], 0, &offset)); if (offset > ts_obj_length) {