diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-28 05:47:15 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-28 05:47:15 +0000 |
commit | c870c76357fc05d3f7181f8121181f983bd25e7f (patch) | |
tree | 4757d379e295e2a594e63d53a0d3b4fe51c77379 /base/file_util_win.cc | |
parent | 0b88baec73430cb25a4d6181b47c221f99fe5d0f (diff) | |
download | chromium_src-c870c76357fc05d3f7181f8121181f983bd25e7f.zip chromium_src-c870c76357fc05d3f7181f8121181f983bd25e7f.tar.gz chromium_src-c870c76357fc05d3f7181f8121181f983bd25e7f.tar.bz2 |
Safe browsing cleanup:
* wstring -> FilePath
* create versions of WriteFile/ReadFile with FilePath signatures
Review URL: http://codereview.chromium.org/19610
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8797 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r-- | base/file_util_win.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 0bd50cb..0947827 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -497,8 +497,8 @@ FILE* OpenFile(const std::string& filename, const char* mode) { return file; } -int ReadFile(const std::wstring& filename, char* data, int size) { - ScopedHandle file(CreateFile(filename.c_str(), +int ReadFile(const FilePath& filename, char* data, int size) { + ScopedHandle file(CreateFile(filename.value().c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, @@ -519,8 +519,8 @@ int ReadFile(const std::wstring& filename, char* data, int size) { return ret_value; } -int WriteFile(const std::wstring& filename, const char* data, int size) { - ScopedHandle file(CreateFile(filename.c_str(), +int WriteFile(const FilePath& filename, const char* data, int size) { + ScopedHandle file(CreateFile(filename.value().c_str(), GENERIC_WRITE, 0, NULL, @@ -528,7 +528,7 @@ int WriteFile(const std::wstring& filename, const char* data, int size) { 0, NULL)); if (file == INVALID_HANDLE_VALUE) { - LOG(WARNING) << "CreateFile failed for path " << filename << + LOG(WARNING) << "CreateFile failed for path " << filename.value() << " error code=" << GetLastError() << " error text=" << win_util::FormatLastWin32Error(); return -1; @@ -541,13 +541,13 @@ int WriteFile(const std::wstring& filename, const char* data, int size) { if (!result) { // WriteFile failed. - LOG(WARNING) << "writing file " << filename << + LOG(WARNING) << "writing file " << filename.value() << " failed, error code=" << GetLastError() << " description=" << win_util::FormatLastWin32Error(); } else { // Didn't write all the bytes. - LOG(WARNING) << "wrote" << written << " bytes to " << filename << - " expected " << size; + LOG(WARNING) << "wrote" << written << " bytes to " << + filename.value() << " expected " << size; } return -1; } |