Chromium Code Reviews| 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 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 9 | 9 |
| 10 #include <cctype> | 10 #include <cctype> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); | 46 return FXSYS_iswalpha(wch) || FXSYS_iswdigit(wch); |
| 47 } | 47 } |
| 48 | 48 |
| 49 inline int FXSYS_toHexDigit(const FX_CHAR c) { | 49 inline int FXSYS_toHexDigit(const FX_CHAR c) { |
| 50 if (!std::isxdigit(c)) | 50 if (!std::isxdigit(c)) |
| 51 return 0; | 51 return 0; |
| 52 char upchar = std::toupper(c); | 52 char upchar = std::toupper(c); |
| 53 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; | 53 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; |
| 54 } | 54 } |
| 55 | 55 |
| 56 inline bool FXSYS_isDecimalDigit(const FX_CHAR c) { | |
| 57 return std::isdigit(c); | |
| 58 } | |
| 59 | |
| 60 inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) { | |
| 61 return std::iswdigit(c); | |
| 62 } | |
| 63 | |
| 64 inline int FXSYS_toDecimalDigit(const uint8_t c) { | |
|
Tom Sepez
2016/03/03 19:26:47
I worry about duplicate definitions if we hit a pl
dsinclair
2016/03/03 19:36:12
So, if I try to compile without these I get errors
Tom Sepez
2016/03/03 20:14:58
Yes, that would be clearer and safer.
dsinclair
2016/03/03 20:26:01
Done.
| |
| 65 if (!std::isdigit(c)) | |
| 66 return 0; | |
| 67 return c - '0'; | |
| 68 } | |
| 69 | |
| 70 inline int FXSYS_toDecimalDigit(const int c) { | |
| 71 if (!std::isdigit(c)) | |
| 72 return 0; | |
| 73 return c - '0'; | |
| 74 } | |
| 75 | |
| 56 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { | 76 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { |
| 57 if (!std::isdigit(c)) | 77 if (!std::isdigit(c)) |
| 58 return 0; | 78 return 0; |
| 59 return c - '0'; | 79 return c - '0'; |
| 60 } | 80 } |
| 61 | 81 |
| 62 inline int FXSYS_toDecimalDigitWide(const FX_WCHAR c) { | 82 inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { |
| 63 if (!std::iswdigit(c)) | 83 if (!std::iswdigit(c)) |
| 64 return 0; | 84 return 0; |
| 65 return c - L'0'; | 85 return c - L'0'; |
| 66 } | 86 } |
| 67 | 87 |
| 68 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, | 88 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, |
| 69 int32_t iLength, | 89 int32_t iLength, |
| 70 FX_BOOL bIgnoreCase = FALSE); | 90 FX_BOOL bIgnoreCase = FALSE); |
| 71 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, | 91 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, |
| 72 int32_t iLength, | 92 int32_t iLength, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 j -= gap; | 135 j -= gap; |
| 116 } | 136 } |
| 117 pArray[j + gap] = v1; | 137 pArray[j + gap] = v1; |
| 118 } | 138 } |
| 119 gap >>= 1; | 139 gap >>= 1; |
| 120 } | 140 } |
| 121 } | 141 } |
| 122 }; | 142 }; |
| 123 | 143 |
| 124 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 144 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| OLD | NEW |