Skip to content

Commit 9ca5c0e

Browse files
RaisinTendanielleadams
authored andcommittedMay 31, 2021
src: fix compiler warnings in node_buffer.cc
The variables could be initialized to `0` to avoid the warnings from `-Wmaybe-uninitialized`. Fixes: #38718 PR-URL: #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>
1 parent c7a5857 commit 9ca5c0e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/node_buffer.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ void Fill(const FunctionCallbackInfo<Value>& args) {
567567
THROW_AND_RETURN_UNLESS_BUFFER(env, args[0]);
568568
SPREAD_BUFFER_ARG(args[0], ts_obj);
569569

570-
size_t start;
570+
size_t start = 0;
571571
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[2], 0, &start));
572572
size_t end;
573573
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[3], 0, &end));
@@ -668,8 +668,8 @@ void StringWrite(const FunctionCallbackInfo<Value>& args) {
668668

669669
Local<String> str = args[0]->ToString(env->context()).ToLocalChecked();
670670

671-
size_t offset;
672-
size_t max_length;
671+
size_t offset = 0;
672+
size_t max_length = 0;
673673

674674
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[1], 0, &offset));
675675
if (offset > ts_obj_length) {

0 commit comments

Comments
 (0)
Please sign in to comment.