Fix missing .Pass() on returning scoped_ptr<SdchManager::DictionarySet>
[chromium-blink-merge.git] / third_party / zlib / google / zip_internal.h
blobffd4039316d0b2a692f3804dde1caff8195ba7e8
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_
8 #if defined(OS_WIN)
9 #include <windows.h>
10 #endif
12 #include <string>
14 #if defined(USE_SYSTEM_MINIZIP)
15 #include <minizip/unzip.h>
16 #include <minizip/zip.h>
17 #else
18 #include "third_party/zlib/contrib/minizip/unzip.h"
19 #include "third_party/zlib/contrib/minizip/zip.h"
20 #endif
22 namespace base {
23 class FilePath;
26 // Utility functions and constants used internally for the zip file
27 // library in the directory. Don't use them outside of the library.
28 namespace zip {
29 namespace internal {
31 // Opens the given file name in UTF-8 for unzipping, with some setup for
32 // Windows.
33 unzFile OpenForUnzipping(const std::string& file_name_utf8);
35 #if defined(OS_POSIX)
36 // Opens the file referred to by |zip_fd| for unzipping.
37 unzFile OpenFdForUnzipping(int zip_fd);
38 #endif
40 #if defined(OS_WIN)
41 // Opens the file referred to by |zip_handle| for unzipping.
42 unzFile OpenHandleForUnzipping(HANDLE zip_handle);
43 #endif
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);
54 #if defined(OS_POSIX)
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);
58 #endif
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
72 } // namespace zip
74 #endif // THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_