Skip to content

Commit 5aae124

Browse files
committed
resolve feedback
1 parent cf9242a commit 5aae124

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ const encodingOps = {
745745
write: asciiWrite,
746746
slice: asciiSlice,
747747
indexOf: (buf, val, byteOffset, dir) =>
748-
indexOfString(buf, val, byteOffset, encodingsMap.latin1, dir),
748+
indexOfString(buf, val, byteOffset, encodingsMap.ascii, dir),
749749
},
750750
base64: {
751751
encoding: 'base64',

src/node_buffer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) {
10501050
needle_length,
10511051
offset,
10521052
is_forward);
1053-
} else if (enc == LATIN1) {
1053+
} else if (enc == ASCII || enc == LATIN1) {
10541054
uint8_t* needle_data = node::UncheckedMalloc<uint8_t>(needle_length);
10551055
if (needle_data == nullptr) {
10561056
return args.GetReturnValue().Set(-1);

0 commit comments

Comments
 (0)