diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-11-12 09:56:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-11-12 11:23:14 +0100 |
commit | f8a30a87a9d0c68dc16d5fa2ca63f687b1d90da1 (patch) | |
tree | 8ab83492dadcebf05308ba883c30ca924a14fd9a /ucb | |
parent | 9c8076f438dfac311a9c7dce559e8ab3ea4fd6e0 (diff) |
Fix (mis-)uses of temporary O[U]StringLiteral
...as sub-expressions of ternary operators, which happened to keep compiling
after 4b9e440c51be3e40326bc90c33ae69885bfb51e4 "Turn OStringLiteral into a
consteval'ed, static-refcound rtl_String" and
e6dfaf9f44f9939abc338c83b3024108431d0f69 "Turn OUStringLiteral into a
consteval'ed, static-refcound rtl_uString" because both branches are of the same
type O[U]StringLiteral<N>, and which didn't cause any issues because no dangling
pointers to those temporary objects escaped the surrounding full expressions.
This was found with an experimental build with VS 2022 with
--enable-latest-c++, which would support HAVE_CPP_CONSTEVAL after some linking
fix in the configure.ac detection code (which is forthcoming in a later commit)
and flagged all these uses in ternary operators as error C7595 "call to
immediate function is not a constant expression". That error looks bogus (and
it also caused a false
> sd/source/ui/unoidl/unoobj.cxx(742): error C7595: 'Color::Color': call to immediate function is not a constant expression
so HAVE_CPP_CONSTEVAL will need to remain undefined for VS 2022 until that
compiler bug is fixed), but it nicely found all these cases that should arguably
be cleaned up.
Change-Id: I81de94e8af5a6c50e5fe7dfa1a4b253e0c2a68f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125082
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/package/pkgcontent.cxx | 8 | ||||
-rw-r--r-- | ucb/source/ucp/package/pkguri.cxx | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx index cf08c8bdfaaf..a22ab7bdaaed 100644 --- a/ucb/source/ucp/package/pkgcontent.cxx +++ b/ucb/source/ucp/package/pkgcontent.cxx @@ -22,6 +22,10 @@ TODO ************************************************************************** *************************************************************************/ +#include <sal/config.h> + +#include <string_view> + #include <osl/diagnose.h> #include <rtl/ustring.hxx> @@ -224,8 +228,8 @@ OUString Content::getContentType( return ( OUString::Concat("application/") + aScheme + ( bFolder - ? OUStringLiteral(u"-folder") - : OUStringLiteral(u"-stream") ) ); + ? std::u16string_view(u"-folder") + : std::u16string_view(u"-stream") ) ); } diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx index dfcde478938b..9796ecc34c73 100644 --- a/ucb/source/ucp/package/pkguri.cxx +++ b/ucb/source/ucp/package/pkguri.cxx @@ -24,6 +24,10 @@ *************************************************************************/ +#include <sal/config.h> + +#include <string_view> + #include <comphelper/storagehelper.hxx> #include "../inc/urihelper.hxx" @@ -109,8 +113,8 @@ void PackageUri::init() const { m_aParam += ( !m_aParam.isEmpty() - ? OUStringLiteral( u"&purezip" ) - : OUStringLiteral( u"?purezip" ) ); + ? std::u16string_view( u"&purezip" ) + : std::u16string_view( u"?purezip" ) ); } aPureUri = aPureUri.replaceAt( 0, |