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

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

Issue 1084613006: Fix all remaining instances of FX_NEW. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: std::min Created 5 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/src/fxcrt/fxcrt_posix.cpp ('k') | core/src/fxge/agg/agg23/fx_agg_driver.cpp » ('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 "../../include/fxcrt/fx_ext.h" 7 #include "../../include/fxcrt/fx_ext.h"
8 #include "fxcrt_windows.h" 8 #include "fxcrt_windows.h"
9 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 9 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
10 FX_BOOL FX_File_Exist(FX_BSTR fileName) 10 FX_BOOL FX_File_Exist(FX_BSTR fileName)
11 { 11 {
12 FX_DWORD dwAttri = ::GetFileAttributesA(fileName.GetCStr()); 12 FX_DWORD dwAttri = ::GetFileAttributesA(fileName.GetCStr());
13 if (dwAttri == -1) { 13 if (dwAttri == -1) {
14 return FALSE; 14 return FALSE;
15 } 15 }
16 return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0; 16 return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0;
17 } 17 }
18 FX_BOOL FX_File_Exist(FX_WSTR fileName) 18 FX_BOOL FX_File_Exist(FX_WSTR fileName)
19 { 19 {
20 FX_DWORD dwAttri = ::GetFileAttributesW((LPCWSTR)fileName.GetPtr()); 20 FX_DWORD dwAttri = ::GetFileAttributesW((LPCWSTR)fileName.GetPtr());
21 if (dwAttri == -1) { 21 if (dwAttri == -1) {
22 return FALSE; 22 return FALSE;
23 } 23 }
24 return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0; 24 return (dwAttri & FILE_ATTRIBUTE_DIRECTORY) == 0;
25 } 25 }
26 IFXCRT_FileAccess* FXCRT_FileAccess_Create() 26 IFXCRT_FileAccess* FXCRT_FileAccess_Create()
27 { 27 {
28 return FX_NEW CFXCRT_FileAccess_Win64; 28 return new CFXCRT_FileAccess_Win64;
29 } 29 }
30 void FXCRT_Windows_GetFileMode(FX_DWORD dwMode, FX_DWORD &dwAccess, FX_DWORD &dw Share, FX_DWORD &dwCreation) 30 void FXCRT_Windows_GetFileMode(FX_DWORD dwMode, FX_DWORD &dwAccess, FX_DWORD &dw Share, FX_DWORD &dwCreation)
31 { 31 {
32 dwAccess = GENERIC_READ; 32 dwAccess = GENERIC_READ;
33 dwShare = FILE_SHARE_READ | FILE_SHARE_WRITE; 33 dwShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
34 if (!(dwMode & FX_FILEMODE_ReadOnly)) { 34 if (!(dwMode & FX_FILEMODE_ReadOnly)) {
35 dwAccess |= GENERIC_WRITE; 35 dwAccess |= GENERIC_WRITE;
36 dwCreation = (dwMode & FX_FILEMODE_Truncate) ? CREATE_ALWAYS : OPEN_ALWA YS; 36 dwCreation = (dwMode & FX_FILEMODE_Truncate) ? CREATE_ALWAYS : OPEN_ALWA YS;
37 } else { 37 } else {
38 dwCreation = OPEN_EXISTING; 38 dwCreation = OPEN_EXISTING;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst) 206 FX_BOOL FX_File_Move(FX_BSTR fileNameSrc, FX_BSTR fileNameDst)
207 { 207 {
208 return ::MoveFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr()); 208 return ::MoveFileA(fileNameSrc.GetCStr(), fileNameDst.GetCStr());
209 } 209 }
210 FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst) 210 FX_BOOL FX_File_Move(FX_WSTR fileNameSrc, FX_WSTR fileNameDst)
211 { 211 {
212 return ::MoveFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPt r()); 212 return ::MoveFileW((LPCWSTR)fileNameSrc.GetPtr(), (LPCWSTR)fileNameDst.GetPt r());
213 } 213 }
214 #endif 214 #endif
OLDNEW
« no previous file with comments | « core/src/fxcrt/fxcrt_posix.cpp ('k') | core/src/fxge/agg/agg23/fx_agg_driver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698