connectivity/source/inc/odbc/OTools.hxx | 4 ++++ 1 file changed, 4 insertions(+)
New commits: commit a9f006bf03ace169663cd2697b7596c51ed4f273 Author: Stephan Bergmann <stephan.bergm...@allotropia.de> AuthorDate: Mon Sep 30 10:05:47 2024 +0200 Commit: Stephan Bergmann <stephan.bergm...@allotropia.de> CommitDate: Tue Oct 1 09:54:33 2024 +0200 Avoid some macOS loplugin warnings around SQLWChars ...like > connectivity/source/drivers/odbc/OPreparedStatement.cxx:285:136: error: replace function parameter of type 'const OUString &' with 'std::u16string_view' [loplugin:stringviewparam] > 285 | void OPreparedStatement::setParameter(const sal_Int32 parameterIndex, const sal_Int32 _nType, const sal_Int16 _nScale, const OUString &_sData) > | ~~~~~~~~~~~~~~~~^~~~~~ and > connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx:851:117: error: directly use a 'std::u16string_view' (aka 'basic_string_view<char16_t>') value instead of a _ustr user-defined string literal [loplugin:ostr] > 851 | SQLWChars aCOL = !uCOL.isEmpty() ? SQLWChars(uCOL.makeStringAndClear()) : SQLWChars(u"" SQL_ALL_TABLE_TYPES ""_ustr); > | ^~~~~~~ caused by SQLWCHAR being 32-bit wchar_t on macOS (rather than 16-bit unsigned short, as on Linux), so SQLWChars is CHARS<sal_uInt32> (rather than CHARS<sal_Unicode>) with a ctor taking a std::u16string_view argument (rather than an OUString argument) Change-Id: I194af5feda5ba6279ed87264bc467b5d574406cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174263 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> diff --git a/connectivity/source/inc/odbc/OTools.hxx b/connectivity/source/inc/odbc/OTools.hxx index adac0cd0c75c..c97ce4f4654a 100644 --- a/connectivity/source/inc/odbc/OTools.hxx +++ b/connectivity/source/inc/odbc/OTools.hxx @@ -333,6 +333,10 @@ public: m_len = p - m_buf.get(); *p = 0; } + // Explicitly define a redundant overload for OUString to avoid certain loplugin warnings in + // code prepared to work with SQLWCHAR being either 16-bit unsigned short (Linux) or 32-bit + // wchar_t (macOS): + CHARS(OUString const & str): CHARS(static_cast<std::u16string_view>(str)) {} C* get() { return reinterpret_cast<C*>(m_buf.get()); } private: