From 875e98c581952478f3a3ccef9b2f2e3ed06c5346 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Wed, 27 Sep 2017 10:53:11 -0400 Subject: Remove FX_STRSIZE and replace with size_t BUG=pdfium:828 Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16 Reviewed-on: https://pdfium-review.googlesource.com/13230 Reviewed-by: dsinclair Commit-Queue: Ryan Harrison --- xfa/fde/cfde_textout.cpp | 2 +- xfa/fgas/font/cfgas_pdffontmgr.cpp | 4 ++-- xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp | 28 ++++++++++++++-------------- xfa/fxfa/fm2js/cxfa_fmlexer.cpp | 6 +++--- xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp | 4 ++-- xfa/fxfa/parser/cxfa_dataexporter.cpp | 4 ++-- xfa/fxfa/parser/cxfa_document.cpp | 4 ++-- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 2 +- xfa/fxfa/parser/cxfa_node.cpp | 4 ++-- xfa/fxfa/parser/cxfa_widgetdata.cpp | 16 ++++++++-------- 10 files changed, 37 insertions(+), 37 deletions(-) (limited to 'xfa') diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp index c31b178ef6..9f96b77b63 100644 --- a/xfa/fde/cfde_textout.cpp +++ b/xfa/fde/cfde_textout.cpp @@ -326,7 +326,7 @@ void CFDE_TextOut::LoadText(const WideString& str, const CFX_RectF& rect) { m_wsText = str; - if (pdfium::CollectionSize(m_CharWidths) < str.GetLength()) + if (pdfium::CollectionSize(m_CharWidths) < str.GetLength()) m_CharWidths.resize(str.GetLength(), 0); float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; diff --git a/xfa/fgas/font/cfgas_pdffontmgr.cpp b/xfa/fgas/font/cfgas_pdffontmgr.cpp index 0fd18aa9b9..af183c2f99 100644 --- a/xfa/fgas/font/cfgas_pdffontmgr.cpp +++ b/xfa/fgas/font/cfgas_pdffontmgr.cpp @@ -119,7 +119,7 @@ bool CFGAS_PDFFontMgr::PsNameMatchDRFontName(const ByteStringView& bsPsName, bool bStrictMatch) { ByteString bsDRName = bsDRFontName; bsDRName.Remove('-'); - FX_STRSIZE iPsLen = bsPsName.GetLength(); + size_t iPsLen = bsPsName.GetLength(); auto nIndex = bsDRName.Find(bsPsName); if (nIndex.has_value() && !bStrictMatch) return true; @@ -127,7 +127,7 @@ bool CFGAS_PDFFontMgr::PsNameMatchDRFontName(const ByteStringView& bsPsName, if (!nIndex.has_value() || nIndex.value() != 0) return false; - FX_STRSIZE iDifferLength = bsDRName.GetLength() - iPsLen; + size_t iDifferLength = bsDRName.GetLength() - iPsLen; if (iDifferLength > 1 || (bBold || bItalic)) { auto iBoldIndex = bsDRName.Find("Bold"); if (bBold != iBoldIndex.has_value()) diff --git a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp index 0b38fd1fab..b4d070ac7d 100644 --- a/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/cxfa_fm2jscontext.cpp @@ -2951,7 +2951,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, return; } - FX_STRSIZE u = 0; + size_t u = 0; while (IsWhitespace(pData[u])) ++u; @@ -2966,7 +2966,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, while (IsWhitespace(pData[u])) ++u; - FX_STRSIZE uLen = unitspanString.GetLength(); + size_t uLen = unitspanString.GetLength(); ByteString strFirstUnit; while (u < uLen) { if (pData[u] == ' ') @@ -2982,7 +2982,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, std::unique_ptr unitValue = GetSimpleValue(pThis, args, 1); ByteString unitTempString = ValueToUTF8String(unitValue.get()); const char* pChar = unitTempString.c_str(); - FX_STRSIZE uVal = 0; + size_t uVal = 0; while (IsWhitespace(pChar[uVal])) ++uVal; @@ -2994,7 +2994,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, while (IsWhitespace(pChar[uVal])) ++uVal; - FX_STRSIZE uValLen = unitTempString.GetLength(); + size_t uValLen = unitTempString.GetLength(); while (uVal < uValLen) { if (pChar[uVal] == ' ') break; @@ -3176,7 +3176,7 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, // static WideString CXFA_FM2JSContext::DecodeURL(const WideString& wsURLString) { const wchar_t* pData = wsURLString.c_str(); - FX_STRSIZE i = 0; + size_t i = 0; CFX_WideTextBuf wsResultBuf; while (i < wsURLString.GetLength()) { wchar_t ch = pData[i]; @@ -3213,9 +3213,9 @@ WideString CXFA_FM2JSContext::DecodeURL(const WideString& wsURLString) { // static WideString CXFA_FM2JSContext::DecodeHTML(const WideString& wsHTMLString) { wchar_t strString[9]; - FX_STRSIZE iStrIndex = 0; - FX_STRSIZE iLen = wsHTMLString.GetLength(); - FX_STRSIZE i = 0; + size_t iStrIndex = 0; + size_t iLen = wsHTMLString.GetLength(); + size_t i = 0; int32_t iCode = 0; const wchar_t* pData = wsHTMLString.c_str(); CFX_WideTextBuf wsResultBuf; @@ -3811,7 +3811,7 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, ByteString argString = ValueToUTF8String(argOne.get()); WideString wsArgString = WideString::FromUTF8(argString.AsStringView()); const wchar_t* pData = wsArgString.c_str(); - FX_STRSIZE i = 0; + size_t i = 0; while (i < argString.GetLength()) { int32_t ch = pData[i]; if ((ch >= 0x41 && ch <= 0x5A) || (ch >= 0xC0 && ch <= 0xDE)) @@ -4008,17 +4008,17 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, threeString = ValueToUTF8String(argThree.get()); } - FX_STRSIZE iFindLen = twoString.GetLength(); + size_t iFindLen = twoString.GetLength(); std::ostringstream resultString; - FX_STRSIZE iFindIndex = 0; - for (FX_STRSIZE u = 0; u < oneString.GetLength(); ++u) { + size_t iFindIndex = 0; + for (size_t u = 0; u < oneString.GetLength(); ++u) { char ch = static_cast(oneString[u]); if (ch != static_cast(twoString[iFindIndex])) { resultString << ch; continue; } - FX_STRSIZE iTemp = u + 1; + size_t iTemp = u + 1; ++iFindIndex; while (iFindIndex < iFindLen) { uint8_t chTemp = oneString[iTemp]; @@ -4353,7 +4353,7 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, ByteString argString = ValueToUTF8String(argOne.get()); WideString wsArgString = WideString::FromUTF8(argString.AsStringView()); const wchar_t* pData = wsArgString.c_str(); - FX_STRSIZE i = 0; + size_t i = 0; while (i < wsArgString.GetLength()) { int32_t ch = pData[i]; if ((ch >= 0x61 && ch <= 0x7A) || (ch >= 0xE0 && ch <= 0xFE)) diff --git a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp index f6b2a58944..675abc3046 100644 --- a/xfa/fxfa/fm2js/cxfa_fmlexer.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmlexer.cpp @@ -378,7 +378,7 @@ void CXFA_FMLexer::AdvanceForNumber() { } m_token->m_string = - WideStringView(m_cursor, static_cast(end - m_cursor)); + WideStringView(m_cursor, static_cast(end - m_cursor)); m_cursor = end; } @@ -395,7 +395,7 @@ void CXFA_FMLexer::AdvanceForString() { // If the end of the input has been reached it was not escaped. if (m_cursor > m_end) { m_token->m_string = - WideStringView(start, static_cast(m_cursor - start)); + WideStringView(start, static_cast(m_cursor - start)); return; } // If the next character is not a " then the end of the string has been @@ -430,7 +430,7 @@ void CXFA_FMLexer::AdvanceForIdentifier() { ++m_cursor; } m_token->m_string = - WideStringView(start, static_cast(m_cursor - start)); + WideStringView(start, static_cast(m_cursor - start)); m_token->m_type = TokenizeIdentifier(m_token->m_string); } diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp index 73dfdd55bc..3cfe0f52d5 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression.cpp @@ -48,7 +48,7 @@ const wchar_t* const g_BuiltInFuncs[] = { L"Within", L"WordNum", }; -const FX_STRSIZE g_BuiltInFuncsMaxLen = 12; +const size_t g_BuiltInFuncsMaxLen = 12; struct XFA_FMSOMMethod { const wchar_t* m_wsSomMethodName; @@ -133,7 +133,7 @@ bool CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { return true; } javascript.AppendChar(L'\"'); - for (FX_STRSIZE i = 1; i < tempStr.GetLength() - 1; i++) { + for (size_t i = 1; i < tempStr.GetLength() - 1; i++) { wchar_t oneChar = tempStr[i]; switch (oneChar) { case L'\"': diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index b0de057e2a..5433ba788e 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -225,7 +225,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, break; std::vector wsSelTextArray; - FX_STRSIZE iStart = 0; + size_t iStart = 0; auto iEnd = wsRawValue.Find(L'\n', iStart); iEnd = !iEnd.has_value() ? wsRawValue.GetLength() : iEnd; while (iEnd.has_value() && iEnd >= iStart) { @@ -335,7 +335,7 @@ void RegenerateFormFile_Container( !pNode->IsContainerNode()) { CFX_WideTextBuf buf; RegenerateFormFile_Changed(pNode, buf, bSaveXML); - FX_STRSIZE nLen = buf.GetLength(); + size_t nLen = buf.GetLength(); if (nLen > 0) pStream->WriteString(buf.AsStringView()); return; diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 3a46e26cb7..cd60f47bed 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -300,7 +300,7 @@ XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( const WideString& wsTemplateNS) { WideStringView wsTemplateURIPrefix = XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI; - FX_STRSIZE nPrefixLength = wsTemplateURIPrefix.GetLength(); + size_t nPrefixLength = wsTemplateURIPrefix.GetLength(); if (WideStringView(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) != wsTemplateURIPrefix) { return XFA_VERSION_UNKNOWN; @@ -374,7 +374,7 @@ void CXFA_Document::DoProtoMerge() { wsURI = wsUseVal.AsStringView(); } else { wsURI = WideStringView(wsUseVal.c_str(), uSharpPos.value()); - FX_STRSIZE uLen = wsUseVal.GetLength(); + size_t uLen = wsUseVal.GetLength(); if (uLen >= uSharpPos.value() + 5 && WideStringView(wsUseVal.c_str() + uSharpPos.value(), 5) == L"#som(" && diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index d8fdbb4ba1..a9e5449e3f 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -148,7 +148,7 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, bool bTargetAllFind = true; while (iSplitIndex != -1) { WideString wsExpr; - pdfium::Optional iSplitNextIndex = 0; + pdfium::Optional iSplitNextIndex = 0; if (!bTargetAllFind) { iSplitNextIndex = wsTargetAll.Find(' ', iSplitIndex); if (!iSplitNextIndex.has_value()) diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 1dc20485ab..0a95b5f0ee 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -4037,8 +4037,8 @@ bool CXFA_Node::SetScriptContent(const WideString& wsContent, std::vector wsSaveTextArray; size_t iSize = 0; if (!wsContent.IsEmpty()) { - FX_STRSIZE iStart = 0; - FX_STRSIZE iLength = wsContent.GetLength(); + size_t iStart = 0; + size_t iLength = wsContent.GetLength(); auto iEnd = wsContent.Find(L'\n', iStart); iEnd = !iEnd.has_value() ? iLength : iEnd; while (iEnd.value() >= iStart) { diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 1879377ae4..13ccf2b824 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -846,8 +846,8 @@ std::vector CXFA_WidgetData::GetSelectedItemsValue() { WideString wsValue = GetRawValue(); if (GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { if (!wsValue.IsEmpty()) { - FX_STRSIZE iStart = 0; - FX_STRSIZE iLength = wsValue.GetLength(); + size_t iStart = 0; + size_t iLength = wsValue.GetLength(); auto iEnd = wsValue.Find(L'\n', iStart); iEnd = (!iEnd.has_value()) ? iLength : iEnd; while (iEnd >= iStart) { @@ -1766,22 +1766,22 @@ void CXFA_WidgetData::FormatNumStr(const WideString& wsValue, bNeg = true; wsSrcNum.Delete(0, 1); } - FX_STRSIZE len = wsSrcNum.GetLength(); + auto dot_index = wsSrcNum.Find('.'); - dot_index = !dot_index.has_value() ? len : dot_index; + dot_index = !dot_index.has_value() ? wsSrcNum.GetLength() : dot_index; if (dot_index.value() >= 1) { - FX_STRSIZE nPos = dot_index.value() % 3; + size_t nPos = dot_index.value() % 3; wsOutput.clear(); - for (FX_STRSIZE i = 0; i < dot_index.value(); i++) { + for (size_t i = 0; i < dot_index.value(); i++) { if (i % 3 == nPos && i != 0) wsOutput += wsGroupSymbol; wsOutput += wsSrcNum[i]; } - if (dot_index.value() < len) { + if (dot_index.value() < wsSrcNum.GetLength()) { wsOutput += pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal); - wsOutput += wsSrcNum.Right(len - dot_index.value() - 1); + wsOutput += wsSrcNum.Right(wsSrcNum.GetLength() - dot_index.value() - 1); } if (bNeg) { wsOutput = -- cgit v1.2.3