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

Unified Diff: base/files/file_util_win.cc

Issue 593113004: Remove implicit HANDLE conversions from base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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/files/file_util_unittest.cc ('k') | base/files/file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_util_win.cc
diff --git a/base/files/file_util_win.cc b/base/files/file_util_win.cc
index 82b53c5fd85adf3dfdc3bca802f7673dc9c46db2..b58619192378d50bab86a791dcdce665cf7a0545 100644
--- a/base/files/file_util_win.cc
+++ b/base/files/file_util_win.cc
@@ -504,7 +504,7 @@ bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path) {
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL));
- if (!file_handle)
+ if (!file_handle.IsValid())
return false;
// Create a file mapping object. Can't easily use MemoryMappedFile, because
@@ -517,7 +517,7 @@ bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path) {
0,
1, // Just one byte. No need to look at the data.
NULL));
- if (!file_map_handle)
+ if (!file_map_handle.IsValid())
return false;
// Use a view of the file to get the path to the file.
@@ -602,11 +602,11 @@ int ReadFile(const FilePath& filename, char* data, int max_size) {
OPEN_EXISTING,
FILE_FLAG_SEQUENTIAL_SCAN,
NULL));
- if (!file)
+ if (!file.IsValid())
return -1;
DWORD read;
- if (::ReadFile(file, data, max_size, &read, NULL))
+ if (::ReadFile(file.Get(), data, max_size, &read, NULL))
return read;
return -1;
@@ -621,14 +621,14 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
CREATE_ALWAYS,
0,
NULL));
- if (!file) {
+ if (!file.IsValid()) {
DPLOG(WARNING) << "CreateFile failed for path "
<< UTF16ToUTF8(filename.value());
return -1;
}
DWORD written;
- BOOL result = ::WriteFile(file, data, size, &written, NULL);
+ BOOL result = ::WriteFile(file.Get(), data, size, &written, NULL);
if (result && static_cast<int>(written) == size)
return written;
@@ -653,14 +653,14 @@ int AppendToFile(const FilePath& filename, const char* data, int size) {
OPEN_EXISTING,
0,
NULL));
- if (!file) {
+ if (!file.IsValid()) {
DPLOG(WARNING) << "CreateFile failed for path "
<< UTF16ToUTF8(filename.value());
return -1;
}
DWORD written;
- BOOL result = ::WriteFile(file, data, size, &written, NULL);
+ BOOL result = ::WriteFile(file.Get(), data, size, &written, NULL);
if (result && static_cast<int>(written) == size)
return written;
« no previous file with comments | « base/files/file_util_unittest.cc ('k') | base/files/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698