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#if defined(OS_WIN)
9#include <windows.h>
10#endif
11
12#include <string>
13
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
21
22// Utility functions and constants used internally for the zip file
23// library in the directory. Don't use them outside of the library.
24namespace zip {
25namespace internal {
26
27// Opens the given file name in UTF-8 for unzipping, with some setup for
28// Windows.
29unzFile OpenForUnzipping(const std::string& file_name_utf8);
30
31#if defined(OS_POSIX)
32// Opens the file referred to by |zip_fd| for unzipping.
33unzFile OpenFdForUnzipping(int zip_fd);
34#endif
35
36#if defined(OS_WIN)
37// Opens the file referred to by |zip_handle| for unzipping.
38unzFile OpenHandleForUnzipping(HANDLE zip_handle);
39#endif
40
41// 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
43// read data from the specified string.
44unzFile PreprareMemoryForUnzipping(const std::string& data);
45
46// Opens the given file name in UTF-8 for zipping, with some setup for
47// Windows. |append_flag| will be passed to zipOpen2().
48zipFile OpenForZipping(const std::string& file_name_utf8, int append_flag);
49
50#if defined(OS_POSIX)
51// Opens the file referred to by |zip_fd| for zipping. |append_flag| will be
52// passed to zipOpen2().
53zipFile OpenFdForZipping(int zip_fd, int append_flag);
54#endif
55
56const int kZipMaxPath = 256;
57const int kZipBufSize = 8192;
58
59}  // namespace internal
60}  // namespace zip
61
62#endif  // THIRD_PARTY_ZLIB_GOOGLE_ZIP_INTERNAL_H_
63