Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: core/include/fxcrt/fx_ext.h

Issue 1452673002: Merge to XFA: Reland "Cleanup some numeric code."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/include/fxcrt/fx_ext.h
diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h
index 0853c895311b19193b6b7e18d2d8804b4897bcd9..d36ecfde4e7c9cdbb216998496e60f22090d845d 100644
--- a/core/include/fxcrt/fx_ext.h
+++ b/core/include/fxcrt/fx_ext.h
@@ -10,9 +10,8 @@
#include "fx_string.h"
#include "fx_system.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <cctype>
dsinclair 2015/11/16 17:44:48 Merge conflict.
+#include <cwctype>
FX_FLOAT FXSYS_tan(FX_FLOAT a);
FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x);
@@ -39,6 +38,25 @@ 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);
@@ -46,13 +64,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);
@@ -64,12 +75,6 @@ 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
dsinclair 2015/11/16 17:44:48 Merge conflict.
-}
-#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
typedef struct FX_GUID {
FX_DWORD data1;
@@ -84,9 +89,7 @@ void FX_GUID_CreateV4(FX_LPGUID pGUID);
void FX_GUID_ToString(FX_LPCGUID pGUID,
CFX_ByteString& bsStr,
FX_BOOL bSeparator = TRUE);
-#ifdef __cplusplus
dsinclair 2015/11/16 17:44:48 Merge conflict.
-}
-#endif
+
template <class baseType>
class CFX_SSortTemplate {
public:

Powered by Google App Engine
This is Rietveld 408576698