| Index: fpdfsdk/src/javascript/util.cpp
|
| diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
|
| index c4f03093a790451bd3e3679e040dcaac2bba4bf8..e775e0ad4f52328f710c7ad4d65e40a6a54dd87a 100644
|
| --- a/fpdfsdk/src/javascript/util.cpp
|
| +++ b/fpdfsdk/src/javascript/util.cpp
|
| @@ -98,9 +98,8 @@ const stru_TbConvert fcTable[] = {
|
|
|
| int util::ParstDataType(std::wstring* sFormat)
|
| {
|
| - size_t i = 0;
|
| bool bPercent = FALSE;
|
| - for (i=0; i<sFormat->length(); ++i)
|
| + for (size_t i = 0; i < sFormat->length(); ++i)
|
| {
|
| wchar_t c = (*sFormat)[i];
|
| if (c == L'%')
|
| @@ -112,25 +111,25 @@ int util::ParstDataType(std::wstring* sFormat)
|
| if (bPercent)
|
| {
|
| if (c == L'c' || c == L'C' || c == L'd' || c == L'i' || c == L'o' || c == L'u' || c == L'x' || c == L'X')
|
| - {
|
| + {
|
| return UTIL_INT;
|
| }
|
| - else if (c == L'e' || c == L'E' || c == L'f' || c == L'g' || c == L'G')
|
| + if (c == L'e' || c == L'E' || c == L'f' || c == L'g' || c == L'G')
|
| {
|
| return UTIL_DOUBLE;
|
| }
|
| - else if (c == L's' || c == L'S')
|
| + if (c == L's' || c == L'S')
|
| {
|
| // Map s to S since we always deal internally
|
| // with wchar_t strings.
|
| (*sFormat)[i] = L'S';
|
| return UTIL_STRING;
|
| }
|
| - else if (c == L'.' || c == L'+' || c == L'-' || c == L'#' || c == L' ' || CJS_PublicMethods::IsDigit(c))
|
| + if (c == L'.' || c == L'+' || c == L'-' || c == L'#' || c == L' ' || CJS_PublicMethods::IsDigit(c))
|
| {
|
| continue;
|
| }
|
| - else break;
|
| + break;
|
| }
|
| }
|
|
|
| @@ -268,7 +267,7 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
|
| vRet = swResult.c_str();
|
| return TRUE;
|
| }
|
| - else if (p1.GetType() == VT_string)
|
| + if (p1.GetType() == VT_string)
|
| {
|
| std::basic_string<wchar_t> cFormat = p1.ToCFXWideString().c_str();
|
|
|
| @@ -310,8 +309,6 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
|
| time.tm_hour = iHour;
|
| time.tm_min = iMin;
|
| time.tm_sec = iSec;
|
| - //COleDateTime cppTm(iYear,iMonth+1,iDay,iHour,iMin,iSec);
|
| - //CString strFormat = cppTm.Format(cFormat.c_str());
|
|
|
| struct stru_TbConvertAd
|
| {
|
| @@ -328,18 +325,14 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
|
| { L"s", iSec },
|
| };
|
|
|
| - //cFormat = strFormat.GetBuffer(strFormat.GetLength()+1);
|
| for(iIndex = 0;iIndex<sizeof(cTableAd)/sizeof(stru_TbConvertAd);iIndex++)
|
| {
|
| wchar_t tszValue[10];
|
| - //_itot(cTableAd[iIndex].iValue,tszValue,10);
|
| CFX_WideString sValue;
|
| sValue.Format(L"%d",cTableAd[iIndex].iValue);
|
| memcpy(tszValue, (wchar_t *)sValue.GetBuffer(sValue.GetLength()+1),
|
| (sValue.GetLength()+1)*sizeof(wchar_t));
|
|
|
| - //strFormat.Replace(cTableAd[iIndex].lpszJSMark,"%d");
|
| - //strFormat.Format(strFormat,cTableAd[iIndex].iValue);
|
| int iStart = 0;
|
| int iEnd;
|
| while((iEnd = cFormat.find(cTableAd[iIndex].lpszJSMark, iStart)) != -1)
|
| @@ -358,13 +351,10 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
|
| }
|
|
|
| CFX_WideString strFormat;
|
| -// strFormat.Format(L"%d,%d,%d,%d,%d,%d",iYear, iMonth, iDay, iHour, iMin, iSec);
|
| -// CString strFormat = cppTm.Format(cFormat.c_str());
|
| wchar_t buf[64] = {};
|
| strFormat = wcsftime(buf, 64, cFormat.c_str(), &time);
|
| cFormat = buf;
|
| vRet = cFormat.c_str();
|
| - //rtRet = strFormat.GetBuffer(strFormat.GetLength()+1);
|
| return TRUE;
|
| }
|
| return FALSE;
|
| @@ -625,10 +615,7 @@ int64_t FX_atoi64(const char *nptr)
|
| c = (int)(unsigned char)*nptr++; /* get next char */
|
| }
|
|
|
| - if (sign == '-')
|
| - return -total;
|
| - else
|
| - return total; /* return result, negated if necessary */
|
| + return sign == '-' ? -total : total;
|
| }
|
|
|
| FX_BOOL util::byteToChar(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
|
|
|