Skip to content

Commit

Permalink
fix upon reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuzilin committed Aug 20, 2022
1 parent f228e6a commit 86e6a30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bun.js/bindings/JSBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,9 @@ static int64_t indexOf(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame*
if (std::isnan(byteOffset_) || std::isinf(byteOffset_)) {
byteOffset = last ? length - 1 : 0;
} else if (byteOffset_ < 0) {
byteOffset = length + static_cast<int>(byteOffset_);
byteOffset = length + static_cast<int64_t>(byteOffset_);
} else {
byteOffset = static_cast<int>(byteOffset_);
byteOffset = static_cast<int64_t>(byteOffset_);
}

if (last) {
Expand All @@ -1069,7 +1069,7 @@ static int64_t indexOf(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame*
}

if (callFrame->argumentCount() > 2) {
std::optional<BufferEncodingType> encoded = parseEnumeration<BufferEncodingType>(*lexicalGlobalObject, callFrame->argument(2));
std::optional<BufferEncodingType> encoded = parseEnumeration<BufferEncodingType>(*lexicalGlobalObject, callFrame->uncheckedArgument(2));
if (!encoded) {
throwTypeError(lexicalGlobalObject, scope, "Invalid encoding"_s);
return JSC::JSValue::encode(jsUndefined());
Expand Down

0 comments on commit 86e6a30

Please sign in to comment.