diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-17 11:39:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-17 12:44:46 +0200 |
commit | 0b2ddcda730897cb5b2801731f03191d77409273 (patch) | |
tree | 063c9beae80927710fef7ac8b5bc22d458004de9 /unotools | |
parent | 3cb8e9e211c30089516f56f465176d3a959631f9 (diff) |
loplugin:buriedassign in tools..xmloff
Change-Id: I31df6c4fd82c6f6d15bbe5228e92e5171cacba51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92410
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/bootstrap.cxx | 3 | ||||
-rw-r--r-- | unotools/source/misc/datetime.cxx | 165 |
2 files changed, 93 insertions, 75 deletions
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index 7ea340b8cc9d..459d8e518945 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -385,7 +385,8 @@ static OUString getExecutableBaseName() static Bootstrap::PathStatus updateStatus(Bootstrap::Impl::PathData & _rResult) { - return _rResult.status = checkStatusAndNormalizeURL(_rResult.path); + _rResult.status = checkStatusAndNormalizeURL(_rResult.path); + return _rResult.status; } static Bootstrap::PathStatus implGetBootstrapFile(rtl::Bootstrap const & _rData, Bootstrap::Impl::PathData & _rBootstrapFile) diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx index ca5c2c110057..703ce91273aa 100644 --- a/unotools/source/misc/datetime.cxx +++ b/unotools/source/misc/datetime.cxx @@ -381,94 +381,111 @@ bool ISO8601parseTime(const OUString &aTimeStr, css::util::Time& rTime) bool bFrac = false; // hours bool bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac); - if (bSuccess) + if (!bSuccess) + return false; + + if ( bFrac && n < aTimeStr.getLength()) + { + // is it junk or the timezone? + bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz); + if (!bSuccess) + return false; + } + bSuccess = convertNumber32( nHour, tokInt, 0, 23 ); + if (!bSuccess) + return false; + + if (bFrac) { - if ( bFrac && n < aTimeStr.getLength()) - // is it junk or the timezone? - bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz); - if (bSuccess && (bSuccess = convertNumber32( nHour, tokInt, 0, 23 )) ) + sal_Int64 fracNumerator; + bSuccess = convertNumber64(fracNumerator, tokFrac); + if ( bSuccess ) { - if (bFrac) - { - sal_Int64 fracNumerator; - if ( (bSuccess = convertNumber64(fracNumerator, tokFrac)) ) - { - double frac = static_cast<double>(fracNumerator) / pow(static_cast<double>(10), static_cast<double>(tokFrac.getLength())); - // minutes - OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac hours (of hours) not between 0 and 1"); - frac *= 60; - nMin = floor(frac); - frac -= nMin; - // seconds - OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac minutes (of hours) not between 0 and 1"); - frac *= 60; - nSec = floor(frac); - frac -= nSec; - // nanoseconds - OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac seconds (of hours) not between 0 and 1"); - frac *= 1000000000; - nNanoSec = ::rtl::math::round(frac); - } - goto end; - } - if(n >= aTimeStr.getLength()) - goto end; + double frac = static_cast<double>(fracNumerator) / pow(static_cast<double>(10), static_cast<double>(tokFrac.getLength())); + // minutes + OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac hours (of hours) not between 0 and 1"); + frac *= 60; + nMin = floor(frac); + frac -= nMin; + // seconds + OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac minutes (of hours) not between 0 and 1"); + frac *= 60; + nSec = floor(frac); + frac -= nSec; + // nanoseconds + OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac seconds (of hours) not between 0 and 1"); + frac *= 1000000000; + nNanoSec = ::rtl::math::round(frac); } + goto end; } + if(n >= aTimeStr.getLength()) + goto end; // minutes - if (bSuccess && (bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac))) + bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac); + if (!bSuccess) + return false; + if ( bFrac && n < aTimeStr.getLength()) { - if ( bFrac && n < aTimeStr.getLength()) - // is it junk or the timezone? - bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz); - if (bSuccess && (bSuccess = convertNumber32( nMin, tokInt, 0, 59 )) ) + // is it junk or the timezone? + bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz); + if (!bSuccess) + return false; + } + bSuccess = convertNumber32( nMin, tokInt, 0, 59 ); + if (!bSuccess) + return false; + if (bFrac) + { + sal_Int64 fracNumerator; + bSuccess = convertNumber64(fracNumerator, tokFrac); + if ( bSuccess ) { - if (bFrac) - { - sal_Int64 fracNumerator; - if ( (bSuccess = convertNumber64(fracNumerator, tokFrac)) ) - { - double frac = static_cast<double>(fracNumerator) / pow(static_cast<double>(10), static_cast<double>(tokFrac.getLength())); - // seconds - OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac minutes (of minutes) not between 0 and 1"); - frac *= 60; - nSec = floor(frac); - frac -= nSec; - // nanoseconds - OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac seconds (of minutes) not between 0 and 1"); - frac *= 1000000000; - nNanoSec = ::rtl::math::round(frac); - } - goto end; - } - if(n >= aTimeStr.getLength()) - goto end; + double frac = static_cast<double>(fracNumerator) / pow(static_cast<double>(10), static_cast<double>(tokFrac.getLength())); + // seconds + OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac minutes (of minutes) not between 0 and 1"); + frac *= 60; + nSec = floor(frac); + frac -= nSec; + // nanoseconds + OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac seconds (of minutes) not between 0 and 1"); + frac *= 1000000000; + nNanoSec = ::rtl::math::round(frac); } + goto end; } + if(n >= aTimeStr.getLength()) + goto end; + // seconds - if (bSuccess && (bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac))) + bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac); + if (!bSuccess) + return false; + if (n < aTimeStr.getLength()) { - if (n < aTimeStr.getLength()) - // is it junk or the timezone? - bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz); - // max 60 for leap seconds - if (bSuccess && (bSuccess = convertNumber32( nSec, tokInt, 0, 60 )) ) + // is it junk or the timezone? + bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz); + if (!bSuccess) + return false; + } + // max 60 for leap seconds + bSuccess = convertNumber32( nSec, tokInt, 0, 60 ); + if (!bSuccess) + return false; + if (bFrac) + { + sal_Int64 fracNumerator; + bSuccess = convertNumber64(fracNumerator, tokFrac); + if ( bSuccess ) { - if (bFrac) - { - sal_Int64 fracNumerator; - if ( (bSuccess = convertNumber64(fracNumerator, tokFrac)) ) - { - double frac = static_cast<double>(fracNumerator) / pow(static_cast<double>(10), static_cast<double>(tokFrac.getLength())); - // nanoseconds - OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac seconds (of seconds) not between 0 and 1"); - frac *= 1000000000; - nNanoSec = ::rtl::math::round(frac); - } - goto end; - } + double frac = static_cast<double>(fracNumerator) / pow(static_cast<double>(10), static_cast<double>(tokFrac.getLength())); + // nanoseconds + OSL_ENSURE(frac < 1 && frac >= 0, "ISO8601parse internal error frac seconds (of seconds) not between 0 and 1"); + frac *= 1000000000; + nNanoSec = ::rtl::math::round(frac); } + goto end; } end: |