summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/PublicMethods.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-08-04 11:33:49 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-08-04 19:26:14 +0000
commitdf950b87e781daf92364afb22f13d87b18858c80 (patch)
treea333e02d43ee4909c7cffcae131aac2cf5a8b45a /fpdfsdk/javascript/PublicMethods.cpp
parent5c09f4ca825652f910d3ff406fcbf64d25f56e23 (diff)
downloadpdfium-df950b87e781daf92364afb22f13d87b18858c80.tar.xz
Remove platform-specific IsFinite, JS_PortIsNan, and GetNan.
Because C++11 gives us std::isfinite(), std::isnan() and std::nan(). Bug: pdfium:459 Change-Id: I128f332ec908df6aff66ef76012288fd22d423ed Reviewed-on: https://pdfium-review.googlesource.com/10190 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/PublicMethods.cpp')
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index f5d3c68780..bf35a67edc 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/javascript/PublicMethods.h"
#include <algorithm>
+#include <cmath>
#include <cwctype>
#include <iomanip>
#include <limits>
@@ -603,11 +604,11 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
} else {
dRet = JS_MakeDate(JS_MakeDay(nYear, nMonth - 1, nDay),
JS_MakeTime(nHour, nMin, nSec, 0));
- if (JS_PortIsNan(dRet))
+ if (std::isnan(dRet))
dRet = JS_DateParse(value);
}
- if (JS_PortIsNan(dRet))
+ if (std::isnan(dRet))
dRet = ParseNormalDate(value, &bBadFormat);
if (bWrongFormat)
@@ -1120,7 +1121,7 @@ bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime,
dDate = MakeRegularDate(strValue, sFormat, nullptr);
}
- if (JS_PortIsNan(dDate)) {
+ if (std::isnan(dDate)) {
CFX_WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
@@ -1181,7 +1182,7 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
int nYear = FX_atof(wsArray[7].AsStringC());
double dRet = JS_MakeDate(JS_MakeDay(nYear, nMonth - 1, nDay),
JS_MakeTime(nHour, nMin, nSec, 0));
- if (JS_PortIsNan(dRet))
+ if (std::isnan(dRet))
dRet = JS_DateParse(strValue);
return dRet;
@@ -1210,7 +1211,7 @@ bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime,
CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
bool bWrongFormat = false;
double dRet = MakeRegularDate(strValue, sFormat, &bWrongFormat);
- if (bWrongFormat || JS_PortIsNan(dRet)) {
+ if (bWrongFormat || std::isnan(dRet)) {
CFX_WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
@@ -1559,7 +1560,7 @@ bool CJS_PublicMethods::AFParseDateEx(CJS_Runtime* pRuntime,
CFX_WideString sValue = params[0].ToCFXWideString(pRuntime);
CFX_WideString sFormat = params[1].ToCFXWideString(pRuntime);
double dDate = MakeRegularDate(sValue, sFormat, nullptr);
- if (JS_PortIsNan(dDate)) {
+ if (std::isnan(dDate)) {
CFX_WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());