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

Unified Diff: third_party/zlib/google/zip_reader.cc

Issue 204983012: Stop using net::FileStream synchronously in third_party/zlib (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/zlib/google/zip.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/zlib/google/zip_reader.cc
diff --git a/third_party/zlib/google/zip_reader.cc b/third_party/zlib/google/zip_reader.cc
index 915dbbc79d149488c7f8946b490b4e1c77c9dc00..f34f4f710168af2cb909a38dfda2dad1f09b412f 100644
--- a/third_party/zlib/google/zip_reader.cc
+++ b/third_party/zlib/google/zip_reader.cc
@@ -4,12 +4,12 @@
#include "third_party/zlib/google/zip_reader.h"
-#include "base/file_util.h"
+#include "base/bind.h"
+#include "base/files/file.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "net/base/file_stream.h"
#include "third_party/zlib/google/zip_internal.h"
#if defined(USE_SYSTEM_MINIZIP)
@@ -205,10 +205,9 @@ bool ZipReader::ExtractCurrentEntryToFilePath(
if (!base::CreateDirectory(output_dir_path))
return false;
- net::FileStream stream(NULL);
- const int flags = (base::PLATFORM_FILE_CREATE_ALWAYS |
- base::PLATFORM_FILE_WRITE);
- if (stream.OpenSync(output_file_path, flags) != 0)
+ base::File file(output_file_path,
+ base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
+ if (!file.IsValid())
return false;
bool success = true; // This becomes false when something bad happens.
@@ -225,14 +224,14 @@ bool ZipReader::ExtractCurrentEntryToFilePath(
break;
} else if (num_bytes_read > 0) {
// Some data is read. Write it to the output file.
- if (num_bytes_read != stream.WriteSync(buf, num_bytes_read)) {
+ if (num_bytes_read != file.WriteAtCurrentPos(buf, num_bytes_read)) {
success = false;
break;
}
}
}
- stream.CloseSync();
+ file.Close();
unzCloseCurrentFile(zip_file_);
if (current_entry_info()->last_modified() != base::Time::UnixEpoch())
« no previous file with comments | « third_party/zlib/google/zip.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698