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

Side by Side Diff: core/fxcrt/fxcrt_windows.cpp

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « core/fxcrt/fxcrt_posix.cpp ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fxcrt/fxcrt_windows.h" 7 #include "core/fxcrt/fxcrt_windows.h"
8 8
9 #include "core/fxcrt/include/fx_string.h" 9 #include "core/fxcrt/include/fx_string.h"
10 10
(...skipping 29 matching lines...) Expand all
40 CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() { 40 CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() {
41 Close(); 41 Close();
42 } 42 }
43 FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, 43 FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName,
44 uint32_t dwMode) { 44 uint32_t dwMode) {
45 if (m_hFile) { 45 if (m_hFile) {
46 return FALSE; 46 return FALSE;
47 } 47 }
48 uint32_t dwAccess, dwShare, dwCreation; 48 uint32_t dwAccess, dwShare, dwCreation;
49 FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); 49 FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
50 m_hFile = ::CreateFileA(fileName.GetCStr(), dwAccess, dwShare, NULL, 50 m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, NULL, dwCreation,
51 dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); 51 FILE_ATTRIBUTE_NORMAL, NULL);
52 if (m_hFile == INVALID_HANDLE_VALUE) { 52 if (m_hFile == INVALID_HANDLE_VALUE) {
53 m_hFile = NULL; 53 m_hFile = NULL;
54 } 54 }
55 return m_hFile != NULL; 55 return m_hFile != NULL;
56 } 56 }
57 FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, 57 FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName,
58 uint32_t dwMode) { 58 uint32_t dwMode) {
59 if (m_hFile) { 59 if (m_hFile) {
60 return FALSE; 60 return FALSE;
61 } 61 }
62 uint32_t dwAccess, dwShare, dwCreation; 62 uint32_t dwAccess, dwShare, dwCreation;
63 FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); 63 FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
64 m_hFile = ::CreateFileW((LPCWSTR)fileName.GetPtr(), dwAccess, dwShare, NULL, 64 m_hFile = ::CreateFileW((LPCWSTR)fileName.raw_str(), dwAccess, dwShare, NULL,
65 dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); 65 dwCreation, FILE_ATTRIBUTE_NORMAL, NULL);
66 if (m_hFile == INVALID_HANDLE_VALUE) { 66 if (m_hFile == INVALID_HANDLE_VALUE) {
67 m_hFile = NULL; 67 m_hFile = NULL;
68 } 68 }
69 return m_hFile != NULL; 69 return m_hFile != NULL;
70 } 70 }
71 void CFXCRT_FileAccess_Win64::Close() { 71 void CFXCRT_FileAccess_Win64::Close() {
72 if (!m_hFile) { 72 if (!m_hFile) {
73 return; 73 return;
74 } 74 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 return ::FlushFileBuffers(m_hFile); 164 return ::FlushFileBuffers(m_hFile);
165 } 165 }
166 FX_BOOL CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) { 166 FX_BOOL CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) {
167 if (SetPosition(szFile) == (FX_FILESIZE)-1) { 167 if (SetPosition(szFile) == (FX_FILESIZE)-1) {
168 return FALSE; 168 return FALSE;
169 } 169 }
170 return ::SetEndOfFile(m_hFile); 170 return ::SetEndOfFile(m_hFile);
171 } 171 }
172 #endif 172 #endif
OLDNEW
« no previous file with comments | « core/fxcrt/fxcrt_posix.cpp ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698