OLD | NEW |
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_platforms.h" | 7 #include "core/fxcrt/fxcrt_platforms.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_basic.h" | 9 #include "core/fxcrt/include/fx_basic.h" |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 CFXCRT_FileAccess_CRT::~CFXCRT_FileAccess_CRT() { | 37 CFXCRT_FileAccess_CRT::~CFXCRT_FileAccess_CRT() { |
38 Close(); | 38 Close(); |
39 } | 39 } |
40 FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, | 40 FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, |
41 uint32_t dwMode) { | 41 uint32_t dwMode) { |
42 if (m_hFile) { | 42 if (m_hFile) { |
43 return FALSE; | 43 return FALSE; |
44 } | 44 } |
45 CFX_ByteString strMode; | 45 CFX_ByteString strMode; |
46 FXCRT_GetFileModeString(dwMode, strMode); | 46 FXCRT_GetFileModeString(dwMode, strMode); |
47 m_hFile = FXSYS_fopen(fileName.GetCStr(), strMode.c_str()); | 47 m_hFile = FXSYS_fopen(fileName.c_str(), strMode.c_str()); |
48 return m_hFile != NULL; | 48 return m_hFile != NULL; |
49 } | 49 } |
50 FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& fileName, | 50 FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& 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 CFX_WideString strMode; | 55 CFX_WideString strMode; |
56 FXCRT_GetFileModeString(dwMode, strMode); | 56 FXCRT_GetFileModeString(dwMode, strMode); |
57 m_hFile = FXSYS_wfopen(fileName.GetPtr(), strMode.c_str()); | 57 m_hFile = FXSYS_wfopen(fileName.raw_str(), strMode.c_str()); |
58 return m_hFile != NULL; | 58 return m_hFile != NULL; |
59 } | 59 } |
60 void CFXCRT_FileAccess_CRT::Close() { | 60 void CFXCRT_FileAccess_CRT::Close() { |
61 if (!m_hFile) { | 61 if (!m_hFile) { |
62 return; | 62 return; |
63 } | 63 } |
64 FXSYS_fclose(m_hFile); | 64 FXSYS_fclose(m_hFile); |
65 m_hFile = NULL; | 65 m_hFile = NULL; |
66 } | 66 } |
67 void CFXCRT_FileAccess_CRT::Release() { | 67 void CFXCRT_FileAccess_CRT::Release() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 FX_BOOL CFXCRT_FileAccess_CRT::Flush() { | 123 FX_BOOL CFXCRT_FileAccess_CRT::Flush() { |
124 if (!m_hFile) { | 124 if (!m_hFile) { |
125 return FALSE; | 125 return FALSE; |
126 } | 126 } |
127 return !FXSYS_fflush(m_hFile); | 127 return !FXSYS_fflush(m_hFile); |
128 } | 128 } |
129 FX_BOOL CFXCRT_FileAccess_CRT::Truncate(FX_FILESIZE szFile) { | 129 FX_BOOL CFXCRT_FileAccess_CRT::Truncate(FX_FILESIZE szFile) { |
130 return FALSE; | 130 return FALSE; |
131 } | 131 } |
132 #endif | 132 #endif |
OLD | NEW |