OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_reader.h" | 5 #include "chrome/common/zip_reader.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 char raw_file_name_in_zip[internal::kZipMaxPath] = {}; | 141 char raw_file_name_in_zip[internal::kZipMaxPath] = {}; |
142 const int result = unzGetCurrentFileInfo(zip_file_, | 142 const int result = unzGetCurrentFileInfo(zip_file_, |
143 &raw_file_info, | 143 &raw_file_info, |
144 raw_file_name_in_zip, | 144 raw_file_name_in_zip, |
145 sizeof(raw_file_name_in_zip) - 1, | 145 sizeof(raw_file_name_in_zip) - 1, |
146 NULL, // extraField. | 146 NULL, // extraField. |
147 0, // extraFieldBufferSize. | 147 0, // extraFieldBufferSize. |
148 NULL, // szComment. | 148 NULL, // szComment. |
149 0); // commentBufferSize. | 149 0); // commentBufferSize. |
150 if (result != UNZ_OK) | 150 if (result != UNZ_OK) |
151 return NULL; | 151 return false; |
152 if (raw_file_name_in_zip[0] == '\0') | 152 if (raw_file_name_in_zip[0] == '\0') |
153 return NULL; | 153 return false; |
154 current_entry_info_.reset( | 154 current_entry_info_.reset( |
155 new EntryInfo(raw_file_name_in_zip, raw_file_info)); | 155 new EntryInfo(raw_file_name_in_zip, raw_file_info)); |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 bool ZipReader::LocateAndOpenEntry(const FilePath& path_in_zip) { | 159 bool ZipReader::LocateAndOpenEntry(const FilePath& path_in_zip) { |
160 DCHECK(zip_file_); | 160 DCHECK(zip_file_); |
161 | 161 |
162 current_entry_info_.reset(); | 162 current_entry_info_.reset(); |
163 reached_end_ = false; | 163 reached_end_ = false; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 288 } |
289 | 289 |
290 void ZipReader::Reset() { | 290 void ZipReader::Reset() { |
291 zip_file_ = NULL; | 291 zip_file_ = NULL; |
292 num_entries_ = 0; | 292 num_entries_ = 0; |
293 reached_end_ = false; | 293 reached_end_ = false; |
294 current_entry_info_.reset(); | 294 current_entry_info_.reset(); |
295 } | 295 } |
296 | 296 |
297 } // namespace zip | 297 } // namespace zip |
OLD | NEW |