diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-01-14 17:25:08 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-01-14 17:25:08 -0800 |
commit | 4cd5b80e70e5fc50d8bd805cfa3c7b54878a0a35 (patch) | |
tree | cb9465e37aa1495d01adbed07d351ab36930e8e2 /fpdfsdk/src/javascript/PublicMethods.h | |
parent | 5b2bc895384749493f2ec2ca818c485797448cae (diff) | |
download | pdfium-4cd5b80e70e5fc50d8bd805cfa3c7b54878a0a35.tar.xz |
Cleanup CJS_PublicMethods::ParseNumber
Original patch by tombergan.
The old version of this function was basically strtod with a few quirks:
1. It always interpreted ',' as '.' independent of locale. I kept this
behavior, to be conservative.
2. It interpreted the first non-number character as a decimal point,
unless there was a prior decimal point, in which case all characters
up to that point are ignored. This would parse "123z4" as "123.4"
and "123xy6" as "6". I did not keep this behavior -- in the new code,
these examples all fail to parse.
The new ParseNumber was inlined into ConvertStringToNumber, which
returns true on success and (false, 0) on failure.
BUG=pdfium:361
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1582013002 .
Diffstat (limited to 'fpdfsdk/src/javascript/PublicMethods.h')
-rw-r--r-- | fpdfsdk/src/javascript/PublicMethods.h | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/fpdfsdk/src/javascript/PublicMethods.h b/fpdfsdk/src/javascript/PublicMethods.h index 013c4ce1a4..0172cbafb8 100644 --- a/fpdfsdk/src/javascript/PublicMethods.h +++ b/fpdfsdk/src/javascript/PublicMethods.h @@ -144,18 +144,11 @@ class CJS_PublicMethods : public CJS_Object { bool* bWrongFormat); static CFX_WideString MakeFormatDate(double dDate, const CFX_WideString& format); - static FX_BOOL ConvertStringToNumber(const FX_WCHAR* swSource, - double& dRet, - FX_BOOL& bDot); + static FX_BOOL ConvertStringToNumber(const FX_WCHAR* swSource, double& dRet); static double ParseStringToNumber(const FX_WCHAR* swSource); static double ParseNormalDate(const CFX_WideString& value, bool* bWrongFormat); static double MakeInterDate(CFX_WideString strValue); - static double ParseNumber(const FX_WCHAR* swSource, - FX_BOOL& bAllDigits, - FX_BOOL& bDot, - FX_BOOL& bSign, - FX_BOOL& bKXJS); public: static CFX_WideString StrLTrim(const FX_WCHAR* pStr); |