From 3a5a81e74308c03b2cf774cccb78f3a102d5be72 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 19 Aug 2020 15:22:34 +0200 Subject: Fold Bootstrap::Impl::getVersionValue into its single use ...thereby fixing that it returns _sDefault instead of an empty string when "version.ini (versionrc) doesn't exist" Change-Id: Ie38afb6d87bd908f8a9773daaf5cee56751ae950 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101000 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- unotools/source/config/bootstrap.cxx | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'unotools/source') diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index 24a5752d3fc1..eccf92f696ad 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -99,7 +99,6 @@ public: // construction and initialization // access helper OUString getBootstrapValue(OUString const& _sName, OUString const& _sDefault) const; - static bool getVersionValue(OUString const& _sName, OUString& _rValue, OUString const& _sDefault); const OUString& getImplName() const { return m_aImplName; } @@ -543,9 +542,17 @@ OUString Bootstrap::getProductKey(OUString const& _sDefault) OUString Bootstrap::getBuildIdData(OUString const& _sDefault) { + // try to open version.ini (versionrc) + OUString uri; + rtl::Bootstrap::get( "BRAND_BASE_DIR", uri); + rtl::Bootstrap aData( uri + "/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ); + if ( aData.getHandle() == nullptr ) + // version.ini (versionrc) doesn't exist + return _sDefault; + + // read value OUString sBuildId; - // read buildid from version.ini (versionrc) - utl::Bootstrap::Impl::getVersionValue( BOOTSTRAP_ITEM_BUILDID, sBuildId, _sDefault ); + aData.getFrom(BOOTSTRAP_ITEM_BUILDID,sBuildId,_sDefault); return sBuildId; } @@ -703,21 +710,6 @@ OUString Bootstrap::Impl::getBootstrapValue(OUString const& _sName, OUString con return sResult; } -bool Bootstrap::Impl::getVersionValue(OUString const& _sName, OUString& _rValue, OUString const& _sDefault) -{ - // try to open version.ini (versionrc) - OUString uri; - rtl::Bootstrap::get( "BRAND_BASE_DIR", uri); - rtl::Bootstrap aData( uri + "/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ); - if ( aData.getHandle() == nullptr ) - // version.ini (versionrc) doesn't exist - return false; - - // read value - aData.getFrom(_sName,_rValue,_sDefault); - return true; -} - } // namespace utl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit