@@ -305,10 +305,11 @@ size_t StringBytes::Write(Isolate* isolate,
305
305
input_view.length ());
306
306
}
307
307
} else {
308
+ String::Value value (isolate, str);
308
309
size_t written_len = buflen;
309
310
auto result = simdutf::base64_to_binary_safe (
310
- reinterpret_cast <const char16_t *>(input_view. data16 () ),
311
- input_view .length (),
311
+ reinterpret_cast <const char16_t *>(*value ),
312
+ value .length (),
312
313
buf,
313
314
written_len,
314
315
simdutf::base64_url);
@@ -318,8 +319,7 @@ size_t StringBytes::Write(Isolate* isolate,
318
319
// The input does not follow the WHATWG forgiving-base64 specification
319
320
// (adapted for base64url with + and / replaced by - and _).
320
321
// https://infra.spec.whatwg.org/#forgiving-base64-decode
321
- nbytes = nbytes::Base64Decode (
322
- buf, buflen, input_view.data16 (), input_view.length ());
322
+ nbytes = nbytes::Base64Decode (buf, buflen, *value, value.length ());
323
323
}
324
324
}
325
325
break ;
@@ -344,19 +344,19 @@ size_t StringBytes::Write(Isolate* isolate,
344
344
input_view.length ());
345
345
}
346
346
} else {
347
+ String::Value value (isolate, str);
347
348
size_t written_len = buflen;
348
349
auto result = simdutf::base64_to_binary_safe (
349
- reinterpret_cast <const char16_t *>(input_view. data16 () ),
350
- input_view .length (),
350
+ reinterpret_cast <const char16_t *>(*value ),
351
+ value .length (),
351
352
buf,
352
353
written_len);
353
354
if (result.error == simdutf::error_code::SUCCESS) {
354
355
nbytes = written_len;
355
356
} else {
356
357
// The input does not follow the WHATWG base64 specification
357
358
// https://infra.spec.whatwg.org/#forgiving-base64-decode
358
- nbytes = nbytes::Base64Decode (
359
- buf, buflen, input_view.data16 (), input_view.length ());
359
+ nbytes = nbytes::Base64Decode (buf, buflen, *value, value.length ());
360
360
}
361
361
}
362
362
break ;
@@ -369,8 +369,8 @@ size_t StringBytes::Write(Isolate* isolate,
369
369
reinterpret_cast <const char *>(input_view.data8 ()),
370
370
input_view.length ());
371
371
} else {
372
- String::ValueView value (isolate, str);
373
- nbytes = nbytes::HexDecode (buf, buflen, value. data8 () , value.length ());
372
+ String::Value value (isolate, str);
373
+ nbytes = nbytes::HexDecode (buf, buflen, * value, value.length ());
374
374
}
375
375
break ;
376
376
0 commit comments