| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cctype> | 10 #include <cctype> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return haystack; | 68 return haystack; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 haystack++; | 71 haystack++; |
| 72 } | 72 } |
| 73 return nullptr; | 73 return nullptr; |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace | 76 } // namespace |
| 77 | 77 |
| 78 static_assert(sizeof(CFX_ByteString) <= sizeof(FX_CHAR*), |
| 79 "Strings must not require more space than pointers"); |
| 80 |
| 78 CFX_ByteString::CFX_ByteString(const FX_CHAR* pStr, FX_STRSIZE nLen) { | 81 CFX_ByteString::CFX_ByteString(const FX_CHAR* pStr, FX_STRSIZE nLen) { |
| 79 if (nLen < 0) | 82 if (nLen < 0) |
| 80 nLen = pStr ? FXSYS_strlen(pStr) : 0; | 83 nLen = pStr ? FXSYS_strlen(pStr) : 0; |
| 81 | 84 |
| 82 if (nLen) | 85 if (nLen) |
| 83 m_pData.Reset(StringData::Create(pStr, nLen)); | 86 m_pData.Reset(StringData::Create(pStr, nLen)); |
| 84 } | 87 } |
| 85 | 88 |
| 86 CFX_ByteString::CFX_ByteString(const uint8_t* pStr, FX_STRSIZE nLen) { | 89 CFX_ByteString::CFX_ByteString(const uint8_t* pStr, FX_STRSIZE nLen) { |
| 87 if (nLen > 0) { | 90 if (nLen > 0) { |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 fraction %= scale; | 990 fraction %= scale; |
| 988 scale /= 10; | 991 scale /= 10; |
| 989 } | 992 } |
| 990 return buf_size; | 993 return buf_size; |
| 991 } | 994 } |
| 992 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { | 995 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { |
| 993 FX_CHAR buf[32]; | 996 FX_CHAR buf[32]; |
| 994 FX_STRSIZE len = FX_ftoa(d, buf); | 997 FX_STRSIZE len = FX_ftoa(d, buf); |
| 995 return CFX_ByteString(buf, len); | 998 return CFX_ByteString(buf, len); |
| 996 } | 999 } |
| OLD | NEW |