rugged 0.21.1b2 → 0.21.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -12
  3. data/ext/rugged/extconf.rb +8 -8
  4. data/ext/rugged/rugged.h +1 -1
  5. data/ext/rugged/rugged_blob.c +0 -57
  6. data/ext/rugged/rugged_cred.c +0 -23
  7. data/ext/rugged/rugged_index.c +2 -6
  8. data/ext/rugged/rugged_remote.c +1 -69
  9. data/ext/rugged/rugged_repo.c +5 -287
  10. data/ext/rugged/rugged_tag_collection.c +2 -70
  11. data/ext/rugged/rugged_tree.c +10 -29
  12. data/lib/rugged.rb +0 -2
  13. data/lib/rugged/diff.rb +1 -0
  14. data/lib/rugged/diff/line.rb +3 -1
  15. data/lib/rugged/patch.rb +2 -12
  16. data/lib/rugged/version.rb +1 -1
  17. data/vendor/libgit2/CMakeLists.txt +0 -11
  18. data/vendor/libgit2/deps/http-parser/http_parser.h +0 -2
  19. data/vendor/libgit2/deps/zlib/adler32.c +29 -39
  20. data/vendor/libgit2/deps/zlib/crc32.c +50 -33
  21. data/vendor/libgit2/deps/zlib/crc32.h +1 -1
  22. data/vendor/libgit2/deps/zlib/deflate.c +65 -198
  23. data/vendor/libgit2/deps/zlib/deflate.h +4 -8
  24. data/vendor/libgit2/deps/zlib/inffast.c +3 -3
  25. data/vendor/libgit2/deps/zlib/inffixed.h +3 -3
  26. data/vendor/libgit2/deps/zlib/inflate.c +52 -84
  27. data/vendor/libgit2/deps/zlib/inftrees.c +39 -15
  28. data/vendor/libgit2/deps/zlib/trees.c +36 -18
  29. data/vendor/libgit2/deps/zlib/zconf.h +0 -4
  30. data/vendor/libgit2/deps/zlib/zlib.h +95 -250
  31. data/vendor/libgit2/deps/zlib/zutil.c +10 -13
  32. data/vendor/libgit2/deps/zlib/zutil.h +62 -41
  33. data/vendor/libgit2/include/git2/attr.h +13 -16
  34. data/vendor/libgit2/include/git2/buffer.h +0 -16
  35. data/vendor/libgit2/include/git2/checkout.h +12 -12
  36. data/vendor/libgit2/include/git2/cherrypick.h +15 -15
  37. data/vendor/libgit2/include/git2/clone.h +69 -77
  38. data/vendor/libgit2/include/git2/diff.h +0 -7
  39. data/vendor/libgit2/include/git2/errors.h +0 -2
  40. data/vendor/libgit2/include/git2/merge.h +0 -16
  41. data/vendor/libgit2/include/git2/oid.h +4 -8
  42. data/vendor/libgit2/include/git2/remote.h +32 -13
  43. data/vendor/libgit2/include/git2/repository.h +1 -4
  44. data/vendor/libgit2/include/git2/reset.h +0 -4
  45. data/vendor/libgit2/include/git2/revert.h +1 -1
  46. data/vendor/libgit2/include/git2/status.h +14 -17
  47. data/vendor/libgit2/include/git2/submodule.h +0 -18
  48. data/vendor/libgit2/include/git2/sys/repository.h +0 -13
  49. data/vendor/libgit2/include/git2/transport.h +313 -79
  50. data/vendor/libgit2/include/git2/tree.h +2 -4
  51. data/vendor/libgit2/include/git2/types.h +6 -54
  52. data/vendor/libgit2/include/git2/version.h +2 -2
  53. data/vendor/libgit2/src/attr.c +4 -8
  54. data/vendor/libgit2/src/attr_file.c +1 -14
  55. data/vendor/libgit2/src/blame.c +1 -0
  56. data/vendor/libgit2/src/buf_text.c +5 -9
  57. data/vendor/libgit2/src/buf_text.h +2 -3
  58. data/vendor/libgit2/src/buffer.c +10 -67
  59. data/vendor/libgit2/src/buffer.h +2 -4
  60. data/vendor/libgit2/src/cache.c +9 -9
  61. data/vendor/libgit2/src/cache.h +1 -1
  62. data/vendor/libgit2/src/checkout.c +44 -121
  63. data/vendor/libgit2/src/cherrypick.c +44 -41
  64. data/vendor/libgit2/src/clone.c +56 -94
  65. data/vendor/libgit2/src/config_file.c +7 -2
  66. data/vendor/libgit2/src/crlf.c +1 -2
  67. data/vendor/libgit2/src/diff.c +0 -21
  68. data/vendor/libgit2/src/diff_file.c +0 -1
  69. data/vendor/libgit2/src/diff_print.c +9 -11
  70. data/vendor/libgit2/src/diff_tform.c +2 -4
  71. data/vendor/libgit2/src/errors.c +7 -9
  72. data/vendor/libgit2/src/filebuf.c +2 -0
  73. data/vendor/libgit2/src/fileops.c +7 -9
  74. data/vendor/libgit2/src/filter.c +11 -2
  75. data/vendor/libgit2/src/global.c +20 -3
  76. data/vendor/libgit2/src/global.h +0 -2
  77. data/vendor/libgit2/src/graph.c +2 -2
  78. data/vendor/libgit2/src/hashsig.c +1 -1
  79. data/vendor/libgit2/{include/git2/sys → src}/hashsig.h +7 -11
  80. data/vendor/libgit2/src/ignore.c +2 -2
  81. data/vendor/libgit2/src/indexer.c +1 -13
  82. data/vendor/libgit2/src/merge.c +145 -99
  83. data/vendor/libgit2/src/merge.h +1 -1
  84. data/vendor/libgit2/src/mwindow.c +8 -117
  85. data/vendor/libgit2/src/mwindow.h +1 -9
  86. data/vendor/libgit2/src/netops.c +7 -6
  87. data/vendor/libgit2/src/netops.h +4 -0
  88. data/vendor/libgit2/src/odb_loose.c +1 -1
  89. data/vendor/libgit2/src/odb_pack.c +3 -6
  90. data/vendor/libgit2/src/oid.c +0 -8
  91. data/vendor/libgit2/src/oid.h +0 -11
  92. data/vendor/libgit2/src/pack.c +6 -20
  93. data/vendor/libgit2/src/pack.h +0 -3
  94. data/vendor/libgit2/src/path.c +64 -134
  95. data/vendor/libgit2/src/path.h +1 -22
  96. data/vendor/libgit2/src/posix.h +28 -46
  97. data/vendor/libgit2/src/refs.h +2 -2
  98. data/vendor/libgit2/src/refspec.c +2 -14
  99. data/vendor/libgit2/src/remote.c +26 -29
  100. data/vendor/libgit2/src/remote.h +1 -3
  101. data/vendor/libgit2/src/repository.c +14 -54
  102. data/vendor/libgit2/src/revert.c +6 -4
  103. data/vendor/libgit2/src/revparse.c +18 -15
  104. data/vendor/libgit2/src/signature.c +2 -2
  105. data/vendor/libgit2/src/stash.c +1 -2
  106. data/vendor/libgit2/src/status.c +2 -11
  107. data/vendor/libgit2/src/strnlen.h +1 -2
  108. data/vendor/libgit2/src/submodule.c +33 -73
  109. data/vendor/libgit2/src/tag.c +3 -2
  110. data/vendor/libgit2/src/thread-utils.h +7 -0
  111. data/vendor/libgit2/src/trace.h +1 -9
  112. data/vendor/libgit2/src/transport.c +90 -93
  113. data/vendor/libgit2/src/transports/cred.c +0 -58
  114. data/vendor/libgit2/src/transports/cred_helpers.c +0 -3
  115. data/vendor/libgit2/src/transports/git.c +0 -1
  116. data/vendor/libgit2/src/transports/http.c +82 -205
  117. data/vendor/libgit2/src/transports/smart.c +0 -2
  118. data/vendor/libgit2/src/transports/smart.h +0 -2
  119. data/vendor/libgit2/src/transports/smart_protocol.c +5 -7
  120. data/vendor/libgit2/src/transports/ssh.c +35 -224
  121. data/vendor/libgit2/src/transports/winhttp.c +34 -140
  122. data/vendor/libgit2/src/tree.c +60 -64
  123. data/vendor/libgit2/src/tree.h +3 -2
  124. data/vendor/libgit2/src/unix/posix.h +9 -23
  125. data/vendor/libgit2/src/unix/realpath.c +7 -8
  126. data/vendor/libgit2/src/util.c +1 -2
  127. data/vendor/libgit2/src/util.h +3 -3
  128. data/vendor/libgit2/src/win32/mingw-compat.h +12 -5
  129. data/vendor/libgit2/src/win32/msvc-compat.h +32 -3
  130. data/vendor/libgit2/src/win32/posix.h +31 -20
  131. data/vendor/libgit2/src/win32/posix_w32.c +18 -62
  132. metadata +5 -18
  133. data/lib/rugged/attributes.rb +0 -41
  134. data/lib/rugged/blob.rb +0 -28
  135. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +0 -324
  136. data/vendor/libgit2/deps/zlib/infback.c +0 -640
  137. data/vendor/libgit2/include/git2/oidarray.h +0 -40
  138. data/vendor/libgit2/include/git2/sys/transport.h +0 -352
  139. data/vendor/libgit2/src/oidarray.c +0 -21
  140. data/vendor/libgit2/src/oidarray.h +0 -18
  141. data/vendor/libgit2/src/transports/auth.c +0 -71
  142. data/vendor/libgit2/src/transports/auth.h +0 -63
  143. data/vendor/libgit2/src/transports/auth_negotiate.c +0 -275
  144. data/vendor/libgit2/src/transports/auth_negotiate.h +0 -27
  145. data/vendor/libgit2/src/transports/cred.h +0 -14
