summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_localevalue.cpp13
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp27
7 files changed, 35 insertions, 34 deletions
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 49a1f5857b..ff9e981e9f 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -225,10 +225,10 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
break;
std::vector<CFX_WideString> wsSelTextArray;
- int32_t iStart = 0;
- int32_t iEnd = wsRawValue.Find(L'\n', iStart);
- iEnd = (iEnd == -1) ? wsRawValue.GetLength() : iEnd;
- while (iEnd >= iStart) {
+ FX_STRSIZE iStart = 0;
+ FX_STRSIZE iEnd = wsRawValue.Find(L'\n', iStart);
+ iEnd = (iEnd == FX_STRNPOS) ? wsRawValue.GetLength() : iEnd;
+ while (iEnd != FX_STRNPOS && iEnd >= iStart) {
wsSelTextArray.push_back(wsRawValue.Mid(iStart, iEnd - iStart));
iStart = iEnd + 1;
if (iStart >= wsRawValue.GetLength())
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 16b999b9e3..f43deaf145 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -306,7 +306,7 @@ XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber(
return XFA_VERSION_UNKNOWN;
}
FX_STRSIZE nDotPos = wsTemplateNS.Find('.', nPrefixLength);
- if (nDotPos == (FX_STRSIZE)-1)
+ if (nDotPos == FX_STRNPOS)
return XFA_VERSION_UNKNOWN;
int8_t iMajor = FXSYS_wtoi(
@@ -368,7 +368,7 @@ void CXFA_Document::DoProtoMerge() {
if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) &&
!wsUseVal.IsEmpty()) {
FX_STRSIZE uSharpPos = wsUseVal.Find('#');
- if (uSharpPos < 0) {
+ if (uSharpPos == FX_STRNPOS) {
wsURI = wsUseVal.AsStringC();
} else {
wsURI = CFX_WideStringC(wsUseVal.c_str(), uSharpPos);
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index 4d6886d7e1..55851bb34a 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -148,9 +148,10 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
bool bTargetAllFind = true;
while (iSplitIndex != -1) {
CFX_WideString wsExpr;
- int32_t iSplitNextIndex = 0;
+ FX_STRSIZE iSplitNextIndex = 0;
if (!bTargetAllFind) {
iSplitNextIndex = wsTargetAll.Find(' ', iSplitIndex);
+ ASSERT(iSplitNextIndex != FX_STRNPOS);
wsExpr = wsTargetAll.Mid(iSplitIndex, iSplitNextIndex - iSplitIndex);
} else {
wsExpr = wsTargetAll;
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index 5b5c27f1d4..aa0f74b170 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -49,10 +49,10 @@ bool ValueSplitDateTime(const CFX_WideString& wsDateTime,
if (wsDateTime.IsEmpty())
return false;
- int 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);
@@ -444,7 +444,7 @@ bool CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate,
if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2)
return false;
- const bool bSymbol = wsDate.Find(0x2D) != -1;
+ const bool bSymbol = wsDate.Find(0x2D) != FX_STRNPOS;
uint16_t wYear = 0;
uint16_t wMonth = 0;
uint16_t wDay = 0;
@@ -519,7 +519,7 @@ bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) {
const uint16_t wCountM = 2;
const uint16_t wCountS = 2;
const uint16_t wCountF = 3;
- const bool bSymbol = wsTime.Find(':') != -1;
+ const bool bSymbol = wsTime.Find(':') != FX_STRNPOS;
uint16_t wHour = 0;
uint16_t wMinute = 0;
uint16_t wSecond = 0;
@@ -558,7 +558,8 @@ bool CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) {
wSecond = pTime[nIndex] - '0' + wSecond * 10;
nIndex++;
}
- if (wsTime.Find('.') > 0) {
+ FX_STRSIZE ret = wsTime.Find('.');
+ if (ret && ret != FX_STRNPOS) {
if (pTime[nIndex] != '.')
return false;
nIndex++;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 261fee1971..8497e60a74 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -4043,10 +4043,10 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
std::vector<CFX_WideString> wsSaveTextArray;
size_t iSize = 0;
if (!wsContent.IsEmpty()) {
- int32_t iStart = 0;
- int32_t iLength = wsContent.GetLength();
- int32_t iEnd = wsContent.Find(L'\n', iStart);
- iEnd = (iEnd == -1) ? iLength : iEnd;
+ FX_STRSIZE iStart = 0;
+ FX_STRSIZE iLength = wsContent.GetLength();
+ FX_STRSIZE iEnd = wsContent.Find(L'\n', iStart);
+ iEnd = (iEnd == FX_STRNPOS) ? iLength : iEnd;
while (iEnd >= iStart) {
wsSaveTextArray.push_back(wsContent.Mid(iStart, iEnd - iStart));
iStart = iEnd + 1;
@@ -4054,7 +4054,7 @@ bool CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
break;
}
iEnd = wsContent.Find(L'\n', iStart);
- if (iEnd < 0) {
+ if (iEnd == FX_STRNPOS) {
wsSaveTextArray.push_back(
wsContent.Mid(iStart, iLength - iStart));
}
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 1b5cccf101..39dc858b9e 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -93,7 +93,7 @@ bool GetAttributeLocalName(const CFX_WideStringC& wsAttributeName,
CFX_WideString& wsLocalAttrName) {
CFX_WideString wsAttrName(wsAttributeName);
FX_STRSIZE iFind = wsAttrName.Find(L':', 0);
- if (iFind < 0) {
+ if (iFind == FX_STRNPOS) {
wsLocalAttrName = wsAttrName;
return false;
}
@@ -135,7 +135,7 @@ bool FindAttributeWithNS(CFX_XMLElement* pElement,
for (auto it : pElement->GetAttributes()) {
FX_STRSIZE iFind = it.first.Find(L':', 0);
CFX_WideString wsNSPrefix;
- if (iFind < 0) {
+ if (iFind == FX_STRNPOS) {
if (wsLocalAttributeName != it.first)
continue;
} else {
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;