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

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

Issue 1757283002: Combine StrToInt methods. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « no previous file | core/src/fxcrt/fx_basic_gcc.cpp » ('j') | core/src/fxcrt/fx_basic_gcc.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/include/fxcrt/fx_ext.h
diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h
index 3f4f6681908950772e9cf1bdef41cf061520366b..e7e170225838957ee0d0a5ebbe8908ced7865c2f 100644
--- a/core/include/fxcrt/fx_ext.h
+++ b/core/include/fxcrt/fx_ext.h
@@ -53,13 +53,33 @@ inline int FXSYS_toHexDigit(const FX_CHAR c) {
return upchar > '9' ? upchar - 'A' + 10 : upchar - '0';
}
+inline bool FXSYS_isDecimalDigit(const FX_CHAR c) {
+ return std::isdigit(c);
+}
+
+inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) {
+ return std::iswdigit(c);
+}
+
+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.
+ if (!std::isdigit(c))
+ return 0;
+ return c - '0';
+}
+
+inline int FXSYS_toDecimalDigit(const int c) {
+ if (!std::isdigit(c))
+ return 0;
+ return c - '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) {
+inline int FXSYS_toDecimalDigit(const FX_WCHAR c) {
if (!std::iswdigit(c))
return 0;
return c - L'0';
« no previous file with comments | « no previous file | core/src/fxcrt/fx_basic_gcc.cpp » ('j') | core/src/fxcrt/fx_basic_gcc.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698