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 #include "chrome/common/zip.h" | 5 #include "chrome/common/zip.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "third_party/zlib/contrib/minizip/unzip.h" | 8 #include "third_party/zlib/contrib/minizip/unzip.h" |
9 #include "third_party/zlib/contrib/minizip/zip.h" | 9 #include "third_party/zlib/contrib/minizip/zip.h" |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 zlib_filefunc_def* zip_func_ptrs = NULL; | 74 zlib_filefunc_def* zip_func_ptrs = NULL; |
75 #if defined(OS_WIN) | 75 #if defined(OS_WIN) |
76 zlib_filefunc_def zip_funcs; | 76 zlib_filefunc_def zip_funcs; |
77 fill_win32_filefunc(&zip_funcs); | 77 fill_win32_filefunc(&zip_funcs); |
78 zip_funcs.zopen_file = ZipOpenFunc; | 78 zip_funcs.zopen_file = ZipOpenFunc; |
79 zip_func_ptrs = &zip_funcs; | 79 zip_func_ptrs = &zip_funcs; |
80 #endif | 80 #endif |
81 return unzOpen2(file_name_utf8.c_str(), zip_func_ptrs); | 81 return unzOpen2(file_name_utf8.c_str(), zip_func_ptrs); |
82 } | 82 } |
83 | 83 |
84 #if defined(OS_POSIX) | |
85 unzFile OpenFdForUnzipping(const int fd) { | |
satorux1
2011/12/12 04:54:14
fd -> zip_fd, to be consistent with the function d
Jorge Lucangeli Obes
2011/12/12 23:34:35
Done.
| |
86 zlib_filefunc_def zip_funcs; | |
87 fill_fdopen_filefunc(&zip_funcs, fd); | |
88 return unzOpen2("fd", &zip_funcs); | |
satorux1
2011/12/12 04:54:14
What's "fd"? Is this a dummy file name? Would be n
Jorge Lucangeli Obes
2011/12/12 23:34:35
Done.
| |
89 } | |
90 #endif | |
91 | |
84 zipFile OpenForZipping(const std::string& file_name_utf8, int append_flag) { | 92 zipFile OpenForZipping(const std::string& file_name_utf8, int append_flag) { |
85 zlib_filefunc_def* zip_func_ptrs = NULL; | 93 zlib_filefunc_def* zip_func_ptrs = NULL; |
86 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
87 zlib_filefunc_def zip_funcs; | 95 zlib_filefunc_def zip_funcs; |
88 fill_win32_filefunc(&zip_funcs); | 96 fill_win32_filefunc(&zip_funcs); |
89 zip_funcs.zopen_file = ZipOpenFunc; | 97 zip_funcs.zopen_file = ZipOpenFunc; |
90 zip_func_ptrs = &zip_funcs; | 98 zip_func_ptrs = &zip_funcs; |
91 #endif | 99 #endif |
92 return zipOpen2(file_name_utf8.c_str(), | 100 return zipOpen2(file_name_utf8.c_str(), |
93 append_flag, | 101 append_flag, |
94 NULL, // global comment | 102 NULL, // global comment |
95 zip_func_ptrs); | 103 zip_func_ptrs); |
96 } | 104 } |
97 | 105 |
98 } // namespace internal | 106 } // namespace internal |
99 } // namespace zip | 107 } // namespace zip |
OLD | NEW |