View | Details | Raw Unified | Return to bug 1046197
Collapse All | Expand All

(-)zlib-1.2.8/deflate.c (-1 / +32 lines)
Lines 51-56 Link Here
51
51
52
#include "deflate.h"
52
#include "deflate.h"
53
53
54
#define read_buf dread_buf
55
54
const char deflate_copyright[] =
56
const char deflate_copyright[] =
55
   " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
57
   " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
56
/*
58
/*
Lines 670-676 Link Here
670
    deflate_state *s;
672
    deflate_state *s;
671
673
672
    if (strm == Z_NULL || strm->state == Z_NULL ||
674
    if (strm == Z_NULL || strm->state == Z_NULL ||
673
        flush > Z_BLOCK || flush < 0) {
675
        (flush > Z_BLOCK && flush != Z_INSERT_ONLY) || flush < 0) {
674
        return Z_STREAM_ERROR;
676
        return Z_STREAM_ERROR;
675
    }
677
    }
676
    s = strm->state;
678
    s = strm->state;
Lines 1593-1598 Link Here
1593
        s->strstart += s->lookahead;
1595
        s->strstart += s->lookahead;
1594
        s->lookahead = 0;
1596
        s->lookahead = 0;
1595
1597
1598
	if (flush == Z_INSERT_ONLY) {
1599
	    s->block_start = s->strstart;
1600
	    continue;
1601
	}
1602
1596
        /* Emit a stored block if pending_buf will be full: */
1603
        /* Emit a stored block if pending_buf will be full: */
1597
        max_start = s->block_start + max_block_size;
1604
        max_start = s->block_start + max_block_size;
1598
        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
1605
        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
Lines 1609-1614 Link Here
1609
        }
1616
        }
1610
    }
1617
    }
1611
    s->insert = 0;
1618
    s->insert = 0;
1619
    if (flush == Z_INSERT_ONLY) {
1620
	s->block_start = s->strstart;
1621
	return need_more;
1622
    }
1612
    if (flush == Z_FINISH) {
1623
    if (flush == Z_FINISH) {
1613
        FLUSH_BLOCK(s, 1);
1624
        FLUSH_BLOCK(s, 1);
1614
        return finish_done;
1625
        return finish_done;
Lines 1654-1659 Link Here
1654
            INSERT_STRING(s, s->strstart, hash_head);
1665
            INSERT_STRING(s, s->strstart, hash_head);
1655
        }
1666
        }
1656
1667
1668
	if (flush == Z_INSERT_ONLY) {
1669
	    s->strstart++;
1670
	    s->lookahead--;
1671
	    continue;
1672
	}
1673
1657
        /* Find the longest match, discarding those <= prev_length.
1674
        /* Find the longest match, discarding those <= prev_length.
1658
         * At this point we have always match_length < MIN_MATCH
1675
         * At this point we have always match_length < MIN_MATCH
1659
         */
1676
         */
Lines 1711-1716 Link Here
1711
        }
1728
        }
1712
        if (bflush) FLUSH_BLOCK(s, 0);
1729
        if (bflush) FLUSH_BLOCK(s, 0);
1713
    }
1730
    }
1731
    if (flush == Z_INSERT_ONLY) {
1732
	s->block_start = s->strstart;
1733
	return need_more;
1734
    }
1714
    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
1735
    s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
1715
    if (flush == Z_FINISH) {
1736
    if (flush == Z_FINISH) {
1716
        FLUSH_BLOCK(s, 1);
1737
        FLUSH_BLOCK(s, 1);
Lines 1757-1762 Link Here
1757
            INSERT_STRING(s, s->strstart, hash_head);
1778
            INSERT_STRING(s, s->strstart, hash_head);
1758
        }
1779
        }
1759
1780
1781
	if (flush == Z_INSERT_ONLY) {
1782
	    s->strstart++;
1783
	    s->lookahead--;
1784
	    continue;
1785
	}
1786
1760
        /* Find the longest match, discarding those <= prev_length.
1787
        /* Find the longest match, discarding those <= prev_length.
1761
         */
