Enable MSVC warning for unused locals.
There is seemingly a bug in the compiler where it occasionally claims a local is
unused when it isn't. This forces a few places to either inline such locals or
mark them ALLOW_UNUSED_LOCAL.
BUG=81439
TEST=none
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/731373002
Cr-Commit-Position: refs/heads/master@{#305108}
diff --git a/net/base/file_stream_context_win.cc b/net/base/file_stream_context_win.cc
index 3b942d3..369dfc1a 100644
--- a/net/base/file_stream_context_win.cc
+++ b/net/base/file_stream_context_win.cc
@@ -68,14 +68,13 @@
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 @@
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 @@
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);