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 "xfa/fgas/crt/fgas_stream.h" | 7 #include "xfa/fgas/crt/fgas_stream.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 if (m_hFile != NULL) { | 381 if (m_hFile != NULL) { |
382 FXSYS_fclose(m_hFile); | 382 FXSYS_fclose(m_hFile); |
383 } | 383 } |
384 } | 384 } |
385 FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, | 385 FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, |
386 uint32_t dwAccess) { | 386 uint32_t dwAccess) { |
387 FXSYS_assert(m_hFile == NULL); | 387 FXSYS_assert(m_hFile == NULL); |
388 FXSYS_assert(pszSrcFileName != NULL && FXSYS_wcslen(pszSrcFileName) > 0); | 388 FXSYS_assert(pszSrcFileName != NULL && FXSYS_wcslen(pszSrcFileName) > 0); |
389 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ | 389 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ |
390 _FX_OS_ == _FX_WIN64_ | 390 _FX_OS_ == _FX_WIN64_ |
391 CFX_WideString wsMode; | 391 const FX_WCHAR* wsMode; |
392 if (dwAccess & FX_STREAMACCESS_Write) { | 392 if (dwAccess & FX_STREAMACCESS_Write) { |
393 if (dwAccess & FX_STREAMACCESS_Append) { | 393 if (dwAccess & FX_STREAMACCESS_Append) { |
394 wsMode = L"a+b"; | 394 wsMode = L"a+b"; |
395 } else if (dwAccess & FX_STREAMACCESS_Truncate) { | 395 } else if (dwAccess & FX_STREAMACCESS_Truncate) { |
396 wsMode = L"w+b"; | 396 wsMode = L"w+b"; |
397 } else { | 397 } else { |
398 wsMode = L"r+b"; | 398 wsMode = L"r+b"; |
399 } | 399 } |
400 } else { | 400 } else { |
401 wsMode = L"rb"; | 401 wsMode = L"rb"; |
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 return m_pStream->WriteData((const uint8_t*)pData, (int32_t)size) == | 1617 return m_pStream->WriteData((const uint8_t*)pData, (int32_t)size) == |
1618 (int32_t)size; | 1618 (int32_t)size; |
1619 } | 1619 } |
1620 FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, | 1620 FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, |
1621 FX_FILESIZE offset, | 1621 FX_FILESIZE offset, |
1622 size_t size) { | 1622 size_t size) { |
1623 m_pStream->Seek(FX_STREAMSEEK_Begin, offset); | 1623 m_pStream->Seek(FX_STREAMSEEK_Begin, offset); |
1624 int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size); | 1624 int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size); |
1625 return iLen == (int32_t)size; | 1625 return iLen == (int32_t)size; |
1626 } | 1626 } |
OLD | NEW |