| 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 "../../include/fxcrt/fx_basic.h" | 7 #include "../../include/fxcrt/fx_basic.h" |
| 8 #include "../../../third_party/numerics/safe_math.h" | 8 #include "../../../third_party/numerics/safe_math.h" |
| 9 | 9 |
| 10 static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) | 10 static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 { | 940 { |
| 941 FXSYS_FILE* file = FXSYS_fopen(CFX_ByteString(filename), "rb"); | 941 FXSYS_FILE* file = FXSYS_fopen(CFX_ByteString(filename), "rb"); |
| 942 if (file == NULL) { | 942 if (file == NULL) { |
| 943 return CFX_ByteString(); | 943 return CFX_ByteString(); |
| 944 } | 944 } |
| 945 FXSYS_fseek(file, 0, FXSYS_SEEK_END); | 945 FXSYS_fseek(file, 0, FXSYS_SEEK_END); |
| 946 int len = FXSYS_ftell(file); | 946 int len = FXSYS_ftell(file); |
| 947 FXSYS_fseek(file, 0, FXSYS_SEEK_SET); | 947 FXSYS_fseek(file, 0, FXSYS_SEEK_SET); |
| 948 CFX_ByteString str; | 948 CFX_ByteString str; |
| 949 FX_LPSTR buf = str.GetBuffer(len); | 949 FX_LPSTR buf = str.GetBuffer(len); |
| 950 size_t readCnt = FXSYS_fread(buf, 1, len, file); | 950 FXSYS_fread(buf, 1, len, file); |
| 951 str.ReleaseBuffer(len); | 951 str.ReleaseBuffer(len); |
| 952 FXSYS_fclose(file); | 952 FXSYS_fclose(file); |
| 953 return str; | 953 return str; |
| 954 } | 954 } |
| 955 CFX_WideString CFX_ByteString::UTF8Decode() const | 955 CFX_WideString CFX_ByteString::UTF8Decode() const |
| 956 { | 956 { |
| 957 CFX_UTF8Decoder decoder; | 957 CFX_UTF8Decoder decoder; |
| 958 for (FX_STRSIZE i = 0; i < GetLength(); i ++) { | 958 for (FX_STRSIZE i = 0; i < GetLength(); i ++) { |
| 959 decoder.Input((FX_BYTE)m_pData->m_String[i]); | 959 decoder.Input((FX_BYTE)m_pData->m_String[i]); |
| 960 } | 960 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 FX_CHAR* pBuffer = (FX_CHAR*)(this + 1); | 1169 FX_CHAR* pBuffer = (FX_CHAR*)(this + 1); |
| 1170 FXSYS_memcpy32(pBuffer + m_Size, str.GetPtr(), len); | 1170 FXSYS_memcpy32(pBuffer + m_Size, str.GetPtr(), len); |
| 1171 m_Size += len; | 1171 m_Size += len; |
| 1172 } | 1172 } |
| 1173 void CFX_StringBufBase::Append(int i, FX_DWORD flags) | 1173 void CFX_StringBufBase::Append(int i, FX_DWORD flags) |
| 1174 { | 1174 { |
| 1175 char buf[32]; | 1175 char buf[32]; |
| 1176 int len = _Buffer_itoa(buf, i, flags); | 1176 int len = _Buffer_itoa(buf, i, flags); |
| 1177 Append(CFX_ByteStringC(buf, len)); | 1177 Append(CFX_ByteStringC(buf, len)); |
| 1178 } | 1178 } |
| OLD | NEW |