@@ -1,5 +1,5 @@
1
1
  /* deflate.h -- internal compression state
2
- * Copyright (C) 1995-2012 Jean-loup Gailly
2
+ * Copyright (C) 1995-2010 Jean-loup Gailly
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -48,9 +48,6 @@
48
48
  #define MAX_BITS 15
49
49
  /* All codes must not exceed MAX_BITS bits */
50
50
 
51
- #define Buf_size 16
52
- /* size of bit buffer in bi_buf */
53
-
54
51
  #define INIT_STATE 42
55
52
  #define EXTRA_STATE 69
56
53
  #define NAME_STATE 73
@@ -104,7 +101,7 @@ typedef struct internal_state {
104
101
  int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
105
102
  gz_headerp gzhead; /* gzip header information to write */
106
103
  uInt gzindex; /* where in extra, name, or comment */
107
- Byte method; /* can only be DEFLATED */
104
+ Byte method; /* STORED (for zip only) or DEFLATED */
108
105
  int last_flush; /* value of flush param for previous deflate call */
109
106
 
110
107
  /* used by deflate.c: */
@@ -191,7 +188,7 @@ typedef struct internal_state {
191
188
  int nice_match; /* Stop searching when current match exceeds this */
192
189
 
193
190
  /* used by trees.c: */
194
- /* Didn't use ct_data typedef below to suppress compiler warning */
191
+ /* Didn't use ct_data typedef below to supress compiler warning */
195
192
  struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
196
193
  struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
197
194
  struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
@@ -247,7 +244,7 @@ typedef struct internal_state {
247
244
  ulg opt_len; /* bit length of current block with optimal trees */
248
245
  ulg static_len; /* bit length of current block with static trees */
249
246
  uInt matches; /* number of string matches in current block */
250
- uInt insert; /* bytes at end of window left to insert */
247
+ int last_eob_len; /* bit length of EOB code for last block */
251
248
 
252
249
  #ifdef DEBUG
253
250
  ulg compressed_len; /* total bit length of compressed file mod 2^32 */
@@ -297,7 +294,6 @@ void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
297
294
  int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
298
295
  void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
299
296
  ulg stored_len, int last));
300
- void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
301
297
  void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
302
298
  void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
303
299
  ulg stored_len, int last));
