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

Unified Diff: net/base/file_stream_context_win.cc

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « net/base/capturing_net_log_observer.cc ('k') | net/base/host_mapping_rules.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/file_stream_context_win.cc
diff --git a/net/base/file_stream_context_win.cc b/net/base/file_stream_context_win.cc
index 3b942d35edc532659f8ccdf2035c4aa990cafe70..369dfc1ad97515d62fbe2b73873fe87b8c90d058 100644
--- a/net/base/file_stream_context_win.cc
+++ b/net/base/file_stream_context_win.cc
@@ -68,14 +68,13 @@ int FileStream::Context::Read(IOBuffer* buf,
if (!ReadFile(file_.GetPlatformFile(), buf->data(), buf_len,
&bytes_read, &io_context_.overlapped)) {
IOResult error = IOResult::FromOSError(GetLastError());
- if (error.os_error == ERROR_IO_PENDING) {
- IOCompletionIsPending(callback, buf);
- } else if (error.os_error == ERROR_HANDLE_EOF) {
+ if (error.os_error == ERROR_HANDLE_EOF)
return 0; // Report EOF by returning 0 bytes read.
- } else {
+ if (error.os_error == ERROR_IO_PENDING)
+ IOCompletionIsPending(callback, buf);
+ else
LOG(WARNING) << "ReadFile failed: " << error.os_error;
- }
- return error.result;
+ return static_cast<int>(error.result);
}
IOCompletionIsPending(callback, buf);
@@ -89,12 +88,11 @@ int FileStream::Context::Write(IOBuffer* buf,
if (!WriteFile(file_.GetPlatformFile(), buf->data(), buf_len,
&bytes_written, &io_context_.overlapped)) {
IOResult error = IOResult::FromOSError(GetLastError());
- if (error.os_error == ERROR_IO_PENDING) {
+ if (error.os_error == ERROR_IO_PENDING)
IOCompletionIsPending(callback, buf);
- } else {
+ else
LOG(WARNING) << "WriteFile failed: " << error.os_error;
- }
- return error.result;
+ return static_cast<int>(error.result);
}
IOCompletionIsPending(callback, buf);
@@ -149,7 +147,7 @@ void FileStream::Context::OnIOCompleted(
result = 0;
} else if (error) {
IOResult error_result = IOResult::FromOSError(error);
- result = error_result.result;
+ result = static_cast<int>(error_result.result);
} else {
result = bytes_read;
IncrementOffset(&io_context_.overlapped, bytes_read);
« no previous file with comments | « net/base/capturing_net_log_observer.cc ('k') | net/base/host_mapping_rules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698