rugged 0.21.1b2 → 0.21.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -12
- data/ext/rugged/extconf.rb +8 -8
- data/ext/rugged/rugged.h +1 -1
- data/ext/rugged/rugged_blob.c +0 -57
- data/ext/rugged/rugged_cred.c +0 -23
- data/ext/rugged/rugged_index.c +2 -6
- data/ext/rugged/rugged_remote.c +1 -69
- data/ext/rugged/rugged_repo.c +5 -287
- data/ext/rugged/rugged_tag_collection.c +2 -70
- data/ext/rugged/rugged_tree.c +10 -29
- data/lib/rugged.rb +0 -2
- data/lib/rugged/diff.rb +1 -0
- data/lib/rugged/diff/line.rb +3 -1
- data/lib/rugged/patch.rb +2 -12
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +0 -11
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -2
- data/vendor/libgit2/deps/zlib/adler32.c +29 -39
- data/vendor/libgit2/deps/zlib/crc32.c +50 -33
- data/vendor/libgit2/deps/zlib/crc32.h +1 -1
- data/vendor/libgit2/deps/zlib/deflate.c +65 -198
- data/vendor/libgit2/deps/zlib/deflate.h +4 -8
- data/vendor/libgit2/deps/zlib/inffast.c +3 -3
- data/vendor/libgit2/deps/zlib/inffixed.h +3 -3
- data/vendor/libgit2/deps/zlib/inflate.c +52 -84
- data/vendor/libgit2/deps/zlib/inftrees.c +39 -15
- data/vendor/libgit2/deps/zlib/trees.c +36 -18
- data/vendor/libgit2/deps/zlib/zconf.h +0 -4
- data/vendor/libgit2/deps/zlib/zlib.h +95 -250
- data/vendor/libgit2/deps/zlib/zutil.c +10 -13
- data/vendor/libgit2/deps/zlib/zutil.h +62 -41
- data/vendor/libgit2/include/git2/attr.h +13 -16
- data/vendor/libgit2/include/git2/buffer.h +0 -16
- data/vendor/libgit2/include/git2/checkout.h +12 -12
- data/vendor/libgit2/include/git2/cherrypick.h +15 -15
- data/vendor/libgit2/include/git2/clone.h +69 -77
- data/vendor/libgit2/include/git2/diff.h +0 -7
- data/vendor/libgit2/include/git2/errors.h +0 -2
- data/vendor/libgit2/include/git2/merge.h +0 -16
- data/vendor/libgit2/include/git2/oid.h +4 -8
- data/vendor/libgit2/include/git2/remote.h +32 -13
- data/vendor/libgit2/include/git2/repository.h +1 -4
- data/vendor/libgit2/include/git2/reset.h +0 -4
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/status.h +14 -17
- data/vendor/libgit2/include/git2/submodule.h +0 -18
- data/vendor/libgit2/include/git2/sys/repository.h +0 -13
- data/vendor/libgit2/include/git2/transport.h +313 -79
- data/vendor/libgit2/include/git2/tree.h +2 -4
- data/vendor/libgit2/include/git2/types.h +6 -54
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/attr.c +4 -8
- data/vendor/libgit2/src/attr_file.c +1 -14
- data/vendor/libgit2/src/blame.c +1 -0
- data/vendor/libgit2/src/buf_text.c +5 -9
- data/vendor/libgit2/src/buf_text.h +2 -3
- data/vendor/libgit2/src/buffer.c +10 -67
- data/vendor/libgit2/src/buffer.h +2 -4
- data/vendor/libgit2/src/cache.c +9 -9
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/checkout.c +44 -121
- data/vendor/libgit2/src/cherrypick.c +44 -41
- data/vendor/libgit2/src/clone.c +56 -94
- data/vendor/libgit2/src/config_file.c +7 -2
- data/vendor/libgit2/src/crlf.c +1 -2
- data/vendor/libgit2/src/diff.c +0 -21
- data/vendor/libgit2/src/diff_file.c +0 -1
- data/vendor/libgit2/src/diff_print.c +9 -11
- data/vendor/libgit2/src/diff_tform.c +2 -4
- data/vendor/libgit2/src/errors.c +7 -9
- data/vendor/libgit2/src/filebuf.c +2 -0
- data/vendor/libgit2/src/fileops.c +7 -9
- data/vendor/libgit2/src/filter.c +11 -2
- data/vendor/libgit2/src/global.c +20 -3
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/graph.c +2 -2
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/{include/git2/sys → src}/hashsig.h +7 -11
- data/vendor/libgit2/src/ignore.c +2 -2
- data/vendor/libgit2/src/indexer.c +1 -13
- data/vendor/libgit2/src/merge.c +145 -99
- data/vendor/libgit2/src/merge.h +1 -1
- data/vendor/libgit2/src/mwindow.c +8 -117
- data/vendor/libgit2/src/mwindow.h +1 -9
- data/vendor/libgit2/src/netops.c +7 -6
- data/vendor/libgit2/src/netops.h +4 -0
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +3 -6
- data/vendor/libgit2/src/oid.c +0 -8
- data/vendor/libgit2/src/oid.h +0 -11
- data/vendor/libgit2/src/pack.c +6 -20
- data/vendor/libgit2/src/pack.h +0 -3
- data/vendor/libgit2/src/path.c +64 -134
- data/vendor/libgit2/src/path.h +1 -22
- data/vendor/libgit2/src/posix.h +28 -46
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +2 -14
- data/vendor/libgit2/src/remote.c +26 -29
- data/vendor/libgit2/src/remote.h +1 -3
- data/vendor/libgit2/src/repository.c +14 -54
- data/vendor/libgit2/src/revert.c +6 -4
- data/vendor/libgit2/src/revparse.c +18 -15
- data/vendor/libgit2/src/signature.c +2 -2
- data/vendor/libgit2/src/stash.c +1 -2
- data/vendor/libgit2/src/status.c +2 -11
- data/vendor/libgit2/src/strnlen.h +1 -2
- data/vendor/libgit2/src/submodule.c +33 -73
- data/vendor/libgit2/src/tag.c +3 -2
- data/vendor/libgit2/src/thread-utils.h +7 -0
- data/vendor/libgit2/src/trace.h +1 -9
- data/vendor/libgit2/src/transport.c +90 -93
- data/vendor/libgit2/src/transports/cred.c +0 -58
- data/vendor/libgit2/src/transports/cred_helpers.c +0 -3
- data/vendor/libgit2/src/transports/git.c +0 -1
- data/vendor/libgit2/src/transports/http.c +82 -205
- data/vendor/libgit2/src/transports/smart.c +0 -2
- data/vendor/libgit2/src/transports/smart.h +0 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +5 -7
- data/vendor/libgit2/src/transports/ssh.c +35 -224
- data/vendor/libgit2/src/transports/winhttp.c +34 -140
- data/vendor/libgit2/src/tree.c +60 -64
- data/vendor/libgit2/src/tree.h +3 -2
- data/vendor/libgit2/src/unix/posix.h +9 -23
- data/vendor/libgit2/src/unix/realpath.c +7 -8
- data/vendor/libgit2/src/util.c +1 -2
- data/vendor/libgit2/src/util.h +3 -3
- data/vendor/libgit2/src/win32/mingw-compat.h +12 -5
- data/vendor/libgit2/src/win32/msvc-compat.h +32 -3
- data/vendor/libgit2/src/win32/posix.h +31 -20
- data/vendor/libgit2/src/win32/posix_w32.c +18 -62
- metadata +5 -18
- data/lib/rugged/attributes.rb +0 -41
- data/lib/rugged/blob.rb +0 -28
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +0 -324
- data/vendor/libgit2/deps/zlib/infback.c +0 -640
- data/vendor/libgit2/include/git2/oidarray.h +0 -40
- data/vendor/libgit2/include/git2/sys/transport.h +0 -352
- data/vendor/libgit2/src/oidarray.c +0 -21
- data/vendor/libgit2/src/oidarray.h +0 -18
- data/vendor/libgit2/src/transports/auth.c +0 -71
- data/vendor/libgit2/src/transports/auth.h +0 -63
- data/vendor/libgit2/src/transports/auth_negotiate.c +0 -275
- data/vendor/libgit2/src/transports/auth_negotiate.h +0 -27
- data/vendor/libgit2/src/transports/cred.h +0 -14
@@ -1,5 +1,5 @@
|
|
1
1
|
/* deflate.c -- compress data using the deflation algorithm
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -37,7 +37,7 @@
|
|
37
37
|
* REFERENCES
|
38
38
|
*
|
39
39
|
* Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
|
40
|
-
* Available in http://
|
40
|
+
* Available in http://www.ietf.org/rfc/rfc1951.txt
|
41
41
|
*
|
42
42
|
* A description of the Rabin and Karp algorithm is given in the book
|
43
43
|
* "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
|
@@ -52,7 +52,7 @@
|
|
52
52
|
#include "deflate.h"
|
53
53
|
|
54
54
|
const char deflate_copyright[] =
|
55
|
-
" deflate 1.2.
|
55
|
+
" deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
|
56
56
|
/*
|
57
57
|
If you use the zlib library in a product, an acknowledgment is welcome
|
58
58
|
in the documentation of your product. If for some reason you cannot
|
@@ -155,9 +155,6 @@ local const config configuration_table[10] = {
|
|
155
155
|
struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
|
156
156
|
#endif
|
157
157
|
|
158
|
-
/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
|
159
|
-
#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0))
|
160
|
-
|
161
158
|
/* ===========================================================================
|
162
159
|
* Update a hash value with the given input byte
|
163
160
|
* IN assertion: all calls to to UPDATE_HASH are made with consecutive
|
@@ -238,19 +235,10 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
238
235
|
|
239
236
|
strm->msg = Z_NULL;
|
240
237
|
if (strm->zalloc == (alloc_func)0) {
|
241
|
-
#ifdef Z_SOLO
|
242
|
-
return Z_STREAM_ERROR;
|
243
|
-
#else
|
244
238
|
strm->zalloc = zcalloc;
|
245
239
|
strm->opaque = (voidpf)0;
|
246
|
-
#endif
|
247
240
|
}
|
248
|
-
if (strm->zfree == (free_func)0)
|
249
|
-
#ifdef Z_SOLO
|
250
|
-
return Z_STREAM_ERROR;
|
251
|
-
#else
|
252
|
-
strm->zfree = zcfree;
|
253
|
-
#endif
|
241
|
+
if (strm->zfree == (free_func)0) strm->zfree = zcfree;
|
254
242
|
|
255
243
|
#ifdef FASTEST
|
256
244
|
if (level != 0) level = 1;
|
@@ -305,7 +293,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
305
293
|
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
306
294
|
s->pending_buf == Z_NULL) {
|
307
295
|
s->status = FINISH_STATE;
|
308
|
-
strm->msg = ERR_MSG(Z_MEM_ERROR);
|
296
|
+
strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
|
309
297
|
deflateEnd (strm);
|
310
298
|
return Z_MEM_ERROR;
|
311
299
|
}
|
@@ -326,70 +314,43 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
|
|
326
314
|
uInt dictLength;
|
327
315
|
{
|
328
316
|
deflate_state *s;
|
329
|
-
uInt
|
330
|
-
|
331
|
-
|
332
|
-
z_const unsigned char *next;
|
317
|
+
uInt length = dictLength;
|
318
|
+
uInt n;
|
319
|
+
IPos hash_head = 0;
|
333
320
|
|
334
|
-
if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL
|
335
|
-
|
336
|
-
|
337
|
-
wrap = s->wrap;
|
338
|
-
if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
|
321
|
+
if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
|
322
|
+
strm->state->wrap == 2 ||
|
323
|
+
(strm->state->wrap == 1 && strm->state->status != INIT_STATE))
|
339
324
|
return Z_STREAM_ERROR;
|
340
325
|
|
341
|
-
|
342
|
-
if (wrap
|
326
|
+
s = strm->state;
|
327
|
+
if (s->wrap)
|
343
328
|
strm->adler = adler32(strm->adler, dictionary, dictLength);
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
CLEAR_HASH(s);
|
350
|
-
s->strstart = 0;
|
351
|
-
s->block_start = 0L;
|
352
|
-
s->insert = 0;
|
353
|
-
}
|
354
|
-
dictionary += dictLength - s->w_size; /* use the tail */
|
355
|
-
dictLength = s->w_size;
|
329
|
+
|
330
|
+
if (length < MIN_MATCH) return Z_OK;
|
331
|
+
if (length > s->w_size) {
|
332
|
+
length = s->w_size;
|
333
|
+
dictionary += dictLength - length; /* use the tail of the dictionary */
|
356
334
|
}
|
335
|
+
zmemcpy(s->window, dictionary, length);
|
336
|
+
s->strstart = length;
|
337
|
+
s->block_start = (long)length;
|
357
338
|
|
358
|
-
/*
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
n = s->lookahead - (MIN_MATCH-1);
|
367
|
-
do {
|
368
|
-
UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
|
369
|
-
#ifndef FASTEST
|
370
|
-
s->prev[str & s->w_mask] = s->head[s->ins_h];
|
371
|
-
#endif
|
372
|
-
s->head[s->ins_h] = (Pos)str;
|
373
|
-
str++;
|
374
|
-
} while (--n);
|
375
|
-
s->strstart = str;
|
376
|
-
s->lookahead = MIN_MATCH-1;
|
377
|
-
fill_window(s);
|
339
|
+
/* Insert all strings in the hash table (except for the last two bytes).
|
340
|
+
* s->lookahead stays null, so s->ins_h will be recomputed at the next
|
341
|
+
* call of fill_window.
|
342
|
+
*/
|
343
|
+
s->ins_h = s->window[0];
|
344
|
+
UPDATE_HASH(s, s->ins_h, s->window[1]);
|
345
|
+
for (n = 0; n <= length - MIN_MATCH; n++) {
|
346
|
+
INSERT_STRING(s, n, hash_head);
|
378
347
|
}
|
379
|
-
|
380
|
-
s->block_start = (long)s->strstart;
|
381
|
-
s->insert = s->lookahead;
|
382
|
-
s->lookahead = 0;
|
383
|
-
s->match_length = s->prev_length = MIN_MATCH-1;
|
384
|
-
s->match_available = 0;
|
385
|
-
strm->next_in = next;
|
386
|
-
strm->avail_in = avail;
|
387
|
-
s->wrap = wrap;
|
348
|
+
if (hash_head) hash_head = 0; /* to make compiler happy */
|
388
349
|
return Z_OK;
|
389
350
|
}
|
390
351
|
|
391
352
|
/* ========================================================================= */
|
392
|
-
int ZEXPORT
|
353
|
+
int ZEXPORT deflateReset (strm)
|
393
354
|
z_streamp strm;
|
394
355
|
{
|
395
356
|
deflate_state *s;
|
@@ -419,22 +380,11 @@ int ZEXPORT deflateResetKeep (strm)
|
|
419
380
|
s->last_flush = Z_NO_FLUSH;
|
420
381
|
|
421
382
|
_tr_init(s);
|
383
|
+
lm_init(s);
|
422
384
|
|
423
385
|
return Z_OK;
|
424
386
|
}
|
425
387
|
|
426
|
-
/* ========================================================================= */
|
427
|
-
int ZEXPORT deflateReset (strm)
|
428
|
-
z_streamp strm;
|
429
|
-
{
|
430
|
-
int ret;
|
431
|
-
|
432
|
-
ret = deflateResetKeep(strm);
|
433
|
-
if (ret == Z_OK)
|
434
|
-
lm_init(strm->state);
|
435
|
-
return ret;
|
436
|
-
}
|
437
|
-
|
438
388
|
/* ========================================================================= */
|
439
389
|
int ZEXPORT deflateSetHeader (strm, head)
|
440
390
|
z_streamp strm;
|
@@ -446,43 +396,15 @@ int ZEXPORT deflateSetHeader (strm, head)
|
|
446
396
|
return Z_OK;
|
447
397
|
}
|
448
398
|
|
449
|
-
/* ========================================================================= */
|
450
|
-
int ZEXPORT deflatePending (strm, pending, bits)
|
451
|
-
unsigned *pending;
|
452
|
-
int *bits;
|
453
|
-
z_streamp strm;
|
454
|
-
{
|
455
|
-
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
456
|
-
if (pending != Z_NULL)
|
457
|
-
*pending = strm->state->pending;
|
458
|
-
if (bits != Z_NULL)
|
459
|
-
*bits = strm->state->bi_valid;
|
460
|
-
return Z_OK;
|
461
|
-
}
|
462
|
-
|
463
399
|
/* ========================================================================= */
|
464
400
|
int ZEXPORT deflatePrime (strm, bits, value)
|
465
401
|
z_streamp strm;
|
466
402
|
int bits;
|
467
403
|
int value;
|
468
404
|
{
|
469
|
-
deflate_state *s;
|
470
|
-
int put;
|
471
|
-
|
472
405
|
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
473
|
-
|
474
|
-
|
475
|
-
return Z_BUF_ERROR;
|
476
|
-
do {
|
477
|
-
put = Buf_size - s->bi_valid;
|
478
|
-
if (put > bits)
|
479
|
-
put = bits;
|
480
|
-
s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
|
481
|
-
s->bi_valid += put;
|
482
|
-
_tr_flush_bits(s);
|
483
|
-
value >>= put;
|
484
|
-
bits -= put;
|
485
|
-
} while (bits);
|
406
|
+
strm->state->bi_valid = bits;
|
407
|
+
strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
|
486
408
|
return Z_OK;
|
487
409
|
}
|
488
410
|
|
@@ -513,8 +435,6 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
|
513
435
|
strm->total_in != 0) {
|
514
436
|
/* Flush the last buffer: */
|
515
437
|
err = deflate(strm, Z_BLOCK);
|
516
|
-
if (err == Z_BUF_ERROR && s->pending == 0)
|
517
|
-
err = Z_OK;
|
518
438
|
}
|
519
439
|
if (s->level != level) {
|
520
440
|
s->level = level;
|
@@ -642,22 +562,19 @@ local void putShortMSB (s, b)
|
|
642
562
|
local void flush_pending(strm)
|
643
563
|
z_streamp strm;
|
644
564
|
{
|
645
|
-
unsigned len;
|
646
|
-
deflate_state *s = strm->state;
|
565
|
+
unsigned len = strm->state->pending;
|
647
566
|
|
648
|
-
_tr_flush_bits(s);
|
649
|
-
len = s->pending;
|
650
567
|
if (len > strm->avail_out) len = strm->avail_out;
|
651
568
|
if (len == 0) return;
|
652
569
|
|
653
|
-
zmemcpy(strm->next_out,
|
570
|
+
zmemcpy(strm->next_out, strm->state->pending_out, len);
|
654
571
|
strm->next_out += len;
|
655
|
-
|
572
|
+
strm->state->pending_out += len;
|
656
573
|
strm->total_out += len;
|
657
574
|
strm->avail_out -= len;
|
658
|
-
|
659
|
-
if (
|
660
|
-
|
575
|
+
strm->state->pending -= len;
|
576
|
+
if (strm->state->pending == 0) {
|
577
|
+
strm->state->pending_out = strm->state->pending_buf;
|
661
578
|
}
|
662
579
|
}
|
663
580
|
|
@@ -884,7 +801,7 @@ int ZEXPORT deflate (strm, flush)
|
|
884
801
|
* flushes. For repeated and useless calls with Z_FINISH, we keep
|
885
802
|
* returning Z_STREAM_END instead of Z_BUF_ERROR.
|
886
803
|
*/
|
887
|
-
} else if (strm->avail_in == 0 &&
|
804
|
+
} else if (strm->avail_in == 0 && flush <= old_flush &&
|
888
805
|
flush != Z_FINISH) {
|
889
806
|
ERR_RETURN(strm, Z_BUF_ERROR);
|
890
807
|
}
|
@@ -933,7 +850,6 @@ int ZEXPORT deflate (strm, flush)
|
|
933
850
|
if (s->lookahead == 0) {
|
934
851
|
s->strstart = 0;
|
935
852
|
s->block_start = 0L;
|
936
|
-
s->insert = 0;
|
937
853
|
}
|
938
854
|
}
|
939
855
|
}
|
@@ -1029,12 +945,12 @@ int ZEXPORT deflateCopy (dest, source)
|
|
1029
945
|
|
1030
946
|
ss = source->state;
|
1031
947
|
|
1032
|
-
zmemcpy(
|
948
|
+
zmemcpy(dest, source, sizeof(z_stream));
|
1033
949
|
|
1034
950
|
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
|
1035
951
|
if (ds == Z_NULL) return Z_MEM_ERROR;
|
1036
952
|
dest->state = (struct internal_state FAR *) ds;
|
1037
|
-
zmemcpy(
|
953
|
+
zmemcpy(ds, ss, sizeof(deflate_state));
|
1038
954
|
ds->strm = dest;
|
1039
955
|
|
1040
956
|
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
|
@@ -1050,8 +966,8 @@ int ZEXPORT deflateCopy (dest, source)
|
|
1050
966
|
}
|
1051
967
|
/* following zmemcpy do not work for 16-bit MSDOS */
|
1052
968
|
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
|
1053
|
-
zmemcpy(
|
1054
|
-
zmemcpy(
|
969
|
+
zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
|
970
|
+
zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
|
1055
971
|
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
|
1056
972
|
|
1057
973
|
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
@@ -1085,15 +1001,15 @@ local int read_buf(strm, buf, size)
|
|
1085
1001
|
|
1086
1002
|
strm->avail_in -= len;
|
1087
1003
|
|
1088
|
-
zmemcpy(buf, strm->next_in, len);
|
1089
1004
|
if (strm->state->wrap == 1) {
|
1090
|
-
strm->adler = adler32(strm->adler,
|
1005
|
+
strm->adler = adler32(strm->adler, strm->next_in, len);
|
1091
1006
|
}
|
1092
1007
|
#ifdef GZIP
|
1093
1008
|
else if (strm->state->wrap == 2) {
|
1094
|
-
strm->adler = crc32(strm->adler,
|
1009
|
+
strm->adler = crc32(strm->adler, strm->next_in, len);
|
1095
1010
|
}
|
1096
1011
|
#endif
|
1012
|
+
zmemcpy(buf, strm->next_in, len);
|
1097
1013
|
strm->next_in += len;
|
1098
1014
|
strm->total_in += len;
|
1099
1015
|
|
@@ -1120,7 +1036,6 @@ local void lm_init (s)
|
|
1120
1036
|
s->strstart = 0;
|
1121
1037
|
s->block_start = 0L;
|
1122
1038
|
s->lookahead = 0;
|
1123
|
-
s->insert = 0;
|
1124
1039
|
s->match_length = s->prev_length = MIN_MATCH-1;
|
1125
1040
|
s->match_available = 0;
|
1126
1041
|
s->ins_h = 0;
|
@@ -1395,8 +1310,6 @@ local void fill_window(s)
|
|
1395
1310
|
unsigned more; /* Amount of free space at the end of the window. */
|
1396
1311
|
uInt wsize = s->w_size;
|
1397
1312
|
|
1398
|
-
Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
1399
|
-
|
1400
1313
|
do {
|
1401
1314
|
more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
|
1402
1315
|
|
@@ -1449,7 +1362,7 @@ local void fill_window(s)
|
|
1449
1362
|
#endif
|
1450
1363
|
more += wsize;
|
1451
1364
|
}
|
1452
|
-
if (s->strm->avail_in == 0)
|
1365
|
+
if (s->strm->avail_in == 0) return;
|
1453
1366
|
|
1454
1367
|
/* If there was no sliding:
|
1455
1368
|
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
@@ -1468,24 +1381,12 @@ local void fill_window(s)
|
|
1468
1381
|
s->lookahead += n;
|
1469
1382
|
|
1470
1383
|
/* Initialize the hash value now that we have some input: */
|
1471
|
-
if (s->lookahead
|
1472
|
-
|
1473
|
-
s->ins_h
|
1474
|
-
UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
|
1384
|
+
if (s->lookahead >= MIN_MATCH) {
|
1385
|
+
s->ins_h = s->window[s->strstart];
|
1386
|
+
UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
|
1475
1387
|
#if MIN_MATCH != 3
|
1476
1388
|
Call UPDATE_HASH() MIN_MATCH-3 more times
|
1477
1389
|
#endif
|
1478
|
-
while (s->insert) {
|
1479
|
-
UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
|
1480
|
-
#ifndef FASTEST
|
1481
|
-
s->prev[str & s->w_mask] = s->head[s->ins_h];
|
1482
|
-
#endif
|
1483
|
-
s->head[s->ins_h] = (Pos)str;
|
1484
|
-
str++;
|
1485
|
-
s->insert--;
|
1486
|
-
if (s->lookahead + s->insert < MIN_MATCH)
|
1487
|
-
break;
|
1488
|
-
}
|
1489
1390
|
}
|
1490
1391
|
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
1491
1392
|
* but this is not important since only literal bytes will be emitted.
|
@@ -1526,9 +1427,6 @@ local void fill_window(s)
|
|
1526
1427
|
s->high_water += init;
|
1527
1428
|
}
|
1528
1429
|
}
|
1529
|
-
|
1530
|
-
Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
1531
|
-
"not enough room for search");
|
1532
1430
|
}
|
1533
1431
|
|
1534
1432
|
/* ===========================================================================
|
@@ -1608,14 +1506,8 @@ local block_state deflate_stored(s, flush)
|
|
1608
1506
|
FLUSH_BLOCK(s, 0);
|
1609
1507
|
}
|
1610
1508
|
}
|
1611
|
-
s
|
1612
|
-
|
1613
|
-
FLUSH_BLOCK(s, 1);
|
1614
|
-
return finish_done;
|
1615
|
-
}
|
1616
|
-
if ((long)s->strstart > s->block_start)
|
1617
|
-
FLUSH_BLOCK(s, 0);
|
1618
|
-
return block_done;
|
1509
|
+
FLUSH_BLOCK(s, flush == Z_FINISH);
|
1510
|
+
return flush == Z_FINISH ? finish_done : block_done;
|
1619
1511
|
}
|
1620
1512
|
|
1621
1513
|
/* ===========================================================================
|
@@ -1711,14 +1603,8 @@ local block_state deflate_fast(s, flush)
|
|
1711
1603
|
}
|
1712
1604
|
if (bflush) FLUSH_BLOCK(s, 0);
|
1713
1605
|
}
|
1714
|
-
s
|
1715
|
-
|
1716
|
-
FLUSH_BLOCK(s, 1);
|
1717
|
-
return finish_done;
|
1718
|
-
}
|
1719
|
-
if (s->last_lit)
|
1720
|
-
FLUSH_BLOCK(s, 0);
|
1721
|
-
return block_done;
|
1606
|
+
FLUSH_BLOCK(s, flush == Z_FINISH);
|
1607
|
+
return flush == Z_FINISH ? finish_done : block_done;
|
1722
1608
|
}
|
1723
1609
|
|
1724
1610
|
#ifndef FASTEST
|
@@ -1842,14 +1728,8 @@ local block_state deflate_slow(s, flush)
|
|
1842
1728
|
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
1843
1729
|
s->match_available = 0;
|
1844
1730
|
}
|
1845
|
-
s
|
1846
|
-
|
1847
|
-
FLUSH_BLOCK(s, 1);
|
1848
|
-
return finish_done;
|
1849
|
-
}
|
1850
|
-
if (s->last_lit)
|
1851
|
-
FLUSH_BLOCK(s, 0);
|
1852
|
-
return block_done;
|
1731
|
+
FLUSH_BLOCK(s, flush == Z_FINISH);
|
1732
|
+
return flush == Z_FINISH ? finish_done : block_done;
|
1853
1733
|
}
|
1854
1734
|
#endif /* FASTEST */
|
1855
1735
|
|
@@ -1869,11 +1749,11 @@ local block_state deflate_rle(s, flush)
|
|
1869
1749
|
for (;;) {
|
1870
1750
|
/* Make sure that we always have enough lookahead, except
|
1871
1751
|
* at the end of the input file. We need MAX_MATCH bytes
|
1872
|
-
* for the longest run
|
1752
|
+
* for the longest encodable run.
|
1873
1753
|
*/
|
1874
|
-
if (s->lookahead
|
1754
|
+
if (s->lookahead < MAX_MATCH) {
|
1875
1755
|
fill_window(s);
|
1876
|
-
if (s->lookahead
|
1756
|
+
if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
|
1877
1757
|
return need_more;
|
1878
1758
|
}
|
1879
1759
|
if (s->lookahead == 0) break; /* flush the current block */
|
@@ -1896,7 +1776,6 @@ local block_state deflate_rle(s, flush)
|
|
1896
1776
|
if (s->match_length > s->lookahead)
|
1897
1777
|
s->match_length = s->lookahead;
|
1898
1778
|
}
|
1899
|
-
Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
|
1900
1779
|
}
|
1901
1780
|
|
1902
1781
|
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
|
@@ -1917,14 +1796,8 @@ local block_state deflate_rle(s, flush)
|
|
1917
1796
|
}
|
1918
1797
|
if (bflush) FLUSH_BLOCK(s, 0);
|
1919
1798
|
}
|
1920
|
-
s
|
1921
|
-
|
1922
|
-
FLUSH_BLOCK(s, 1);
|
1923
|
-
return finish_done;
|
1924
|
-
}
|
1925
|
-
if (s->last_lit)
|
1926
|
-
FLUSH_BLOCK(s, 0);
|
1927
|
-
return block_done;
|
1799
|
+
FLUSH_BLOCK(s, flush == Z_FINISH);
|
1800
|
+
return flush == Z_FINISH ? finish_done : block_done;
|
1928
1801
|
}
|
1929
1802
|
|
1930
1803
|
/* ===========================================================================
|
@@ -1956,12 +1829,6 @@ local block_state deflate_huff(s, flush)
|
|
1956
1829
|
s->strstart++;
|
1957
1830
|
if (bflush) FLUSH_BLOCK(s, 0);
|
1958
1831
|
}
|
1959
|
-
s
|
1960
|
-
|
1961
|
-
FLUSH_BLOCK(s, 1);
|
1962
|
-
return finish_done;
|
1963
|
-
}
|
1964
|
-
if (s->last_lit)
|
1965
|
-
FLUSH_BLOCK(s, 0);
|
1966
|
-
return block_done;
|
1832
|
+
FLUSH_BLOCK(s, flush == Z_FINISH);
|
1833
|
+
return flush == Z_FINISH ? finish_done : block_done;
|
1967
1834
|
}
|