@@ -1,5 +1,5 @@
1
1
  /* inffast.c -- fast decoding
2
- * Copyright (C) 1995-2008, 2010, 2013 Mark Adler
2
+ * Copyright (C) 1995-2008, 2010 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -69,8 +69,8 @@ z_streamp strm;
69
69
  unsigned start; /* inflate()'s starting value for strm->avail_out */
70
70
  {
71
71
  struct inflate_state FAR *state;
72
- z_const unsigned char FAR *in; /* local strm->next_in */
73
- z_const unsigned char FAR *last; /* have enough input while in < last */
72
+ unsigned char FAR *in; /* local strm->next_in */
73
+ unsigned char FAR *last; /* while in < last, enough input available */
74
74
  unsigned char FAR *out; /* local strm->next_out */
75
75
  unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
76
76
  unsigned char FAR *end; /* while out < end, enough space available */
@@ -2,9 +2,9 @@
2
2
  * Generated automatically by makefixed().
3
3
  */
4
4
 
5
- /* WARNING: this file should *not* be used by applications.
6
- It is part of the implementation of this library and is
7
- subject to change. Applications should only use zlib.h.
5
+ /* WARNING: this file should *not* be used by applications. It
6
+ is part of the implementation of the compression library and
7
+ is subject to change. Applications should only use zlib.h.
8
8
  */
9
9
 
10
10
  static const code lenfix[512] = {
@@ -1,5 +1,5 @@
1
1
  /* inflate.c -- zlib decompression
2
- * Copyright (C) 1995-2012 Mark Adler
2
+ * Copyright (C) 1995-2010 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -93,15 +93,14 @@
93
93
 
94
94
  /* function prototypes */
95
95
  local void fixedtables OF((struct inflate_state FAR *state));
96
- local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
97
- unsigned copy));
96
+ local int updatewindow OF((z_streamp strm, unsigned out));
98
97
  #ifdef BUILDFIXED
