diff options
Diffstat (limited to 'xfa/fxfa/parser/cxfa_widgetdata.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 5efc0ea481..34e3aeaf0f 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -42,11 +42,10 @@ bool SplitDateTime(const CFX_WideString& wsDateTime, if (wsDateTime.IsEmpty()) return false; - int nSplitIndex = -1; - nSplitIndex = wsDateTime.Find('T'); - if (nSplitIndex < 0) + FX_STRSIZE nSplitIndex = wsDateTime.Find('T'); + if (nSplitIndex == FX_STRNPOS) nSplitIndex = wsDateTime.Find(' '); - if (nSplitIndex < 0) + if (nSplitIndex == FX_STRNPOS) return false; wsDate = wsDateTime.Left(nSplitIndex); @@ -848,17 +847,17 @@ std::vector<CFX_WideString> CXFA_WidgetData::GetSelectedItemsValue() { CFX_WideString wsValue = GetRawValue(); if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { if (!wsValue.IsEmpty()) { - int32_t iStart = 0; - int32_t iLength = wsValue.GetLength(); - int32_t iEnd = wsValue.Find(L'\n', iStart); - iEnd = (iEnd == -1) ? iLength : iEnd; + FX_STRSIZE iStart = 0; + FX_STRSIZE iLength = wsValue.GetLength(); + FX_STRSIZE iEnd = wsValue.Find(L'\n', iStart); + iEnd = (iEnd == FX_STRNPOS) ? iLength : iEnd; while (iEnd >= iStart) { wsSelTextArray.push_back(wsValue.Mid(iStart, iEnd - iStart)); iStart = iEnd + 1; if (iStart >= iLength) break; iEnd = wsValue.Find(L'\n', iStart); - if (iEnd < 0) + if (iEnd == FX_STRNPOS) wsSelTextArray.push_back(wsValue.Mid(iStart, iLength - iStart)); } } @@ -1318,7 +1317,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) { if (pUIChild->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, wsWideNarrowRatio)) { FX_STRSIZE ptPos = wsWideNarrowRatio.Find(':'); float fRatio = 0; - if (ptPos >= 0) { + if (ptPos != FX_STRNPOS) { fRatio = (float)FXSYS_wtoi(wsWideNarrowRatio.c_str()); } else { int32_t fA, fB; @@ -1743,9 +1742,9 @@ void CXFA_WidgetData::NormalizeNumStr(const CFX_WideString& wsValue, wsOutput = wsValue; wsOutput.TrimLeft('0'); - int32_t dot_index = wsOutput.Find('.'); + FX_STRSIZE dot_index = wsOutput.Find('.'); int32_t iFracDigits = 0; - if (!wsOutput.IsEmpty() && dot_index >= 0 && + if (!wsOutput.IsEmpty() && dot_index != FX_STRNPOS && (!GetFracDigits(iFracDigits) || iFracDigits != -1)) { wsOutput.TrimRight(L"0"); wsOutput.TrimRight(L"."); @@ -1769,8 +1768,8 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue, wsSrcNum.Delete(0, 1); } int32_t len = wsSrcNum.GetLength(); - int32_t dot_index = wsSrcNum.Find('.'); - if (dot_index == -1) + FX_STRSIZE dot_index = wsSrcNum.Find('.'); + if (dot_index == FX_STRNPOS) dot_index = len; int32_t cc = dot_index - 1; |