src: fix compiler warnings in node_buffer.cc

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 <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
This commit is contained in:
Darshan Sen 2021-05-18 20:56:53 +05:30 committed by James M Snell
parent 80ed0a66b5
commit 7766b3853a
No known key found for this signature in database
GPG Key ID: 7341B15C070877AC

View File

@ -567,7 +567,7 @@ void Fill(const FunctionCallbackInfo<Value>& 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));
@ -668,8 +668,8 @@ void StringWrite(const FunctionCallbackInfo<Value>& args) {
Local<String> 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) {