1788
         */
1762
        s->prev_length = s->match_length, s->prev_match = s->match_start;
1789
        s->prev_length = s->match_length, s->prev_match = s->match_start;
Lines 1836-1841 Link Here
1836
            s->lookahead--;
1863
            s->lookahead--;
1837
        }
1864
        }
1838
    }
1865
    }
1866
    if (flush == Z_INSERT_ONLY) {
1867
	s->block_start = s->strstart;
1868
	return need_more;
1869
    }
1839
    Assert (flush != Z_NO_FLUSH, "no flush?");
1870
    Assert (flush != Z_NO_FLUSH, "no flush?");
1840
    if (s->match_available) {
1871
    if (s->match_available) {
1841
        Tracevv((stderr,"%c", s->window[s->strstart-1]));
1872
        Tracevv((stderr,"%c", s->window[s->strstart-1]));
(-)zlib-1.2.8/inflate.c (+21 lines)
Lines 702-707 Link Here
702
            if (state->flags & 0x0200) CRC2(state->check, hold);
702
            if (state->flags & 0x0200) CRC2(state->check, hold);
703
            INITBITS();
703
            INITBITS();
704
            state->mode = TIME;
704
            state->mode = TIME;
705
	    /* FALL THROUGH */
705
        case TIME:
706
        case TIME:
706
            NEEDBITS(32);
707
            NEEDBITS(32);
707
            if (state->head != Z_NULL)
708
            if (state->head != Z_NULL)
Lines 709-714 Link Here
709
            if (state->flags & 0x0200) CRC4(state->check, hold);
710
            if (state->flags & 0x0200) CRC4(state->check, hold);
710
            INITBITS();
711
            INITBITS();
711
            state->mode = OS;
712
            state->mode = OS;
713
	    /* FALL THROUGH */
712
        case OS:
714
        case OS:
713
            NEEDBITS(16);
715
            NEEDBITS(16);
714
            if (state->head != Z_NULL) {
716
            if (state->head != Z_NULL) {
Lines 718-723 Link Here
718
            if (state->flags & 0x0200) CRC2(state->check, hold);
720
            if (state->flags & 0x0200) CRC2(state->check, hold);
719
            INITBITS();
721
            INITBITS();
720
            state->mode = EXLEN;
722
            state->mode = EXLEN;
723
	    /* FALL THROUGH */
721
        case EXLEN:
724
        case EXLEN:
722
            if (state->flags & 0x0400) {
725
            if (state->flags & 0x0400) {
723
                NEEDBITS(16);
726
                NEEDBITS(16);
Lines 730-735 Link Here
730
            else if (state->head != Z_NULL)
733
            else if (state->head != Z_NULL)
731
                state->head->extra = Z_NULL;
734
                state->head->extra = Z_NULL;
732
            state->mode = EXTRA;
735
            state->mode = EXTRA;
736
	    /* FALL THROUGH */
733
        case EXTRA:
737
        case EXTRA:
734
            if (state->flags & 0x0400) {
738
            if (state->flags & 0x0400) {
735
                copy = state->length;
739
                copy = state->length;
Lines 752-757 Link Here
752
            }
756
            }
753
            state->length = 0;
757
            state->length = 0;
754
            state->mode = NAME;
758
            state->mode = NAME;
759
	    /* FALL THROUGH */
755
        case NAME:
760
        case NAME:
756
            if (state->flags & 0x0800) {
761
            if (state->flags & 0x0800) {
757
                if (have == 0) goto inf_leave;
762
                if (have == 0) goto inf_leave;
Lines 773-778 Link Here
773
                state->head->name = Z_NULL;
778
                state->head->name = Z_NULL;
774
            state->length = 0;
779
            state->length = 0;
775
            state->mode = COMMENT;
780
            state->mode = COMMENT;
781
	    /* FALL THROUGH */
776
        case COMMENT:
782
        case COMMENT:
777
            if (state->flags & 0x1000) {
783
            if (state->flags & 0x1000) {
778
                if (have == 0) goto inf_leave;
784
                if (have == 0) goto inf_leave;
Lines 793-798 Link Here
793
            else if (state->head != Z_NULL)
799
            else if (state->head != Z_NULL)
794
                state->head->comment = Z_NULL;
800
                state->head->comment = Z_NULL;
795
            state->mode = HCRC;
801
            state->mode = HCRC;
802
	    /* FALL THROUGH */
796
        case HCRC:
803
        case HCRC:
797
            if (state->flags & 0x0200) {
804
            if (state->flags & 0x0200) {
798
                NEEDBITS(16);
805
                NEEDBITS(16);
Lines 816-821 Link Here
816
            strm->adler = state->check = ZSWAP32(hold);
823
            strm->adler = state->check = ZSWAP32(hold);
817
            INITBITS();
824
            INITBITS();
818
            state->mode = DICT;
825
            state->mode = DICT;
826
	    /* FALL THROUGH */
819
        case DICT:
827
        case DICT:
820
            if (state->havedict == 0) {
828
            if (state->havedict == 0) {
821
                RESTORE();
829
                RESTORE();
Lines 823-830 Link Here
823
            }
831
            }
824
            strm->adler = state->check = adler32(0L, Z_NULL, 0);
832
            strm->adler = state->check = adler32(0L, Z_NULL, 0);
825
            state->mode = TYPE;
833
            state->mode = TYPE;
834
	    /* FALL THROUGH */
826
        case TYPE:
835
        case TYPE:
827
            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
836
            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
837
	    /* FALL THROUGH */
828
        case TYPEDO:
838
        case TYPEDO:
829
            if (state->last) {
839
            if (state->last) {
830
                BYTEBITS();
840
                BYTEBITS();
Lines 877-882 Link Here
877
            if (flush == Z_TREES) goto inf_leave;
887
            if (flush == Z_TREES) goto inf_leave;
878
        case COPY_:
888
        case COPY_:
879
            state->mode = COPY;
889
            state->mode = COPY;
890
	    /* FALL THROUGH */
880
        case COPY:
891
        case COPY:
881
            copy = state->length;
892
            copy = state->length;
882
            if (copy) {
893
            if (copy) {
Lines 912-917 Link Here
912
            Tracev((stderr, "inflate:       table sizes ok\n"));
923
            Tracev((stderr, "inflate:       table sizes ok\n"));
913
            state->have = 0;
924
            state->have = 0;
914
            state->mode = LENLENS;
925
            state->mode = LENLENS;
926
	    /* FALL THROUGH */
915
        case LENLENS:
927
        case LENLENS:
916
            while (state->have < state->ncode) {
928
            while (state->have < state->ncode) {
917
                NEEDBITS(3);
929
                NEEDBITS(3);
Lines 933-938 Link Here
933
            Tracev((stderr, "inflate:       code lengths ok\n"));
945
            Tracev((stderr, "inflate:       code lengths ok\n"));
934
            state->have = 0;
946
            state->have = 0;
935
            state->mode = CODELENS;
947
            state->mode = CODELENS;
948
	    /* FALL THROUGH */
936
        case CODELENS:
949
        case CODELENS:
937
            while (state->have < state->nlen + state->ndist) {
950
            while (state->have < state->nlen + state->ndist) {
938
                for (;;) {
951
                for (;;) {
Lines 1016-1023 Link Here
1016
            Tracev((stderr, "inflate:       codes ok\n"));
1029
            Tracev((stderr, "inflate:       codes ok\n"));
1017
            state->mode = LEN_;
1030
            state->mode = LEN_;
1018
            if (flush == Z_TREES) goto inf_leave;
1031
            if (flush == Z_TREES) goto inf_leave;
1032
	    /* FALL THROUGH */
1019
        case LEN_:
1033
        case LEN_:
1020
            state->mode = LEN;
1034
            state->mode = LEN;
1035
	    /* FALL THROUGH */
1021
        case LEN:
1036
        case LEN:
1022
            if (have >= 6 && left >= 258) {
1037
            if (have >= 6 && left >= 258) {
1023
                RESTORE();
1038
                RESTORE();
Lines 1067-1072 Link Here
1067
            }
1082
            }
1068
            state->extra = (unsigned)(here.op) & 15;
1083
            state->extra = (unsigned)(here.op) & 15;
1069
            state->mode = LENEXT;
1084
            state->mode = LENEXT;
1085
	    /* FALL THROUGH */
1070
        case LENEXT:
1086
        case LENEXT:
1071
            if (state->extra) {
1087
            if (state->extra) {
1072
                NEEDBITS(state->extra);
1088
                NEEDBITS(state->extra);
Lines 1077-1082 Link Here
1077
            Tracevv((stderr, "inflate:         length %u\n", state->length));
1093
            Tracevv((stderr, "inflate:         length %u\n", state->length));
1078
            state->was = state->length;
1094
            state->was = state->length;
1079
            state->mode = DIST;
1095
            state->mode = DIST;
1096
	    /* FALL THROUGH */
1080
        case DIST:
1097
        case DIST:
1081
            for (;;) {
1098
            for (;;) {
1082
                here = state->distcode[BITS(state->distbits)];
1099
                here = state->distcode[BITS(state->distbits)];
Lines 1104-1109 Link Here
1104
            state->offset = (unsigned)here.val;
1121
            state->offset = (unsigned)here.val;
1105
            state->extra = (unsigned)(here.op) & 15;
1122
            state->extra = (unsigned)(here.op) & 15;
1106
            state->mode = DISTEXT;
1123
            state->mode = DISTEXT;
1124
	    /* FALL THROUGH */
1107
        case DISTEXT:
1125
        case DISTEXT:
1108
            if (state->extra) {
1126
            if (state->extra) {
1109
                NEEDBITS(state->extra);
1127
                NEEDBITS(state->extra);
Lines 1120-1125 Link Here
1120
#endif
1138
#endif
1121
            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
1139
            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
1122
            state->mode = MATCH;
1140
            state->mode = MATCH;
1141
	    /* FALL THROUGH */
1123
        case MATCH:
1142
        case MATCH:
1124
            if (left == 0) goto inf_leave;
1143
            if (left == 0) goto inf_leave;
1125
            copy = out - left;
1144
            copy = out - left;
Lines 1195-1200 Link Here
1195
            }
1214
            }
1196
#ifdef GUNZIP
1215
#ifdef GUNZIP
1197
            state->mode = LENGTH;
1216
            state->mode = LENGTH;
1217
	    /* FALL THROUGH */
1198
        case LENGTH:
1218
        case LENGTH:
1199
            if (state->wrap && state->flags) {
1219
            if (state->wrap && state->flags) {
1200
                NEEDBITS(32);
1220
                NEEDBITS(32);
Lines 1208-1213 Link Here
1208
            }
1228
            }
1209
#endif
1229
#endif
1210
            state->mode = DONE;
1230
            state->mode = DONE;
1231
	    /* FALL THROUGH */
1211
        case DONE:
1232
        case DONE:
1212
            ret = Z_STREAM_END;
1233
            ret = Z_STREAM_END;
1213
            goto inf_leave;
1234
            goto inf_leave;
(-)zlib-1.2.8/inflate.h (+4 lines)
Lines 16-21 Link Here
16
#  define GUNZIP
16
#  define GUNZIP
17
#endif
17
#endif
18
18
19
#ifdef BAD /* For AIX */
20
#undef BAD
21
#endif
22
19
/* Possible inflate modes between inflate() calls */
23
/* Possible inflate modes between inflate() calls */
20
typedef enum {
24
typedef enum {
21
    HEAD,       /* i: waiting for magic header */
25
    HEAD,       /* i: waiting for magic header */
(-)zlib-1.2.8/zlib.h (+1 lines)
Lines 169-174 Link Here
169
#define Z_BLOCK         5
169
#define Z_BLOCK         5
170
#define Z_TREES         6
170
#define Z_TREES         6
171
/* Allowed flush values; see deflate() and inflate() below for details */
171
/* Allowed flush values; see deflate() and inflate() below for details */
172
#define Z_INSERT_ONLY	7
172
173
173
#define Z_OK            0
174
#define Z_OK            0
174
#define Z_STREAM_END    1
175
#define Z_STREAM_END    1
(-)zlib-1.2.8/zutil.c (-12 / +12 lines)
Lines 38-64 Link Here
38
38
39
    flags = 0;
39
    flags = 0;
40
    switch ((int)(sizeof(uInt))) {
40
    switch ((int)(sizeof(uInt))) {
41
    case 2:     break;
41
    case 2:     break;				/* CONSTANT CONDITION */
42
    case 4:     flags += 1;     break;
42
    case 4:     flags += 1;     break;		/* CONSTANT CONDITION */
43
    case 8:     flags += 2;     break;
43
    case 8:     flags += 2;     break;		/* CONSTANT CONDITION */
44
    default:    flags += 3;
44
    default:    flags += 3;
45
    }
45
    }
46
    switch ((int)(sizeof(uLong))) {
46
    switch ((int)(sizeof(uLong))) {
47
    case 2:     break;
47
    case 2:     break;				/* CONSTANT CONDITION */
48
    case 4:     flags += 1 << 2;        break;
48
    case 4:     flags += 1 << 2;        break;	/* CONSTANT CONDITION */
49
    case 8:     flags += 2 << 2;        break;
49
    case 8:     flags += 2 << 2;        break;	/* CONSTANT CONDITION */
50
    default:    flags += 3 << 2;
50
    default:    flags += 3 << 2;
51
    }
51
    }
52
    switch ((int)(sizeof(voidpf))) {
52
    switch ((int)(sizeof(voidpf))) {
53
    case 2:     break;
53
    case 2:     break;				/* CONSTANT CONDITION */
54
    case 4:     flags += 1 << 4;        break;
54
    case 4:     flags += 1 << 4;        break;	/* CONSTANT CONDITION */
55
    case 8:     flags += 2 << 4;        break;
55
    case 8:     flags += 2 << 4;        break;	/* CONSTANT CONDITION */
56
    default:    flags += 3 << 4;
56
    default:    flags += 3 << 4;
57
    }
57
    }
58
    switch ((int)(sizeof(z_off_t))) {
58
    switch ((int)(sizeof(z_off_t))) {
59
    case 2:     break;
59
    case 2:     break;				/* CONSTANT CONDITION */
60
    case 4:     flags += 1 << 6;        break;
60
    case 4:     flags += 1 << 6;        break;	/* CONSTANT CONDITION */
61
    case 8:     flags += 2 << 6;        break;
61
    case 8:     flags += 2 << 6;        break;	/* CONSTANT CONDITION */
62
    default:    flags += 3 << 6;
62
    default:    flags += 3 << 6;
63
    }
63
    }
64
#ifdef DEBUG
64
#ifdef DEBUG
(-)zlib-1.2.8/zutil.h (-6 / +4 lines)
Lines 13-26 Link Here
13
#ifndef ZUTIL_H
13
#ifndef ZUTIL_H
14
#define ZUTIL_H
14
#define ZUTIL_H
15
15
16
#ifdef HAVE_HIDDEN
16
#define ZLIB_INTERNAL
17
#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
17
#include "../rsync.h"
18
#else
19
#  define ZLIB_INTERNAL
20
#endif
21
22
#include "zlib.h"
18
#include "zlib.h"
23
19
20
#if 0
24
#if defined(STDC) && !defined(Z_SOLO)
21
#if defined(STDC) && !defined(Z_SOLO)
25
#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
22
#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
26
#    include <stddef.h>
23
#    include <stddef.h>
Lines 28-33 Link Here
28
#  include <string.h>
25
#  include <string.h>
29
#  include <stdlib.h>
26
#  include <stdlib.h>
30
#endif
27
#endif
28
#endif
31
29
32
#ifdef Z_SOLO
30
#ifdef Z_SOLO
33
   typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */
31
   typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */

Return to bug 1046197