diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 03:34:57 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 03:34:57 +0000 |
commit | 167c929e90ac048545bdf16cf454c03b3bae2882 (patch) | |
tree | cd973aa3ea6314255d4043028c3d3cf8188536ea /third_party/zlib | |
parent | 9d54c863641deb83a981353f6577668f9188c24f (diff) | |
download | chromium_src-167c929e90ac048545bdf16cf454c03b3bae2882.zip chromium_src-167c929e90ac048545bdf16cf454c03b3bae2882.tar.gz chromium_src-167c929e90ac048545bdf16cf454c03b3bae2882.tar.bz2 |
gn win: Fix potentially uninitialized variable warning in zip_internal
The gn Windows build says
d:\src\cr3\src\third_party\zlib\google\zip_internal.cc(62) : error C2220: warning treated as error - no 'object' file generated
d:\src\cr3\src\third_party\zlib\google\zip_internal.cc(62) : warning C4701: potentially uninitialized local variable 'creation_disposition' used
This warning is disabled in the gyp build, but it seems better to keep
it on if possible, and it seems like depending on the flags passed to
ZipOpenFunc, it could indeed be passing an uninitialized value to
::CreateFile. Setting it explicitly to 0 will cause ::CreateFile to
fail, if it's left unset by the ifs.
R=satorux@chromium.org
BUG=354261
Review URL: https://codereview.chromium.org/430963002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/zlib')
-rw-r--r-- | third_party/zlib/google/zip_internal.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/third_party/zlib/google/zip_internal.cc b/third_party/zlib/google/zip_internal.cc index 6349b7a..5ed2024 100644 --- a/third_party/zlib/google/zip_internal.cc +++ b/third_party/zlib/google/zip_internal.cc @@ -37,13 +37,11 @@ typedef struct { // Its only difference is that it treats the char* as UTF8 and // uses the Unicode version of CreateFile. void* ZipOpenFunc(void *opaque, const char* filename, int mode) { - DWORD desired_access, creation_disposition; - DWORD share_mode, flags_and_attributes; + DWORD desired_access = 0, creation_disposition = 0; + DWORD share_mode = 0, flags_and_attributes = 0; HANDLE file = 0; void* ret = NULL; - desired_access = share_mode = flags_and_attributes = 0; - if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ) { desired_access = GENERIC_READ; creation_disposition = OPEN_EXISTING; |