| 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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 if ((m_pStreamImp->GetAccessModes() & FX_STREAMACCESS_Write) == 0) { | 1105 if ((m_pStreamImp->GetAccessModes() & FX_STREAMACCESS_Write) == 0) { |
| 1106 return -1; | 1106 return -1; |
| 1107 } | 1107 } |
| 1108 if (m_wCodePage == FX_CODEPAGE_UTF8) { | 1108 if (m_wCodePage == FX_CODEPAGE_UTF8) { |
| 1109 int32_t len = iLength; | 1109 int32_t len = iLength; |
| 1110 CFX_UTF8Encoder encoder; | 1110 CFX_UTF8Encoder encoder; |
| 1111 while (len-- > 0) { | 1111 while (len-- > 0) { |
| 1112 encoder.Input(*pStr++); | 1112 encoder.Input(*pStr++); |
| 1113 } | 1113 } |
| 1114 CFX_ByteStringC bsResult = encoder.GetResult(); | 1114 CFX_ByteStringC bsResult = encoder.GetResult(); |
| 1115 m_pStreamImp->WriteData((const uint8_t*)bsResult.GetCStr(), | 1115 m_pStreamImp->WriteData((const uint8_t*)bsResult.c_str(), |
| 1116 bsResult.GetLength()); | 1116 bsResult.GetLength()); |
| 1117 } | 1117 } |
| 1118 return iLength; | 1118 return iLength; |
| 1119 } | 1119 } |
| 1120 CFX_Stream::CFX_Stream() | 1120 CFX_Stream::CFX_Stream() |
| 1121 : m_eStreamType(FX_SREAMTYPE_Unknown), | 1121 : m_eStreamType(FX_SREAMTYPE_Unknown), |
| 1122 m_pStreamImp(NULL), | 1122 m_pStreamImp(NULL), |
| 1123 m_dwAccess(0), | 1123 m_dwAccess(0), |
| 1124 m_iTotalSize(0), | 1124 m_iTotalSize(0), |
| 1125 m_iPosition(0), | 1125 m_iPosition(0), |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 return m_pStream->WriteData((const uint8_t*)pData, (int32_t)size) == | 1619 return m_pStream->WriteData((const uint8_t*)pData, (int32_t)size) == |
| 1620 (int32_t)size; | 1620 (int32_t)size; |
| 1621 } | 1621 } |
| 1622 FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, | 1622 FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, |
| 1623 FX_FILESIZE offset, | 1623 FX_FILESIZE offset, |
| 1624 size_t size) { | 1624 size_t size) { |
| 1625 m_pStream->Seek(FX_STREAMSEEK_Begin, offset); | 1625 m_pStream->Seek(FX_STREAMSEEK_Begin, offset); |
| 1626 int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size); | 1626 int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size); |
| 1627 return iLen == (int32_t)size; | 1627 return iLen == (int32_t)size; |
| 1628 } | 1628 } |
| OLD | NEW |