99
98
  void makefixed OF((void));
100
99
  #endif
101
- local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
100
+ local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
102
101
  unsigned len));
103
102
 
104
- int ZEXPORT inflateResetKeep(strm)
103
+ int ZEXPORT inflateReset(strm)
105
104
  z_streamp strm;
106
105
  {
107
106
  struct inflate_state FAR *state;
@@ -110,13 +109,15 @@ z_streamp strm;
110
109
  state = (struct inflate_state FAR *)strm->state;
111
110
  strm->total_in = strm->total_out = state->total = 0;
112
111
  strm->msg = Z_NULL;
113
- if (state->wrap) /* to support ill-conceived Java test suite */
114
- strm->adler = state->wrap & 1;
112
+ strm->adler = 1; /* to support ill-conceived Java test suite */
115
113
  state->mode = HEAD;
116
114
  state->last = 0;
117
115
  state->havedict = 0;
118
116
  state->dmax = 32768U;
119
117
  state->head = Z_NULL;
118
+ state->wsize = 0;
119
+ state->whave = 0;
120
+ state->wnext = 0;
120
121
  state->hold = 0;
121
122
  state->bits = 0;
122
123
  state->lencode = state->distcode = state->next = state->codes;
@@ -126,19 +127,6 @@ z_streamp strm;
126
127
  return Z_OK;
127
128
  }
128
129
 
129
- int ZEXPORT inflateReset(strm)
130
- z_streamp strm;
131
- {
132
- struct inflate_state FAR *state;
133
-
134
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
135
- state = (struct inflate_state FAR *)strm->state;
136
- state->wsize = 0;
137
- state->whave = 0;
138
- state->wnext = 0;
139
- return inflateResetKeep(strm);
140
- }
141
-
142
130
  int ZEXPORT inflateReset2(strm, windowBits)
143
131
  z_streamp strm;
144
132
  int windowBits;
@@ -192,19 +180,10 @@ int stream_size;
192
180
  if (strm == Z_NULL) return Z_STREAM_ERROR;
193
181
  strm->msg = Z_NULL; /* in case we return an error */
194
182
  if (strm->zalloc == (alloc_func)0) {
195
- #ifdef Z_SOLO
196
- return Z_STREAM_ERROR;
197
- #else
198
183
  strm->zalloc = zcalloc;
199
184
  strm->opaque = (voidpf)0;
200
- #endif
201
185
  }
202
- if (strm->zfree == (free_func)0)
203
- #ifdef Z_SOLO
204
- return Z_STREAM_ERROR;
205
- #else
206
- strm->zfree = zcfree;
207
- #endif
186
+ if (strm->zfree == (free_func)0) strm->zfree = zcfree;
208
187
  state = (struct inflate_state FAR *)
209
188
  ZALLOC(strm, 1, sizeof(struct inflate_state));
210
189
  if (state == Z_NULL) return Z_MEM_ERROR;
@@ -342,8 +321,8 @@ void makefixed()
342
321
  low = 0;
343
322
  for (;;) {
344
323
  if ((low % 7) == 0) printf("\n ");
345
- printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
346
- state.lencode[low].bits, state.lencode[low].val);
324
+ printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
325
+ state.lencode[low].val);
347
326
  if (++low == size) break;
