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

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

Issue 614893004: Refactor AppendToFile and WriteFileDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 6 years, 2 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 | « media/cast/test/simulator.cc ('k') | ui/base/resource/data_pack_unittest.cc » ('j') | 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 internal::kZipBufSize); 324 internal::kZipBufSize);
325 if (num_bytes_read == 0) { 325 if (num_bytes_read == 0) {
326 // Reached the end of the file. 326 // Reached the end of the file.
327 break; 327 break;
328 } else if (num_bytes_read < 0) { 328 } else if (num_bytes_read < 0) {
329 // If num_bytes_read < 0, then it's a specific UNZ_* error code. 329 // If num_bytes_read < 0, then it's a specific UNZ_* error code.
330 success = false; 330 success = false;
331 break; 331 break;
332 } else if (num_bytes_read > 0) { 332 } else if (num_bytes_read > 0) {
333 // Some data is read. Write it to the output file descriptor. 333 // Some data is read. Write it to the output file descriptor.
334 if (num_bytes_read != 334 if (!base::WriteFileDescriptor(fd, buf, num_bytes_read)) {
335 base::WriteFileDescriptor(fd, buf, num_bytes_read)) {
336 success = false; 335 success = false;
337 break; 336 break;
338 } 337 }
339 } 338 }
340 } 339 }
341 340
342 unzCloseCurrentFile(zip_file_); 341 unzCloseCurrentFile(zip_file_);
343 return success; 342 return success;
344 } 343 }
345 #endif // defined(OS_POSIX) 344 #endif // defined(OS_POSIX)
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 success_callback, 455 success_callback,
457 failure_callback, 456 failure_callback,
458 progress_callback, 457 progress_callback,
459 current_progress)); 458 current_progress));
460 459
461 } 460 }
462 } 461 }
463 462
464 463
465 } // namespace zip 464 } // namespace zip
OLDNEW
« no previous file with comments | « media/cast/test/simulator.cc ('k') | ui/base/resource/data_pack_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698