Index: base/file_util_win.cc |
diff --git a/base/file_util_win.cc b/base/file_util_win.cc |
index fb65febbb91a179eda8be41a0b5e7e8499440d65..4f96ef34cfc9dd0a352e7e51ff0c4ba30a18a56f 100644 |
--- a/base/file_util_win.cc |
+++ b/base/file_util_win.cc |
@@ -656,11 +656,15 @@ int ReadFile(const FilePath& filename, char* data, int size) { |
if (file == INVALID_HANDLE_VALUE) |
return -1; |
+ int ret_value; |
DWORD read; |
- if (::ReadFile(file, data, size, &read, NULL) && |
- static_cast<int>(read) == size) |
- return read; |
- return -1; |
+ if (::ReadFile(file, data, size, &read, NULL) && read == size) { |
+ ret_value = static_cast<int>(read); |
+ } else { |
+ ret_value = -1; |
+ } |
+ |
+ return ret_value; |
} |
int WriteFile(const FilePath& filename, const char* data, int size) { |
@@ -680,8 +684,8 @@ int WriteFile(const FilePath& filename, const char* data, int size) { |
DWORD written; |
BOOL result = ::WriteFile(file, data, size, &written, NULL); |
- if (result && static_cast<int>(written) == size) |
- return written; |
+ if (result && written == size) |
+ return static_cast<int>(written); |
if (!result) { |
// WriteFile failed. |