diff options
author | Noel Gordon <noel@chromium.org> | 2018-02-10 01:41:35 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2018-02-10 01:41:35 +0000 |
commit | 1d8aa692dcf4b2ca21f53bc5ece8e8fd42a72226 (patch) | |
tree | f405662a21e93f1e591bf0bbb6c127d9e8bf5a44 /patches | |
parent | d50bf77b88f79bd66ca3bd831a65468dd7b76b71 (diff) | |
download | zlib-1d8aa692dcf4b2ca21f53bc5ece8e8fd42a72226.tar.gz |
Remove zlib/patches/0003-use-defines-for-inffast.patch
Patch files are no longer needed per the README.chromium guidelines.
Bug: 764431
Change-Id: I7cbfb9e51f74a7499697e6ff541bb02e30572c5b
Reviewed-on: https://chromium-review.googlesource.com/910870
Reviewed-by: Chris Blume <cblume@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#535919}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: f53ef9e9a51e6b4d16e50ff6533d3761cacb868e
Diffstat (limited to 'patches')
-rw-r--r-- | patches/0003-use-defines-for-inffast.patch | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/patches/0003-use-defines-for-inffast.patch b/patches/0003-use-defines-for-inffast.patch deleted file mode 100644 index 9413934..0000000 --- a/patches/0003-use-defines-for-inffast.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 8626f3ea324e1e6f15229722761617063a70b96b Mon Sep 17 00:00:00 2001 -From: Chris Blume <cblume@google.com> -Date: Tue, 12 Sep 2017 11:17:55 -0700 -Subject: [PATCH 1/1] Zlib: Use defines for inffast - -Zlib's inffast uses a handful of magic numbers. It would be easier to -read and maintain if these magic numbers were instead #defines. - -NigelTao@ wrote this code to clean up the magic numbers in -https://chromium-review.googlesource.com/c/chromium/src/+/601694 - -Nigel gave me permission to make a separate pull request to separate out -just the magic number cleaning. - -BUG=764431 ---- - third_party/zlib/infback.c | 3 ++- - third_party/zlib/inffast.c | 15 +++++++++------ - third_party/zlib/inffast.h | 15 +++++++++++++++ - third_party/zlib/inflate.c | 3 ++- - 4 files changed, 28 insertions(+), 8 deletions(-) - -diff --git a/third_party/zlib/infback.c b/third_party/zlib/infback.c -index 59679ecbfc5d..b93ef478e957 100644 ---- a/third_party/zlib/infback.c -+++ b/third_party/zlib/infback.c -@@ -480,7 +480,8 @@ void FAR *out_desc; - - case LEN: - /* use inflate_fast() if we have enough input and output */ -- if (have >= 6 && left >= 258) { -+ if (have >= INFLATE_FAST_MIN_HAVE && -+ left >= INFLATE_FAST_MIN_LEFT) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; -diff --git a/third_party/zlib/inffast.c b/third_party/zlib/inffast.c -index 0dbd1dbc09f2..66c0d02494a9 100644 ---- a/third_party/zlib/inffast.c -+++ b/third_party/zlib/inffast.c -@@ -23,8 +23,8 @@ - Entry assumptions: - - state->mode == LEN -- strm->avail_in >= 6 -- strm->avail_out >= 258 -+ strm->avail_in >= INFLATE_FAST_MIN_HAVE -+ strm->avail_out >= INFLATE_FAST_MIN_LEFT - start >= strm->avail_out - state->bits < 8 - -@@ -80,10 +80,10 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - in = strm->next_in; -- last = in + (strm->avail_in - 5); -+ last = in + (strm->avail_in - (INFLATE_FAST_MIN_HAVE - 1)); - out = strm->next_out; - beg = out - (start - strm->avail_out); -- end = out + (strm->avail_out - 257); -+ end = out + (strm->avail_out - (INFLATE_FAST_MIN_LEFT - 1)); - #ifdef INFLATE_STRICT - dmax = state->dmax; - #endif -@@ -298,9 +298,12 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ - /* update state and return */ - strm->next_in = in; - strm->next_out = out; -- strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); -+ strm->avail_in = (unsigned)(in < last ? -+ (INFLATE_FAST_MIN_HAVE - 1) + (last - in) : -+ (INFLATE_FAST_MIN_HAVE - 1) - (in - last)); - strm->avail_out = (unsigned)(out < end ? -- 257 + (end - out) : 257 - (out - end)); -+ (INFLATE_FAST_MIN_LEFT - 1) + (end - out) : -+ (INFLATE_FAST_MIN_LEFT - 1) - (out - end)); - state->hold = hold; - state->bits = bits; - return; -diff --git a/third_party/zlib/inffast.h b/third_party/zlib/inffast.h -index e5c1aa4ca8cd..dda6bc82cc3b 100644 ---- a/third_party/zlib/inffast.h -+++ b/third_party/zlib/inffast.h -@@ -8,4 +8,19 @@ - subject to change. Applications should only use zlib.h. - */ - -+ -+/* INFLATE_FAST_MIN_LEFT is the minimum number of output bytes that are left, -+ so that we can call inflate_fast safely with only one up front bounds check. -+ One length-distance code pair can copy up to 258 bytes. -+ */ -+#define INFLATE_FAST_MIN_LEFT 258 -+ -+/* INFLATE_FAST_MIN_HAVE is the minimum number of input bytes that we have, so -+ that we can call inflate_fast safely with only one up front bounds check. -+ One length-distance code pair (as two Huffman encoded values of up to 15 -+ bits each) plus any additional bits (up to 5 for length and 13 for distance) -+ can require reading up to 48 bits, or 6 bytes. -+ */ -+#define INFLATE_FAST_MIN_HAVE 6 -+ - void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); -diff --git a/third_party/zlib/inflate.c b/third_party/zlib/inflate.c -index cc38b983485b..257b9a982668 100644 ---- a/third_party/zlib/inflate.c -+++ b/third_party/zlib/inflate.c -@@ -1044,7 +1044,8 @@ int flush; - case LEN_: - state->mode = LEN; - case LEN: -- if (have >= 6 && left >= 258) { -+ if (have >= INFLATE_FAST_MIN_HAVE && -+ left >= INFLATE_FAST_MIN_LEFT) { - RESTORE(); - inflate_fast(strm, out); - LOAD(); --- -2.14.1.581.gf28d330327-goog - |