Chromium Code Reviews| Index: core/include/fxcrt/fx_ext.h |
| diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h |
| index c24955fb7cb0de19b294a822a85c4671d9995bfc..9810e20e90a2974dec0657d34e45b7fce19f585d 100644 |
| --- a/core/include/fxcrt/fx_ext.h |
| +++ b/core/include/fxcrt/fx_ext.h |
| @@ -7,11 +7,9 @@ |
| #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| #define CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| -#include "fx_system.h" |
| +#include <cctype> |
| -#ifdef __cplusplus |
| -extern "C" { |
| -#endif |
| +#include "fx_system.h" |
| FX_FLOAT FXSYS_tan(FX_FLOAT a); |
| FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); |
| @@ -38,6 +36,19 @@ inline int32_t FXSYS_toupper(int32_t ch) { |
| return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); |
| } |
| +inline int FXSYS_toHexDigit(const char c) { |
| + if (!std::isxdigit(c)) |
| + return 0; |
| + char upchar = std::toupper(c); |
| + return upchar > '9' ? upchar - 'A' + 10 : upchar - '0'; |
| +} |
| + |
| +inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { |
|
dsinclair
2015/11/03 21:05:48
This makes the windows build happy locally. If I t
Tom Sepez
2015/11/03 21:54:36
isdigit says: The behavior is undefined if the val
Tom Sepez
2015/11/03 22:02:51
If its http://build.chromium.org/p/client.pdfium/b
dsinclair
2015/11/04 14:45:01
Done.
|
| + if (!std::isdigit(c)) |
| + return 0; |
| + return c - '0'; |
| +} |
| + |
| FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, |
| int32_t iLength, |
| FX_BOOL bIgnoreCase = FALSE); |
| @@ -45,13 +56,6 @@ FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, |
| int32_t iLength, |
| FX_BOOL bIgnoreCase = FALSE); |
| -#ifdef __cplusplus |
| -} |
| -#endif |
| -#ifdef __cplusplus |
| -extern "C" { |
| -#endif |
| - |
| void* FX_Random_MT_Start(FX_DWORD dwSeed); |
| FX_DWORD FX_Random_MT_Generate(void* pContext); |
| @@ -63,9 +67,7 @@ void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); |
| void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); |
| void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); |
| -#ifdef __cplusplus |
| -} |
| -#endif |
| + |
| template <class baseType> |
| class CFX_SSortTemplate { |
| public: |