| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 inline int FXSYS_toHexDigit(const FX_CHAR c) { | 55 inline int FXSYS_toHexDigit(const FX_CHAR c) { |
| 56 if (!std::isxdigit(c)) | 56 if (!std::isxdigit(c)) |
| 57 return 0; | 57 return 0; |
| 58 char upchar = std::toupper(c); | 58 char upchar = std::toupper(c); |
| 59 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; | 59 return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; |
| 60 } | 60 } |
| 61 | 61 |
| 62 inline bool FXSYS_isDecimalDigit(const FX_CHAR c) { | 62 inline bool FXSYS_isDecimalDigit(const FX_CHAR c) { |
| 63 return std::isdigit(c); | 63 return !!std::isdigit(c); |
| 64 } | 64 } |
| 65 | 65 |
| 66 inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) { | 66 inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) { |
| 67 return std::iswdigit(c); | 67 return !!std::iswdigit(c); |
| 68 } | 68 } |
| 69 | 69 |
| 70 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { | 70 inline int FXSYS_toDecimalDigit(const FX_CHAR c) { |
| 71 if (!std::isdigit(c)) | 71 return std::isdigit(c) ? c - '0' : 0; |
| 72 return 0; | |
| 73 return c - '0'; | |
| 74 } | 72 } |
| 75 | 73 |
| 76 inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { | 74 inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { |
| 77 if (!std::iswdigit(c)) | 75 return std::iswdigit(c) ? c - L'0' : 0; |
| 78 return 0; | |
| 79 return c - L'0'; | |
| 80 } | 76 } |
| 81 | 77 |
| 82 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, | 78 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, |
| 83 int32_t iLength, | 79 int32_t iLength, |
| 84 FX_BOOL bIgnoreCase = FALSE); | 80 FX_BOOL bIgnoreCase = FALSE); |
| 85 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, | 81 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, |
| 86 int32_t iLength, | 82 int32_t iLength, |
| 87 FX_BOOL bIgnoreCase = FALSE); | 83 FX_BOOL bIgnoreCase = FALSE); |
| 88 | 84 |
| 89 void* FX_Random_MT_Start(FX_DWORD dwSeed); | 85 void* FX_Random_MT_Start(FX_DWORD dwSeed); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 j -= gap; | 125 j -= gap; |
| 130 } | 126 } |
| 131 pArray[j + gap] = v1; | 127 pArray[j + gap] = v1; |
| 132 } | 128 } |
| 133 gap >>= 1; | 129 gap >>= 1; |
| 134 } | 130 } |
| 135 } | 131 } |
| 136 }; | 132 }; |
| 137 | 133 |
| 138 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 134 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| OLD | NEW |