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

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

Issue 2512933002: Make ifdefs consistent in zib. (Closed)
Patch Set: Update after review. Created 4 years 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 | « no previous file | 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 507 }
508 508
509 // FileWriterDelegate ---------------------------------------------------------- 509 // FileWriterDelegate ----------------------------------------------------------
510 510
511 FileWriterDelegate::FileWriterDelegate(base::File* file) 511 FileWriterDelegate::FileWriterDelegate(base::File* file)
512 : file_(file), 512 : file_(file),
513 file_length_(0) { 513 file_length_(0) {
514 } 514 }
515 515
516 FileWriterDelegate::~FileWriterDelegate() { 516 FileWriterDelegate::~FileWriterDelegate() {
517 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 517 if (!file_->SetLength(file_length_)) {
518 const bool success = 518 DPLOG(ERROR) << "Failed updating length of written file";
519 #endif 519 }
520 file_->SetLength(file_length_);
521 DPLOG_IF(ERROR, !success) << "Failed updating length of written file";
522 } 520 }
523 521
524 bool FileWriterDelegate::PrepareOutput() { 522 bool FileWriterDelegate::PrepareOutput() {
525 return file_->Seek(base::File::FROM_BEGIN, 0) >= 0; 523 return file_->Seek(base::File::FROM_BEGIN, 0) >= 0;
526 } 524 }
527 525
528 bool FileWriterDelegate::WriteBytes(const char* data, int num_bytes) { 526 bool FileWriterDelegate::WriteBytes(const char* data, int num_bytes) {
529 int bytes_written = file_->WriteAtCurrentPos(data, num_bytes); 527 int bytes_written = file_->WriteAtCurrentPos(data, num_bytes);
530 if (bytes_written > 0) 528 if (bytes_written > 0)
531 file_length_ += bytes_written; 529 file_length_ += bytes_written;
532 return bytes_written == num_bytes; 530 return bytes_written == num_bytes;
533 } 531 }
534 532
535 } // namespace zip 533 } // namespace zip
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698