diff options
author | dan sinclair <dsinclair@chromium.org> | 2015-11-10 13:33:04 -0500 |
---|---|---|
committer | dan sinclair <dsinclair@chromium.org> | 2015-11-10 13:33:04 -0500 |
commit | 0569ab0b11b723d9bca4ddd642b0cf8828c4bdd1 (patch) | |
tree | d0f6ba295574785c773536be7b5526680ed60f04 /core/include/fxcrt/fx_ext.h | |
parent | e6e16954f0cdc324849fca9da883be8f131b3834 (diff) | |
download | pdfium-0569ab0b11b723d9bca4ddd642b0cf8828c4bdd1.tar.xz |
Revert x4 "Cleanup some numeric code."
This reverts commit b27902b8995bb3e003daed6b0811ed746763c68d.
Cleanup some numeric code.
This changes the various comparisons of char >= '0' && char <= '9' and
char < '0' || char > '9' to use std::isdigit checks. It also cleans up
a handful of hex to digit conversions to call one common method.
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1432973003 .
Diffstat (limited to 'core/include/fxcrt/fx_ext.h')
-rw-r--r-- | core/include/fxcrt/fx_ext.h | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index f13d37caf4..c24955fb7c 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -7,11 +7,12 @@ #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ #define CORE_INCLUDE_FXCRT_FX_EXT_H_ -#include <cctype> -#include <cwctype> - #include "fx_system.h" +#ifdef __cplusplus +extern "C" { +#endif + FX_FLOAT FXSYS_tan(FX_FLOAT a); FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, @@ -37,25 +38,6 @@ inline int32_t FXSYS_toupper(int32_t ch) { return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); } -inline int FXSYS_toHexDigit(const FX_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_CHAR c) { - if (!std::isdigit(c)) - return 0; - return c - '0'; -} - -inline int FXSYS_toDecimalDigitWide(const FX_WCHAR c) { - if (!std::iswdigit(c)) - return 0; - return c - L'0'; -} - FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); @@ -63,6 +45,13 @@ 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); @@ -74,7 +63,9 @@ 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: |