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>
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index f5d3c68..bf35a67 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 @@
} 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 @@
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 @@
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 @@
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 @@
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());