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

Unified Diff: trunk/src/base/file_util_win.cc

Issue 105823009: Revert 239280 "Move more file_util functions to base namespace." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 | « trunk/src/base/file_util_unittest.cc ('k') | trunk/src/base/files/file_util_proxy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/base/file_util_win.cc
===================================================================
--- trunk/src/base/file_util_win.cc (revision 239399)
+++ trunk/src/base/file_util_win.cc (working copy)
@@ -264,7 +264,7 @@
// Open file in binary mode, to avoid problems with fwrite. On Windows
// it replaces \n's with \r\n's, which may surprise you.
// Reference: http://msdn.microsoft.com/en-us/library/h9t88zwz(VS.71).aspx
- return OpenFile(*path, "wb+");
+ return file_util::OpenFile(*path, "wb+");
}
bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) {
@@ -530,14 +530,29 @@
return true;
}
+} // namespace base
+
+// -----------------------------------------------------------------------------
+
+namespace file_util {
+
+using base::DirectoryExists;
+using base::FilePath;
+using base::kFileShareAll;
+
FILE* OpenFile(const FilePath& filename, const char* mode) {
- ThreadRestrictions::AssertIOAllowed();
+ base::ThreadRestrictions::AssertIOAllowed();
std::wstring w_mode = ASCIIToWide(std::string(mode));
return _wfsopen(filename.value().c_str(), w_mode.c_str(), _SH_DENYNO);
}
+FILE* OpenFile(const std::string& filename, const char* mode) {
+ base::ThreadRestrictions::AssertIOAllowed();
+ return _fsopen(filename.c_str(), mode, _SH_DENYNO);
+}
+
int ReadFile(const FilePath& filename, char* data, int size) {
- ThreadRestrictions::AssertIOAllowed();
+ base::ThreadRestrictions::AssertIOAllowed();
base::win::ScopedHandle file(CreateFile(filename.value().c_str(),
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -555,21 +570,6 @@
return -1;
}
-} // namespace base
-
-// -----------------------------------------------------------------------------
-
-namespace file_util {
-
-using base::DirectoryExists;
-using base::FilePath;
-using base::kFileShareAll;
-
-FILE* OpenFile(const std::string& filename, const char* mode) {
- base::ThreadRestrictions::AssertIOAllowed();
- return _fsopen(filename.c_str(), mode, _SH_DENYNO);
-}
-
int WriteFile(const FilePath& filename, const char* data, int size) {
base::ThreadRestrictions::AssertIOAllowed();
base::win::ScopedHandle file(CreateFile(filename.value().c_str(),
« no previous file with comments | « trunk/src/base/file_util_unittest.cc ('k') | trunk/src/base/files/file_util_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698