Chromium Code Reviews| 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 #ifndef THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_ | 5 #ifndef THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_ |
| 6 #define THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_ | 6 #define THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_ |
| 7 | 7 |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #if defined(USE_SYSTEM_MINIZIP) | 14 #if defined(USE_SYSTEM_MINIZIP) |
| 15 #include <minizip/unzip.h> | 15 #include <minizip/unzip.h> |
| 16 #include <minizip/zip.h> | 16 #include <minizip/zip.h> |
| 17 #else | 17 #else |
| 18 #include "third_party/zlib/contrib/minizip/unzip.h" | 18 #include "third_party/zlib/contrib/minizip/unzip.h" |
| 19 #include "third_party/zlib/contrib/minizip/zip.h" | 19 #include "third_party/zlib/contrib/minizip/zip.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace base { | |
| 23 class FilePath; | |
| 24 } | |
| 25 | |
| 22 // Utility functions and constants used internally for the zip file | 26 // Utility functions and constants used internally for the zip file |
| 23 // library in the directory. Don't use them outside of the library. | 27 // library in the directory. Don't use them outside of the library. |
| 24 namespace zip { | 28 namespace zip { |
| 25 namespace internal { | 29 namespace internal { |
| 26 | 30 |
| 27 // Opens the given file name in UTF-8 for unzipping, with some setup for | 31 // Opens the given file name in UTF-8 for unzipping, with some setup for |
| 28 // Windows. | 32 // Windows. |
| 29 unzFile OpenForUnzipping(const std::string& file_name_utf8); | 33 unzFile OpenForUnzipping(const std::string& file_name_utf8); |
| 30 | 34 |
| 31 #if defined(OS_POSIX) | 35 #if defined(OS_POSIX) |
| 32 // Opens the file referred to by |zip_fd| for unzipping. | 36 // Opens the file referred to by |zip_fd| for unzipping. |
| 33 unzFile OpenFdForUnzipping(int zip_fd); | 37 unzFile OpenFdForUnzipping(int zip_fd); |
| 34 #endif | 38 #endif |
| 35 | 39 |
| 36 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 37 // Opens the file referred to by |zip_handle| for unzipping. | 41 // Opens the file referred to by |zip_handle| for unzipping. |
| 38 unzFile OpenHandleForUnzipping(HANDLE zip_handle); | 42 unzFile OpenHandleForUnzipping(HANDLE zip_handle); |
| 39 #endif | 43 #endif |
| 40 | 44 |
| 41 // Creates a custom unzFile object which reads data from the specified string. | 45 // Creates a custom unzFile object which reads data from the specified string. |
| 42 // This custom unzFile object overrides the I/O API functions of zlib so it can | 46 // This custom unzFile object overrides the I/O API functions of zlib so it can |
| 43 // read data from the specified string. | 47 // read data from the specified string. |
| 44 unzFile PreprareMemoryForUnzipping(const std::string& data); | 48 unzFile PrepareMemoryForUnzipping(const std::string& data); |
| 45 | 49 |
| 46 // Opens the given file name in UTF-8 for zipping, with some setup for | 50 // Opens the given file name in UTF-8 for zipping, with some setup for |
| 47 // Windows. |append_flag| will be passed to zipOpen2(). | 51 // Windows. |append_flag| will be passed to zipOpen2(). |
| 48 zipFile OpenForZipping(const std::string& file_name_utf8, int append_flag); | 52 zipFile OpenForZipping(const std::string& file_name_utf8, int append_flag); |
| 49 | 53 |
| 50 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
| 51 // Opens the file referred to by |zip_fd| for zipping. |append_flag| will be | 55 // Opens the file referred to by |zip_fd| for zipping. |append_flag| will be |
| 52 // passed to zipOpen2(). | 56 // passed to zipOpen2(). |
| 53 zipFile OpenFdForZipping(int zip_fd, int append_flag); | 57 zipFile OpenFdForZipping(int zip_fd, int append_flag); |
| 54 #endif | 58 #endif |
| 55 | 59 |
| 60 // Returns a zip_fileinfo with the last modification date of |path| set. | |
| 61 zip_fileinfo GetFileInfoForZipping(const base::FilePath& path); | |
| 62 | |
| 63 // Wrapper around zipOpenNewFileInZip4 which passes most common options. | |
| 64 bool ZipOpenNewFileInZipWrapper(zipFile zip_file, | |
|
satorux1
2014/04/03 05:10:54
Drop "Wrapper" from the function name?
| |
| 65 const std::string& str_path, | |
| 66 const zip_fileinfo* file_info); | |
| 67 | |
| 56 const int kZipMaxPath = 256; | 68 const int kZipMaxPath = 256; |
| 57 const int kZipBufSize = 8192; | 69 const int kZipBufSize = 8192; |
| 58 | 70 |
| 59 } // namespace internal | 71 } // namespace internal |
| 60 } // namespace zip | 72 } // namespace zip |
| 61 | 73 |
| 62 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_ | 74 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_ |
| OLD | NEW |