Skip to content

Commit

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

Fixes: #38718
  • Loading branch information
RaisinTen committed May 18, 2021
1 parent 910efc2 commit 15303b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node_buffer.cc
Expand Up @@ -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) {
Expand Down

0 comments on commit 15303b2

Please sign in to comment.