From ce56557ef58facf2519f541d5cad33ea121b4c21 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 23 Jun 2016 14:00:32 -0700 Subject: Use some FXSYS methods instead of duplicating This CL uses the FXSYS_isDecimalDigit in place of a few custom IsDigit methods. It also creates an iswspace and some fractional math helper methods to share some code. Review-Url: https://codereview.chromium.org/2094453004 --- xfa/fxfa/parser/cxfa_data.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_data.cpp') diff --git a/xfa/fxfa/parser/cxfa_data.cpp b/xfa/fxfa/parser/cxfa_data.cpp index 7a218516b7..0589adf581 100644 --- a/xfa/fxfa/parser/cxfa_data.cpp +++ b/xfa/fxfa/parser/cxfa_data.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/cxfa_data.h" +#include "core/fxcrt/include/fx_ext.h" #include "xfa/fxfa/parser/xfa_object.h" // Static. @@ -17,14 +18,14 @@ FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) { int cc = 0; const FX_WCHAR* str = wsValue.c_str(); int len = wsValue.GetLength(); - while (XFA_IsSpace(str[cc]) && cc < len) + while (FXSYS_iswspace(str[cc]) && cc < len) cc++; if (cc >= len) return 0xff000000; while (cc < len) { - if (str[cc] == ',' || !XFA_IsDigit(str[cc])) + if (str[cc] == ',' || !FXSYS_isDecimalDigit(str[cc])) break; r = r * 10 + str[cc] - '0'; @@ -32,11 +33,11 @@ FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) { } if (cc < len && str[cc] == ',') { cc++; - while (XFA_IsSpace(str[cc]) && cc < len) + while (FXSYS_iswspace(str[cc]) && cc < len) cc++; while (cc < len) { - if (str[cc] == ',' || !XFA_IsDigit(str[cc])) + if (str[cc] == ',' || !FXSYS_isDecimalDigit(str[cc])) break; g = g * 10 + str[cc] - '0'; @@ -44,11 +45,11 @@ FX_ARGB CXFA_Data::ToColor(const CFX_WideStringC& wsValue) { } if (cc < len && str[cc] == ',') { cc++; - while (XFA_IsSpace(str[cc]) && cc < len) + while (FXSYS_iswspace(str[cc]) && cc < len) cc++; while (cc < len) { - if (str[cc] == ',' || !XFA_IsDigit(str[cc])) + if (str[cc] == ',' || !FXSYS_isDecimalDigit(str[cc])) break; b = b * 10 + str[cc] - '0'; -- cgit v1.2.3