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

Unified Diff: core/src/fxcrt/fx_basic_util.cpp

Issue 1405253007: Revert "Revert "Cleanup some numeric code."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix mac build Created 5 years, 2 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
Index: core/src/fxcrt/fx_basic_util.cpp
diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp
index 46a0dec1e538884370b92f7865aa84d1fde13722..70bbacc7e822ca963901c1cc78ccf6d55ebf1614 100644
--- a/core/src/fxcrt/fx_basic_util.cpp
+++ b/core/src/fxcrt/fx_basic_util.cpp
@@ -11,6 +11,9 @@
#else
#include <direct.h>
#endif
+
+#include <cctype>
+
CFX_PrivateData::~CFX_PrivateData() {
ClearAll();
}
@@ -101,13 +104,13 @@ void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData) {
cc++;
}
while (cc < len) {
- if (str[cc] < '0' || str[cc] > '9') {
+ if (!std::isdigit(str[cc]))
break;
- }
+
integer = integer * 10 + str[cc] - '0';
- if (integer < 0) {
+ if (integer < 0)
break;
- }
+
cc++;
}
if (bNegative) {

Powered by Google App Engine
This is Rietveld 408576698