Skip to content

Commit

Permalink
src: fix compiler warnings in node_buffer.cc
Browse files Browse the repository at this point in the history
The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.

Fixes: #38718

PR-URL: #38722
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
  • Loading branch information
RaisinTen authored and targos committed Jun 11, 2021
1 parent 78cde14 commit 8a60ae2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,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));
Expand Down Expand Up @@ -658,8 +658,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) {
Expand Down

0 comments on commit 8a60ae2

Please sign in to comment.