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

Unified Diff: base/platform_file_posix.cc

Issue 270066: Step 2 in porting disk cache to using FilePath. (Closed)
Patch Set: deprecated Created 11 years, 2 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/platform_file.h ('k') | base/platform_file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/platform_file_posix.cc
diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc
index 623223c541950993a08a847b193f7e35ece24713..46039b980ffe2ba788786ada360ba0c21e3f49b3 100644
--- a/base/platform_file_posix.cc
+++ b/base/platform_file_posix.cc
@@ -8,14 +8,14 @@
#include <errno.h>
#include <sys/stat.h>
+#include "base/file_path.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
namespace base {
// TODO(erikkay): does it make sense to support PLATFORM_FILE_EXCLUSIVE_* here?
-PlatformFile CreatePlatformFile(const std::wstring& name,
- int flags,
+PlatformFile CreatePlatformFile(const FilePath& name, int flags,
bool* created) {
int open_flags = 0;
if (flags & PLATFORM_FILE_CREATE)
@@ -43,8 +43,7 @@ PlatformFile CreatePlatformFile(const std::wstring& name,
DCHECK(O_RDONLY == 0);
- int descriptor = open(WideToUTF8(name).c_str(), open_flags,
- S_IRUSR | S_IWUSR);
+ int descriptor = open(name.value().c_str(), open_flags, S_IRUSR | S_IWUSR);
if (flags & PLATFORM_FILE_OPEN_ALWAYS) {
if (descriptor > 0) {
@@ -56,20 +55,24 @@ PlatformFile CreatePlatformFile(const std::wstring& name,
flags & PLATFORM_FILE_EXCLUSIVE_WRITE) {
open_flags |= O_EXCL; // together with O_CREAT implies O_NOFOLLOW
}
- descriptor = open(WideToUTF8(name).c_str(), open_flags,
- S_IRUSR | S_IWUSR);
+ descriptor = open(name.value().c_str(), open_flags, S_IRUSR | S_IWUSR);
if (created && descriptor > 0)
*created = true;
}
}
if ((descriptor > 0) && (flags & PLATFORM_FILE_DELETE_ON_CLOSE)) {
- unlink(WideToUTF8(name).c_str());
+ unlink(name.value().c_str());
}
return descriptor;
}
+PlatformFile CreatePlatformFile(const std::wstring& name, int flags,
+ bool* created) {
+ return CreatePlatformFile(FilePath::FromWStringHack(name), flags, created);
+}
+
bool ClosePlatformFile(PlatformFile file) {
return close(file);
}
« no previous file with comments | « base/platform_file.h ('k') | base/platform_file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698