| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |