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

Unified Diff: base/file_util_win.cc

Issue 240893002: base::ReadFile() should return the number of read bytes on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing parenthesis. Created 6 years, 8 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
« base/file_util_unittest.cc ('K') | « base/file_util_unittest.cc ('k') | no next file » | 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 94b545a5f21888f286528c6633046ff64812992b..eb9c6dc23dcf3f3eff8177d6c5083f7a9318385d 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -571,7 +571,7 @@ FILE* OpenFile(const FilePath& filename, const char* mode) {
return _wfsopen(filename.value().c_str(), w_mode.c_str(), _SH_DENYNO);
}
-int ReadFile(const FilePath& filename, char* data, int size) {
+int ReadFile(const FilePath& filename, char* data, int max_size) {
ThreadRestrictions::AssertIOAllowed();
base::win::ScopedHandle file(CreateFile(filename.value().c_str(),
GENERIC_READ,
@@ -584,9 +584,9 @@ int ReadFile(const FilePath& filename, char* data, int size) {
return -1;
DWORD read;
- if (::ReadFile(file, data, size, &read, NULL) &&
- static_cast<int>(read) == size)
+ if (::ReadFile(file, data, max_size, &read, NULL))
Mark Mentovai 2014/04/17 16:21:57 The same concern about short non-EOF reads that I
fukino 2014/04/18 02:22:12 Yes. filed as http://crbug.com/364762.
return read;
+
return -1;
}
« base/file_util_unittest.cc ('K') | « base/file_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698