File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -411,15 +411,7 @@ function makeTextDecoderICU() {
411
411
412
412
decode ( input = empty , options = kEmptyObject ) {
413
413
validateDecoder ( this ) ;
414
- if ( isAnyArrayBuffer ( input ) ) {
415
- try {
416
- input = lazyBuffer ( ) . from ( input ) ;
417
- } catch {
418
- // If the buffer is detached,
419
- // use an empty Uint8Array to avoid TypeError
420
- input = empty ;
421
- }
422
- } else if ( ! isArrayBufferView ( input ) ) {
414
+ if ( ! isAnyArrayBuffer ( input ) && ! isArrayBufferView ( input ) ) {
423
415
throw new ERR_INVALID_ARG_TYPE ( 'input' ,
424
416
[ 'ArrayBuffer' , 'ArrayBufferView' ] ,
425
417
input ) ;
Original file line number Diff line number Diff line change 46
46
#if defined(NODE_HAVE_I18N_SUPPORT)
47
47
48
48
#include " base_object-inl.h"
49
+ #include " crypto/crypto_util.h"
49
50
#include " node.h"
50
51
#include " node_buffer.h"
51
52
#include " node_errors.h"
@@ -440,7 +441,7 @@ void ConverterObject::Decode(const FunctionCallbackInfo<Value>& args) {
440
441
441
442
ConverterObject* converter;
442
443
ASSIGN_OR_RETURN_UNWRAP (&converter, args[0 ].As <Object>());
443
- ArrayBufferViewContents <char > input (args[1 ]);
444
+ crypto::ArrayBufferOrViewContents <char > input (args[1 ]);
444
445
int flags = args[2 ]->Uint32Value (env->context ()).ToChecked ();
445
446
446
447
UErrorCode status = U_ZERO_ERROR;
@@ -454,9 +455,9 @@ void ConverterObject::Decode(const FunctionCallbackInfo<Value>& args) {
454
455
// take up to 2 UChars to encode a character
455
456
size_t limit = 2 * converter->min_char_size () *
456
457
(!flush ?
457
- input.length () :
458
+ input.size () :
458
459
std::max (
459
- input.length (),
460
+ input.size (),
460
461
static_cast <size_t >(
461
462
ucnv_toUCountPending (converter->conv (), &status))));
462
463
status = U_ZERO_ERROR;
@@ -473,7 +474,7 @@ void ConverterObject::Decode(const FunctionCallbackInfo<Value>& args) {
473
474
});
474
475
475
476
const char * source = input.data ();
476
- size_t source_length = input.length ();
477
+ size_t source_length = input.size ();
477
478
478
479
UChar* target = *result;
479
480
ucnv_toUnicode (converter->conv (),
You can’t perform that action at this time.
0 commit comments