348
327
  putchar(',');
349
328
  }
@@ -376,13 +355,12 @@ void makefixed()
376
355
  output will fall in the output data, making match copies simpler and faster.
377
356
  The advantage may be dependent on the size of the processor's data caches.
378
357
  */
379
- local int updatewindow(strm, end, copy)
358
+ local int updatewindow(strm, out)
380
359
  z_streamp strm;
381
- const Bytef *end;
382
- unsigned copy;
360
+ unsigned out;
383
361
  {
384
362
  struct inflate_state FAR *state;
385
- unsigned dist;
363
+ unsigned copy, dist;
386
364
 
387
365
  state = (struct inflate_state FAR *)strm->state;
388
366
 
@@ -402,18 +380,19 @@ unsigned copy;
402
380
  }
403
381
 
404
382
  /* copy state->wsize or less output bytes into the circular window */
383
+ copy = out - strm->avail_out;
405
384
  if (copy >= state->wsize) {
406
- zmemcpy(state->window, end - state->wsize, state->wsize);
385
+ zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
407
386
  state->wnext = 0;
408
387
  state->whave = state->wsize;
409
388
  }
410
389
  else {
411
390
  dist = state->wsize - state->wnext;
412
391
  if (dist > copy) dist = copy;
413
- zmemcpy(state->window + state->wnext, end - copy, dist);
392
+ zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);
414
393
  copy -= dist;
415
394
  if (copy) {
416
- zmemcpy(state->window, end - copy, copy);
395
+ zmemcpy(state->window, strm->next_out - copy, copy);
417
396
  state->wnext = copy;
418
397
  state->whave = state->wsize;
419
398
  }
@@ -520,6 +499,11 @@ unsigned copy;
520
499
  bits -= bits & 7; \
521
500
  } while (0)
522
501
 
502
+ /* Reverse the bytes in a 32-bit value */
503
+ #define REVERSE(q) \
504
+ ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
505
+ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
506
+
523
507
  /*
524
508
  inflate() uses a state machine to process as much input data and generate as
525
509
  much output data as possible before returning. The state machine is
@@ -607,7 +591,7 @@ z_streamp strm;
607
591
  int flush;
608
592
  {
609
593
  struct inflate_state FAR *state;
610
- z_const unsigned char FAR *next; /* next input */
594
+ unsigned char FAR *next; /* next input */
611
595
  unsigned char FAR *put; /* next output */
612
596
  unsigned have, left; /* available input and output */
613
597
  unsigned long hold; /* bit buffer */
@@ -813,7 +797,7 @@ int flush;
813
797
  #endif
814
798
  case DICTID:
815
799
  NEEDBITS(32);
816
- strm->adler = state->check = ZSWAP32(hold);
800
+ strm->adler = state->check = REVERSE(hold);
817
801
  INITBITS();
818
802
  state->mode = DICT;
819
803
  case DICT:
@@ -921,7 +905,7 @@ int flush;
921
905
  while (state->have < 19)
922
906
  state->lens[order[state->have++]] = 0;
923
907
  state->next = state->codes;
924
- state->lencode = (const code FAR *)(state->next);
908
+ state->lencode = (code const FAR *)(state->next);
925
909
  state->lenbits = 7;
926
910
  ret = inflate_table(CODES, state->lens, 19, &(state->next),
927
911
  &(state->lenbits), state->work);
@@ -941,6 +925,7 @@ int flush;
941
925
  PULLBYTE();
942
926
  }
943
927
  if (here.val < 16) {
928
+ NEEDBITS(here.bits);
944
929
  DROPBITS(here.bits);
945
930
  state->lens[state->have++] = here.val;
946
931
  }
@@ -995,7 +980,7 @@ int flush;
995
980
  values here (9 and 6) without reading the comments in inftrees.h
996
981
  concerning the ENOUGH constants, which depend on those values */
997
982
  state->next = state->codes;
998
- state->lencode = (const code FAR *)(state->next);
983
+ state->lencode = (code const FAR *)(state->next);
999
984
  state->lenbits = 9;
1000
985
  ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
1001
986
  &(state->lenbits), state->work);
@@ -1004,7 +989,7 @@ int flush;
1004
989
  state->mode = BAD;
1005
990
  break;
1006
991
  }
1007
- state->distcode = (const code FAR *)(state->next);
992
+ state->distcode = (code const FAR *)(state->next);
1008
993
  state->distbits = 6;
