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

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

Issue 2477443002: Remove FX_BOOL from core (Closed)
Patch Set: Created 4 years, 1 month 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_stream.cpp ('k') | core/fxcrt/xml_int.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/fx_string.h" 9 #include "core/fxcrt/fx_string.h"
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 CFXCRT_FileAccess_Win64::CFXCRT_FileAccess_Win64() : m_hFile(nullptr) {} 44 CFXCRT_FileAccess_Win64::CFXCRT_FileAccess_Win64() : m_hFile(nullptr) {}
45 45
46 CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() { 46 CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() {
47 Close(); 47 Close();
48 } 48 }
49 49
50 bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, 50 bool CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName,
51 uint32_t dwMode) { 51 uint32_t dwMode) {
52 if (m_hFile) 52 if (m_hFile)
53 return FALSE; 53 return false;
54 54
55 uint32_t dwAccess, dwShare, dwCreation; 55 uint32_t dwAccess, dwShare, dwCreation;
56 FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); 56 FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
57 m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, nullptr, 57 m_hFile = ::CreateFileA(fileName.c_str(), dwAccess, dwShare, nullptr,
58 dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr); 58 dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr);
59 if (m_hFile == INVALID_HANDLE_VALUE) 59 if (m_hFile == INVALID_HANDLE_VALUE)
60 m_hFile = nullptr; 60 m_hFile = nullptr;
61 61
62 return !!m_hFile; 62 return !!m_hFile;
63 } 63 }
64 64
65 bool CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, 65 bool CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName,
66 uint32_t dwMode) { 66 uint32_t dwMode) {
67 if (m_hFile) 67 if (m_hFile)
68 return FALSE; 68 return false;
69 69
70 uint32_t dwAccess, dwShare, dwCreation; 70 uint32_t dwAccess, dwShare, dwCreation;
71 FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); 71 FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation);
72 m_hFile = ::CreateFileW((LPCWSTR)fileName.c_str(), dwAccess, dwShare, nullptr, 72 m_hFile = ::CreateFileW((LPCWSTR)fileName.c_str(), dwAccess, dwShare, nullptr,
73 dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr); 73 dwCreation, FILE_ATTRIBUTE_NORMAL, nullptr);
74 if (m_hFile == INVALID_HANDLE_VALUE) 74 if (m_hFile == INVALID_HANDLE_VALUE)
75 m_hFile = nullptr; 75 m_hFile = nullptr;
76 76
77 return !!m_hFile; 77 return !!m_hFile;
78 } 78 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return !!::FlushFileBuffers(m_hFile); 179 return !!::FlushFileBuffers(m_hFile);
180 } 180 }
181 181
182 bool CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) { 182 bool CFXCRT_FileAccess_Win64::Truncate(FX_FILESIZE szFile) {
183 if (SetPosition(szFile) == (FX_FILESIZE)-1) 183 if (SetPosition(szFile) == (FX_FILESIZE)-1)
184 return false; 184 return false;
185 185
186 return !!::SetEndOfFile(m_hFile); 186 return !!::SetEndOfFile(m_hFile);
187 } 187 }
188 #endif 188 #endif
OLDNEW
« no previous file with comments | « core/fxcrt/fxcrt_stream.cpp ('k') | core/fxcrt/xml_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698