From baaf79a5dd4b191156f8933d527873887409fecf Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Wed, 29 Mar 2023 10:44:09 +0300 Subject: [PATCH] . --- DesktopEditor/allthemesgen/main.cpp | 7 +- DesktopEditor/doctrenderer/doctrenderer.pro | 3 + .../test/DisplayingXML/CMetafileTreeView.cpp | 8 +- DesktopEditor/xmlsec/src/src/OOXMLSigner.cpp | 36 ++++---- .../xmlsec/src/src/OOXMLVerifier.cpp | 89 +++++++++---------- DesktopEditor/xmlsec/src/src/XmlRels.h | 9 +- DesktopEditor/xmlsec/src/src/XmlTransform.h | 18 ++-- HtmlFile/HtmlFile.cpp | 69 +++++++------- PdfFile/SrcReader/RendererOutputDev.cpp | 6 +- Test/Applications/x2tTester/x2tTester.cpp | 21 ++--- 10 files changed, 121 insertions(+), 145 deletions(-) diff --git a/DesktopEditor/allthemesgen/main.cpp b/DesktopEditor/allthemesgen/main.cpp index bdbd6555c5..e387b14c7b 100644 --- a/DesktopEditor/allthemesgen/main.cpp +++ b/DesktopEditor/allthemesgen/main.cpp @@ -585,11 +585,10 @@ int main(int argc, char** argv) XmlUtils::CXmlNode oNode; if (bIsNeedCorrectSdkAll && oNode.FromXmlFile(sPathDoctRendererConfig)) { - XmlUtils::CXmlNodes oNodesFile = oNode.GetNode(L"PpttSdk").GetNodes(L"file"); - for (int i = 0; i < oNodesFile.GetCount(); ++i) + std::vector oNodesFile = oNode.GetNode(L"PpttSdk").GetNodes(L"file"); + for (size_t i = 0; i < oNodesFile.size(); ++i) { - XmlUtils::CXmlNode oNodeFile; - oNodesFile.GetAt(i, oNodeFile); + XmlUtils::CXmlNode & oNodeFile = oNodesFile[i]; std::wstring sFileSdk = oNodeFile.GetText(); diff --git a/DesktopEditor/doctrenderer/doctrenderer.pro b/DesktopEditor/doctrenderer/doctrenderer.pro index c49729e0ee..fc8d328164 100644 --- a/DesktopEditor/doctrenderer/doctrenderer.pro +++ b/DesktopEditor/doctrenderer/doctrenderer.pro @@ -12,6 +12,9 @@ CONFIG += c++11 CONFIG += core_static_link_libstd +CONFIG += doct_renderer_empty +CONFIG += v8_version_89 + CORE_ROOT_DIR = $$PWD/../.. PWD_ROOT_DIR = $$PWD include(../../Common/base.pri) diff --git a/DesktopEditor/raster/Metafile/test/DisplayingXML/CMetafileTreeView.cpp b/DesktopEditor/raster/Metafile/test/DisplayingXML/CMetafileTreeView.cpp index 90906ffb8a..eb73fba37c 100644 --- a/DesktopEditor/raster/Metafile/test/DisplayingXML/CMetafileTreeView.cpp +++ b/DesktopEditor/raster/Metafile/test/DisplayingXML/CMetafileTreeView.cpp @@ -98,17 +98,17 @@ bool CMetafileTreeView::SaveInXmlFile(const std::wstring& wsSaveFilePath) void CMetafileTreeView::ReadXmlNode(XmlUtils::CXmlNode& oXmlNode, QStandardItem* oStandartItem, unsigned int unLevel) { - XmlUtils::CXmlNodes oXmlChilds; + std::vector oXmlChilds; if (oXmlNode.GetChilds(oXmlChilds)) { if (unLevel == 2) oStandartItem->setData("Record", 3); - for (unsigned int i = 0; i < oXmlChilds.GetCount(); ++i) + for (size_t i = 0; i < oXmlChilds.size(); ++i) { - XmlUtils::CXmlNode oXmlChild; - if (oXmlChilds.GetAt(i, oXmlChild)) + XmlUtils::CXmlNode & oXmlChild = oXmlChilds[i]; + if (XmlChild.IsValid()) { QStandardItem *pStandardItem = new QStandardItem(QString("<%1>").arg(QString::fromStdWString(oXmlChild.GetName()))); diff --git a/DesktopEditor/xmlsec/src/src/OOXMLSigner.cpp b/DesktopEditor/xmlsec/src/src/OOXMLSigner.cpp index 0e1c9a7065..56674c4319 100644 --- a/DesktopEditor/xmlsec/src/src/OOXMLSigner.cpp +++ b/DesktopEditor/xmlsec/src/src/OOXMLSigner.cpp @@ -188,12 +188,11 @@ public: XmlUtils::CXmlNode oNodeRels = m_pFolder->getNodeFromFile(*iter); if (!oNodeRels.IsValid()) continue; - XmlUtils::CXmlNodes oNodesRels = oNodeRels.GetNodes(L"Relationship"); - int nCount = oNodesRels.GetCount(); - for (int nIndex = 0; nIndex < nCount; nIndex++) + std::vector oNodesRels = oNodeRels.GetNodes(L"Relationship"); + size_t nCount = oNodesRels.size(); + for (size_t nIndex = 0; nIndex < nCount; nIndex++) { - XmlUtils::CXmlNode oNodeRel; - oNodesRels.GetAt(nIndex, oNodeRel); + XmlUtils::CXmlNode & oNodeRel = oNodesRels[nIndex]; std::wstring sTarget = oNodeRel.GetAttribute(L"Target"); if (!sTarget.empty() && arSigFiles.find(sTarget) == arSigFiles.end() && m_pFolder->exists(folder + L"/" + sTarget)) @@ -261,26 +260,24 @@ public: { XmlUtils::CXmlNode oNode = m_pFolder->getNodeFromFile(L"/[Content_Types].xml"); - XmlUtils::CXmlNodes nodesDefaults; + std::vector nodesDefaults; oNode.GetNodes(L"Default", nodesDefaults); - XmlUtils::CXmlNodes nodesOverrides; + std::vector nodesOverrides; oNode.GetNodes(L"Override", nodesOverrides); - int nCount = nodesDefaults.GetCount(); - for (int i = 0; i < nCount; ++i) + size_t nCount = nodesDefaults.size(); + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode node; - nodesDefaults.GetAt(i, node); + XmlUtils::CXmlNode & node = nodesDefaults[i]; m_content_types.insert(std::pair(node.GetAttribute("Extension"), node.GetAttribute("ContentType"))); } - nCount = nodesOverrides.GetCount(); - for (int i = 0; i < nCount; ++i) + nCount = nodesOverrides.size(); + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode node; - nodesOverrides.GetAt(i, node); + XmlUtils::CXmlNode & node = nodesOverrides[i]; m_content_types.insert(std::pair(node.GetAttribute("PartName"), node.GetAttribute("ContentType"))); } @@ -393,13 +390,12 @@ public: oBuilder.WriteNodeEnd(oNode.GetName(), true, false); - XmlUtils::CXmlNodes oNodes = oNode.GetNodes(L"*"); + std::vector oNodes = oNode.GetNodes(L"*"); - int nCountNodes = oNodes.GetCount(); - for (int nIndex = 0; nIndex < nCountNodes; ++nIndex) + size_t nCountNodes = oNodes.size(); + for (size_t nIndex = 0; nIndex < nCountNodes; ++nIndex) { - XmlUtils::CXmlNode oCurrentRecord; - oNodes.GetAt(nIndex, oCurrentRecord); + XmlUtils::CXmlNode & oCurrentRecord = oNodesnIndex[]; if (L"Default" == oCurrentRecord.GetName() && oCurrentRecord.GetAttributeA("Extension") == "sigs") continue; diff --git a/DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp b/DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp index a23b097431..b8762f3f45 100644 --- a/DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp +++ b/DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp @@ -87,14 +87,14 @@ public: if (oBuilder.GetCurSize() != 1) ret.m_namespaces += oBuilder.GetData(); - XmlUtils::CXmlNodes oNodes; + std::vector oNodes; if (stack.m_node.GetChilds(oNodes)) { - int nCount = oNodes.GetCount(); + size_t nCount = oNodes.size(); - for (int i = 0; i < nCount; i++) + for (size_t i = 0; i < nCount; i++) { - oNodes.GetAt(i, ret.m_node); + ret.m_node = oNodes[i]; CXmlStackNamespaces _retRecursion = ret.GetByIdRec(ret, id, isNameUse); if (_retRecursion.m_node.IsValid()) return _retRecursion; @@ -228,12 +228,11 @@ public: if (!sDateW.empty()) m_sDate = U_TO_UTF8(sDateW); - XmlUtils::CXmlNodes nodesManifestRefs = nodeManifect.ReadNode(L"Manifest").GetNodes(L"Reference"); - int nRefsCount = nodesManifestRefs.GetCount(); - for (int i = 0; i < nRefsCount; i++) + std::vector nodesManifestRefs = nodeManifect.ReadNode(L"Manifest").GetNodes(L"Reference"); + size_t nRefsCount = nodesManifestRefs.size(); + for (size_t i = 0; i < nRefsCount; i++) { - XmlUtils::CXmlNode tmp; - nodesManifestRefs.GetAt(i, tmp); + XmlUtils::CXmlNode &tmp = nodesManifestRefs[i]; m_valid = CheckManifestReference(tmp); if (OOXML_SIGNATURE_VALID != m_valid) @@ -241,13 +240,12 @@ public: } // 4) Objects - XmlUtils::CXmlNodes nodesReferences; + std::vector nodesReferences; m_node.ReadNode(L"SignedInfo").GetNodes(L"Reference", nodesReferences); - nRefsCount = nodesReferences.GetCount(); - for (int i = 0; i < nRefsCount; i++) + nRefsCount = nodesReferences.size(); + for (size_t i = 0; i < nRefsCount; i++) { - XmlUtils::CXmlNode tmp; - nodesReferences.GetAt(i, tmp); + XmlUtils::CXmlNode &tmp = nodesReferences[i]; m_valid = CheckObjectReference(tmp); if (OOXML_SIGNATURE_VALID != m_valid) @@ -295,12 +293,11 @@ public: XmlUtils::CXmlNode GetObjectById(std::string sId) { - XmlUtils::CXmlNodes oNodes = m_node.GetNodes(L"Object"); - int nCount = oNodes.GetCount(); - for (int i = 0; i < nCount; i++) + std::vector oNodes = m_node.GetNodes(L"Object"); + size_t nCount = oNodes.size(); + for (size_t i = 0; i < nCount; i++) { - XmlUtils::CXmlNode tmp; - oNodes.GetAt(i, tmp); + XmlUtils::CXmlNode &tmp = oNodes[i]; if (sId == tmp.GetAttributeA("Id")) return tmp; } @@ -310,12 +307,11 @@ public: XmlUtils::CXmlNode GetObjectSignedProperties() { - XmlUtils::CXmlNodes oNodes = m_node.GetNodes(L"Object"); - int nCount = oNodes.GetCount(); - for (int i = 0; i < nCount; i++) + std::vector oNodes = m_node.GetNodes(L"Object"); + size_t nCount = oNodes.size(); + for (size_t i = 0; i < nCount; i++) { - XmlUtils::CXmlNode tmp; - oNodes.GetAt(i, tmp); + XmlUtils::CXmlNode &tmp = oNodes[i]; XmlUtils::CXmlNode nodeQ = tmp.ReadNodeNoNS(L"QualifyingProperties"); if (nodeQ.IsValid()) @@ -332,14 +328,13 @@ public: if (node.GetName() == sName) return node; - XmlUtils::CXmlNodes childs; + std::vector childs; if (node.GetChilds(childs)) { - int nCount = childs.GetCount(); - for (int i = 0; i < nCount; i++) + size_t nCount = childs.size(); + for (size_t i = 0; i < nCount; i++) { - XmlUtils::CXmlNode child; - childs.GetAt(i, child); + XmlUtils::CXmlNode &child = childs[i]; XmlUtils::CXmlNode ret = FindFirstChild(child, sName); if (ret.IsValid()) @@ -600,13 +595,12 @@ public: if (!oContentTypes.IsValid()) return; - XmlUtils::CXmlNodes oOverrides = oContentTypes.GetNodes(L"Override"); - int nCount = oOverrides.GetCount(); + std::vector oOverrides = oContentTypes.GetNodes(L"Override"); + size_t nCount = oOverrides.size(); - for (int i = 0; i < nCount; i++) + for (size_t i = 0; i < nCount; i++) { - XmlUtils::CXmlNode node; - oOverrides.GetAt(i, node); + XmlUtils::CXmlNode &node = oOverrides[i]; if (node.GetAttributeA("ContentType") != "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml") continue; @@ -676,15 +670,14 @@ public: XmlUtils::CXmlNode oContentTypes = m_pFolder->getNodeFromFile(L"[Content_Types].xml"); std::wstring sXml = L"\n"; - XmlUtils::CXmlNodes oNodes; + std::vector oNodes; if (oContentTypes.GetNodes(L"*", oNodes)) { - int nCount = oNodes.GetCount(); + size_t nCount = oNodes.size(); - for (int i = 0; i < nCount; ++i) + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode oNode; - oNodes.GetAt(i, oNode); + XmlUtils::CXmlNode &oNode = oNodes[i]; if (bIsRemoveAll) { @@ -722,15 +715,14 @@ public: return; sXml = L""; - XmlUtils::CXmlNodes oNodes; + std::vector oNodes; if (oRels.GetNodes(L"*", oNodes)) { - int nCount = oNodes.GetCount(); + size_t nCount = oNodes.size(); - for (int i = 0; i < nCount; ++i) + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode oNode; - oNodes.GetAt(i, oNode); + XmlUtils::CXmlNode &oNode = oNodes[i]; if (L"Relationship" == oNode.GetName() && L"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin" == oNode.GetAttribute(L"Type")) @@ -756,15 +748,14 @@ public: return; sXml = L""; - XmlUtils::CXmlNodes oNodes; + std::vector oNodes; if (oRels.GetNodes(L"*", oNodes)) { - int nCount = oNodes.GetCount(); + size_t nCount = oNodes.size(); - for (int i = 0; i < nCount; ++i) + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode oNode; - oNodes.GetAt(i, oNode); + XmlUtils::CXmlNode &oNode = oNodes[i]; if (L"Relationship" == oNode.GetName() && L"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature" == oNode.GetAttribute(L"Type") && diff --git a/DesktopEditor/xmlsec/src/src/XmlRels.h b/DesktopEditor/xmlsec/src/src/XmlRels.h index 9b52c9522f..35c6ec1b61 100644 --- a/DesktopEditor/xmlsec/src/src/XmlRels.h +++ b/DesktopEditor/xmlsec/src/src/XmlRels.h @@ -107,15 +107,14 @@ public: void FromXmlNode(XmlUtils::CXmlNode& oNode, std::map* check_need = NULL) { - XmlUtils::CXmlNodes oNodes; + std::vector oNodes; if (!oNode.GetNodes(L"Relationship", oNodes)) return; - int nCount = oNodes.GetCount(); - for (int i = 0; i < nCount; ++i) + size_t nCount = oNodes.size(); + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode oRel; - oNodes.GetAt(i, oRel); + XmlUtils::CXmlNode &oRel = oNodes[i]; if (NULL == check_need) { diff --git a/DesktopEditor/xmlsec/src/src/XmlTransform.h b/DesktopEditor/xmlsec/src/src/XmlTransform.h index bd5516893c..72b469157e 100644 --- a/DesktopEditor/xmlsec/src/src/XmlTransform.h +++ b/DesktopEditor/xmlsec/src/src/XmlTransform.h @@ -43,14 +43,13 @@ public: virtual void LoadFromXml(XmlUtils::CXmlNode& node) { - XmlUtils::CXmlNodes oNodesIds; + std::vector oNodesIds; node.GetChilds(oNodesIds); - int nCount = oNodesIds.GetCount(); - for (int i = 0; i < nCount; ++i) + size_t nCount = oNodesIds.size(); + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode _node; - oNodesIds.GetAt(i, _node); + XmlUtils::CXmlNode& _node = oNodesIds[i]; std::wstring sType = _node.GetAttribute("SourceId"); if (!sType.empty()) @@ -138,12 +137,11 @@ public: { m_valid = true; - XmlUtils::CXmlNodes oNodes = node.GetNodes(L"Transform"); - int nCount = oNodes.GetCount(); - for (int i = 0; i < nCount; ++i) + std::vector oNodes = node.GetNodes(L"Transform"); + size_t nCount = oNodes.size(); + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode nodeTransform; - oNodes.GetAt(i, nodeTransform); + XmlUtils::CXmlNode &nodeTransform = oNodes[i]; IXmlTransform* pTransform = IXmlTransform::GetFromType(nodeTransform.GetAttributeA("Algorithm")); if (NULL == pTransform) diff --git a/HtmlFile/HtmlFile.cpp b/HtmlFile/HtmlFile.cpp index 2ef1b41c1a..4554e8fceb 100644 --- a/HtmlFile/HtmlFile.cpp +++ b/HtmlFile/HtmlFile.cpp @@ -201,19 +201,19 @@ static bool IsLinuxXVFB() XmlUtils::CXmlNode oNode; if (oNode.FromXmlFile(sPathConfig)) { - XmlUtils::CXmlNodes oNodes; + std::vector oNodes; if (oNode.GetNodes(L"htmlnoxvfb", oNodes)) { - if (oNodes.GetCount() == 1) + if (oNodes.size() == 1) return false; } } else if (oNode.FromXmlFile(sProcess + L"converter/DoctRenderer.config")) { - XmlUtils::CXmlNodes oNodes; + std::vector oNodes; if (oNode.GetNodes(L"htmlnoxvfb", oNodes)) { - if (oNodes.GetCount() == 1) + if (oNodes.size() == 1) return false; } } @@ -228,14 +228,13 @@ static void GetScriptsPath(NSStringUtils::CStringBuilder& oBuilder) if (!oNode.FromXmlFile(sPathConfig)) return; - XmlUtils::CXmlNodes oNodesFiles; + std::vector oNodesFiles; if (oNode.GetNodes(L"file", oNodesFiles)) { - int nCount = oNodesFiles.GetCount(); - for (int i = 0; i < nCount; ++i) + size_t nCount = oNodesFiles.size(); + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode _node; - oNodesFiles.GetAt(i, _node); + XmlUtils::CXmlNode &_node = oNodesFiles[i]; std::wstring sFile = _node.GetText(); @@ -256,14 +255,13 @@ static void GetScriptsPath(NSStringUtils::CStringBuilder& oBuilder) } } } - XmlUtils::CXmlNodes oNodesHtmlFiles; + std::vector oNodesHtmlFiles; if (oNode.GetNodes(L"htmlfile", oNodesHtmlFiles)) { - int nCount = oNodesHtmlFiles.GetCount(); + size_t nCount = oNodesHtmlFiles.size(); for (int i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode _node; - oNodesHtmlFiles.GetAt(i, _node); + XmlUtils::CXmlNode &_node = oNodesHtmlFiles[i]; std::wstring sFile = _node.GetText(); @@ -279,14 +277,13 @@ static void GetScriptsPath(NSStringUtils::CStringBuilder& oBuilder) } XmlUtils::CXmlNode oNodeSdk = oNode.ReadNode(L"DoctSdk"); - XmlUtils::CXmlNodes oNodes; + std::vector oNodes; if (oNodeSdk.GetNodes(L"file", oNodes)) { - int nCount = oNodes.GetCount(); - XmlUtils::CXmlNode _node; - for (int i = 0; i < nCount; ++i) + size_t nCount = oNodes.size(); + for (size_t i = 0; i < nCount; ++i) { - oNodes.GetAt(i, _node); + XmlUtils::CXmlNode &_node = oNodes[i]; std::wstring sPath = _node.GetText(); if (!NSFile::CFileBinary::Exists(sPath) || NSFile::CFileBinary::Exists(sProcess + sPath)) @@ -590,14 +587,13 @@ static std::vector ParseEpub(const std::wstring& sPackagePath, std std::wstring sDescription = oNodeMeta.ReadValueString(L"dc:description"); std::wstring sCoverage = oNodeMeta.ReadValueString(L"dc:coverage"); - XmlUtils::CXmlNodes oMetaNodes = oNodeMeta.ReadNodesNoNS(L"meta"); + std::vector oMetaNodes = oNodeMeta.ReadNodesNoNS(L"meta"); if (oMetaNodes.IsValid()) { - int nCountMeta = oMetaNodes.GetCount(); - for (int i = 0; i < nCountMeta; ++i) + size_t nCountMeta = oMetaNodes.size(); + for (size_t i = 0; i < nCountMeta; ++i) { - XmlUtils::CXmlNode oNodeTmp; - oMetaNodes.GetAt(i, oNodeTmp); + XmlUtils::CXmlNode &oNodeTmp = oMetaNodes[i]; std::wstring sName = oNodeTmp.GetAttribute(L"name"); if (sName == L"cover") @@ -658,16 +654,15 @@ static std::vector ParseEpub(const std::wstring& sPackagePath, std if (!oNodeRoot.IsValid()) return arHtmls; - XmlUtils::CXmlNodes oNodesItemRef = oNodeSpine.ReadNodesNoNS(L"itemref"); + std::vector oNodesItemRef = oNodeSpine.ReadNodesNoNS(L"itemref"); if (!oNodeSpine.IsValid()) return arHtmls; std::vector sIds; - int nCountRefs = oNodesItemRef.GetCount(); - for (int i = 0; i < nCountRefs; ++i) + size_t nCountRefs = oNodesItemRef.size(); + for (size_t i = 0; i < nCountRefs; ++i) { - XmlUtils::CXmlNode oNodeTmp; - oNodesItemRef.GetAt(i, oNodeTmp); + XmlUtils::CXmlNode &oNodeTmp = oNodesItemRef[i]; std::wstring sId = oNodeTmp.GetAttribute(L"idref"); if (!sId.empty()) @@ -680,7 +675,7 @@ static std::vector ParseEpub(const std::wstring& sPackagePath, std XmlUtils::CXmlNode oNodeManifest = oNodeRoot.ReadNodeNoNS(L"manifest"); if (!oNodeRoot.IsValid()) return arHtmls; - XmlUtils::CXmlNodes oNodesItems = oNodeManifest.ReadNodesNoNS(L"item"); + std::vector oNodesItems = oNodeManifest.ReadNodesNoNS(L"item"); if (!oNodeManifest.IsValid()) return arHtmls; @@ -690,11 +685,10 @@ static std::vector ParseEpub(const std::wstring& sPackagePath, std sPackagePathDir = sPackagePath.substr(0, pos + 1); std::map mapHtmls; - int nCountItems = oNodesItems.GetCount(); - for (int i = 0; i < nCountItems; ++i) + size_t nCountItems = oNodesItems.size(); + for (size_t i = 0; i < nCountItems; ++i) { - XmlUtils::CXmlNode oNodeTmp; - oNodesItems.GetAt(i, oNodeTmp); + XmlUtils::CXmlNode &oNodeTmp = oNodesItems[i]; std::wstring sMime = oNodeTmp.GetAttribute(L"media-type"); std::wstring sHRef = oNodeTmp.GetAttribute(L"href"); @@ -758,15 +752,14 @@ int CHtmlFile::ConvertEpub(const std::wstring& sFolder, std::wstring& sMetaInfo, std::wstring sPackagePathXml; - XmlUtils::CXmlNodes oNodesRootFile = oNodeRootFiles.ReadNodesNoNS(L"rootfile"); + std::vector oNodesRootFile = oNodeRootFiles.ReadNodesNoNS(L"rootfile"); if (!oNodeRootFiles.IsValid()) return 1; - int nCount = oNodesRootFile.GetCount(); - for (int i = 0; i < nCount; ++i) + size_t nCount = oNodesRootFile.size(); + for (size_t i = 0; i < nCount; ++i) { - XmlUtils::CXmlNode oNodeRF; - oNodesRootFile.GetAt(i, oNodeRF); + XmlUtils::CXmlNode &oNodeRF = oNodesRootFile[i]; std::wstring sMime = oNodeRF.GetAttribute(L"media-type"); std::wstring sPackagePath = oNodeRF.GetAttribute(L"full-path"); diff --git a/PdfFile/SrcReader/RendererOutputDev.cpp b/PdfFile/SrcReader/RendererOutputDev.cpp index 9b4f2302d0..ae0e06b39d 100644 --- a/PdfFile/SrcReader/RendererOutputDev.cpp +++ b/PdfFile/SrcReader/RendererOutputDev.cpp @@ -266,7 +266,7 @@ namespace PdfReader //if ( _T("PDFFontList") == oMainNode.getName() ) //{ - // XmlUtils::CXmlNodes oFonts; + // std::vector oFonts; // oMainNode.GetNodes( _T("Font"), oFonts ); // for ( int nIndex = 0; nIndex < oFonts.GetCount(); nIndex++ ) // { @@ -301,7 +301,7 @@ namespace PdfReader // if ( !pCodeToGid ) // return; - // XmlUtils::CXmlNodes oArray; + // std::vector oArray; // oNode.GetNodes( _T("Entry"), oArray ); // for ( int nCurIndex = 0; nCurIndex < oArray.GetCount() && nCurIndex < nLength; nCurIndex++ ) // { @@ -323,7 +323,7 @@ namespace PdfReader // if ( !pCodeToUnicode ) // return; - // XmlUtils::CXmlNodes oArray; + // std::vector oArray; // oNode.GetNodes( _T("Entry"), oArray ); // for ( int nCurIndex = 0; nCurIndex < oArray.GetCount() && nCurIndex < nLength; nCurIndex++ ) // { diff --git a/Test/Applications/x2tTester/x2tTester.cpp b/Test/Applications/x2tTester/x2tTester.cpp index c794b77c3c..3969256cbc 100644 --- a/Test/Applications/x2tTester/x2tTester.cpp +++ b/Test/Applications/x2tTester/x2tTester.cpp @@ -278,13 +278,12 @@ void Cx2tTester::SetConfig(const std::wstring& configPath) bool default_output_formats = true; XmlUtils::CXmlNode root; - XmlUtils::CXmlNodes nodes; + std::vector nodes; if(root.FromXmlFile(configPath) && root.GetChilds(nodes)) { - for(int i = 0; i < nodes.GetCount(); i++) + for(size_t i = 0; i < nodes.size(); i++) { - XmlUtils::CXmlNode node; - nodes.GetAt(i, node); + XmlUtils::CXmlNode node = nodes[i]; std::wstring name = node.GetName(); // key-value @@ -304,15 +303,14 @@ void Cx2tTester::SetConfig(const std::wstring& configPath) else if(name == L"inputFilesList" && !node.GetText().empty()) { XmlUtils::CXmlNode files_list_root; - XmlUtils::CXmlNodes files_list_nodes; + std::vector files_list_nodes; std::wstring files_list = node.GetText(); if(files_list_root.FromXmlFile(files_list) && files_list_root.GetChilds(files_list_nodes)) { - for(int j = 0; j < files_list_nodes.GetCount(); j++) + for(size_t j = 0; j < files_list_nodes.size(); j++) { - XmlUtils::CXmlNode n; - files_list_nodes.GetAt(j, n); + XmlUtils::CXmlNode &n = files_list_nodes[j]; m_inputFiles.push_back(n.GetText()); } } @@ -338,11 +336,10 @@ void Cx2tTester::SetConfig(const std::wstring& configPath) else if (name == L"fonts") { m_bIsUseSystemFonts = (1 == node.ReadAttributeInt(L"system", 1)) ? true : false; - XmlUtils::CXmlNodes oNodeFontDirs = node.ReadNodesNoNS(L"directory"); - for (int nIndex = 0, nCount = oNodeFontDirs.GetCount(); nIndex < nCount; ++nIndex) + std::vector oNodeFontDirs = node.ReadNodesNoNS(L"directory"); + for (size_t nIndex = 0, nCount = oNodeFontDirs.size(); nIndex < nCount; ++nIndex) { - XmlUtils::CXmlNode oNodeDir; - oNodeFontDirs.GetAt(nIndex, oNodeDir); + XmlUtils::CXmlNode &oNodeDir = oNodeFontDirs[nIndex]; m_arAdditionalFontsDirs.push_back(oNodeDir.GetText()); } }