Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Side by Side Diff: third_party/zlib/google/zip_reader.cc

Issue 1911823002: Convert //third_party from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update crashpad's README.chromium Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/zlib/google/zip_reader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "third_party/zlib/google/zip_reader.h" 5 #include "third_party/zlib/google/zip_reader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 DCHECK(zip_file_); 296 DCHECK(zip_file_);
297 297
298 const int open_result = unzOpenCurrentFile(zip_file_); 298 const int open_result = unzOpenCurrentFile(zip_file_);
299 if (open_result != UNZ_OK) 299 if (open_result != UNZ_OK)
300 return false; 300 return false;
301 301
302 if (!delegate->PrepareOutput()) 302 if (!delegate->PrepareOutput())
303 return false; 303 return false;
304 304
305 bool success = true; // This becomes false when something bad happens. 305 bool success = true; // This becomes false when something bad happens.
306 scoped_ptr<char[]> buf(new char[internal::kZipBufSize]); 306 std::unique_ptr<char[]> buf(new char[internal::kZipBufSize]);
307 while (true) { 307 while (true) {
308 const int num_bytes_read = unzReadCurrentFile(zip_file_, buf.get(), 308 const int num_bytes_read = unzReadCurrentFile(zip_file_, buf.get(),
309 internal::kZipBufSize); 309 internal::kZipBufSize);
310 if (num_bytes_read == 0) { 310 if (num_bytes_read == 0) {
311 // Reached the end of the file. 311 // Reached the end of the file.
312 break; 312 break;
313 } else if (num_bytes_read < 0) { 313 } else if (num_bytes_read < 0) {
314 // If num_bytes_read < 0, then it's a specific UNZ_* error code. 314 // If num_bytes_read < 0, then it's a specific UNZ_* error code.
315 success = false; 315 success = false;
316 break; 316 break;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 529 }
530 530
531 bool FileWriterDelegate::WriteBytes(const char* data, int num_bytes) { 531 bool FileWriterDelegate::WriteBytes(const char* data, int num_bytes) {
532 int bytes_written = file_->WriteAtCurrentPos(data, num_bytes); 532 int bytes_written = file_->WriteAtCurrentPos(data, num_bytes);
533 if (bytes_written > 0) 533 if (bytes_written > 0)
534 file_length_ += bytes_written; 534 file_length_ += bytes_written;
535 return bytes_written == num_bytes; 535 return bytes_written == num_bytes;
536 } 536 }
537 537
538 } // namespace zip 538 } // namespace zip
OLDNEW
« no previous file with comments | « third_party/zlib/google/zip_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698