diff options
author | brucedawson <brucedawson@chromium.org> | 2015-10-07 11:46:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-07 18:46:59 +0000 |
commit | b474ca01fcc5376eb538f71e524351e52319d396 (patch) | |
tree | 4d056b7eaf5d1628823a30083ebfc81e9cdd6c43 | |
parent | e73c1f46bc7df7e05f8d0999e408e3ffbfaa652d (diff) | |
download | chromium_src-b474ca01fcc5376eb538f71e524351e52319d396.zip chromium_src-b474ca01fcc5376eb538f71e524351e52319d396.tar.gz chromium_src-b474ca01fcc5376eb538f71e524351e52319d396.tar.bz2 |
Fix VC++ 2015 64-bit truncation warning in zlib
VC++ 2015 64-bit builds were giving this warning:
crc_folding.c(286): warning C4311: 'type cast': pointer truncation from
'const unsigned char *' to 'unsigned long'
Converting from unsigned char* to long is normally dodgy but is safe in
this case because of the masking with 0xF. Casting through uintptr_t is
sufficient to allay VC++'s fears that we are making a mistake.
R=pkasting@chromium.org,gavinp@chromium.org
BUG=440500
Review URL: https://codereview.chromium.org/1384773002
Cr-Commit-Position: refs/heads/master@{#352900}
-rw-r--r-- | third_party/zlib/README.chromium | 1 | ||||
-rw-r--r-- | third_party/zlib/crc_folding.c | 2 | ||||
-rw-r--r-- | third_party/zlib/google.patch | 12 |
3 files changed, 14 insertions, 1 deletions
diff --git a/third_party/zlib/README.chromium b/third_party/zlib/README.chromium index b90bcff..ddb63d7 100644 --- a/third_party/zlib/README.chromium +++ b/third_party/zlib/README.chromium @@ -15,6 +15,7 @@ A few minor changes, all marked with "Google": - Added 'int z_errno' global for WinCE, to which 'errno' is defined in zutil.h. - Added 'mozzconf.h' to mangle the function names. - Added logic in zlib.h to undef our earlier mangles when defaulting to 64 bit offset versions of API. +- Added casts to suppress VC++ warnings The 'google.patch' file represents our changes from the original zlib-1.2.5. A more significant change to support mixed-source data compression. See diff --git a/third_party/zlib/crc_folding.c b/third_party/zlib/crc_folding.c index 98c559c..48d7774 100644 --- a/third_party/zlib/crc_folding.c +++ b/third_party/zlib/crc_folding.c @@ -283,7 +283,7 @@ ZLIB_INTERNAL void crc_fold_copy(deflate_state *const s, goto partial; } - algn_diff = 0 - (unsigned long)src & 0xF; + algn_diff = 0 - (uintptr_t)src & 0xF; if (algn_diff) { xmm_crc_part = _mm_loadu_si128((__m128i *)src); _mm_storeu_si128((__m128i *)dst, xmm_crc_part); diff --git a/third_party/zlib/google.patch b/third_party/zlib/google.patch index 3818b11..c943b41 100644 --- a/third_party/zlib/google.patch +++ b/third_party/zlib/google.patch @@ -1,3 +1,15 @@ +diff -ru zlib-1.2.5/crc_folding.c zlib/crc_folding.c +--- zlib-1.2.5/crc_folding.c ++++ zlib/crc_folding.c +@@ -283,7 +283,7 @@ + goto partial; + } + +- algn_diff = 0 - (unsigned long)src & 0xF; ++ algn_diff = 0 - (uintptr_t)src & 0xF; + if (algn_diff) { + xmm_crc_part = _mm_loadu_si128((__m128i *)src); + _mm_storeu_si128((__m128i *)dst, xmm_crc_part); diff -ru zlib-1.2.5/gzlib.c zlib/gzlib.c --- zlib-1.2.5/gzlib.c +++ zlib/gzlib.c |