| 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 if (num_bytes_read == 0) { | 326 if (num_bytes_read == 0) { |
| 327 // Reached the end of the file. | 327 // Reached the end of the file. |
| 328 break; | 328 break; |
| 329 } else if (num_bytes_read < 0) { | 329 } else if (num_bytes_read < 0) { |
| 330 // If num_bytes_read < 0, then it's a specific UNZ_* error code. | 330 // If num_bytes_read < 0, then it's a specific UNZ_* error code. |
| 331 success = false; | 331 success = false; |
| 332 break; | 332 break; |
| 333 } else if (num_bytes_read > 0) { | 333 } else if (num_bytes_read > 0) { |
| 334 // Some data is read. Write it to the output file descriptor. | 334 // Some data is read. Write it to the output file descriptor. |
| 335 if (num_bytes_read != | 335 if (num_bytes_read != |
| 336 file_util::WriteFileDescriptor(fd, buf, num_bytes_read)) { | 336 base::WriteFileDescriptor(fd, buf, num_bytes_read)) { |
| 337 success = false; | 337 success = false; |
| 338 break; | 338 break; |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 | 342 |
| 343 unzCloseCurrentFile(zip_file_); | 343 unzCloseCurrentFile(zip_file_); |
| 344 return success; | 344 return success; |
| 345 } | 345 } |
| 346 #endif // defined(OS_POSIX) | 346 #endif // defined(OS_POSIX) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 success_callback, | 405 success_callback, |
| 406 failure_callback, | 406 failure_callback, |
| 407 progress_callback, | 407 progress_callback, |
| 408 current_progress)); | 408 current_progress)); |
| 409 | 409 |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 | 413 |
| 414 } // namespace zip | 414 } // namespace zip |
| OLD | NEW |