diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 19:08:45 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-08 13:51:31 +0100 |
commit | 2bde8e466a4451c7319e3a072d118917957d6554 (patch) | |
tree | 28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebCore/platform/wince | |
parent | 6939c99b71d9372d14a0c74a772108052e8c48c8 (diff) | |
download | external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2 |
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebCore/platform/wince')
-rw-r--r-- | Source/WebCore/platform/wince/FileSystemWinCE.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/Source/WebCore/platform/wince/FileSystemWinCE.cpp b/Source/WebCore/platform/wince/FileSystemWinCE.cpp index 49acf12..3e28a01 100644 --- a/Source/WebCore/platform/wince/FileSystemWinCE.cpp +++ b/Source/WebCore/platform/wince/FileSystemWinCE.cpp @@ -187,18 +187,18 @@ String directoryName(const String& path) return path.left(pos); } -CString openTemporaryFile(const char*, PlatformFileHandle& handle) +String openTemporaryFile(const String&, PlatformFileHandle& handle) { handle = INVALID_HANDLE_VALUE; wchar_t tempPath[MAX_PATH]; int tempPathLength = ::GetTempPath(WTF_ARRAY_LENGTH(tempPath), tempPath); if (tempPathLength <= 0 || tempPathLength > WTF_ARRAY_LENGTH(tempPath)) - return CString(); + return String(); HCRYPTPROV hCryptProv = 0; if (!CryptAcquireContext(&hCryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) - return CString(); + return String(); String proposedPath; while (1) { @@ -229,9 +229,28 @@ CString openTemporaryFile(const char*, PlatformFileHandle& handle) CryptReleaseContext(hCryptProv, 0); if (!isHandleValid(handle)) - return CString(); + return String(); + + return proposedPath; +} + +PlatformFileHandle openFile(const String& path, FileOpenMode mode) +{ + DWORD desiredAccess = 0; + DWORD creationDisposition = 0; + switch (mode) { + case OpenForRead: + desiredAccess = GENERIC_READ; + creationDisposition = OPEN_EXISTING; + case OpenForWrite: + desiredAccess = GENERIC_WRITE; + creationDisposition = CREATE_ALWAYS; + default: + ASSERT_NOT_REACHED(); + } - return proposedPath.latin1(); + String destination = path; + return CreateFile(destination.charactersWithNullTermination(), desiredAccess, 0, 0, creationDisposition, FILE_ATTRIBUTE_NORMAL, 0); } void closeFile(PlatformFileHandle& handle) |