From 72ef2b5d9802c424dbb0810e0a72fae50d92b678 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 22 Nov 2017 14:12:34 +0100 Subject: Make loplugin:unnecessaryparen warn about (x) ? ... : ... after all ...which had been left out because "lots of our code uses this style, which I'm loathe to bulk-fix as yet", but now in "use std::unique_ptr" would have caused an otherwise innocent-looking code change to trigger a loplugin:unnecessaryparen warning for pFormat = (pGrfObj) ? ... (barring a change to ignoreAllImplicit in compilerplugins/clang/unnecessaryparen.cxx similar to that in "Make not warning about !! in loplugin:simplifybool consistent", which should also have caused the warning to disappear for the modified code, IIUC). Change-Id: I8bff0cc11bbb839ef06d07b8d9237f150804fec2 Reviewed-on: https://gerrit.libreoffice.org/45088 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sax/qa/cppunit/test_converter.cxx | 6 +++--- sax/source/tools/converter.cxx | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sax') diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index 7fd28345c0a6..d1ac259cc33c 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -79,7 +79,7 @@ private: void doTest(util::Duration const & rid, char const*const pis, char const*const i_pos = nullptr) { - char const*const pos((i_pos) ? i_pos : pis); + char const*const pos(i_pos ? i_pos : pis); util::Duration od; OUString is(::rtl::OUString::createFromAscii(pis)); SAL_INFO("sax.cppunit","about to convert '" << is << "'"); @@ -155,7 +155,7 @@ bool eqDateTime(const util::DateTime& a, const util::DateTime& b) { void doTest(util::DateTime const & rdt, char const*const pis, char const*const i_pos = nullptr) { - char const*const pos((i_pos) ? i_pos : pis); + char const*const pos(i_pos ? i_pos : pis); OUString is(OUString::createFromAscii(pis)); util::DateTime odt; SAL_INFO("sax.cppunit","about to convert '" << is << "'"); @@ -249,7 +249,7 @@ void ConverterTest::testDateTime() void doTestTime(util::DateTime const & rdt, char const*const pis, char const*const i_pos = nullptr) { - char const*const pos((i_pos) ? i_pos : pis); + char const*const pos(i_pos ? i_pos : pis); OUString is(OUString::createFromAscii(pis)); util::DateTime odt; SAL_INFO("sax.cppunit","about to convert '" << is << "'"); diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 121ae8a2ffa4..ad5cb8c19113 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -991,7 +991,7 @@ readUnsignedNumber(const OUString & rString, io_rnPos = nPos; o_rNumber = nTemp; - return (bOverflow) ? R_OVERFLOW : R_SUCCESS; + return bOverflow ? R_OVERFLOW : R_SUCCESS; } static Result @@ -1035,7 +1035,7 @@ readUnsignedNumberMaxDigits(int maxDigits, io_rnPos = nPos; o_rNumber = nTemp; - return (bOverflow) ? R_OVERFLOW : R_SUCCESS; + return bOverflow ? R_OVERFLOW : R_SUCCESS; } static bool @@ -1778,12 +1778,12 @@ static bool lcl_parseDateTime( if (bSuccess) { - sal_Int16 const nTimezoneOffset = ((bHaveTimezoneMinus) ? (-1) : (+1)) + sal_Int16 const nTimezoneOffset = (bHaveTimezoneMinus ? (-1) : (+1)) * ((nTimezoneHours * 60) + nTimezoneMinutes); if (!pDate || bHaveTime) // time is optional { rDateTime.Year = - ((isNegative) ? (-1) : (+1)) * static_cast(nYear); + (isNegative ? (-1) : (+1)) * static_cast(nYear); rDateTime.Month = static_cast(nMonth); rDateTime.Day = static_cast(nDay); rDateTime.Hours = static_cast(nHours); @@ -1818,7 +1818,7 @@ static bool lcl_parseDateTime( else { pDate->Year = - ((isNegative) ? (-1) : (+1)) * static_cast(nYear); + (isNegative ? (-1) : (+1)) * static_cast(nYear); pDate->Month = static_cast(nMonth); pDate->Day = static_cast(nDay); if (bHaveTimezone) -- cgit