From 589f7e0a57675efce9810c15a3e9b7c49bf0bc90 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 29 Oct 2015 14:56:26 -0400 Subject: 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. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1415933005 . --- core/src/fpdftext/fpdf_text.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'core/src/fpdftext/fpdf_text.cpp') diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index 9ecbc21bda..e9ad338025 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -436,10 +436,8 @@ void NormalizeString(CFX_WideString& str) { static FX_BOOL IsNumber(CFX_WideString& str) { for (int i = 0; i < str.GetLength(); i++) { FX_WCHAR ch = str[i]; - if ((ch < '0' || ch > '9') && ch != '-' && ch != '+' && ch != '.' && - ch != ' ') { + if (!std::isdigit(ch) && ch != '-' && ch != '+' && ch != '.' && ch != ' ') return FALSE; - } } return TRUE; } -- cgit v1.2.3