@@ -1982,9 +1982,7 @@ function LZ4_uncompress(input, output, sIdx, eIdx) {
19821982 * @return {Promise } with unzipped content
19831983 * @private */
19841984async function R__unzip ( arr , tgtsize , noalert , src_shift ) {
1985- const HDRSIZE = 9 , totallen = arr . byteLength ,
1986- checkChar = ( o , symb ) => { return String . fromCharCode ( arr . getUint8 ( o ) ) === symb ; } ,
1987- getCode = o => arr . getUint8 ( o )
1985+ const HDRSIZE = 9 , totallen = arr . byteLength ;
19881986
19891987 let curr = src_shift || 0 , fullres = 0 , tgtbuf = null ;
19901988
@@ -1997,7 +1995,9 @@ async function R__unzip(arr, tgtsize, noalert, src_shift) {
19971995 return Promise . resolve ( null ) ;
19981996 }
19991997
2000- const checkFmt = ( a , b , c ) => { return checkChar ( curr , a ) && checkChar ( curr + 1 , b ) && ( getCode ( curr + 2 ) === c ) ; } ;
1998+ const getCode = o => arr . getUint8 ( o ) ,
1999+ checkChar = ( o , symb ) => { return getCode ( o ) === symb . charCodeAt ( 0 ) ; } ,
2000+ checkFmt = ( a , b , c ) => { return checkChar ( curr , a ) && checkChar ( curr + 1 , b ) && ( getCode ( curr + 2 ) === c ) ; } ;
20012001
20022002 if ( checkFmt ( 'Z' , 'L' , 8 ) ) {
20032003 fmt = 'new' ;
@@ -2008,7 +2008,7 @@ async function R__unzip(arr, tgtsize, noalert, src_shift) {
20082008 fmt = 'LZMA' ;
20092009 else if ( checkFmt ( 'Z' , 'S' , 1 ) )
20102010 fmt = 'ZSTD' ;
2011- else if ( checkChar ( curr , 'L' ) && checkChar ( curr + 1 , '4' ) ) {
2011+ else if ( checkChar ( curr , 'L' ) && checkChar ( curr + 1 , '4' ) ) {
20122012 fmt = 'LZ4' ; CHKSUM = 8 ;
20132013 }
20142014
0 commit comments