コード例 #1
0
        private int table; // table lengths (14 bits)

        #endregion Fields

        #region Constructors

        internal InflateBlocks(ZlibCodec codec, object checkfn, int w)
        {
            this.Codec = codec;
            this.hufts = new int[Many * 3];
            this.Window = new byte[w];
            this.End = w;
            this.checkfn = checkfn;
            this.mode = InflateBlockMode.Type;
            this.Reset();
        }
コード例 #2
0
        /// <param name="codec">
        /// </param><param name="w"></param>
        /// <returns></returns> <exception cref = "ZlibException"></exception>
        internal int Initialize(ZlibCodec codec, int w)
        {
            this.codec = codec;
            this.codec.Message = null;
            this.blocks = null;

            // handle undocumented nowrap option (no zlib header or check) nowrap = 0; if (w < 0) { w = - w; nowrap = 1;
            // }

            // set window size
            if (w < 8 || w > 15)
            {
                this.End();
                throw new ZlibException("Bad window size.");

                // return ZlibConstants.Z_STREAM_ERROR;
            }

            this.wbits = w;

            this.blocks = new InflateBlocks(codec, this.HandleRfc1950HeaderBytes ? this : null, 1 << w);

            // reset state
            this.Reset();
            return ZlibConstants.Zok;
        }
コード例 #3
0
        private void End()
        {
            if (this.Z == null)
            {
                return;
            }

            if (this.WantCompress)
            {
                this.ZlibCodec.EndDeflate();
            }
            else
            {
                this.ZlibCodec.EndInflate();
            }

            this.ZlibCodec = null;
        }
コード例 #4
0
ファイル: InfTree.cs プロジェクト: robertbaker/SevenUpdate
        /// <param name="nl"></param><param name="nd"></param> <param name="c"></param><param name="bl"></param>
        /// <param name="bd"></param><param name="tl"></param> <param name="td"></param><param name="hp"></param><param name="z"></param><returns></returns>
        internal int InflateTreesDynamic(
            int nl, int nd, int[] c, int[] bl, int[] bd, int[] tl, int[] td, int[] hp, ZlibCodec z)
        {
            // build literal/length tree
            this.InitWorkArea(288);
            this.hufts[0] = 0;
            int result = this.HuftBuild(c, 0, nl, 257, Cplens, Cplext, tl, bl, hp, this.hufts, this.workArea);
            if (result != Zok || bl[0] == 0)
            {
                if (result == ZDataError)
                {
                    z.Message = "oversubscribed literal/length tree";
                }
                else if (result != ZMemError)
                {
                    z.Message = "incomplete literal/length tree";
                    result = ZDataError;
                }

                return result;
            }

            // build distance tree
            this.InitWorkArea(288);
            result = this.HuftBuild(c, nl, nd, 0, Cpdist, Cpdext, td, bd, hp, this.hufts, this.workArea);

            if (result != Zok || (bd[0] == 0 && nl > 257))
            {
                if (result == ZDataError)
                {
                    z.Message = "oversubscribed distance tree";
                }
                else if (result == ZBufError)
                {
                    z.Message = "incomplete distance tree";
                    result = ZDataError;
                }
                else if (result != ZMemError)
                {
                    z.Message = "empty distance tree with lengths";
                    result = ZDataError;
                }

                return result;
            }

            return Zok;
        }
コード例 #5
0
ファイル: InfTree.cs プロジェクト: robertbaker/SevenUpdate
        /// <param name="c"></param><param name="bb"></param> <param name="tb"></param><param name="hp"></param><param name="z"></param><returns></returns>
        internal int InflateTreesBits(int[] c, int[] bb, int[] tb, int[] hp, ZlibCodec z)
        {
            this.InitWorkArea(19);
            this.hufts[0] = 0;
            int result = this.HuftBuild(c, 0, 19, 19, null, null, tb, bb, hp, this.hufts, this.workArea);

            if (result == ZDataError)
            {
                z.Message = "oversubscribed dynamic bit lengths tree";
            }
            else if (result == ZBufError || bb[0] == 0)
            {
                z.Message = "incomplete dynamic bit lengths tree";
                result = ZDataError;
            }

            return result;
        }
コード例 #6
0
 public void ChangeDataToRead(int size)
 {
     nomoreinput = false;
     DataToRead  = size;
     _z          = null;
 }