Skip to content

Commit 42b4ff4

Browse files
committed
src: use validate_ascii_with_errors
1 parent 866781f commit 42b4ff4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/encoding_binding.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ void BindingData::DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
365365

366366
if (has_fatal) {
367367
// Are we perhaps ASCII? Then we won't have to check for UTF-8
368-
if (simdutf::validate_ascii(data, length)) {
368+
if (!simdutf::validate_ascii_with_errors(data, length).error) {
369369
Local<Value> ret;
370370
if (StringBytes::Encode(env->isolate(), data, length, LATIN1)
371371
.ToLocal(&ret)) {

src/string_bytes.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate,
535535
// ASCII fast path
536536
// TODO(chalker): remove when String::NewFromUtf8 is fast enough itself
537537
// This is cheap compared to the benefits though
538-
if (simdutf::validate_ascii(buf, buflen)) {
538+
if (!simdutf::validate_ascii_with_errors(buf, buflen).error) {
539539
return ExternOneByteString::NewFromCopy(isolate, buf, buflen);
540540
}
541541

0 commit comments

Comments
 (0)