Example #1
0
        internal static int InflateTreeDynamic(
            int nl,
            int nd,
            int[] c,
            int[] bl,
            int[] bd,
            int[] tl,
            int[] td,
            int[] hp,
            CompressionStream z)
        {
            int[] v    = new int[288];
            int[] hn   = new int[1];
            int   num1 = InflaterTree.BuildHuffmanTree(c, 0, nl, 257, InflaterTreeConstants.CpLens, InflaterTreeConstants.CpLext, tl, bl, hp, hn, v);

            if (num1 != 0 || bl[0] == 0)
            {
                switch (num1)
                {
                case -4:
                    return(num1);

                case -3:
                    z.ErrorMessage = "oversubscribed literal/length tree";
                    goto case -4;

                default:
                    z.ErrorMessage = "incomplete literal/length tree";
                    num1           = -3;
                    goto case -4;
                }
            }
            else
            {
                int num2 = InflaterTree.BuildHuffmanTree(c, nl, nd, 0, InflaterTreeConstants.CpDist, InflaterTreeConstants.CpDext, td, bd, hp, hn, v);
                if (num2 == 0 && (bd[0] != 0 || nl <= 257))
                {
                    return(0);
                }
                switch (num2)
                {
                case -5:
                    z.ErrorMessage = "incomplete distance tree";
                    num2           = -3;
                    goto case -4;

                case -4:
                    return(num2);

                case -3:
                    z.ErrorMessage = "oversubscribed distance tree";
                    goto case -4;

                default:
                    z.ErrorMessage = "empty distance tree with lengths";
                    num2           = -3;
                    goto case -4;
                }
            }
        }
Example #2
0
        internal static int InflateTreeBits(
            int[] c,
            int[] bb,
            int[] tb,
            int[] hp,
            CompressionStream z)
        {
            int[] hn   = new int[1];
            int[] v    = new int[19];
            int   num1 = InflaterTree.BuildHuffmanTree(c, 0, 19, 19, (int[])null, (int[])null, tb, bb, hp, hn, v);
            int   num2;

            switch (num1)
            {
            case -5:
                num2 = 0;
                break;

            case -3:
                z.ErrorMessage = "oversubscribed dynamic bit lengths tree";
                goto label_6;

            default:
                num2 = bb[0] != 0 ? 1 : 0;
                break;
            }
            if (num2 == 0)
            {
                z.ErrorMessage = "incomplete dynamic bit lengths tree";
                num1           = -3;
            }
label_6:
            return(num1);
        }