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

Unified Diff: base/file_util_win.cc

Issue 2253001: Revert 48186, 48196, 48198 (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 7 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 | « base/event_trace_provider_win_unittest.cc ('k') | base/iat_patch.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « base/event_trace_provider_win_unittest.cc ('k') | base/iat_patch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698