1009
994
  ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
1010
995
  &(state->next), &(state->distbits), state->work);
@@ -1185,7 +1170,7 @@ int flush;
1185
1170
  #ifdef GUNZIP
1186
1171
  state->flags ? hold :
1187
1172
  #endif
1188
- ZSWAP32(hold)) != state->check) {
1173
+ REVERSE(hold)) != state->check) {
1189
1174
  strm->msg = (char *)"incorrect data check";
1190
1175
  state->mode = BAD;
1191
1176
  break;
@@ -1229,9 +1214,8 @@ int flush;
1229
1214
  */
1230
1215
  inf_leave:
1231
1216
  RESTORE();
1232
- if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
1233
- (state->mode < CHECK || flush != Z_FINISH)))
1234
- if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
1217
+ if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
1218
+ if (updatewindow(strm, out)) {
1235
1219
  state->mode = MEM;
1236
1220
  return Z_MEM_ERROR;
1237
1221
  }
@@ -1265,37 +1249,13 @@ z_streamp strm;
1265
1249
  return Z_OK;
1266
1250
  }
1267
1251
 
1268
- int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
1269
- z_streamp strm;
1270
- Bytef *dictionary;
1271
- uInt *dictLength;
1272
- {
1273
- struct inflate_state FAR *state;
1274
-
1275
- /* check state */
1276
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
1277
- state = (struct inflate_state FAR *)strm->state;
1278
-
1279
- /* copy dictionary */
1280
- if (state->whave && dictionary != Z_NULL) {
1281
- zmemcpy(dictionary, state->window + state->wnext,
1282
- state->whave - state->wnext);
1283
- zmemcpy(dictionary + state->whave - state->wnext,
1284
- state->window, state->wnext);
1285
- }
1286
- if (dictLength != Z_NULL)
1287
- *dictLength = state->whave;
1288
- return Z_OK;
1289
- }
1290
-
1291
1252
  int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
1292
1253
  z_streamp strm;
1293
1254
  const Bytef *dictionary;
1294
1255
  uInt dictLength;
