connectivity/source/manager/mdrivermanager.cxx | 4 hwpfilter/source/hstyle.cxx | 4 linguistic/source/lngsvcmgr.cxx | 7 + sal/osl/unx/thread.cxx | 2 sal/rtl/byteseq.cxx | 7 + sal/rtl/hash.cxx | 2 sfx2/source/dialog/splitwin.cxx | 5 svl/source/items/itemset.cxx | 4 sw/qa/extras/unowriter/data/section-table.fodt | 162 +++++++++++++++++++++++++ sw/qa/extras/unowriter/unowriter.cxx | 31 ++++ sw/source/core/doc/doc.cxx | 4 sw/source/core/doc/docfmt.cxx | 3 sw/source/core/text/atrstck.cxx | 3 sw/source/core/unocore/unomap.cxx | 2 sw/source/core/unocore/unoobj2.cxx | 30 ++-- vcl/source/filter/png/PngImageReader.cxx | 7 + vcl/source/window/layout.cxx | 12 - 17 files changed, 255 insertions(+), 34 deletions(-)
New commits: commit 0a18c7a57bf0fcada9667b398cee5fc4159b23be Author: Michael Stahl <[email protected]> AuthorDate: Mon Nov 25 13:45:39 2024 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 21:46:56 2024 +0100 sw: fix property set implementation of SwXTextRange RANGE_IS_SECTION Use cursor that includes section nodes, the core implementation should not need start/end to be a text node. Fix one case in SwDoc::ResetAttrs() where a text node is expected. (regression from commit 7ab349296dac79dad3fec09f60348efcbb9ea17e) Change-Id: I56960b5d233ced02703a7c522ebe6afa3347cd25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177259 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 4fef75d4c8798dd5ebff1c6bd66993665602507d) diff --git a/sw/qa/extras/unowriter/data/section-table.fodt b/sw/qa/extras/unowriter/data/section-table.fodt new file mode 100644 index 000000000000..4f46ac086c91 --- /dev/null +++ b/sw/qa/extras/unowriter/data/section-table.fodt @@ -0,0 +1,162 @@ +<?xml version='1.0' encoding='UTF-8'?> +<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:c alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns: meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:initial-creator>GCC</meta:initial-creator><meta:creation-date>2024-11-25T12:23:18.360978950</meta:creation-date><dc:date>2024-11-25T12:24:38.999591414</dc:date><dc:creator>GCC</dc:creator><meta:editing-duration>PT1M22S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="1" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="2" meta:word-count="5" meta:character-count="31" meta:non-whitespace-character-count="28"/><meta:generator>LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/10f916791e49306b51a6a299739b130fc2129de1</meta:generator></office:meta> + <office:font-face-decls> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Lucida Sans1" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0cm" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" loext:hyphenation-keep-type="column" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing"/> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:orphans="0" fo:widows="0" text:number-lines="false" text:line-number="0"/> + </style:style> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="1" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="2" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="3" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="4" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="5" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="6" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="7" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="8" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="9" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="10" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + </text:outline-style> + <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> + <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/> + <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> + </office:styles> + <office:automatic-styles> + <style:style style:name="Table1" style:family="table"> + <style:table-properties style:width="17cm" table:align="margins"/> + </style:style> + <style:style style:name="Table1.A" style:family="table-column"> + <style:table-column-properties style:column-width="8.5cm" style:rel-column-width="32767*"/> + </style:style> + <style:style style:name="Table1.A1" style:family="table-cell"> + <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" fo:border-right="none" fo:border-top="0.5pt solid #000000" fo:border-bottom="0.5pt solid #000000"/> + </style:style> + <style:style style:name="Table1.B1" style:family="table-cell"> + <style:table-cell-properties fo:padding="0.097cm" fo:border="0.5pt solid #000000"/> + </style:style> + <style:style style:name="Table1.A2" style:family="table-cell"> + <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.5pt solid #000000"/> + </style:style> + <style:style style:name="Table1.B2" style:family="table-cell"> + <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" fo:border-right="0.5pt solid #000000" fo:border-top="none" fo:border-bottom="0.5pt solid #000000"/> + </style:style> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Table_20_Contents"> + <style:text-properties/> + </style:style> + <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard"> + <style:text-properties/> + </style:style> + <style:style style:name="Sect1" style:family="section"> + <style:section-properties fo:background-color="#158466" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + <style:background-image/> + </style:section-properties> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm" loext:margin-gutter="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </office:master-styles> + <office:body> + <office:text> + <text:sequence-decls> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> + <text:sequence-decl text:display-outline-level="0" text:name="Table"/> + <text:sequence-decl text:display-outline-level="0" text:name="Text"/> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> + <text:sequence-decl text:display-outline-level="0" text:name="Figure"/> + </text:sequence-decls> + <text:section text:style-name="Sect1" text:name="Section1"> + <table:table table:name="Table1" table:style-name="Table1"> + <table:table-column table:style-name="Table1.A" table:number-columns-repeated="2"/> + <table:table-row> + <table:table-cell table:style-name="Table1.A1" office:value-type="string"> + <text:p text:style-name="P1">Table in section</text:p> + </table:table-cell> + <table:table-cell table:style-name="Table1.B1" office:value-type="string"> + <text:p text:style-name="Table_20_Contents"/> + </table:table-cell> + </table:table-row> + <table:table-row> + <table:table-cell table:style-name="Table1.A2" office:value-type="string"> + <text:p text:style-name="Table_20_Contents"/> + </table:table-cell> + <table:table-cell table:style-name="Table1.B2" office:value-type="string"> + <text:p text:style-name="Table_20_Contents"/> + </table:table-cell> + </table:table-row> + </table:table> + </text:section> + <text:p text:style-name="P2">Outside section</text:p> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index a2c03bbaaf02..8823cb1defa5 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -556,6 +556,37 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorCopyTable) xCursor->getString()); } +CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSectionAnchorProperties) +{ + createSwDoc("section-table.fodt"); + + uno::Reference<text::XTextSectionsSupplier> const xTextSectionsSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> const xSections( + xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount()); + + uno::Reference<text::XTextContent> const xSection(xSections->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> const xAnchor(xSection->getAnchor()); + uno::Reference<beans::XPropertySet> const xAnchorProp(xAnchor, uno::UNO_QUERY); + + // the problem was that the property set didn't work + auto xSecFromProp = getProperty<uno::Reference<text::XTextContent>>(xAnchorProp, "TextSection"); + CPPUNIT_ASSERT_EQUAL(xSection, xSecFromProp); + + xAnchorProp->setPropertyValue("CharHeight", uno::Any(float(64))); + CPPUNIT_ASSERT_EQUAL(float(64), getProperty<float>(xAnchorProp, "CharHeight")); + uno::Reference<beans::XPropertyState> const xAnchorState(xAnchor, uno::UNO_QUERY); + // TODO: why does this return DEFAULT_VALUE instead of DIRECT_VALUE? + CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, + xAnchorState->getPropertyState("CharHeight")); + CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, + xAnchorState->getPropertyStates({ "CharHeight" })[0]); + CPPUNIT_ASSERT_EQUAL(float(12), xAnchorState->getPropertyDefault("CharHeight").get<float>()); + xAnchorState->setPropertyToDefault("CharHeight"); + CPPUNIT_ASSERT_EQUAL(float(12), getProperty<float>(xAnchorProp, "CharHeight")); +} + CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTextRangeInTable) { createSwDoc("bookmarkintable.fodt"); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 755ee2541fde..4f89de65e4f4 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -365,7 +365,8 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, ++aTmpStt; } - if( pEnd->GetContentIndex() == pEnd->GetNode().GetContentNode()->Len() ) + if (!pEnd->GetNode().IsContentNode() + || pEnd->GetContentIndex() == pEnd->GetNode().GetContentNode()->Len()) { // set up a later, and all CharFormatAttr -> TextFormatAttr ++aTmpEnd; diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 5cb73bf7b8f0..db08e63592e6 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1439,12 +1439,13 @@ SwXTextRange::setPropertyValue( { SolarMutexGuard aGuard; - if (!m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark() + && (m_pImpl->m_eRangePosition != RANGE_IS_SECTION || !m_pImpl->m_pTableOrSectionFormat)) { throw uno::RuntimeException("range has no mark (table?)"); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); SwUnoCursorHelper::SetPropertyValue(aPaM, m_pImpl->m_rPropSet, rPropertyName, rValue); } @@ -1454,12 +1455,13 @@ SwXTextRange::getPropertyValue(const OUString& rPropertyName) { SolarMutexGuard aGuard; - if (!m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark() + && (m_pImpl->m_eRangePosition != RANGE_IS_SECTION || !m_pImpl->m_pTableOrSectionFormat)) { throw uno::RuntimeException("range has no mark (table?)"); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); return SwUnoCursorHelper::GetPropertyValue(aPaM, m_pImpl->m_rPropSet, rPropertyName); } @@ -1501,12 +1503,13 @@ SwXTextRange::getPropertyState(const OUString& rPropertyName) { SolarMutexGuard aGuard; - if (!m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark() + && (m_pImpl->m_eRangePosition != RANGE_IS_SECTION || !m_pImpl->m_pTableOrSectionFormat)) { throw uno::RuntimeException("range has no mark (table?)"); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); return SwUnoCursorHelper::GetPropertyState(aPaM, m_pImpl->m_rPropSet, rPropertyName); } @@ -1516,12 +1519,13 @@ SwXTextRange::getPropertyStates(const uno::Sequence< OUString >& rPropertyName) { SolarMutexGuard g; - if (!m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark() + && (m_pImpl->m_eRangePosition != RANGE_IS_SECTION || !m_pImpl->m_pTableOrSectionFormat)) { throw uno::RuntimeException("range has no mark (table?)"); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); return SwUnoCursorHelper::GetPropertyStates(aPaM, m_pImpl->m_rPropSet, rPropertyName); } @@ -1530,12 +1534,13 @@ void SAL_CALL SwXTextRange::setPropertyToDefault(const OUString& rPropertyName) { SolarMutexGuard aGuard; - if (!m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark() + && (m_pImpl->m_eRangePosition != RANGE_IS_SECTION || !m_pImpl->m_pTableOrSectionFormat)) { throw uno::RuntimeException("range has no mark (table?)"); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); SwUnoCursorHelper::SetPropertyToDefault(aPaM, m_pImpl->m_rPropSet, rPropertyName); } @@ -1545,12 +1550,13 @@ SwXTextRange::getPropertyDefault(const OUString& rPropertyName) { SolarMutexGuard aGuard; - if (!m_pImpl->GetBookmark()) + if (!m_pImpl->GetBookmark() + && (m_pImpl->m_eRangePosition != RANGE_IS_SECTION || !m_pImpl->m_pTableOrSectionFormat)) { throw uno::RuntimeException("range has no mark (table?)"); } SwPaM aPaM(GetDoc().GetNodes()); - GetPositions(aPaM); + GetPositions(aPaM, ::sw::TextRangeMode::AllowNonTextNode); return SwUnoCursorHelper::GetPropertyDefault(aPaM, m_pImpl->m_rPropSet, rPropertyName); } commit 918ccb9de1d868458f8dbad4ad8bbd0f8c193a1b Author: Oliver Specht <[email protected]> AuthorDate: Thu Jul 25 14:17:06 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 21:46:56 2024 +0100 Use NDEBUG to show/hide m_bDeleted "#ifndef NDEBUG" is now always used to hide/show member m_bDeleted Change-Id: I10f5111cd36e13b8101d2a69ed9268bee622344a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171012 Tested-by: Jenkins Reviewed-by: Oliver Specht <[email protected]> (cherry picked from commit 44d129870795da2e370ad5f2f8abc95c5c6873aa) diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index acc5d64ea50a..5a85d2d7780e 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -110,7 +110,7 @@ SfxPoolItemHolder::~SfxPoolItemHolder() #endif if (nullptr != m_pItem) implCleanupItemEntry(*m_pPool, m_pItem); -#ifdef DBG_UTIL +#ifndef NDEBUG m_bDeleted = true; #endif } commit 52c3223e3dbb64c2ef57e5f383e42c8e0121c827 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Dec 23 13:52:09 2023 +0000 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 21:46:56 2024 +0100 cid#1559884 Uninitialized scalar variable etc, since: commit e9e3576ada06d53de12efed041fb309fe5388e01 Date: Thu Dec 21 22:49:27 2023 +0100 svl: fix build with --enable-debug Change-Id: I1c3c82f0f1674cb46fa6a36d5f9f5cc4435ebef1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161241 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit b803b3a7a1eda1b9862112f399c0a8b988c1f930) diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index fd9cbb1dddee..acc5d64ea50a 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -61,7 +61,7 @@ static bool g_bItemClassicMode(getenv("ITEM_CLASSIC_MODE")); SfxPoolItemHolder::SfxPoolItemHolder() : m_pPool(nullptr) , m_pItem(nullptr) -#ifdef DBG_UTIL +#ifndef NDEBUG , m_bDeleted(false) #endif { commit 5c0ad8c7043c8b5fe68dfa96d3f4fa95185fa036 Author: Michael Stahl <[email protected]> AuthorDate: Wed Mar 13 16:24:50 2024 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 21:37:16 2024 +0100 sw: convert OSL_ENSURE to assert To avoid spurious -Warray-bounds from GCC 13.2.1 Change-Id: I26aba84a6ceda79ffc111c925c8be96df8b186dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164782 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 7389be1996159b557f2e4022459ed8408302d72a) diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index 048878292fc0..0eb8d74e89c6 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -472,8 +472,7 @@ void SwAttrHandler::Pop( const SwTextAttr& rAttr ) void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr ) { - OSL_ENSURE( nAttr < RES_TXTATR_WITHEND_END, - "I cannot activate this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); + assert(nAttr < RES_TXTATR_WITHEND_END); const sal_uInt16 nStackPos = StackPos[ nAttr ]; const SwTextAttr* pTopAt = GetTop(nStackPos); diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 3004fb684e9c..78df4a8dc6d8 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -73,7 +73,7 @@ using namespace ::com::sun::star::beans; std::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyMapEntries(sal_uInt16 nPropertyId) { - OSL_ENSURE(nPropertyId < PROPERTY_MAP_END, "Id ?" ); + assert(nPropertyId < PROPERTY_MAP_END); if( m_aMapEntriesArr[ nPropertyId ].empty() ) { switch(nPropertyId) commit 35c4a7793d880b3af9daf9e72de58f203dfa88a5 Author: Julien Nabet <[email protected]> AuthorDate: Fri Aug 23 11:57:45 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 21:06:07 2024 +0100 Silence some bogus -Werror=array-bounds etc. also with GCC 14 and -std=c++20 Change-Id: If7a3e0d7536642ae672ba6096183bb8413b36a31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172310 Reviewed-by: Julien Nabet <[email protected]> Tested-by: Julien Nabet <[email protected]> (cherry picked from commit 6e51d65c3d8031967727092ee2f48b8577db9b85) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 93ec0fa23e48..1a92fc3224ed 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -992,13 +992,13 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // just one page is special ... if ( 1 == aVec.size() ) { -#if defined __GNUC__ && !defined __clang__ && __GNUC__ <= 13 && __cplusplus == 202002L +#if defined __GNUC__ && !defined __clang__ && __GNUC__ <= 14 && __cplusplus == 202002L #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warray-bounds" #pragma GCC diagnostic ignored "-Wstringop-overflow" #endif aVec.insert( aVec.begin() + 1, nullptr ); // insert a second empty page -#if defined __GNUC__ && !defined __clang__ && __GNUC__ <= 13 && __cplusplus == 202002L +#if defined __GNUC__ && !defined __clang__ && __GNUC__ <= 14 && __cplusplus == 202002L #pragma GCC diagnostic pop #endif } commit b06f55a3793a5b4f21107f9d652830837c887d82 Author: Julien Nabet <[email protected]> AuthorDate: Wed May 1 15:50:50 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 21:06:06 2024 +0100 Silence some bogus -Werror=array-bounds etc. also with GCC 13 and -std=c++20 See 1c3c27bc2e42f70e588ef5dbc769a8a346042e04 Silence some bogus -Werror=array-bounds etc. with GCC 12 and -std=c++20 Change-Id: I65675d1f18415ae82afb98c7d388dac3cdc18ab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166966 Reviewed-by: Julien Nabet <[email protected]> Tested-by: Jenkins (cherry picked from commit a835b40e05462e9be58cb501aa6b938f3dc998b8) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 4bcb2a35e856..93ec0fa23e48 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -992,13 +992,13 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // just one page is special ... if ( 1 == aVec.size() ) { -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 12 && __cplusplus == 202002L +#if defined __GNUC__ && !defined __clang__ && __GNUC__ <= 13 && __cplusplus == 202002L #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warray-bounds" #pragma GCC diagnostic ignored "-Wstringop-overflow" #endif aVec.insert( aVec.begin() + 1, nullptr ); // insert a second empty page -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 12 && __cplusplus == 202002L +#if defined __GNUC__ && !defined __clang__ && __GNUC__ <= 13 && __cplusplus == 202002L #pragma GCC diagnostic pop #endif } commit 6855f7170d1a35b8b0dbce90dc2b7924dd4fbde9 Author: Julien Nabet <[email protected]> AuthorDate: Fri Aug 23 10:56:27 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 21:06:06 2024 +0100 -Werror=maybe-uninitialized in sfx2 /home/julien/lo/libo_perf/sfx2/source/dialog/splitwin.cxx: In member function ‘void SfxSplitWindow::InsertWindow(SfxDockingWindow*, const Size&)’: /home/julien/lo/libo_perf/sfx2/source/dialog/splitwin.cxx:462:23: error: ‘nL’ may be used uninitialized [-Werror=maybe-uninitialized] 462 | nLine = static_cast<short>(nL); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ /home/julien/lo/libo_perf/sfx2/source/dialog/splitwin.cxx:433:16: note: ‘nL’ was declared here 433 | sal_uInt16 nL; | ^~ /home/julien/lo/libo_perf/sfx2/source/dialog/splitwin.cxx: In member function ‘void SfxSplitWindow::MoveWindow(SfxDockingWindow*, const Size&, sal_uInt16, sal_uInt16, bool)’: /home/julien/lo/libo_perf/sfx2/source/dialog/splitwin.cxx:552:21: error: ‘nL’ may be used uninitialized [-Werror=maybe-uninitialized] 552 | if ( nLine > nL && GetItemCount( GetItemId( nL ) ) == 1 ) | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/julien/lo/libo_perf/sfx2/source/dialog/splitwin.cxx:548:16: note: ‘nL’ was declared here 548 | sal_uInt16 nL, nP; | ^~ Change-Id: I816ec49fe2c63e4f448ae83251d3a24b08383903 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172306 Reviewed-by: Julien Nabet <[email protected]> Tested-by: Jenkins (cherry picked from commit 73884e28faeb457c01b80051a701c073112ad564) diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 210a9dbeaaff..61903bb13d6c 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -429,7 +429,6 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize */ { short nLine = -1; // so that the first window cab set nline to 0 - sal_uInt16 nL; sal_uInt16 nPos = 0; bool bNewLine = true; bool bSaveConfig = false; @@ -456,6 +455,7 @@ void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize if ( bNewLine && !pFoundDock ) { // Not known until now in which real line it is located + sal_uInt16 nL = 0; GetWindowPos( rDock.pWin, nL, nPos ); nLine = static_cast<short>(nL); } @@ -543,7 +543,8 @@ void SfxSplitWindow::MoveWindow( SfxDockingWindow* pDockWin, const Size& rSize, */ { - sal_uInt16 nL, nP; + sal_uInt16 nL = 0; + sal_uInt16 nP = 0; GetWindowPos( pDockWin, nL, nP ); if ( nLine > nL && GetItemCount( GetItemId( nL ) ) == 1 ) commit 1e3c473eb41fcaab546cb273d36fdb05a29d0006 Author: Stephan Bergmann <[email protected]> AuthorDate: Fri Apr 5 16:43:08 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 20:18:14 2024 +0100 Silence strange -Wmaybe-uninitialized with recent GCC 14 ...seen at least with some (--enable-dbgutil --enable-otpimized etc.) configuration and a recent GCC 14 trunk, > In file included from ~/gcc/inst/include/c++/14.0.1/vector:66, > from include/unotools/options.hxx:26, > from include/unotools/lingucfg.hxx:27, > from linguistic/source/lngsvcmgr.cxx:35: > In destructor ‘constexpr std::__cxx1998::vector< <template-parameter-1-1>, <template-parameter-1-2> >::~vector() [with _Tp = SvcInfo; _Alloc = std::allocator<SvcInfo>]’, > inlined from ‘constexpr std::__debug::vector<_Tp, _Allocator>::~vector() [with _Tp = SvcInfo; _Allocator = std::allocator<SvcInfo>]’ at ~/gcc/inst/include/c++/14.0.1/debug/vector:245:7, > inlined from ‘constexpr void std::_Optional_payload_base<_Tp>::_M_destroy() [with _Tp = std::__debug::vector<SvcInfo>]’ at ~/gcc/inst/include/c++/14.0.1/optional:283:35, > inlined from ‘constexpr void std::_Optional_payload_base<_Tp>::_M_reset() [with _Tp = std::__debug::vector<SvcInfo>]’ at ~/gcc/inst/include/c++/14.0.1/optional:314:14, > inlined from ‘constexpr std::_Optional_payload<_Tp, false, _Copy, _Move>::~_Optional_payload() [with _Tp = std::__debug::vector<SvcInfo>; bool _Copy = false; bool _Move = false]’ at ~/gcc/inst/include/c++/14.0.1/optional:437:65, > inlined from ‘constexpr std::_Optional_base<std::__debug::vector<SvcInfo>, false, false>::~_Optional_base()’ at ~/gcc/inst/include/c++/14.0.1/optional:508:12, > inlined from ‘constexpr std::optional<std::__debug::vector<SvcInfo> >::~optional()’ at ~/gcc/inst/include/c++/14.0.1/optional:703:11, > inlined from ‘LngSvcMgr::~LngSvcMgr()’ at linguistic/source/lngsvcmgr.cxx:519:1: > ~/gcc/inst/include/c++/14.0.1/bits/stl_vector.h:735:22: error: ‘((std::__cxx1998::vector<SvcInfo, std::allocator<SvcInfo> >*)((char*)this + 16))[22].std::__cxx1998::vector<SvcInfo, std::allocator<SvcInfo> >::std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_M_impl.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl::std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl_data.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl_data::_M_finish’ may be used uninitialized [-Werror=maybe-uninitialized] > 735 | std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, > | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 736 | _M_get_Tp_allocator()); > | ~~~~~~~~~~~~~~~~~~~~~~ > ~/gcc/inst/include/c++/14.0.1/bits/stl_vector.h:735:22: error: ‘((std::__cxx1998::vector<SvcInfo, std::allocator<SvcInfo> >*)((char*)this + 16))[22].std::__cxx1998::vector<SvcInfo, std::allocator<SvcInfo> >::std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_M_impl.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl::std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl_data.std::__cxx1998::_Vector_base<SvcInfo, std::allocator<SvcInfo> >::_Vector_impl_data::_M_start’ may be used uninitialized [-Werror=maybe-uninitialized] Change-Id: I02815c39ee6026b4637a4bb6ad2804af7a446a57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165821 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 745ba22017fde53b50f38a1db5c3eaa388003871) diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 850d4d813bfd..f6bd3b705344 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -496,6 +496,10 @@ void LngSvcMgr::disposing(const lang::EventObject&) stopListening(); } +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 14 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif LngSvcMgr::~LngSvcMgr() { stopListening(); @@ -509,6 +513,9 @@ LngSvcMgr::~LngSvcMgr() pAvailHyphSvcs.reset(); pAvailThesSvcs.reset(); } +#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 14 +#pragma GCC diagnostic pop +#endif namespace { commit 27b0d05a4ba314de47e52f8e91bede9ed9fc3efc Author: Julien Nabet <[email protected]> AuthorDate: Thu May 2 09:16:26 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 20:05:54 2024 +0100 Extend silence strange -Wclobbered with GCC <= 14 See 2bcd9fe0fa10339294e6ab820498fa18334e02f3 Silence strange -Wclobbered with recent GCC 14 Change-Id: Id51659cb8cd49b65c55b22ed0ac515a8ab609602 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166994 Reviewed-by: Stephan Bergmann <[email protected]> Tested-by: Julien Nabet <[email protected]> (cherry picked from commit e783a1c09093f3dbaf778661b77a2d5872a2029d) diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx index 72626d174fe6..fdf5903d2480 100644 --- a/vcl/source/filter/png/PngImageReader.cxx +++ b/vcl/source/filter/png/PngImageReader.cxx @@ -322,7 +322,7 @@ bool fcTLbeforeIDAT(SvStream& rStream) return false; } -#if defined __GNUC__ && __GNUC__ == 14 && !defined __clang__ +#if defined __GNUC__ && __GNUC__ <= 14 && !defined __clang__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclobbered" #endif @@ -821,7 +821,7 @@ BinaryDataContainer getMsGifChunk(SvStream& rStream) return {}; } } -#if defined __GNUC__ && __GNUC__ == 14 && !defined __clang__ +#if defined __GNUC__ && __GNUC__ <= 14 && !defined __clang__ #pragma GCC diagnostic pop #endif commit a485cb3d6b573a31e46b9a79068697a753cbcf78 Author: Stephan Bergmann <[email protected]> AuthorDate: Fri Apr 5 16:55:28 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 20:05:53 2024 +0100 Silence strange -Wclobbered with recent GCC 14 ...seen at least with some (--enable-dbgutil --enable-otpimized etc.) configuration and a recent GCC 14 trunk, > vcl/source/filter/png/PngImageReader.cxx: In function ‘bool {anonymous}::reader(SvStream&, Graphic&, GraphicFilterImportFlags, BitmapScopedWriteAccess*, BitmapScopedWriteAccess*)’: > vcl/source/filter/png/PngImageReader.cxx:361:16: error: variable ‘bSupportsBitmap32’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] > 361 | const bool bSupportsBitmap32 = bFuzzing || ImplGetSVData()->mpDefInst->supportsBitmap32(); > | ^~~~~~~~~~~~~~~~~ Change-Id: Icc1932347a213877ecc9f561f98de779f8041c09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165823 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 2bcd9fe0fa10339294e6ab820498fa18334e02f3) diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx index d6a5a219c5e2..72626d174fe6 100644 --- a/vcl/source/filter/png/PngImageReader.cxx +++ b/vcl/source/filter/png/PngImageReader.cxx @@ -322,6 +322,10 @@ bool fcTLbeforeIDAT(SvStream& rStream) return false; } +#if defined __GNUC__ && __GNUC__ == 14 && !defined __clang__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclobbered" +#endif bool reader(SvStream& rStream, Graphic& rGraphic, GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE, BitmapScopedWriteAccess* pAccess = nullptr, @@ -817,6 +821,9 @@ BinaryDataContainer getMsGifChunk(SvStream& rStream) return {}; } } +#if defined __GNUC__ && __GNUC__ == 14 && !defined __clang__ +#pragma GCC diagnostic pop +#endif } // anonymous namespace commit 9f2fdeade631f1538244862fe6dddf9a39d3a3be Author: Stephan Bergmann <[email protected]> AuthorDate: Wed Apr 3 23:58:18 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 20:05:53 2024 +0100 A number of bogus GCC 13 warnings still hit with recent GCC 14 trunk Change-Id: I0ec7743cd79429591fcfc3eb9715ff36d06fc00b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165765 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 6b7245f51274424a6c634424161e8766f8827033) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172464 Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 2e56b56894c4176e9e7ce88a27b90f7687e118ed) (cherry picked from commit f5bf0f71e1dd4b4c04ed7eb4bbbc4611266b342e) diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index 5c283be5d82d..c0c979079946 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -601,12 +601,12 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const OUString& _rU m_aDriversBS.end(), // end of search range [&_rURL, this] (const DriverAccessArray::value_type& driverAccess) { // extract the driver from the access, then ask the resulting driver for acceptance -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 14 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif const DriverAccess& ensuredAccess = EnsureDriver(m_xContext)(driverAccess); -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 14 #pragma GCC diagnostic pop #endif const Reference<XDriver> driver = ExtractDriverFromAccess()(ensuredAccess); diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx index 013f755496a5..9a0040edcf08 100644 --- a/hwpfilter/source/hstyle.cxx +++ b/hwpfilter/source/hstyle.cxx @@ -68,14 +68,14 @@ void HWPStyle::SetName(int n, char const* name) if (name) { -#if defined __GNUC__ && (__GNUC__ >= 8 && __GNUC__ <= 13) && !defined __clang__ +#if defined __GNUC__ && (__GNUC__ >= 8 && __GNUC__ <= 14) && !defined __clang__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-truncation" #endif auto const p = style[n].name; strncpy(p, name, MAXSTYLENAME); p[MAXSTYLENAME] = ' -#if defined __GNUC__ && (__GNUC__ >= 8 && __GNUC__ <= 13) && !defined __clang__ +#if defined __GNUC__ && (__GNUC__ >= 8 && __GNUC__ <= 14) && !defined __clang__ #pragma GCC diagnostic pop #endif } diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 5639d8e62d57..ec4331528f9a 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -954,12 +954,12 @@ array_type assembleGrid(const VclGrid &rGrid) { for (sal_Int32 y = 0; y < nMaxY; ++y) { -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 14 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif const GridEntry &rEntry = A[x][y]; -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 14 #pragma GCC diagnostic pop #endif const vcl::Window *pChild = rEntry.pChild; @@ -1084,12 +1084,12 @@ static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, { for (sal_Int32 y = 0; y < nMaxY; ++y) { -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 14 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif const GridEntry &rEntry = A[x][y]; -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 14 #pragma GCC diagnostic pop #endif const vcl::Window *pChild = rEntry.pChild; @@ -1122,12 +1122,12 @@ static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, { for (sal_Int32 y = 0; y < nMaxY; ++y) { -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 14 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif const GridEntry &rEntry = A[x][y]; -#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13 +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 13 && __GNUC__ <= 14 #pragma GCC diagnostic pop #endif const vcl::Window *pChild = rEntry.pChild; commit 548d07e6f4451d7c1aca14d6a51267f9fc3e2fa9 Author: Stephan Bergmann <[email protected]> AuthorDate: Sun Dec 24 13:12:52 2023 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 19:38:16 2024 +0100 -Werror=calloc-transposed-args (cherry-picked from 4663c56edf788a37545f253e028db99e480feb34) Change-Id: I7b8b020bdbcd5b4db4cb478cc5fe1225f19ae0cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161268 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 0b1251cb717022f13ee766df02638803d0c2d8cf) diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx index b17f363511c6..3d51f4ab2a33 100644 --- a/sal/osl/unx/thread.cxx +++ b/sal/osl/unx/thread.cxx @@ -624,7 +624,7 @@ static oslThreadIdentifier insertThreadId (pthread_t hThread) if (pEntry == nullptr) { - pEntry = static_cast<HashEntry*>(calloc(sizeof(HashEntry), 1)); + pEntry = static_cast<HashEntry*>(calloc(1, sizeof(HashEntry))); pEntry->Handle = hThread; diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx index 7cfc443cb972..4e255d965e17 100644 --- a/sal/rtl/hash.cxx +++ b/sal/rtl/hash.cxx @@ -79,7 +79,7 @@ static StringHashTable * rtl_str_hash_new(sal_uInt32 nSize) pHash->nEntries = 0; pHash->nSize = getNextSize (nSize); - pHash->pData = static_cast< rtl_uString ** >(calloc(sizeof(rtl_uString *), pHash->nSize)); + pHash->pData = static_cast< rtl_uString ** >(calloc(pHash->nSize, sizeof(rtl_uString *))); return pHash; } commit 38add14d752297322aeb973f81cd2da28c6cbf9e Author: Stephan Bergmann <[email protected]> AuthorDate: Sun Dec 24 13:14:53 2023 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Nov 25 19:38:16 2024 +0100 Silence new GCC 14 trunk -Werror=alloc-size > sal/rtl/byteseq.cxx: In function ‘void rtl_byte_sequence_reference2One(sal_Sequence**)’: > sal/rtl/byteseq.cxx:63:20: error: allocation of insufficient size ‘8’ for type ‘sal_Sequence’ {aka ‘_sal_Sequence’} with size ‘12’ [-Werror=alloc-size] > 63 | pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE )); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (cherry-picked from 5e3af4aec40531b490950da5ed49342a01c1477b) Change-Id: I9d4081ed2938fffdf282c852250a3eed5f0d9e25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161269 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit 86211693569151d0f9d824425927b35d76bd1737) diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx index 3c4967d5456d..0084f3969812 100644 --- a/sal/rtl/byteseq.cxx +++ b/sal/rtl/byteseq.cxx @@ -60,7 +60,14 @@ void SAL_CALL rtl_byte_sequence_reference2One( } else { +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 14 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Walloc-size" +#endif pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE )); +#if defined __GNUC__ && !defined __clang__ && __GNUC__ >= 14 +#pragma GCC diagnostic pop +#endif } if ( pNew != nullptr )
