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.
5 #ifndef THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_
6 #define THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_
14 #if defined(USE_SYSTEM_MINIZIP)
15 #include <minizip/unzip.h>
16 #include <minizip/zip.h>
18 #include "third_party/zlib/contrib/minizip/unzip.h"
19 #include "third_party/zlib/contrib/minizip/zip.h"
26 // Utility functions and constants used internally for the zip file
27 // library in the directory. Don't use them outside of the library.
31 // Opens the given file name in UTF-8 for unzipping, with some setup for
33 unzFile
OpenForUnzipping(const std::string
& file_name_utf8
);
36 // Opens the file referred to by |zip_fd| for unzipping.
37 unzFile
OpenFdForUnzipping(int zip_fd
);
41 // Opens the file referred to by |zip_handle| for unzipping.
42 unzFile
OpenHandleForUnzipping(HANDLE zip_handle
);
45 // Creates a custom unzFile object which reads data from the specified string.
46 // This custom unzFile object overrides the I/O API functions of zlib so it can
47 // read data from the specified string.
48 unzFile
PrepareMemoryForUnzipping(const std::string
& data
);
50 // Opens the given file name in UTF-8 for zipping, with some setup for
51 // Windows. |append_flag| will be passed to zipOpen2().
52 zipFile
OpenForZipping(const std::string
& file_name_utf8
, int append_flag
);
55 // Opens the file referred to by |zip_fd| for zipping. |append_flag| will be
56 // passed to zipOpen2().
57 zipFile
OpenFdForZipping(int zip_fd
, int append_flag
);
60 // Returns a zip_fileinfo with the last modification date of |path| set.
61 zip_fileinfo
GetFileInfoForZipping(const base::FilePath
& path
);
63 // Wrapper around zipOpenNewFileInZip4 which passes most common options.
64 bool ZipOpenNewFileInZip(zipFile zip_file
,
65 const std::string
& str_path
,
66 const zip_fileinfo
* file_info
);
68 const int kZipMaxPath
= 256;
69 const int kZipBufSize
= 8192;
71 } // namespace internal
74 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_