diff --git a/README.md b/README.md index 809e11a..7ade0bd 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,4 @@ Using it Simplest way is just to call jszlib_uncompress. Takes an ArrayBuffer, returns an ArrayBuffer, throws an exception if something breaks. You can also use a ZStream class which behaves much like ZStream from jzlib. This might be useful if you need to uncompress partial data -- -some kinds of streaming network protocol, for instance -- but is overkill for most applications. \ No newline at end of file +some kinds of streaming network protocol, for instance -- but is overkill for most applications. diff --git a/arrayCopy.js b/arrayCopy.js new file mode 100644 index 0000000..fea1998 --- /dev/null +++ b/arrayCopy.js @@ -0,0 +1,48 @@ +define([], + function() { + +var testArray; +try { + testArray = new Uint8Array(1); +} catch (x) {} +var hasSlice = false; /* (typeof testArray.slice === 'function'); */ // Chrome slice performance is so dire that we're currently not using it... + +function arrayCopy(src, srcOffset, dest, destOffset, count) { + if (count == 0) { + return; + } + if (!src) { + throw "Undef src"; + } else if (!dest) { + throw "Undef dest"; + } + + if (srcOffset == 0 && count == src.length) { + arrayCopy_fast(src, dest, destOffset); + } else if ( src.subarray ) { + arrayCopy_fast(src.subarray(srcOffset, srcOffset + count), dest, destOffset); + } else if (src.BYTES_PER_ELEMENT == 1 && count > 100) { + arrayCopy_fast(new Uint8Array(src.buffer, src.byteOffset + srcOffset, count), dest, destOffset); + } else { + arrayCopy_slow(src, srcOffset, dest, destOffset, count); + } + +} + +function arrayCopy_slow(src, srcOffset, dest, destOffset, count) { + + // dlog('_slow call: srcOffset=' + srcOffset + '; destOffset=' + destOffset + '; count=' + count); + + for (var i = 0; i < count; ++i) { + dest[destOffset + i] = src[srcOffset + i]; + } +} + +function arrayCopy_fast(src, dest, destOffset) { + dest.set(src, destOffset); +} + + +return arrayCopy; + +}); \ No newline at end of file diff --git a/js/inflate.js b/inflate.js similarity index 61% rename from js/inflate.js rename to inflate.js index a0b6af5..013e7ec 100644 --- a/js/inflate.js +++ b/inflate.js @@ -1,6 +1,8 @@ /* -*- mode: javascript; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +define([ './arrayCopy' ], + function( arrayCopy ) { -// +// // Javascript ZLib // By Thomas Down 2010-2011 // @@ -31,15 +33,17 @@ var Z_FINISH=4; var Z_DEFLATED=8; -var Z_OK=0; -var Z_STREAM_END=1; -var Z_NEED_DICT=2; -var Z_ERRNO=-1; -var Z_STREAM_ERROR=-2; -var Z_DATA_ERROR=-3; -var Z_MEM_ERROR=-4; -var Z_BUF_ERROR=-5; -var Z_VERSION_ERROR=-6; +var STATUS_STRINGS = []; +var Z_OK = 0; STATUS_STRINGS[Z_OK] = 'Z_OK: stream correct'; +var Z_STREAM_END = 1; STATUS_STRINGS[Z_STREAM_END] = 'Z_STREAM_END: end of stream'; +var Z_NEED_DICT = 2; STATUS_STRINGS[Z_NEED_DICT] = 'Z_NEED_DICT: stream not yet complete'; + +var Z_ERRNO = -1; STATUS_STRINGS[Z_ERRNO] = 'Z_ERRNO'; +var Z_STREAM_ERROR = -2; STATUS_STRINGS[Z_STREAM_ERROR] = 'Z_STREAM_ERROR'; +var Z_DATA_ERROR = -3; STATUS_STRINGS[Z_DATA_ERROR] = 'Z_DATA_ERROR'; +var Z_MEM_ERROR = -4; STATUS_STRINGS[Z_MEM_ERROR ] = 'Z_MEM_ERROR'; +var Z_BUF_ERROR = -5; STATUS_STRINGS[Z_BUF_ERROR ] = 'Z_BUF_ERROR: premature end of buffer'; +var Z_VERSION_ERROR = -6; STATUS_STRINGS[Z_VERSION_ERROR] = 'Z_VERSION_ERROR'; var METHOD=0; // waiting for method byte var FLAG=1; // waiting for flag byte @@ -237,6 +241,7 @@ var fixed_td = [ 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]; + // // ZStream.java // @@ -247,34 +252,34 @@ function ZStream() { ZStream.prototype.inflateInit = function(w, nowrap) { if (!w) { - w = DEF_WBITS; + w = DEF_WBITS; } if (nowrap) { - nowrap = false; + nowrap = false; } this.istate = new Inflate(); return this.istate.inflateInit(this, nowrap?-w:w); -} +}; ZStream.prototype.inflate = function(f) { if(this.istate==null) return Z_STREAM_ERROR; return this.istate.inflate(this, f); -} +}; ZStream.prototype.inflateEnd = function(){ if(this.istate==null) return Z_STREAM_ERROR; var ret=istate.inflateEnd(this); this.istate = null; return ret; -} +}; ZStream.prototype.inflateSync = function(){ // if(istate == null) return Z_STREAM_ERROR; return istate.inflateSync(this); -} +}; ZStream.prototype.inflateSetDictionary = function(dictionary, dictLength){ // if(istate == null) return Z_STREAM_ERROR; return istate.inflateSetDictionary(this, dictionary, dictLength); -} +}; /* @@ -331,12 +336,12 @@ ZStream.prototype.inflateSetDictionary = function(dictionary, dictLength){ dstate.pending_buf.length<(dstate.pending_out+len) || next_out.length<(next_out_index+len)){ System.out.println(dstate.pending_buf.length+", "+dstate.pending_out+ - ", "+next_out.length+", "+next_out_index+", "+len); + ", "+next_out.length+", "+next_out_index+", "+len); System.out.println("avail_out="+avail_out); } System.arraycopy(dstate.pending_buf, dstate.pending_out, - next_out, next_out_index, len); + next_out, next_out_index, len); next_out_index+=len; dstate.pending_out+=len; @@ -390,27 +395,27 @@ function Inflate() { Inflate.prototype.inflateReset = function(z) { if(z == null || z.istate == null) return Z_STREAM_ERROR; - + z.total_in = z.total_out = 0; z.msg = null; z.istate.mode = z.istate.nowrap!=0 ? BLOCKS : METHOD; z.istate.blocks.reset(z, null); return Z_OK; -} +}; Inflate.prototype.inflateEnd = function(z){ if(this.blocks != null) this.blocks.free(z); this.blocks=null; return Z_OK; -} +}; Inflate.prototype.inflateInit = function(z, w){ z.msg = null; this.blocks = null; // handle undocumented nowrap option (no zlib header or check) - nowrap = 0; + var nowrap = 0; if(w < 0){ w = - w; nowrap = 1; @@ -423,14 +428,14 @@ Inflate.prototype.inflateInit = function(z, w){ } this.wbits=w; - z.istate.blocks=new InfBlocks(z, - z.istate.nowrap!=0 ? null : this, - 1<= (1<>> 1){ - case 0: // stored + while(k<(3)){ + if(n!=0){ + r=Z_OK; + } + else{ + this.bitb=b; this.bitk=k; + z.avail_in=n; + z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + }; + n--; + b|=(z.next_in[p++]&0xff)<>> 1){ + case 0: // stored {b>>>=(3);k-=(3);} t = k & 7; // go to byte boundary @@ -767,11 +774,11 @@ InfBlocks.prototype.reset = function(z, c){ case 1: // fixed { var bl=new Int32Array(1); - var bd=new Int32Array(1); + var bd=new Int32Array(1); var tl=[]; - var td=[]; + var td=[]; - inflate_trees_fixed(bl, bd, tl, td, z); + inflate_trees_fixed(bl, bd, tl, td, z); this.codes.init(bl[0], bd[0], tl[0], 0, td[0], 0, z); } @@ -792,360 +799,360 @@ InfBlocks.prototype.reset = function(z, c){ z.msg = "invalid block type"; r = Z_DATA_ERROR; - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - } - break; + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + } + break; case IB_LENS: - while(k<(32)){ - if(n!=0){ - r=Z_OK; - } - else{ - this.bitb=b; this.bitk=k; - z.avail_in=n; - z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - }; - n--; - b|=(z.next_in[p++]&0xff)<>> 16) & 0xffff) != (b & 0xffff)){ - this.mode = BAD; - z.msg = "invalid stored block lengths"; - r = Z_DATA_ERROR; - - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - } - this.left = (b & 0xffff); - b = k = 0; // dump bits - this.mode = left!=0 ? IB_STORED : (this.last!=0 ? IB_DRY : IB_TYPE); - break; + while(k<(32)){ + if(n!=0){ + r=Z_OK; + } + else{ + this.bitb=b; this.bitk=k; + z.avail_in=n; + z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + }; + n--; + b|=(z.next_in[p++]&0xff)<>> 16) & 0xffff) != (b & 0xffff)){ + this.mode = BAD; + z.msg = "invalid stored block lengths"; + r = Z_DATA_ERROR; + + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + } + this.left = (b & 0xffff); + b = k = 0; // dump bits + this.mode = this.left!=0 ? IB_STORED : (this.last!=0 ? IB_DRY : IB_TYPE); + break; case IB_STORED: - if (n == 0){ - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - write=q; - return this.inflate_flush(z,r); - } - - if(m==0){ - if(q==end&&read!=0){ - q=0; m=(qn) t = n; - if(t>m) t = m; - arrayCopy(z.next_in, p, window, q, t); - p += t; n -= t; - q += t; m -= t; - if ((this.left -= t) != 0) - break; - this.mode = (this.last != 0 ? IB_DRY : IB_TYPE); - break; + if (n == 0){ + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + } + + if(m==0){ + if(q==end&&read!=0){ + q=0; m=(qn) t = n; + if(t>m) t = m; + arrayCopy(z.next_in, p, this.window, q, t); + p += t; n -= t; + q += t; m -= t; + if ((this.left -= t) != 0) + break; + this.mode = (this.last != 0 ? IB_DRY : IB_TYPE); + break; case IB_TABLE: - while(k<(14)){ - if(n!=0){ - r=Z_OK; - } - else{ - this.bitb=b; this.bitk=k; - z.avail_in=n; - z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - }; - n--; - b|=(z.next_in[p++]&0xff)< 29 || ((t >> 5) & 0x1f) > 29) - { - this.mode = IB_BAD; - z.msg = "too many length or distance symbols"; - r = Z_DATA_ERROR; - - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - } - t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); - if(this.blens==null || this.blens.length 29 || ((t >> 5) & 0x1f) > 29) + { + this.mode = IB_BAD; + z.msg = "too many length or distance symbols"; + r = Z_DATA_ERROR; + + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + } + t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); + if(this.blens==null || this.blens.length>>=(14);k-=(14);} + {b>>>=(14);k-=(14);} - this.index = 0; - mode = IB_BTREE; + this.index = 0; + this.mode = IB_BTREE; case IB_BTREE: - while (this.index < 4 + (this.table >>> 10)){ - while(k<(3)){ - if(n!=0){ - r=Z_OK; - } - else{ - this.bitb=b; this.bitk=k; - z.avail_in=n; - z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - }; - n--; - b|=(z.next_in[p++]&0xff)<>>=(3);k-=(3);} - } - - while(this.index < 19){ - this.blens[INFBLOCKS_BORDER[this.index++]] = 0; - } - - this.bb[0] = 7; - t = this.inftree.inflate_trees_bits(this.blens, this.bb, this.tb, this.hufts, z); - if (t != Z_OK){ - r = t; - if (r == Z_DATA_ERROR){ - this.blens=null; - this.mode = IB_BAD; - } - - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - write=q; - return this.inflate_flush(z,r); - } - - this.index = 0; - this.mode = IB_DTREE; + while (this.index < 4 + (this.table >>> 10)){ + while(k<(3)){ + if(n!=0){ + r=Z_OK; + } + else{ + this.bitb=b; this.bitk=k; + z.avail_in=n; + z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + }; + n--; + b|=(z.next_in[p++]&0xff)<>>=(3);k-=(3);} + } + + while(this.index < 19){ + this.blens[INFBLOCKS_BORDER[this.index++]] = 0; + } + + this.bb[0] = 7; + t = this.inftree.inflate_trees_bits(this.blens, this.bb, this.tb, this.hufts, z); + if (t != Z_OK){ + r = t; + if (r == Z_DATA_ERROR){ + this.blens=null; + this.mode = IB_BAD; + } + + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + } + + this.index = 0; + this.mode = IB_DTREE; case IB_DTREE: - while (true){ - t = this.table; - if(!(this.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))){ - break; - } - - var h; //int[] - var i, j, c; - - t = this.bb[0]; - - while(k<(t)){ - if(n!=0){ - r=Z_OK; - } - else{ - this.bitb=b; this.bitk=k; - z.avail_in=n; - z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - }; - n--; - b|=(z.next_in[p++]&0xff)<> 5) & 0x1f))){ + break; + } + + var h; //int[] + var i, j, c; + + t = this.bb[0]; + + while(k<(t)){ + if(n!=0){ + r=Z_OK; + } + else{ + this.bitb=b; this.bitk=k; + z.avail_in=n; + z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + }; + n--; + b|=(z.next_in[p++]&0xff)<>>=(t);k-=(t); - this.blens[this.index++] = c; - } - else { // c == 16..18 - i = c == 18 ? 7 : c - 14; - j = c == 18 ? 11 : 3; - - while(k<(t+i)){ - if(n!=0){ - r=Z_OK; - } - else{ - this.bitb=b; this.bitk=k; - z.avail_in=n; - z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - }; - n--; - b|=(z.next_in[p++]&0xff)<>>=(t);k-=(t); - - j += (b & inflate_mask[i]); - - b>>>=(i);k-=(i); - - i = this.index; - t = this.table; - if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || - (c == 16 && i < 1)){ - this.blens=null; - this.mode = IB_BAD; - z.msg = "invalid bit length repeat"; - r = Z_DATA_ERROR; - - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - } - - c = c == 16 ? this.blens[i-1] : 0; - do{ - this.blens[i++] = c; - } - while (--j!=0); - this.index = i; - } - } - - this.tb[0]=-1; - { - var bl=new Int32Array(1); - var bd=new Int32Array(1); - var tl=new Int32Array(1); - var td=new Int32Array(1); - bl[0] = 9; // must be <= 9 for lookahead assumptions - bd[0] = 6; // must be <= 9 for lookahead assumptions - - t = this.table; - t = this.inftree.inflate_trees_dynamic(257 + (t & 0x1f), - 1 + ((t >> 5) & 0x1f), - this.blens, bl, bd, tl, td, this.hufts, z); - - if (t != Z_OK){ - if (t == Z_DATA_ERROR){ - this.blens=null; - this.mode = BAD; - } - r = t; - - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z,r); - } - this.codes.init(bl[0], bd[0], this.hufts, tl[0], this.hufts, td[0], z); - } - this.mode = IB_CODES; +// } + + t=this.hufts[(this.tb[0]+(b & inflate_mask[t]))*3+1]; + c=this.hufts[(this.tb[0]+(b & inflate_mask[t]))*3+2]; + + if (c < 16){ + b>>>=(t);k-=(t); + this.blens[this.index++] = c; + } + else { // c == 16..18 + i = c == 18 ? 7 : c - 14; + j = c == 18 ? 11 : 3; + + while(k<(t+i)){ + if(n!=0){ + r=Z_OK; + } + else{ + this.bitb=b; this.bitk=k; + z.avail_in=n; + z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + }; + n--; + b|=(z.next_in[p++]&0xff)<>>=(t);k-=(t); + + j += (b & inflate_mask[i]); + + b>>>=(i);k-=(i); + + i = this.index; + t = this.table; + if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || + (c == 16 && i < 1)){ + this.blens=null; + this.mode = IB_BAD; + z.msg = "invalid bit length repeat"; + r = Z_DATA_ERROR; + + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + } + + c = c == 16 ? this.blens[i-1] : 0; + do{ + this.blens[i++] = c; + } + while (--j!=0); + this.index = i; + } + } + + this.tb[0]=-1; + { + var bl=new Int32Array(1); + var bd=new Int32Array(1); + var tl=new Int32Array(1); + var td=new Int32Array(1); + bl[0] = 9; // must be <= 9 for lookahead assumptions + bd[0] = 6; // must be <= 9 for lookahead assumptions + + t = this.table; + t = this.inftree.inflate_trees_dynamic(257 + (t & 0x1f), + 1 + ((t >> 5) & 0x1f), + this.blens, bl, bd, tl, td, this.hufts, z); + + if (t != Z_OK){ + if (t == Z_DATA_ERROR){ + this.blens=null; + this.mode = BAD; + } + r = t; + + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z,r); + } + this.codes.init(bl[0], bd[0], this.hufts, tl[0], this.hufts, td[0], z); + } + this.mode = IB_CODES; case IB_CODES: - this.bitb=b; this.bitk=k; - z.avail_in=n; z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - - if ((r = this.codes.proc(this, z, r)) != Z_STREAM_END){ - return this.inflate_flush(z, r); - } - r = Z_OK; - this.codes.free(z); - - p=z.next_in_index; n=z.avail_in;b=this.bitb;k=this.bitk; - q=this.write;m = (q < this.read ? this.read-q-1 : this.end-q); - - if (this.last==0){ - this.mode = IB_TYPE; - break; - } - this.mode = IB_DRY; + this.bitb=b; this.bitk=k; + z.avail_in=n; z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + + if ((r = this.codes.proc(this, z, r)) != Z_STREAM_END){ + return this.inflate_flush(z, r); + } + r = Z_OK; + this.codes.free(z); + + p=z.next_in_index; n=z.avail_in;b=this.bitb;k=this.bitk; + q=this.write;m = (q < this.read ? this.read-q-1 : this.end-q); + + if (this.last==0){ + this.mode = IB_TYPE; + break; + } + this.mode = IB_DRY; case IB_DRY: - this.write=q; - r = this.inflate_flush(z, r); - q=this.write; m = (q < this.read ? this.read-q-1 : this.end-q); - if (this.read != this.write){ - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z, r); - } - mode = DONE; + this.write=q; + r = this.inflate_flush(z, r); + q=this.write; m = (q < this.read ? this.read-q-1 : this.end-q); + if (this.read != this.write){ + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z, r); + } + this.mode = DONE; case IB_DONE: - r = Z_STREAM_END; + r = Z_STREAM_END; - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z, r); + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z, r); case IB_BAD: - r = Z_DATA_ERROR; + r = Z_DATA_ERROR; - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z, r); + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z, r); default: - r = Z_STREAM_ERROR; + r = Z_STREAM_ERROR; - this.bitb=b; this.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - this.write=q; - return this.inflate_flush(z, r); + this.bitb=b; this.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + this.write=q; + return this.inflate_flush(z, r); } } - } + }; InfBlocks.prototype.free = function(z){ this.reset(z, null); this.window=null; this.hufts=null; -} +}; InfBlocks.prototype.set_dictionary = function(d, start, n){ - arrayCopy(d, start, window, 0, n); + arrayCopy(d, start, this.window, 0, n); this.read = this.write = n; -} +}; // Returns true if inflate is currently at the end of a block generated - // by Z_SYNC_FLUSH or Z_FULL_FLUSH. + // by Z_SYNC_FLUSH or Z_FULL_FLUSH. InfBlocks.prototype.sync_point = function(){ return this.mode == IB_LENS; -} +}; // copy as much as possible from the sliding window to the output area InfBlocks.prototype.inflate_flush = function(z, r){ @@ -1167,8 +1174,10 @@ InfBlocks.prototype.inflate_flush = function(z, r){ z.total_out += n; // update check information - if(this.checkfn != null) - z.adler=this.check=z._adler.adler32(this.check, this.window, q, n); + if(this.checkfn != null) { + this.check = adler32(this.check, this.window, q, n); + z.adler = this.check; + } // copy as far as end of window arrayCopy(this.window, q, z.next_out, p, n); @@ -1192,8 +1201,10 @@ InfBlocks.prototype.inflate_flush = function(z, r){ z.total_out += n; // update check information - if(this.checkfn != null) - z.adler=this.check=z._adler.adler32(this.check, this.window, q, n); + if(this.checkfn != null) { + this.check = adler32(this.check, this.window, q, n); + z.adler = this.check; + } // copy arrayCopy(this.window, q, z.next_out, p, n); @@ -1207,7 +1218,7 @@ InfBlocks.prototype.inflate_flush = function(z, r){ // done return r; - } + }; // // InfCodes.java @@ -1236,9 +1247,9 @@ InfCodes.prototype.init = function(bl, bd, tl, tl_index, td, td_index, z) { this.dtree = td; this.dtree_index=td_index; this.tree=null; -} +}; -InfCodes.prototype.proc = function(s, z, r){ +InfCodes.prototype.proc = function(s, z, r){ var j; // temporary storage var t; // temporary pointer (int[]) var tindex; // temporary pointer @@ -1258,274 +1269,274 @@ InfCodes.prototype.proc = function(s, z, r){ // process input and output based on current state while (true){ switch (this.mode){ - // waiting for "i:"=input, "o:"=output, "x:"=nothing + // waiting for "i:"=input, "o:"=output, "x:"=nothing case IC_START: // x: set up for LEN - if (m >= 258 && n >= 10){ - - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - r = this.inflate_fast(this.lbits, this.dbits, - this.ltree, this.ltree_index, - this.dtree, this.dtree_index, - s, z); - - p=z.next_in_index;n=z.avail_in;b=s.bitb;k=s.bitk; - q=s.write;m=q= 258 && n >= 10){ + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + r = this.inflate_fast(this.lbits, this.dbits, + this.ltree, this.ltree_index, + this.dtree, this.dtree_index, + s, z); + + p=z.next_in_index;n=z.avail_in;b=s.bitb;k=s.bitk; + q=s.write;m=q>>=(this.tree[tindex+1]); - k-=(this.tree[tindex+1]); - - e=this.tree[tindex]; - - if(e == 0){ // literal - this.lit = this.tree[tindex+2]; - this.mode = IC_LIT; - break; - } - if((e & 16)!=0 ){ // length - this.get = e & 15; - this.len = this.tree[tindex+2]; - this.mode = IC_LENEXT; - break; - } - if ((e & 64) == 0){ // next table - this.need = e; - this.tree_index = tindex/3 + this.tree[tindex+2]; - break; - } - if ((e & 32)!=0){ // end of block - this.mode = IC_WASH; - break; - } - this.mode = IC_BADCODE; // invalid code - z.msg = "invalid literal/length code"; - r = Z_DATA_ERROR; - - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - return s.inflate_flush(z,r); + j = this.need; + + while(k<(j)){ + if(n!=0)r=Z_OK; + else{ + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + return s.inflate_flush(z,r); + } + n--; + b|=(z.next_in[p++]&0xff)<>>=(this.tree[tindex+1]); + k-=(this.tree[tindex+1]); + + e=this.tree[tindex]; + + if(e == 0){ // literal + this.lit = this.tree[tindex+2]; + this.mode = IC_LIT; + break; + } + if((e & 16)!=0 ){ // length + this.get = e & 15; + this.len = this.tree[tindex+2]; + this.mode = IC_LENEXT; + break; + } + if ((e & 64) == 0){ // next table + this.need = e; + this.tree_index = tindex/3 + this.tree[tindex+2]; + break; + } + if ((e & 32)!=0){ // end of block + this.mode = IC_WASH; + break; + } + this.mode = IC_BADCODE; // invalid code + z.msg = "invalid literal/length code"; + r = Z_DATA_ERROR; + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + return s.inflate_flush(z,r); case IC_LENEXT: // i: getting length extra (have base) - j = this.get; - - while(k<(j)){ - if(n!=0)r=Z_OK; - else{ - - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - return s.inflate_flush(z,r); - } - n--; b|=(z.next_in[p++]&0xff)<>=j; - k-=j; - - this.need = this.dbits; - this.tree = this.dtree; - this.tree_index = this.dtree_index; - this.mode = IC_DIST; + j = this.get; + + while(k<(j)){ + if(n!=0)r=Z_OK; + else{ + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + return s.inflate_flush(z,r); + } + n--; b|=(z.next_in[p++]&0xff)<>=j; + k-=j; + + this.need = this.dbits; + this.tree = this.dtree; + this.tree_index = this.dtree_index; + this.mode = IC_DIST; case IC_DIST: // i: get distance next - j = this.need; - - while(k<(j)){ - if(n!=0)r=Z_OK; - else{ - - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - return s.inflate_flush(z,r); - } - n--; b|=(z.next_in[p++]&0xff)<>=this.tree[tindex+1]; - k-=this.tree[tindex+1]; - - e = (this.tree[tindex]); - if((e & 16)!=0){ // distance - this.get = e & 15; - this.dist = this.tree[tindex+2]; - this.mode = IC_DISTEXT; - break; - } - if ((e & 64) == 0){ // next table - this.need = e; - this.tree_index = tindex/3 + this.tree[tindex+2]; - break; - } - this.mode = IC_BADCODE; // invalid code - z.msg = "invalid distance code"; - r = Z_DATA_ERROR; - - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - return s.inflate_flush(z,r); + j = this.need; + + while(k<(j)){ + if(n!=0)r=Z_OK; + else{ + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + return s.inflate_flush(z,r); + } + n--; b|=(z.next_in[p++]&0xff)<>=this.tree[tindex+1]; + k-=this.tree[tindex+1]; + + e = (this.tree[tindex]); + if((e & 16)!=0){ // distance + this.get = e & 15; + this.dist = this.tree[tindex+2]; + this.mode = IC_DISTEXT; + break; + } + if ((e & 64) == 0){ // next table + this.need = e; + this.tree_index = tindex/3 + this.tree[tindex+2]; + break; + } + this.mode = IC_BADCODE; // invalid code + z.msg = "invalid distance code"; + r = Z_DATA_ERROR; + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + return s.inflate_flush(z,r); case IC_DISTEXT: // i: getting distance extra - j = this.get; + j = this.get; - while(k<(j)){ - if(n!=0)r=Z_OK; - else{ + while(k<(j)){ + if(n!=0)r=Z_OK; + else{ - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - return s.inflate_flush(z,r); - } - n--; b|=(z.next_in[p++]&0xff)<>=j; - k-=j; + b>>=j; + k-=j; - this.mode = IC_COPY; + this.mode = IC_COPY; case IC_COPY: // o: copying bytes in window, waiting for space f = q - this.dist; while(f < 0){ // modulo window size-"while" instead f += s.end; // of "if" handles invalid distances - } - while (this.len!=0){ + } + while (this.len!=0){ - if(m==0){ - if(q==s.end&&s.read!=0){q=0;m=q 7){ // return unused byte, if any - k -= 8; - n++; - p--; // can always return one - } - - s.write=q; r=s.inflate_flush(z,r); - q=s.write;m=q 7){ // return unused byte, if any + k -= 8; + n++; + p--; // can always return one + } + + s.write=q; r=s.inflate_flush(z,r); + q=s.write;m=q= 258 && n >= 10 // get literal/length code while(k<(20)){ // max bits for literal/length code - n--; - b|=(z.next_in[p++]&0xff)<>=(tp[tp_index_t_3+1]); k-=(tp[tp_index_t_3+1]); + b>>=(tp[tp_index_t_3+1]); k-=(tp[tp_index_t_3+1]); - s.window[q++] = tp[tp_index_t_3+2]; - m--; - continue; + s.window[q++] = tp[tp_index_t_3+2]; + m--; + continue; } do { - b>>=(tp[tp_index_t_3+1]); k-=(tp[tp_index_t_3+1]); + b>>=(tp[tp_index_t_3+1]); k-=(tp[tp_index_t_3+1]); - if((e&16)!=0){ - e &= 15; - c = tp[tp_index_t_3+2] + (b & inflate_mask[e]); + if((e&16)!=0){ + e &= 15; + c = tp[tp_index_t_3+2] + (b & inflate_mask[e]); - b>>=e; k-=e; + b>>=e; k-=e; - // decode distance base of block to copy - while(k<(15)){ // max bits for distance code - n--; - b|=(z.next_in[p++]&0xff)<>=(tp[tp_index_t_3+1]); k-=(tp[tp_index_t_3+1]); - - if((e&16)!=0){ - // get extra bits to add to distance base - e &= 15; - while(k<(e)){ // get extra bits (up to 13) - n--; - b|=(z.next_in[p++]&0xff)<>=(e); k-=(e); - - // do the copy - m -= c; - if (q >= d){ // offset before dest - // just copy - r=q-d; - if(q-r>0 && 2>(q-r)){ - s.window[q++]=s.window[r++]; // minimum count is three, - s.window[q++]=s.window[r++]; // so unroll loop a little - c-=2; - } - else{ - s.window[q++]=s.window[r++]; // minimum count is three, - s.window[q++]=s.window[r++]; // so unroll loop a little - c-=2; - } - } - else{ // else offset after destination + e = tp[tp_index_t_3]; + + do { + + b>>=(tp[tp_index_t_3+1]); k-=(tp[tp_index_t_3+1]); + + if((e&16)!=0){ + // get extra bits to add to distance base + e &= 15; + while(k<(e)){ // get extra bits (up to 13) + n--; + b|=(z.next_in[p++]&0xff)<>=(e); k-=(e); + + // do the copy + m -= c; + if (q >= d){ // offset before dest + // just copy + r=q-d; + if(q-r>0 && 2>(q-r)){ + s.window[q++]=s.window[r++]; // minimum count is three, + s.window[q++]=s.window[r++]; // so unroll loop a little + c-=2; + } + else{ + s.window[q++]=s.window[r++]; // minimum count is three, + s.window[q++]=s.window[r++]; // so unroll loop a little + c-=2; + } + } + else{ // else offset after destination r=q-d; do{ r+=s.end; // force pointer in window }while(r<0); // covers invalid distances - e=s.end-r; - if(c>e){ // if source crosses, - c-=e; // wrapped copy - if(q-r>0 && e>(q-r)){ - do{s.window[q++] = s.window[r++];} - while(--e!=0); - } - else{ - arrayCopy(s.window, r, s.window, q, e); - q+=e; r+=e; e=0; - } - r = 0; // copy rest from start of window - } - - } - - // copy all or what's left + e=s.end-r; + if(c>e){ // if source crosses, + c-=e; // wrapped copy + if(q-r>0 && e>(q-r)){ + do{s.window[q++] = s.window[r++];} + while(--e!=0); + } + else{ + arrayCopy(s.window, r, s.window, q, e); + q+=e; r+=e; e=0; + } + r = 0; // copy rest from start of window + } + + } + + // copy all or what's left do{s.window[q++] = s.window[r++];} - while(--c!=0); - break; - } - else if((e&64)==0){ - t+=tp[tp_index_t_3+2]; - t+=(b&inflate_mask[e]); - tp_index_t_3=(tp_index+t)*3; - e=tp[tp_index_t_3]; - } - else{ - z.msg = "invalid distance code"; - - c=z.avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3; - - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - - return Z_DATA_ERROR; - } - } - while(true); - break; - } - - if((e&64)==0){ - t+=tp[tp_index_t_3+2]; - t+=(b&inflate_mask[e]); - tp_index_t_3=(tp_index+t)*3; - if((e=tp[tp_index_t_3])==0){ - - b>>=(tp[tp_index_t_3+1]); k-=(tp[tp_index_t_3+1]); - - s.window[q++]=tp[tp_index_t_3+2]; - m--; - break; - } - } - else if((e&32)!=0){ - - c=z.avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3; - - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - - return Z_STREAM_END; - } - else{ - z.msg="invalid literal/length code"; - - c=z.avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3; - - s.bitb=b;s.bitk=k; - z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; - s.write=q; - - return Z_DATA_ERROR; - } - } + while(--c!=0); + break; + } + else if((e&64)==0){ + t+=tp[tp_index_t_3+2]; + t+=(b&inflate_mask[e]); + tp_index_t_3=(tp_index+t)*3; + e=tp[tp_index_t_3]; + } + else{ + z.msg = "invalid distance code"; + + c=z.avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3; + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + + return Z_DATA_ERROR; + } + } + while(true); + break; + } + + if((e&64)==0){ + t+=tp[tp_index_t_3+2]; + t+=(b&inflate_mask[e]); + tp_index_t_3=(tp_index+t)*3; + if((e=tp[tp_index_t_3])==0){ + + b>>=(tp[tp_index_t_3+1]); k-=(tp[tp_index_t_3+1]); + + s.window[q++]=tp[tp_index_t_3+2]; + m--; + break; + } + } + else if((e&32)!=0){ + + c=z.avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3; + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + + return Z_STREAM_END; + } + else{ + z.msg="invalid literal/length code"; + + c=z.avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3; + + s.bitb=b;s.bitk=k; + z.avail_in=n;z.total_in+=p-z.next_in_index;z.next_in_index=p; + s.write=q; + + return Z_DATA_ERROR; + } + } while(true); - } + } while(m>=258 && n>= 10); // not enough input or output--restore pointers and return @@ -1727,7 +1738,7 @@ InfCodes.prototype.inflate_fast = function(bl, bd, tl, tl_index, td, td_index, s s.write=q; return Z_OK; -} +}; // // InfTree.java @@ -1834,12 +1845,12 @@ InfTree.prototype.huft_build = function(b, bindex, n, s, d, e, t, m, hp, hn, v) for (; k <= g; k++){ a = this.c[k]; while (a--!=0){ - // here i is the Huffman code of length k bits for value *p - // make tables up to required level + // here i is the Huffman code of length k bits for value *p + // make tables up to required level while (k > w + l){ h++; w += l; // previous table always l bits - // compute minimum size table less than or equal to l bits + // compute minimum size table less than or equal to l bits z = g - w; z = (z > l) ? l : z; // table size upper limit if((f=1<<(j=k-w))>a+1){ // try a k-w bit table @@ -1852,19 +1863,19 @@ InfTree.prototype.huft_build = function(b, bindex, n, s, d, e, t, m, hp, hn, v) break; // enough codes to use up j bits f -= this.c[xp]; // else deduct codes from patterns } - } + } } z = 1 << j; // table entries for j-bit table - // allocate new table + // allocate new table if (this.hn[0] + z > MANY){ // (note: doesn't matter for fixed) return Z_DATA_ERROR; // overflow of MANY } this.u[h] = q = /*hp+*/ this.hn[0]; // DEBUG this.hn[0] += z; - - // connect to last table, if there is one - if(h!=0){ + + // connect to last table, if there is one + if(h!=0){ this.x[h]=i; // save pattern for backing up this.r[0]=j; // bits in this table this.r[1]=l; // bits to dump before this table @@ -1874,14 +1885,14 @@ InfTree.prototype.huft_build = function(b, bindex, n, s, d, e, t, m, hp, hn, v) } else{ t[0] = q; // first table is returned result - } + } } - // set up table entry in r + // set up table entry in r this.r[1] = (k - w); if (p >= n){ this.r[0] = 128 + 64; // out of values--invalid code - } + } else if (v[p] < s){ this.r[0] = (this.v[p] < 256 ? 0 : 32 + 64); // 256 is end-of-block this.r[2] = this.v[p++]; // simple code is just the value @@ -1895,15 +1906,15 @@ InfTree.prototype.huft_build = function(b, bindex, n, s, d, e, t, m, hp, hn, v) f=1<<(k-w); for (j=i>>>w;j>>= 1){ i ^= j; - } + } i ^= j; - // backup over finished tables + // backup over finished tables mask = (1 << w) - 1; // needed on HP, cc -O bug while ((i & mask) != this.x[h]){ h--; // don't need to update q @@ -1914,7 +1925,7 @@ InfTree.prototype.huft_build = function(b, bindex, n, s, d, e, t, m, hp, hn, v) } // Return Z_BUF_ERROR if we were given an incomplete table return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK; -} +}; InfTree.prototype.inflate_trees_bits = function(c, bb, tb, hp, z) { var result; @@ -1930,7 +1941,7 @@ InfTree.prototype.inflate_trees_bits = function(c, bb, tb, hp, z) { result = Z_DATA_ERROR; } return result; -} +}; InfTree.prototype.inflate_trees_dynamic = function(nl, nd, c, bl, bd, tl, td, hp, z) { var result; @@ -1970,14 +1981,15 @@ InfTree.prototype.inflate_trees_dynamic = function(nl, nd, c, bl, bd, tl, td, hp } return Z_OK; -} +}; + /* static int inflate_trees_fixed(int[] bl, //literal desired/actual bit depth int[] bd, //distance desired/actual bit depth int[][] tl,//literal/length tree result - int[][] td,//distance tree result + int[][] td,//distance tree result ZStream z //for memory allocation - ){ + ){ */ @@ -1990,6 +2002,7 @@ function inflate_trees_fixed(bl, bd, tl, td, z) { } InfTree.prototype.initWorkArea = function(vsize){ + var i; if(this.hn==null){ this.hn=new Int32Array(1); this.v=new Int32Array(vsize); @@ -1998,60 +2011,20 @@ InfTree.prototype.initWorkArea = function(vsize){ this.u=new Int32Array(BMAX); this.x=new Int32Array(BMAX+1); } - if(this.v.length 100) { - arrayCopy_fast(new Uint8Array(src.buffer, src.byteOffset + srcOffset, count), dest, destOffset); - } else { - arrayCopy_slow(src, srcOffset, dest, destOffset, count); - } - -} - -function arrayCopy_slow(src, srcOffset, dest, destOffset, count) { - - // dlog('_slow call: srcOffset=' + srcOffset + '; destOffset=' + destOffset + '; count=' + count); - - for (var i = 0; i < count; ++i) { - dest[destOffset + i] = src[srcOffset + i]; - } -} - -function arrayCopy_fast(src, dest, destOffset) { - dest.set(src, destOffset); -} - +}; // largest prime smaller than 65536 -var ADLER_BASE=65521; +var ADLER_BASE=65521; // NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 var ADLER_NMAX=5552; @@ -2096,9 +2069,7 @@ function adler32(adler, /* byte[] */ buf, index, len){ return (s2<<16)|s1; } - - -function jszlib_inflate_buffer(buffer, start, length, afterUncOffset) { +return function(buffer, start, length, afterUncOffset) { if (!start) { buffer = new Uint8Array(buffer); } else { @@ -2120,7 +2091,14 @@ function jszlib_inflate_buffer(buffer, start, length, afterUncOffset) { z.avail_out = obuf.length; var status = z.inflate(Z_NO_FLUSH); if (status != Z_OK && status != Z_STREAM_END) { - throw z.msg; + var error = z.msg ? typeof z.msg == 'object' ? z.msg : + typeof z.msg == 'string' ? new Error(z.msg) : + new Error('Unknown error in inflate: msg="' + +z.msg+'", status="'+STATUS_STRINGS[status]||status+'"') + : new Error('Inflate error, status="'+STATUS_STRINGS[status]||status+'")'); + error.statusCode = status; + error.statusString = STATUS_STRINGS[status]; + throw error; } if (z.avail_out != 0) { var newob = new Uint8Array(obuf.length - z.avail_out); @@ -2150,4 +2128,6 @@ function jszlib_inflate_buffer(buffer, start, length, afterUncOffset) { } return out.buffer; } -} \ No newline at end of file +}; + +}); \ No newline at end of file diff --git a/jszlib.profile.js b/jszlib.profile.js new file mode 100644 index 0000000..f2226bf --- /dev/null +++ b/jszlib.profile.js @@ -0,0 +1,66 @@ +function copyOnly(mid) { + return mid in { + // There are no modules right now that are copy-only. If you + // have some, though, just add + // them here like this: + // 'app/module': 1 + }; +} + +var profile = { + basePath: '..', + action: 'release', + mini: true, + optimize: 'closure', + layerOptimize: 'closure', + stripConsole: 'all', + layers: { + 'jszlib': { + include: [ 'jszlib' ], + boot: true, + customBase: true + } + }, + staticHasFeatures: { + // The trace & log APIs are used for debugging the loader, so we don’t need them in the build + 'dojo-trace-api':0, + 'dojo-log-api':0, + + // This causes normally private loader data to be exposed for debugging, so we don’t need that either + 'dojo-publish-privates':0, + + // We’re fully async, so get rid of the legacy loader + 'dojo-sync-loader':0, + + // dojo-xhr-factory relies on dojo-sync-loader + 'dojo-xhr-factory':0, + + // We aren’t loading tests in production + 'dojo-test-sniff':0 + }, + + // Resource tags are functions that provide hints to the compiler about a given file. The first argument is the + // filename of the file, and the second argument is the module ID for the file. + resourceTags: { + // Files that contain test code. + test: function (filename, mid) { + return false; + }, + + // Files that should be copied as-is without being modified by the build system. + copyOnly: function (filename, mid) { + return copyOnly(mid); + }, + + // Files that are AMD modules. + amd: function (filename, mid) { + return !copyOnly(mid) && /\.js$/.test(filename); + }, + + // Files that should not be copied when the “mini” compiler flag is set to true. + miniExclude: function (filename, mid) { + return mid in { + }; + } + } +}; diff --git a/main.js b/main.js new file mode 100644 index 0000000..b9a79b8 --- /dev/null +++ b/main.js @@ -0,0 +1,5 @@ +define(['jszlib/inflate'], function(inflate){ + return { + inflate: inflate + }; +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..8a59a4f --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "jszlib", + "version":"0.1", + "directories": { + "lib": "." + }, + "main": "main", + "description": "JavaScript implementation of zlib, for modern web browsers.", + "licenses": [ + { + "type": "BSD", + "url": "http://raw.github.com/rbuels/jszlib/master/LICENSE.txt" + } + ], + "bugs": "http://github.com/rbuels/jszlib/issues", + "keywords": ["JavaScript", "zlib", "unzip", "compression"], + "dojoBuild": "jszlib.profile.js" +}