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

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

Issue 1449873003: Reland "Cleanup some numeric code."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix windows build 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
« no previous file with comments | « core/src/fxcodec/codec/fx_codec.cpp ('k') | core/src/fxcrt/fx_basic_gcc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_basic_bstring.cpp
diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp
index 9d64fbe1392cbb2453a04f89bda5fd0fdbd3361e..574e57a9a64058990726b7857b9bfb7aabb81424 100644
--- a/core/src/fxcrt/fx_basic_bstring.cpp
+++ b/core/src/fxcrt/fx_basic_bstring.cpp
@@ -5,6 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include <stddef.h> // For offsetof().
+#include <cctype>
#include "core/include/fxcrt/fx_basic.h"
#include "third_party/base/numerics/safe_math.h"
@@ -493,8 +494,8 @@ void CFX_ByteString::FormatV(const FX_CHAR* lpszFormat, va_list argList) {
}
if (nWidth == 0) {
nWidth = FXSYS_atoi(lpsz);
- for (; (*lpsz) >= '0' && (*lpsz) <= '9'; lpsz++)
- ;
+ while (std::isdigit(*lpsz))
+ lpsz++;
}
if (nWidth < 0 || nWidth > 128 * 1024) {
lpszFormat = "Bad width";
@@ -509,8 +510,8 @@ void CFX_ByteString::FormatV(const FX_CHAR* lpszFormat, va_list argList) {
lpsz++;
} else {
nPrecision = FXSYS_atoi(lpsz);
- for (; (*lpsz) >= '0' && (*lpsz) <= '9'; lpsz++)
- ;
+ while (std::isdigit(*lpsz))
+ lpsz++;
}
}
if (nPrecision < 0 || nPrecision > 128 * 1024) {
« no previous file with comments | « core/src/fxcodec/codec/fx_codec.cpp ('k') | core/src/fxcrt/fx_basic_gcc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698