| 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.h" | 5 #include "third_party/zlib/google/zip.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 creation_disposition = OPEN_EXISTING; | 47 creation_disposition = OPEN_EXISTING; |
| 48 share_mode = FILE_SHARE_READ; | 48 share_mode = FILE_SHARE_READ; |
| 49 } else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) { | 49 } else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) { |
| 50 desired_access = GENERIC_WRITE | GENERIC_READ; | 50 desired_access = GENERIC_WRITE | GENERIC_READ; |
| 51 creation_disposition = OPEN_EXISTING; | 51 creation_disposition = OPEN_EXISTING; |
| 52 } else if (mode & ZLIB_FILEFUNC_MODE_CREATE) { | 52 } else if (mode & ZLIB_FILEFUNC_MODE_CREATE) { |
| 53 desired_access = GENERIC_WRITE | GENERIC_READ; | 53 desired_access = GENERIC_WRITE | GENERIC_READ; |
| 54 creation_disposition = CREATE_ALWAYS; | 54 creation_disposition = CREATE_ALWAYS; |
| 55 } | 55 } |
| 56 | 56 |
| 57 base::string16 filename16 = UTF8ToUTF16(filename); | 57 base::string16 filename16 = base::UTF8ToUTF16(filename); |
| 58 if ((filename != NULL) && (desired_access != 0)) { | 58 if ((filename != NULL) && (desired_access != 0)) { |
| 59 file = CreateFile(filename16.c_str(), desired_access, share_mode, | 59 file = CreateFile(filename16.c_str(), desired_access, share_mode, |
| 60 NULL, creation_disposition, flags_and_attributes, NULL); | 60 NULL, creation_disposition, flags_and_attributes, NULL); |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (file == INVALID_HANDLE_VALUE) | 63 if (file == INVALID_HANDLE_VALUE) |
| 64 file = NULL; | 64 file = NULL; |
| 65 | 65 |
| 66 if (file != NULL) { | 66 if (file != NULL) { |
| 67 WIN32FILE_IOWIN file_ret; | 67 WIN32FILE_IOWIN file_ret; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 zipFile OpenFdForZipping(int zip_fd, int append_flag) { | 307 zipFile OpenFdForZipping(int zip_fd, int append_flag) { |
| 308 zlib_filefunc_def zip_funcs; | 308 zlib_filefunc_def zip_funcs; |
| 309 FillFdOpenFileFunc(&zip_funcs, zip_fd); | 309 FillFdOpenFileFunc(&zip_funcs, zip_fd); |
| 310 // Passing dummy "fd" filename to zlib. | 310 // Passing dummy "fd" filename to zlib. |
| 311 return zipOpen2("fd", append_flag, NULL, &zip_funcs); | 311 return zipOpen2("fd", append_flag, NULL, &zip_funcs); |
| 312 } | 312 } |
| 313 #endif | 313 #endif |
| 314 | 314 |
| 315 } // namespace internal | 315 } // namespace internal |
| 316 } // namespace zip | 316 } // namespace zip |
| OLD | NEW |