From 167c929e90ac048545bdf16cf454c03b3bae2882 Mon Sep 17 00:00:00 2001 From: "scottmg@chromium.org" Date: Thu, 31 Jul 2014 03:34:57 +0000 Subject: 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 --- third_party/zlib/google/zip_internal.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'third_party/zlib') 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; -- cgit v1.1