1
1
import { prettyByte } from "./utils/prettyByte" ;
2
2
import { ExtensionCodec , ExtensionCodecType } from "./ExtensionCodec" ;
3
- import { getInt64 , getUint64 } from "./utils/int" ;
3
+ import { getInt64 , getUint64 , UINT32_MAX } from "./utils/int" ;
4
4
import { utf8DecodeJs , TEXT_DECODER_THRESHOLD , utf8DecodeTD } from "./utils/utf8" ;
5
5
import { createDataView , ensureUint8Array } from "./utils/typedArrays" ;
6
6
import { CachedKeyDecoder , KeyDecoder } from "./CachedKeyDecoder" ;
@@ -57,8 +57,6 @@ export const DataViewIndexOutOfBoundsError: typeof Error = (() => {
57
57
58
58
const MORE_DATA = new DataViewIndexOutOfBoundsError ( "Insufficient data" ) ;
59
59
60
- const DEFAULT_MAX_LENGTH = 0xffff_ffff ; // uint32_max
61
-
62
60
const sharedCachedKeyDecoder = new CachedKeyDecoder ( ) ;
63
61
64
62
export class Decoder < ContextType = undefined > {
@@ -73,11 +71,11 @@ export class Decoder<ContextType = undefined> {
73
71
public constructor (
74
72
private readonly extensionCodec : ExtensionCodecType < ContextType > = ExtensionCodec . defaultCodec as any ,
75
73
private readonly context : ContextType = undefined as any ,
76
- private readonly maxStrLength = DEFAULT_MAX_LENGTH ,
77
- private readonly maxBinLength = DEFAULT_MAX_LENGTH ,
78
- private readonly maxArrayLength = DEFAULT_MAX_LENGTH ,
79
- private readonly maxMapLength = DEFAULT_MAX_LENGTH ,
80
- private readonly maxExtLength = DEFAULT_MAX_LENGTH ,
74
+ private readonly maxStrLength = UINT32_MAX ,
75
+ private readonly maxBinLength = UINT32_MAX ,
76
+ private readonly maxArrayLength = UINT32_MAX ,
77
+ private readonly maxMapLength = UINT32_MAX ,
78
+ private readonly maxExtLength = UINT32_MAX ,
81
79
private readonly keyDecoder : KeyDecoder | null = sharedCachedKeyDecoder ,
82
80
) { }
83
81
0 commit comments