drawinglayer/source/tools/primitive2dxmldump.cxx | 1 filter/source/xsltfilter/LibXSLTTransformer.cxx | 2 helpcompiler/source/HelpLinker.cxx | 4 + include/xmloff/xmltoken.hxx | 2 sax/source/fastparser/fastparser.cxx | 2 sc/source/core/tool/interpr7.cxx | 1 sc/source/filter/xml/XMLExportDataPilot.cxx | 2 sc/source/filter/xml/XMLExportDatabaseRanges.cxx | 2 sc/source/filter/xml/xmlfilti.cxx | 6 - sw/inc/pagedesc.hxx | 8 +- sw/source/core/doc/docfmt.cxx | 33 +++++++++ sw/source/core/layout/pagedesc.cxx | 76 +++++++++++------------ unoxml/source/dom/attr.cxx | 1 unoxml/source/dom/document.cxx | 1 unoxml/source/dom/documentbuilder.cxx | 1 unoxml/source/dom/entity.cxx | 1 unoxml/source/xpath/xpathapi.cxx | 7 +- xmloff/source/core/xmltoken.cxx | 2 xmloff/source/draw/sdpropls.cxx | 2 xmloff/source/style/PageMasterStyleMap.cxx | 6 - xmloff/source/table/XMLTableExport.cxx | 2 xmlsecurity/inc/xmlsec-wrapper.h | 1 xmlsecurity/inc/xmlsec/saxhelper.hxx | 1 23 files changed, 105 insertions(+), 59 deletions(-)
New commits: commit 3b737ae67d26387e17d497a88206aafc53a182ce Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Feb 23 17:18:04 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Feb 26 16:20:30 2024 +0100 tdf#147731 sw: fix memory leak in SwDoc::CopyPageDesc() Commit 963de9feb37105560fde14b44d992e47f341bb5b "sw: fix issue with copying stashed frame format" fixed the actual bug here, but introduced a new memory leak. This causes an assert in CppunitTest_uiwriter3: cppunittester: svl/source/items/itempool.cxx:779: void SfxItemPool::Remove(const SfxPoolItem&): Assertion `rItem.GetRefCount() && "RefCount == 0, Remove impossible"' failed. The assert happens only when this is backported to the libreoffice-7-6 branch, because commit ab7c81f55621d7b0d1468c63305163016dd78837 "ITEM: Get away from classic 'poolable' Item flag" removed the assert. The problem is that a SwFormatFrameSize inside a footer SwFrameFormat is leaked 4 times, because 4 SwFrameFormats are leaked; the leak is that SwDoc::CopyPageDesc() creates a new pNewFormat, passed it to StashFrameFormat(), which copies it but doesn't free it. There is also a usage of std::shared_ptr here that is very questionable; SwFrameFormat should never be shared between different SwPageDesc. (regression from commit b802ab694a8a7357d4657f3e11b571144fa7c7bf) Change-Id: I44133bc5e6789a51ce064f1aa5ea8b325224365b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163854 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 5c4ae1b19c51dcd62dad8e1d3e8beb87a0311352) (cherry picked from commit 9179d7051872be45471b133caf44fec423144fce) diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index 11bb347aa1fb..ddc7e659a5bb 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -151,9 +151,9 @@ class SW_DLLPUBLIC SwPageDesc final struct StashedPageDesc { - std::shared_ptr<SwFrameFormat> m_pStashedFirst; - std::shared_ptr<SwFrameFormat> m_pStashedLeft; - std::shared_ptr<SwFrameFormat> m_pStashedFirstLeft; + std::optional<SwFrameFormat> m_oStashedFirst; + std::optional<SwFrameFormat> m_oStashedLeft; + std::optional<SwFrameFormat> m_oStashedFirstLeft; }; mutable StashedPageDesc m_aStashedHeader; diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index d9af7d346a89..3bedfd125219 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1558,21 +1558,21 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, { if (pStashedFormatSrc->GetDoc() != this) { - SwFrameFormat* pNewFormat = new SwFrameFormat(GetAttrPool(), "CopyDesc", GetDfltFrameFormat()); + SwFrameFormat newFormat(GetAttrPool(), "CopyDesc", GetDfltFrameFormat()); SfxItemSet aAttrSet(pStashedFormatSrc->GetAttrSet()); aAttrSet.ClearItem(RES_HEADER); aAttrSet.ClearItem(RES_FOOTER); - pNewFormat->DelDiffs( aAttrSet ); - pNewFormat->SetFormatAttr( aAttrSet ); + newFormat.DelDiffs(aAttrSet); + newFormat.SetFormatAttr(aAttrSet); if (bHeader) - CopyHeader(*pStashedFormatSrc, *pNewFormat); + CopyHeader(*pStashedFormatSrc, newFormat); else - CopyFooter(*pStashedFormatSrc, *pNewFormat); + CopyFooter(*pStashedFormatSrc, newFormat); - rDstDesc.StashFrameFormat(*pNewFormat, bHeader, bLeft, bFirst); + rDstDesc.StashFrameFormat(newFormat, bHeader, bLeft, bFirst); } else { diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 40a7b5865766..5bc08706b80a 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -83,13 +83,13 @@ SwPageDesc::SwPageDesc( const SwPageDesc &rCpy ) , m_FootnoteInfo( rCpy.GetFootnoteInfo() ) , m_pdList( nullptr ) { - m_aStashedHeader.m_pStashedFirst = rCpy.m_aStashedHeader.m_pStashedFirst; - m_aStashedHeader.m_pStashedLeft = rCpy.m_aStashedHeader.m_pStashedLeft; - m_aStashedHeader.m_pStashedFirstLeft = rCpy.m_aStashedHeader.m_pStashedFirstLeft; + m_aStashedHeader.m_oStashedFirst = rCpy.m_aStashedHeader.m_oStashedFirst; + m_aStashedHeader.m_oStashedLeft = rCpy.m_aStashedHeader.m_oStashedLeft; + m_aStashedHeader.m_oStashedFirstLeft = rCpy.m_aStashedHeader.m_oStashedFirstLeft; - m_aStashedFooter.m_pStashedFirst = rCpy.m_aStashedFooter.m_pStashedFirst; - m_aStashedFooter.m_pStashedLeft = rCpy.m_aStashedFooter.m_pStashedLeft; - m_aStashedFooter.m_pStashedFirstLeft = rCpy.m_aStashedFooter.m_pStashedFirstLeft; + m_aStashedFooter.m_oStashedFirst = rCpy.m_aStashedFooter.m_oStashedFirst; + m_aStashedFooter.m_oStashedLeft = rCpy.m_aStashedFooter.m_oStashedLeft; + m_aStashedFooter.m_oStashedFirstLeft = rCpy.m_aStashedFooter.m_oStashedFirstLeft; if (rCpy.m_pTextFormatColl && rCpy.m_aDepends.IsListeningTo(rCpy.m_pTextFormatColl)) { @@ -110,13 +110,13 @@ SwPageDesc & SwPageDesc::operator = (const SwPageDesc & rSrc) m_FirstMaster = rSrc.m_FirstMaster; m_FirstLeft = rSrc.m_FirstLeft; - m_aStashedHeader.m_pStashedFirst = rSrc.m_aStashedHeader.m_pStashedFirst; - m_aStashedHeader.m_pStashedLeft = rSrc.m_aStashedHeader.m_pStashedLeft; - m_aStashedHeader.m_pStashedFirstLeft = rSrc.m_aStashedHeader.m_pStashedFirstLeft; + m_aStashedHeader.m_oStashedFirst = rSrc.m_aStashedHeader.m_oStashedFirst; + m_aStashedHeader.m_oStashedLeft = rSrc.m_aStashedHeader.m_oStashedLeft; + m_aStashedHeader.m_oStashedFirstLeft = rSrc.m_aStashedHeader.m_oStashedFirstLeft; - m_aStashedFooter.m_pStashedFirst = rSrc.m_aStashedFooter.m_pStashedFirst; - m_aStashedFooter.m_pStashedLeft = rSrc.m_aStashedFooter.m_pStashedLeft; - m_aStashedFooter.m_pStashedFirstLeft = rSrc.m_aStashedFooter.m_pStashedFirstLeft; + m_aStashedFooter.m_oStashedFirst = rSrc.m_aStashedFooter.m_oStashedFirst; + m_aStashedFooter.m_oStashedLeft = rSrc.m_aStashedFooter.m_oStashedLeft; + m_aStashedFooter.m_oStashedFirstLeft = rSrc.m_aStashedFooter.m_oStashedFirstLeft; m_aDepends.EndListeningAll(); if (rSrc.m_pTextFormatColl && rSrc.m_aDepends.IsListeningTo(rSrc.m_pTextFormatColl)) @@ -409,30 +409,30 @@ void SwPageDesc::ChgFirstShare( bool bNew ) void SwPageDesc::StashFrameFormat(const SwFrameFormat& rFormat, bool bHeader, bool bLeft, bool bFirst) { assert(rFormat.GetRegisteredIn()); - std::shared_ptr<SwFrameFormat>* pFormat = nullptr; + std::optional<SwFrameFormat>* pFormat = nullptr; if (bHeader) { if (bLeft && !bFirst) - pFormat = &m_aStashedHeader.m_pStashedLeft; + pFormat = &m_aStashedHeader.m_oStashedLeft; else if (!bLeft && bFirst) - pFormat = &m_aStashedHeader.m_pStashedFirst; + pFormat = &m_aStashedHeader.m_oStashedFirst; else if (bLeft && bFirst) - pFormat = &m_aStashedHeader.m_pStashedFirstLeft; + pFormat = &m_aStashedHeader.m_oStashedFirstLeft; } else { if (bLeft && !bFirst) - pFormat = &m_aStashedFooter.m_pStashedLeft; + pFormat = &m_aStashedFooter.m_oStashedLeft; else if (!bLeft && bFirst) - pFormat = &m_aStashedFooter.m_pStashedFirst; + pFormat = &m_aStashedFooter.m_oStashedFirst; else if (bLeft && bFirst) - pFormat = &m_aStashedFooter.m_pStashedFirstLeft; + pFormat = &m_aStashedFooter.m_oStashedFirstLeft; } if (pFormat) { - *pFormat = std::make_shared<SwFrameFormat>(rFormat); + pFormat->emplace(rFormat); } else { @@ -444,24 +444,24 @@ void SwPageDesc::StashFrameFormat(const SwFrameFormat& rFormat, bool bHeader, bo const SwFrameFormat* SwPageDesc::GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const { - std::shared_ptr<SwFrameFormat>* pFormat = nullptr; + std::optional<SwFrameFormat>* pFormat = nullptr; if (bLeft && !bFirst) { - pFormat = bHeader ? &m_aStashedHeader.m_pStashedLeft : &m_aStashedFooter.m_pStashedLeft; + pFormat = bHeader ? &m_aStashedHeader.m_oStashedLeft : &m_aStashedFooter.m_oStashedLeft; } else if (!bLeft && bFirst) { - pFormat = bHeader ? &m_aStashedHeader.m_pStashedFirst : &m_aStashedFooter.m_pStashedFirst; + pFormat = bHeader ? &m_aStashedHeader.m_oStashedFirst : &m_aStashedFooter.m_oStashedFirst; } else if (bLeft && bFirst) { - pFormat = bHeader ? &m_aStashedHeader.m_pStashedFirstLeft : &m_aStashedFooter.m_pStashedFirstLeft; + pFormat = bHeader ? &m_aStashedHeader.m_oStashedFirstLeft : &m_aStashedFooter.m_oStashedFirstLeft; } if (pFormat) { - return pFormat->get(); + return pFormat->has_value() ? &**pFormat : nullptr; } else { @@ -476,15 +476,15 @@ bool SwPageDesc::HasStashedFormat(bool bHeader, bool bLeft, bool bFirst) const { if (bLeft && !bFirst) { - return m_aStashedHeader.m_pStashedLeft != nullptr; + return m_aStashedHeader.m_oStashedLeft.has_value(); } else if (!bLeft && bFirst) { - return m_aStashedHeader.m_pStashedFirst != nullptr; + return m_aStashedHeader.m_oStashedFirst.has_value(); } else if (bLeft && bFirst) { - return m_aStashedHeader.m_pStashedFirstLeft != nullptr; + return m_aStashedHeader.m_oStashedFirstLeft.has_value(); } else { @@ -496,15 +496,15 @@ bool SwPageDesc::HasStashedFormat(bool bHeader, bool bLeft, bool bFirst) const { if (bLeft && !bFirst) { - return m_aStashedFooter.m_pStashedLeft != nullptr; + return m_aStashedFooter.m_oStashedLeft.has_value(); } else if (!bLeft && bFirst) { - return m_aStashedFooter.m_pStashedFirst != nullptr; + return m_aStashedFooter.m_oStashedFirst.has_value(); } else if (bLeft && bFirst) { - return m_aStashedFooter.m_pStashedFirstLeft != nullptr; + return m_aStashedFooter.m_oStashedFirstLeft.has_value(); } else { @@ -520,15 +520,15 @@ void SwPageDesc::RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst) { if (bLeft && !bFirst) { - m_aStashedHeader.m_pStashedLeft.reset(); + m_aStashedHeader.m_oStashedLeft.reset(); } else if (!bLeft && bFirst) { - m_aStashedHeader.m_pStashedFirst.reset(); + m_aStashedHeader.m_oStashedFirst.reset(); } else if (bLeft && bFirst) { - m_aStashedHeader.m_pStashedFirstLeft.reset(); + m_aStashedHeader.m_oStashedFirstLeft.reset(); } else { @@ -539,15 +539,15 @@ void SwPageDesc::RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst) { if (bLeft && !bFirst) { - m_aStashedFooter.m_pStashedLeft.reset(); + m_aStashedFooter.m_oStashedLeft.reset(); } else if (!bLeft && bFirst) { - m_aStashedFooter.m_pStashedFirst.reset(); + m_aStashedFooter.m_oStashedFirst.reset(); } else if (bLeft && bFirst) { - m_aStashedFooter.m_pStashedFirstLeft.reset(); + m_aStashedFooter.m_oStashedFirstLeft.reset(); } else { commit c3d7b5a3def5f728a66295a099f6d6cb5f035b93 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Nov 30 16:42:26 2023 +0900 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Feb 26 16:20:30 2024 +0100 sw: fix issue with copying stashed frame format When the PageDesc is copied from one document to another, we don't make sure the stashed FrameFormat(s) are also properly copied to the new document (which can happen at copy/paste). This can cause a crash if the stashed FrameFormats are accessed or destructed after the original document is destroyed. This fixes the issue so that when we detect the PageDesc belong to different documents, the stashed FrameFormats are copied just like the non-stashed FrameFormats (used for headers and footers). Change-Id: I948068dba4d39bb47c3725dfa8491c53c5833c7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160065 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 50c887d67c5c27234374bad7235225ff7500b98d) diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index 382bbb5f00cd..11bb347aa1fb 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -223,7 +223,7 @@ public: const SwFrameFormat* GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const; /// Checks if the pagedescriptor has a stashed format according to the parameters or not. - bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst); + bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst) const; /// Gives the feature of removing the stashed format by hand if it is necessary. void RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index dbf8fefeda4a..d9af7d346a89 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1545,14 +1545,43 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, // Copy the stashed formats as well between the page descriptors... for (bool bFirst : { true, false }) + { for (bool bLeft : { true, false }) + { for (bool bHeader : { true, false }) { if (!bLeft && !bFirst) continue; - if (auto pStashedFormat = rSrcDesc.GetStashedFrameFormat(bHeader, bLeft, bFirst)) - rDstDesc.StashFrameFormat(*pStashedFormat, bHeader, bLeft, bFirst); + + // Copy format only if it exists + if (auto pStashedFormatSrc = rSrcDesc.GetStashedFrameFormat(bHeader, bLeft, bFirst)) + { + if (pStashedFormatSrc->GetDoc() != this) + { + SwFrameFormat* pNewFormat = new SwFrameFormat(GetAttrPool(), "CopyDesc", GetDfltFrameFormat()); + + SfxItemSet aAttrSet(pStashedFormatSrc->GetAttrSet()); + aAttrSet.ClearItem(RES_HEADER); + aAttrSet.ClearItem(RES_FOOTER); + + pNewFormat->DelDiffs( aAttrSet ); + pNewFormat->SetFormatAttr( aAttrSet ); + + if (bHeader) + CopyHeader(*pStashedFormatSrc, *pNewFormat); + else + CopyFooter(*pStashedFormatSrc, *pNewFormat); + + rDstDesc.StashFrameFormat(*pNewFormat, bHeader, bLeft, bFirst); + } + else + { + rDstDesc.StashFrameFormat(*pStashedFormatSrc, bHeader, bLeft, bFirst); + } + } } + } + } } void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles ) diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index d93b47517e5b..40a7b5865766 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -470,7 +470,7 @@ const SwFrameFormat* SwPageDesc::GetStashedFrameFormat(bool bHeader, bool bLeft, } } -bool SwPageDesc::HasStashedFormat(bool bHeader, bool bLeft, bool bFirst) +bool SwPageDesc::HasStashedFormat(bool bHeader, bool bLeft, bool bFirst) const { if (bHeader) { commit 81cc1e539114cf826f82c3d3718fe0dfacf66a9a Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Nov 27 08:02:59 2023 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Feb 26 16:20:30 2024 +0100 tdf#158302 fix build against system-libxml-2.12 Seen in a fedora:40 container, using --with-system-libcmis, --with-system-liblangtag and --with-system-xmlsec. Change-Id: I9d748d3dc0b70dbfdfcb6b99c9ce8440bda6f326 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159980 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit c8f7408db73d2f2ccacb25a2b4fef8dfebdfc6cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161661 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 764890a53cea2ccb6d2fb6d8c7edb5e1c91ecdc0) diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index 63562973d6ca..9ec59e75dccb 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -15,6 +15,7 @@ #include <math.h> #include <memory> +#include <libxml/parser.h> #include <sal/log.hxx> #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index 324404cf33cc..28803b68e840 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -333,7 +333,7 @@ namespace XSLT } else { - xmlErrorPtr lastErr = xmlGetLastError(); + const xmlError* lastErr = xmlGetLastError(); OUString msg; if (lastErr) msg = OStringToOUString(lastErr->message, RTL_TEXTENCODING_UTF8); diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index f7acc30ecc7d..d4541b86a2d2 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -815,7 +815,11 @@ static const HelpProcessingException* GpXMLParsingException = nullptr; extern "C" { +#if LIBXML_VERSION >= 21200 +static void StructuredXMLErrorFunction(SAL_UNUSED_PARAMETER void *, const xmlError* error) +#else static void StructuredXMLErrorFunction(SAL_UNUSED_PARAMETER void *, xmlErrorPtr error) +#endif { std::string aErrorMsg = error->message; std::string aXMLParsingFile; diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 77f9c605b707..4965e466977a 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -735,7 +735,7 @@ namespace xmloff::token { XML_EMBEDDED_VISIBLE_AREA, XML_EMBOSSED, XML_EMISSIVE_COLOR, - XML_EMPTY, + XML_TOKEN_EMPTY, XML_EMPTY_LINE_REFRESH, XML_ENABLE_NUMBERING, XML_ENABLED, diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 250078bc5054..6ea329684178 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -579,7 +579,7 @@ Event& Entity::getEvent( CallbackType aType ) OUString lclGetErrorMessage( xmlParserCtxtPtr ctxt, std::u16string_view sSystemId, sal_Int32 nLine ) { const char* pMessage; - xmlErrorPtr error = xmlCtxtGetLastError( ctxt ); + const xmlError* error = xmlCtxtGetLastError( ctxt ); if( error && error->message ) pMessage = error->message; else diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index 352c7cf70e45..ecb4ea346396 100644 --- a/sc/source/core/tool/interpr7.cxx +++ b/sc/source/core/tool/interpr7.cxx @@ -31,6 +31,7 @@ #include <cstring> #include <memory> #include <string_view> +#include <libxml/parser.h> using namespace com::sun::star; diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index cd6f26b1135e..f8595a5a71e7 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -123,7 +123,7 @@ void ScXMLExportDataPilot::WriteDPCondition(const ScQueryEntry& aQueryEntry, boo if (aQueryEntry.IsQueryByEmpty()) { - rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_OPERATOR, GetXMLToken(XML_EMPTY)); + rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_OPERATOR, GetXMLToken(XML_TOKEN_EMPTY)); } else if (aQueryEntry.IsQueryByNonEmpty()) { diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx index 61c01d236bfa..9c78f60e8427 100644 --- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx +++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx @@ -376,7 +376,7 @@ private: case SC_EQUAL: { if (rEntry.IsQueryByEmpty()) - return GetXMLToken(XML_EMPTY); + return GetXMLToken(XML_TOKEN_EMPTY); else if (rEntry.IsQueryByNonEmpty()) return GetXMLToken(XML_NOEMPTY); diff --git a/sc/source/filter/xml/xmlfilti.cxx b/sc/source/filter/xml/xmlfilti.cxx index 7585ce0c50fa..61f7cfe4a349 100644 --- a/sc/source/filter/xml/xmlfilti.cxx +++ b/sc/source/filter/xml/xmlfilti.cxx @@ -370,7 +370,7 @@ void ScXMLConditionContext::GetOperator( rEntry.eOp = SC_BOTPERC; else if (IsXMLToken(aOpStr, XML_BOTTOM_VALUES)) rEntry.eOp = SC_BOTVAL; - else if (IsXMLToken(aOpStr, XML_EMPTY)) + else if (IsXMLToken(aOpStr, XML_TOKEN_EMPTY)) rEntry.SetQueryByEmpty(); else if (aOpStr == u">") rEntry.eOp = SC_GREATER; @@ -422,7 +422,7 @@ void SAL_CALL ScXMLConditionContext::endFastElement( sal_Int32 /*nElement*/ ) if (maQueryItems.empty()) { ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); - if (IsXMLToken(sOperator, XML_EMPTY)) + if (IsXMLToken(sOperator, XML_TOKEN_EMPTY)) return; if (IsXMLToken(sDataType, XML_NUMBER)) { @@ -753,7 +753,7 @@ void SAL_CALL ScXMLDPConditionContext::endFastElement( sal_Int32 /*nElement*/ ) else aFilterField.eConnect = SC_AND; pFilterContext->SetIsCaseSensitive(bIsCaseSensitive); - if (IsXMLToken(sOperator, XML_EMPTY)) + if (IsXMLToken(sOperator, XML_TOKEN_EMPTY)) aFilterField.SetQueryByEmpty(); else if (IsXMLToken(sOperator, XML_NOEMPTY)) aFilterField.SetQueryByNonEmpty(); diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx index 4988aa4211ec..9d9179c6570b 100644 --- a/unoxml/source/dom/attr.cxx +++ b/unoxml/source/dom/attr.cxx @@ -22,6 +22,7 @@ #include <string.h> #include <memory> +#include <libxml/entities.h> #include <osl/diagnose.h> #include <sal/log.hxx> diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index 413f764815e5..5784c74d2255 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -41,6 +41,7 @@ #include <eventdispatcher.hxx> #include <string.h> +#include <libxml/xmlIO.h> #include <osl/diagnose.h> diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx index 90de083f25c8..dad0f3cc2625 100644 --- a/unoxml/source/dom/documentbuilder.cxx +++ b/unoxml/source/dom/documentbuilder.cxx @@ -22,6 +22,7 @@ #include <string.h> #include <libxml/xmlerror.h> +#include <libxml/parser.h> #include <memory> diff --git a/unoxml/source/dom/entity.cxx b/unoxml/source/dom/entity.cxx index ccc8a0872499..98909dfe8f12 100644 --- a/unoxml/source/dom/entity.cxx +++ b/unoxml/source/dom/entity.cxx @@ -22,6 +22,7 @@ #include <osl/diagnose.h> #include <string.h> +#include <libxml/entities.h> using namespace css::uno; using namespace css::xml::dom; diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index f1968c208860..29450175ea08 100644 --- a/unoxml/source/xpath/xpathapi.cxx +++ b/unoxml/source/xpath/xpathapi.cxx @@ -26,6 +26,7 @@ #include <libxml/xmlerror.h> #include <libxml/xpath.h> #include <libxml/xpathInternals.h> +#include <libxml/xmlIO.h> #include <com/sun/star/xml/xpath/XPathException.hpp> @@ -217,7 +218,7 @@ namespace XPath return selectSingleNode(contextNode, expr); } - static OUString make_error_message(xmlErrorPtr pError) + static OUString make_error_message(const xmlError* pError) { OUStringBuffer buf; if (pError) { @@ -263,7 +264,11 @@ namespace XPath SAL_WARN("unoxml", "libxml2 error: " << str); } +#if LIBXML_VERSION >= 21200 + static void structured_error_func(void *, const xmlError* error) +#else static void structured_error_func(void *, xmlErrorPtr error) +#endif { SAL_WARN("unoxml", "libxml2 error: " << make_error_message(error)); } diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 1606dbc68ab3..0650c1488f1f 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -747,7 +747,7 @@ namespace xmloff::token { TOKEN( "embedded-visible-area", XML_EMBEDDED_VISIBLE_AREA ), TOKEN( "embossed", XML_EMBOSSED ), TOKEN( "emissive-color", XML_EMISSIVE_COLOR ), - TOKEN( "empty", XML_EMPTY ), + TOKEN( "empty", XML_TOKEN_EMPTY ), TOKEN( "empty-line-refresh", XML_EMPTY_LINE_REFRESH ), TOKEN( "enable-numbering", XML_ENABLE_NUMBERING ), TOKEN( "enabled", XML_ENABLED ), diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 5e68aa17599d..f1218d48c8d7 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -76,7 +76,7 @@ using namespace ::xmloff::token; #define DPMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_DRAWING_PAGE,context) #define TMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TEXT,context) #define PMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_PARAGRAPH,context) -#define MAP_END() { nullptr, 0, XML_EMPTY, 0 ,0, SvtSaveOptions::ODFSVER_010, false } +#define MAP_END() { nullptr, 0, XML_TOKEN_EMPTY, 0 ,0, SvtSaveOptions::ODFSVER_010, false } // entry list for graphic properties diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx index 349badc23c5c..c66228c3e385 100644 --- a/xmloff/source/style/PageMasterStyleMap.cxx +++ b/xmloff/source/style/PageMasterStyleMap.cxx @@ -155,7 +155,7 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = PLMAP( "FootnoteLineRelativeWidth", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_PERCENT8|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_WIDTH ), PLMAP( "FootnoteLineTextDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_DISTANCE ), PLMAP( "FootnoteLineWeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_SEP, XML_TYPE_MEASURE16|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_WEIGHT ), - PLMAP( "FootnoteLineStyle", XML_NAMESPACE_STYLE, XML_EMPTY, XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_STYLE ), + PLMAP( "FootnoteLineStyle", XML_NAMESPACE_STYLE, XML_TOKEN_EMPTY, XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_STYLE ), PLMAP_EXT("GutterMargin", XML_NAMESPACE_LO_EXT, XML_MARGIN_GUTTER, XML_TYPE_MEASURE, CTF_PM_MARGINGUTTER), ////////////////////////////////////////////////////////////////////////// @@ -270,7 +270,7 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = HFMAP( "FooterFillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERREPEAT_OFFSET_X ), HFMAP( "FooterFillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERREPEAT_OFFSET_Y ), - { nullptr, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFSVER_010, false } // index 190 + { nullptr, 0, XML_TOKEN_EMPTY, 0, 0, SvtSaveOptions::ODFSVER_010, false } // index 190 }; XMLPropertyMapEntry const g_XMLPageMasterDrawingPageStyleMap[] = @@ -299,7 +299,7 @@ XMLPropertyMapEntry const g_XMLPageMasterDrawingPageStyleMap[] = DPMAP("FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_X), DPMAP("FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_Y), - { nullptr, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFSVER_010, false } + { nullptr, 0, XML_TOKEN_EMPTY, 0, 0, SvtSaveOptions::ODFSVER_010, false } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index c9e306f5e273..46164c372f01 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -60,7 +60,7 @@ using namespace ::com::sun::star::style; #define CMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_COLUMN,context) #define RMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_ROW,context) #define CELLMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_CELL,context) -#define MAP_END { nullptr, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFSVER_010, false } +#define MAP_END { nullptr, 0, XML_TOKEN_EMPTY, 0, 0, SvtSaveOptions::ODFSVER_010, false } const XMLPropertyMapEntry* getColumnPropertiesMap() { diff --git a/xmlsecurity/inc/xmlsec-wrapper.h b/xmlsecurity/inc/xmlsec-wrapper.h index e4048de94bf2..1dc594119202 100644 --- a/xmlsecurity/inc/xmlsec-wrapper.h +++ b/xmlsecurity/inc/xmlsec-wrapper.h @@ -28,6 +28,7 @@ #define XMLSEC_NO_SIZE_T #endif +#include <libxml/parser.h> #include <xmlsec/base64.h> #include <xmlsec/bn.h> #include <xmlsec/errors.h> diff --git a/xmlsecurity/inc/xmlsec/saxhelper.hxx b/xmlsecurity/inc/xmlsec/saxhelper.hxx index a49ccef1894c..a5863ffd0e2a 100644 --- a/xmlsecurity/inc/xmlsec/saxhelper.hxx +++ b/xmlsecurity/inc/xmlsec/saxhelper.hxx @@ -23,6 +23,7 @@ #include <string_view> +#include <libxml/parser.h> #include <libxml/tree.h> #include <rtl/ustring.hxx>