OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "third_party/zlib/google/zip_internal.h" | 5 #include "third_party/zlib/google/zip_internal.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 typedef struct { | 31 typedef struct { |
32 HANDLE hf; | 32 HANDLE hf; |
33 int error; | 33 int error; |
34 } WIN32FILE_IOWIN; | 34 } WIN32FILE_IOWIN; |
35 | 35 |
36 // This function is derived from third_party/minizip/iowin32.c. | 36 // This function is derived from third_party/minizip/iowin32.c. |
37 // Its only difference is that it treats the char* as UTF8 and | 37 // Its only difference is that it treats the char* as UTF8 and |
38 // uses the Unicode version of CreateFile. | 38 // uses the Unicode version of CreateFile. |
39 void* ZipOpenFunc(void *opaque, const char* filename, int mode) { | 39 void* ZipOpenFunc(void *opaque, const char* filename, int mode) { |
40 DWORD desired_access, creation_disposition; | 40 DWORD desired_access, creation_disposition; |
41 DWORD share_mode, flags_and_attributes; | 41 DWORD share_mode, flags_and_attributes; |
satorux1
2014/07/30 21:40:39
while you are at it, could you change the code to
scottmg
2014/07/30 21:43:44
Done.
| |
42 HANDLE file = 0; | 42 HANDLE file = 0; |
43 void* ret = NULL; | 43 void* ret = NULL; |
44 | 44 |
45 desired_access = share_mode = flags_and_attributes = 0; | 45 desired_access = creation_disposition = share_mode = flags_and_attributes = 0; |
46 | 46 |
47 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ) { | 47 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ) { |
48 desired_access = GENERIC_READ; | 48 desired_access = GENERIC_READ; |
49 creation_disposition = OPEN_EXISTING; | 49 creation_disposition = OPEN_EXISTING; |
50 share_mode = FILE_SHARE_READ; | 50 share_mode = FILE_SHARE_READ; |
51 } else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) { | 51 } else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) { |
52 desired_access = GENERIC_WRITE | GENERIC_READ; | 52 desired_access = GENERIC_WRITE | GENERIC_READ; |
53 creation_disposition = OPEN_EXISTING; | 53 creation_disposition = OPEN_EXISTING; |
54 } else if (mode & ZLIB_FILEFUNC_MODE_CREATE) { | 54 } else if (mode & ZLIB_FILEFUNC_MODE_CREATE) { |
55 desired_access = GENERIC_WRITE | GENERIC_READ; | 55 desired_access = GENERIC_WRITE | GENERIC_READ; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 0, // versionMadeBy | 371 0, // versionMadeBy |
372 LANGUAGE_ENCODING_FLAG)) { // flagBase | 372 LANGUAGE_ENCODING_FLAG)) { // flagBase |
373 DLOG(ERROR) << "Could not open zip file entry " << str_path; | 373 DLOG(ERROR) << "Could not open zip file entry " << str_path; |
374 return false; | 374 return false; |
375 } | 375 } |
376 return true; | 376 return true; |
377 } | 377 } |
378 | 378 |
379 } // namespace internal | 379 } // namespace internal |
380 } // namespace zip | 380 } // namespace zip |
OLD | NEW |