[Libreoffice-commits] core.git: oox/source stoc/test
oox/source/export/DMLPresetShapeExport.cxx | 36 +++ stoc/test/registry_tdprovider/testregistrytdprovider.cxx |4 - 2 files changed, 19 insertions(+), 21 deletions(-) New commits: commit 87f52dbf4faf8dcd6fcc1b070e070b9ca8584ac4 Author: ektagoel12 AuthorDate: Wed Jan 25 22:43:15 2023 + Commit: Hossein CommitDate: Thu Apr 6 12:09:49 2023 +0200 tdf#145538 Use range based for loops Change-Id: Ib74318a36898270c7b6e45e5e064ddd696a91be8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145905 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/oox/source/export/DMLPresetShapeExport.cxx b/oox/source/export/DMLPresetShapeExport.cxx index a2d08ec3e2e2..1eaef29927fa 100644 --- a/oox/source/export/DMLPresetShapeExport.cxx +++ b/oox/source/export/DMLPresetShapeExport.cxx @@ -43,47 +43,45 @@ DMLPresetShapeExporter::DMLPresetShapeExporter(DrawingML* pDMLExporter, = xShapeProps->getPropertyValue("CustomShapeGeometry") .get>(); -for (sal_uInt32 i = 0; i < aCustomShapeGeometry.size(); i++) +for (auto const& rCustomShapeGeometryItem : aCustomShapeGeometry) { -if (aCustomShapeGeometry[i].Name == "Type") +if (rCustomShapeGeometryItem.Name == "Type") { -m_sPresetShapeType = aCustomShapeGeometry[i].Value.get(); +m_sPresetShapeType = rCustomShapeGeometryItem.Value.get(); } -if (aCustomShapeGeometry[i].Name == "Handles") +if (rCustomShapeGeometryItem.Name == "Handles") { m_bHasHandleValues = true; m_HandleValues -= aCustomShapeGeometry[i] - .Value += rCustomShapeGeometryItem.Value .get>>(); } -if (aCustomShapeGeometry[i].Name == "AdjustmentValues") +if (rCustomShapeGeometryItem.Name == "AdjustmentValues") { m_AdjustmentValues -= aCustomShapeGeometry[i] - .Value += rCustomShapeGeometryItem.Value .get>(); } -if (aCustomShapeGeometry[i].Name == "MirroredX") +if (rCustomShapeGeometryItem.Name == "MirroredX") { -m_bIsFlipped.first = aCustomShapeGeometry[i].Value.get(); +m_bIsFlipped.first = rCustomShapeGeometryItem.Value.get(); } -if (aCustomShapeGeometry[i].Name == "MirroredY") +if (rCustomShapeGeometryItem.Name == "MirroredY") { -m_bIsFlipped.second = aCustomShapeGeometry[i].Value.get(); +m_bIsFlipped.second = rCustomShapeGeometryItem.Value.get(); } -//if (aCustomShapeGeometry[i].Name == "Equations") +//if (rCustomShapeGeometryItem.Name == "Equations") //{ -//m_Equations = aCustomShapeGeometry[i].Value.get>(); +//m_Equations = rCustomShapeGeometryItem.Value.get>(); //} -//if (aCustomShapeGeometry[i].Name == "Path") +//if (rCustomShapeGeometryItem.Name == "Path") //{ -//m_Path = aCustomShapeGeometry[i] +//m_Path = rCustomShapeGeometryItem // .Value.get>(); //} -//if (aCustomShapeGeometry[i].Name == "ViewBox") +//if (rCustomShapeGeometryItem.Name == "ViewBox") //{ -//m_ViewBox = aCustomShapeGeometry[i].Value.get(); +//m_ViewBox = rCustomShapeGeometryItem.Value.get(); //} } }; diff --git a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx index 359c4b789f3b..879859b92e27 100644 --- a/stoc/test/registry_tdprovider/testregistrytdprovider.cxx +++ b/stoc/test/registry_tdprovider/testregistrytdprovider.cxx @@ -776,9 +776,9 @@ bool writeInfo(void * registryKey, OUString const & implementationName, return false; } bool success = true; -for (sal_Int32 i = 0; i < serviceNames.getLength(); ++i) { +for (auto const& rServiceName : serviceNames) { try { -key->createKey(serviceNames[i]); +key->createKey(rServiceName); } catch (css::registry::InvalidRegistryException &) { success = false; break;
[Libreoffice-commits] core.git: bridges/source sc/source
bridges/source/cpp_uno/gcc3_linux_sparc64/cpp2uno.cxx |4 +--- sc/source/filter/excel/xestream.cxx |7 +++ 2 files changed, 4 insertions(+), 7 deletions(-) New commits: commit 307b1cc494c51c802882ae23029e33a72d57f2a3 Author: ektagoel12 AuthorDate: Mon Mar 13 19:51:25 2023 +0530 Commit: Ilmari Lauhakangas CommitDate: Sat Mar 18 16:39:34 2023 + tdf#130924 replace debugging fprintf calls with SAL_INFO/SAL_WARN Change-Id: I1893e130af2584c1d57c3e37ee3f3ff18c07c077 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148792 Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc64/cpp2uno.cxx index f455be45dc88..11d60fdeab44 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc64/cpp2uno.cxx @@ -369,10 +369,8 @@ static typelib_TypeClass cpp_mediate( TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); -#if defined BRIDGES_DEBUG OString cstr( OUStringToOString( aMemberDescr.get()->pTypeName, RTL_TEXTENCODING_ASCII_US ) ); -fprintf( stderr, "calling %s, nFunctionIndex=%d\n", cstr.getStr(), nFunctionIndex ); -#endif +SAL_WARN("bridges", "calling " << cstr.getStr() << ", nFunctionIndex=" << nFunctionIndex); typelib_TypeClass eRet; switch (aMemberDescr.get()->eTypeClass) diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 467dfefd278f..374743786212 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -593,10 +593,9 @@ void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector& aBy sal_uInt16 nBlockOffset = GetOffsetInBlock(nStrmPos); sal_uInt32 nBlockPos = GetBlockPos(nStrmPos); -#if DEBUG_XL_ENCRYPTION -fprintf(stdout, "XclExpBiff8Encrypter::EncryptBytes: stream pos = %ld offset in block = %d block pos = %ld\n", -nStrmPos, nBlockOffset, nBlockPos); -#endif +SAL_INFO("sc.filter", "XclExpBiff8Encrypter::EncryptBytes: stream pos = " + << nStrmPos << " offset in block = " << nBlockOffset + << " block pos = " << nBlockPos); sal_uInt16 nSize = static_cast< sal_uInt16 >( aBytes.size() ); if (nSize == 0)
[Libreoffice-commits] core.git: i18npool/qa svx/source
i18npool/qa/cppunit/test_breakiterator.cxx | 44 ++--- svx/source/dialog/strarray.cxx | 10 +++--- 2 files changed, 27 insertions(+), 27 deletions(-) New commits: commit eb5c14f305f9c6355bd49bd65ab9175831453cb3 Author: ektagoel12 AuthorDate: Mon Jan 23 11:49:42 2023 +0530 Commit: Hossein CommitDate: Tue Jan 31 13:30:53 2023 + tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro Also change some range based for Change-Id: I2e17feaba7a6b219aa0c9126c5046cf3bdf855d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145988 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index cdcbff9be535..6673fb4b8df5 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -274,9 +274,9 @@ void TestBreakIterator::testWordBoundaries() for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode) { //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary -for (size_t i = 0; i < SAL_N_ELEMENTS(aBreakTests); ++i) +for (auto const& i: aBreakTests) { -OUString aTest = "Word" + OUStringChar(aBreakTests[i]) + "Word"; +OUString aTest = "Word" + OUStringChar(i) + "Word"; aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true); switch (mode) { @@ -307,9 +307,9 @@ void TestBreakIterator::testWordBoundaries() for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode) { //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary -for (size_t i = 0; i < SAL_N_ELEMENTS(aJoinTests); ++i) +for (auto const& p: aJoinTests) { -OUString aTest = "Word" + OUStringChar(aJoinTests[i]) + "Word"; +OUString aTest = "Word" + OUStringChar(p) + "Word"; aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true); switch (mode) { @@ -347,21 +347,21 @@ void TestBreakIterator::testWordBoundaries() }; const sal_Int32 aDoublePositions[] = {0, 2, 4, 6, 8, 10, 12, 14}; -for (size_t j = 0; j < SAL_N_ELEMENTS(aTests); ++j) +for (auto const& r: aTests) { -OUString aTest = aBase.replace('x', aTests[j]); +OUString aTest = aBase.replace('x', r); sal_Int32 nPos = -1; size_t i = 0; do { -CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aDoublePositions)); +CPPUNIT_ASSERT(i < std::size(aDoublePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; CPPUNIT_ASSERT_EQUAL(aDoublePositions[i], nPos); ++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); -i = SAL_N_ELEMENTS(aDoublePositions)-1; +i = std::size(aDoublePositions)-1; do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; @@ -379,14 +379,14 @@ void TestBreakIterator::testWordBoundaries() size_t i = 0; do { -CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSinglePositions)); +CPPUNIT_ASSERT(i < std::size(aSinglePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; CPPUNIT_ASSERT_EQUAL(aSinglePositions[i], nPos); ++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); -i = SAL_N_ELEMENTS(aSinglePositions)-1; +i = std::size(aSinglePositions)-1; do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; @@ -404,14 +404,14 @@ void TestBreakIterator::testWordBoundaries() size_t i = 0; do { -CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSingleQuotePositions)); +CPPUNIT_ASSERT(i < std::size(aSingleQuotePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i], nPos); ++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); -i = SAL_N_ELEMENTS(aSingleQuotePositions)-1; +i = std::size(aSingleQuotePositions)-1; do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale,
[Libreoffice-commits] core.git: svx/qa
svx/qa/unit/styles.cxx | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) New commits: commit 21fbb4b952c7ba5d580c71150ffe9423aaf57f9e Author: ektagoel12 AuthorDate: Sun Jan 22 14:24:09 2023 +0530 Commit: Xisco Fauli CommitDate: Tue Jan 24 17:57:20 2023 + tdf#141908 Replace usage of sal_Int32 with Color Change-Id: Id2849140ba1302d59918eb30458984aef2b5c6ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145964 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx index 3a4aff375fc7..d44bf9ac4dc8 100644 --- a/svx/qa/unit/styles.cxx +++ b/svx/qa/unit/styles.cxx @@ -30,22 +30,22 @@ public: }; /// Get the character color of the first text portion in xShape. -sal_Int32 GetShapeTextColor(const uno::Reference& xShape) +Color GetShapeTextColor(const uno::Reference& xShape) { uno::Reference xText(xShape->getText(), uno::UNO_QUERY); uno::Reference xPara(xText->createEnumeration()->nextElement(), uno::UNO_QUERY); uno::Reference xPortion(xPara->createEnumeration()->nextElement(), uno::UNO_QUERY); -sal_Int32 nColor{}; +Color nColor{}; xPortion->getPropertyValue("CharColor") >>= nColor; return nColor; } /// Get the solid fill color of xShape. -sal_Int32 GetShapeFillColor(const uno::Reference& xShape) +Color GetShapeFillColor(const uno::Reference& xShape) { -sal_Int32 nColor{}; +Color nColor{}; xShape->getPropertyValue("FillColor") >>= nColor; return nColor; } @@ -61,17 +61,17 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange) uno::Reference xDrawPageShapes(xDrawPage, uno::UNO_QUERY); uno::Reference xShape(xDrawPageShapes->getByIndex(0), uno::UNO_QUERY); // Blue. -CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), GetShapeTextColor(xShape)); +CPPUNIT_ASSERT_EQUAL(Color(0x4472c4), GetShapeTextColor(xShape)); uno::Reference xShape2(xDrawPageShapes->getByIndex(1), uno::UNO_QUERY); // Blue, lighter. -CPPUNIT_ASSERT_EQUAL(static_cast(0xb4c7e7), GetShapeTextColor(xShape2)); +CPPUNIT_ASSERT_EQUAL(Color(0xb4c7e7), GetShapeTextColor(xShape2)); uno::Reference xShape3(xDrawPageShapes->getByIndex(2), uno::UNO_QUERY); // Blue, darker. -CPPUNIT_ASSERT_EQUAL(static_cast(0x2f5597), GetShapeTextColor(xShape3)); +CPPUNIT_ASSERT_EQUAL(Color(0x2f5597), GetShapeTextColor(xShape3)); // Shape fill: uno::Reference xShape4(xDrawPageShapes->getByIndex(4), uno::UNO_QUERY); // Blue. -CPPUNIT_ASSERT_EQUAL(static_cast(0x4472c4), GetShapeFillColor(xShape4)); +CPPUNIT_ASSERT_EQUAL(Color(0x4472c4), GetShapeFillColor(xShape4)); // The theme color of this filled shape is set by the PPTX import: { @@ -84,7 +84,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange) } uno::Reference xShape5(xDrawPageShapes->getByIndex(5), uno::UNO_QUERY); // Blue, lighter. -CPPUNIT_ASSERT_EQUAL(static_cast(0xb4c7e7), GetShapeFillColor(xShape5)); +CPPUNIT_ASSERT_EQUAL(Color(0xb4c7e7), GetShapeFillColor(xShape5)); // The theme index, and effects (lum mod, lum off) are set by the PPTX import: { uno::Reference xThemeColor; @@ -113,26 +113,26 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange) // - Expected: 9486886 (#90c226, green) // - Actual : 4485828 (#4472c4, blue) // i.e. shape text was not updated on theme change. -CPPUNIT_ASSERT_EQUAL(static_cast(0x90c226), GetShapeTextColor(xShape)); +CPPUNIT_ASSERT_EQUAL(Color(0x90c226), GetShapeTextColor(xShape)); // Green, lighter: // Without the accompanying fix in place, this test would have failed with: // - Expected: 14020002 (#d5eda2, light green) // - Actual : 9486886 (#90c226, stock green) // i.e. the "light" effect on green was not applied. -CPPUNIT_ASSERT_EQUAL(static_cast(0xd5eda2), GetShapeTextColor(xShape2)); +CPPUNIT_ASSERT_EQUAL(Color(0xd5eda2), GetShapeTextColor(xShape2)); // Green, darker. -CPPUNIT_ASSERT_EQUAL(static_cast(0x6c911d), GetShapeTextColor(xShape3)); +CPPUNIT_ASSERT_EQUAL(Color(0x6c911d), GetShapeTextColor(xShape3)); // Shape fill: // Without the accompanying fix in place, this test would have failed with: // - Expected: 9486886 (#90c226, green) // - Actual : 4485828 (#4472c4, blue) -CPPUNIT_ASSERT_EQUAL(static_cast(0x90c226), GetShapeFillColor(xShape4)); +CPPUNIT_ASSERT_EQUAL(Color(0x90c226), GetShapeFillColor(xShape4)); // Green, lighter: // Without the accompanying fix in place, this test would have failed with: // - Expected: 14020002 (#d5eda2, light green) // - Actual : 9486886 (#90c226, green) // i.e. the "light" effect on green was not applied. -CPPUNIT_ASSERT_EQUAL(static_cast(0xd5eda2), GetShapeFillColor(xShape5)); +
[Libreoffice-commits] core.git: vcl/source
vcl/source/bitmap/BitmapSobelGreyFilter.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 841ab19fb3f68dbab6295459ef11a257f0f022e8 Author: ektagoel12 AuthorDate: Thu Jan 19 21:51:53 2023 +0530 Commit: Hossein CommitDate: Fri Jan 20 12:04:30 2023 + tdf#147906 Use std::hypot for Pythagorean addition Change-Id: I4b16fc7daff2f85ae60666e512636634f7d6eb19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145822 Reviewed-by: Hossein Tested-by: Hossein diff --git a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx index 80daebedf949..043f9ad12fee 100644 --- a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx +++ b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx @@ -113,8 +113,7 @@ BitmapEx BitmapSobelGreyFilter::execute(BitmapEx const& rBitmapEx) const nSum1 += nMask331 * nGrey33; nSum2 += nMask332 * nGrey33; -nSum1 -= static_cast(sqrt(static_cast(nSum1 * nSum1 + nSum2 * nSum2))); +nSum1 = static_cast(std::hypot(nSum1, nSum2)); aGrey.SetIndex( ~static_cast(std::clamp(nSum1, sal_Int32(0), sal_Int32(255;