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