1295
1256
  {
1296
1257
  struct inflate_state FAR *state;
1297
- unsigned long dictid;
1298
- int ret;
1258
+ unsigned long id;
1299
1259
 
1300
1260
  /* check state */
1301
1261
  if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
@@ -1303,21 +1263,29 @@ uInt dictLength;
1303
1263
  if (state->wrap != 0 && state->mode != DICT)
1304
1264
  return Z_STREAM_ERROR;
1305
1265
 
1306
- /* check for correct dictionary identifier */
1266
+ /* check for correct dictionary id */
1307
1267
  if (state->mode == DICT) {
1308
- dictid = adler32(0L, Z_NULL, 0);
1309
- dictid = adler32(dictid, dictionary, dictLength);
1310
- if (dictid != state->check)
1268
+ id = adler32(0L, Z_NULL, 0);
1269
+ id = adler32(id, dictionary, dictLength);
1270
+ if (id != state->check)
1311
1271
  return Z_DATA_ERROR;
1312
1272
  }
1313
1273
 
1314
- /* copy dictionary to window using updatewindow(), which will amend the
1315
- existing dictionary if appropriate */
1316
- ret = updatewindow(strm, dictionary + dictLength, dictLength);
1317
- if (ret) {
1274
+ /* copy dictionary to window */
1275
+ if (updatewindow(strm, strm->avail_out)) {
1318
1276
  state->mode = MEM;
1319
1277
  return Z_MEM_ERROR;
1320
1278
  }
1279
+ if (dictLength > state->wsize) {
1280
+ zmemcpy(state->window, dictionary + dictLength - state->wsize,
1281
+ state->wsize);
1282
+ state->whave = state->wsize;
1283
+ }
1284
+ else {
1285
+ zmemcpy(state->window + state->wsize - dictLength, dictionary,
1286
+ dictLength);
1287
+ state->whave = dictLength;
1288
+ }
1321
1289
  state->havedict = 1;
1322
1290
  Tracev((stderr, "inflate: dictionary set\n"));
1323
1291
  return Z_OK;
@@ -1353,7 +1321,7 @@ gz_headerp head;
1353
1321
  */
1354
1322
  local unsigned syncsearch(have, buf, len)
1355
1323
  unsigned FAR *have;
1356
- const unsigned char FAR *buf;
1324
+ unsigned char FAR *buf;
1357
1325
  unsigned len;
1358
1326
  {
1359
1327
  unsigned got;
@@ -1465,8 +1433,8 @@ z_streamp source;
1465
1433
  }
1466
1434
 
1467
1435
  /* copy state */
1468
- zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
1469
- zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
1436
+ zmemcpy(dest, source, sizeof(z_stream));
1437
+ zmemcpy(copy, state, sizeof(struct inflate_state));
1470
1438
  if (state->lencode >= state->codes &&
1471
1439
  state->lencode <= state->codes + ENOUGH - 1) {
1472
1440
  copy->lencode = copy->codes + (state->lencode - state->codes);
@@ -1,5 +1,5 @@
1
1
  /* inftrees.c -- generate Huffman trees for efficient decoding
2
- * Copyright (C) 1995-2013 Mark Adler
2
+ * Copyright (C) 1995-2010 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -9,7 +9,7 @@
9
9
  #define MAXBITS 15
10
10
 
11
11
  const char inflate_copyright[] =
12
- " inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
12
+ " inflate 1.2.5 Copyright 1995-2010 Mark Adler ";
13
13
  /*
14
14
  If you use the zlib library in a product, an acknowledgment is welcome
15
15
  in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
62
62
  35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
63
63
  static const unsigned short lext[31] = { /* Length codes 257..285 extra */
64
64
  16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
65
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78};
65
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};
66
66
  static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
67
67
  1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
68
68
  257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
@@ -208,8 +208,8 @@ unsigned short FAR *work;
208
208
  mask = used - 1; /* mask for comparing low */
209
209
 
210
210
  /* check available table space */
211
- if ((type == LENS && used > ENOUGH_LENS) ||
212
- (type == DISTS && used > ENOUGH_DISTS))
211
+ if ((type == LENS && used >= ENOUGH_LENS) ||
212
+ (type == DISTS && used >= ENOUGH_DISTS))
213
213
  return 1;
214
214
 
215
215
  /* process all codes and make table entries */
@@ -277,8 +277,8 @@ unsigned short FAR *work;
277
277
 
278
278
  /* check for enough space */
279
279
  used += 1U << curr;
280
- if ((type == LENS && used > ENOUGH_LENS) ||
281
- (type == DISTS && used > ENOUGH_DISTS))
280
+ if ((type == LENS && used >= ENOUGH_LENS) ||
281
+ (type == DISTS && used >= ENOUGH_DISTS))
282
282
  return 1;
283
283
 
284
284
  /* point entry in root table to sub-table */
@@ -289,14 +289,38 @@ unsigned short FAR *work;
289
289
  }
290
290
  }
291
291
 
292
- /* fill in remaining table entry if code is incomplete (guaranteed to have
293
- at most one remaining entry, since if the code is incomplete, the
294
- maximum code length that was allowed to get this far is one bit) */
295
- if (huff != 0) {
296
- here.op = (unsigned char)64; /* invalid code marker */
297
- here.bits = (unsigned char)(len - drop);
298
- here.val = (unsigned short)0;
299
- next[huff] = here;
292
+ /*
293
+ Fill in rest of table for incomplete codes. This loop is similar to the
294
+ loop above in incrementing huff for table indices. It is assumed that
295
+ len is equal to curr + drop, so there is no loop needed to increment
296
+ through high index bits. When the current sub-table is filled, the loop
297
+ drops back to the root table to fill in any remaining entries there.
298
+ */
299
+ here.op = (unsigned char)64; /* invalid code marker */
300
+ here.bits = (unsigned char)(len - drop);
301
+ here.val = (unsigned short)0;
302
+ while (huff != 0) {
303
+ /* when done with sub-table, drop back to root table */
304
+ if (drop != 0 && (huff & mask) != low) {
305
+ drop = 0;
306
+ len = root;
307
+ next = *table;
308
+ here.bits = (unsigned char)len;
309
+ }
310
+
311
+ /* put invalid code marker in table */
312
+ next[huff >> drop] = here;
313
+
314
+ /* backwards increment the len-bit code huff */
315
+ incr = 1U << (len - 1);
316
+ while (huff & incr)
317
+ incr >>= 1;
318
+ if (incr != 0) {
319
+ huff &= incr - 1;
320
+ huff += incr;
321
+ }
322
+ else
323
+ huff = 0;
300
324
  }
301
325
 
302
326
  /* set return parameters */