shell/source/backends/kf5be/kfaccess.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit eff8497fa2ab9c0e4889e1cf38fdeff1b2ec195a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu May 30 14:29:05 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 31 14:29:01 2024 +0200

    kf5be: Make fromQStringToOUString work for Qt 6
    
    Sync `fromQStringToOUString` with the `toOUString`
    implementation in `vcl/inc/qt5/QtTools.hxx`, which
    makes it work with Qt 6 as well.
    
    Without this, building this with a planned upcoming
    change that introduces a KF 6 desktop backend would fail
    like this:
    
        In file included from 
/home/user/development/git/libreoffice/shell/source/backends/kf6be/kfaccess.cxx:10:
        
/home/user/development/git/libreoffice/shell/source/backends/kf6be/../kf5be/kfaccess.cxx:53:60:
 error: non-constant-expression cannot be narrowed from type 'qsizetype' (aka 
'long long') to 'sal_Int32' (aka 'int') in initializer list [-Wc++11-narrowing]
           53 |     return { reinterpret_cast<char16_t const*>(s.utf16()), 
s.size() };
              |                                                            
^~~~~~~~
        
/home/user/development/git/libreoffice/shell/source/backends/kf6be/../kf5be/kfaccess.cxx:53:60:
 note: insert an explicit cast to silence this issue
           53 |     return { reinterpret_cast<char16_t const*>(s.utf16()), 
s.size() };
              |                                                            
^~~~~~~~
              |                                                            
static_cast<sal_Int32>( )
    
    Change-Id: Ic2b1ddcaa290379187db69b33e4a700c148650e1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168275
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/shell/source/backends/kf5be/kfaccess.cxx 
b/shell/source/backends/kf5be/kfaccess.cxx
index 93fe1ed49b20..498fb9e1efb5 100644
--- a/shell/source/backends/kf5be/kfaccess.cxx
+++ b/shell/source/backends/kf5be/kfaccess.cxx
@@ -47,10 +47,9 @@ namespace uno = css::uno;
 
 namespace
 {
-OUString fromQStringToOUString(QString const& s)
+OUString fromQStringToOUString(const QString& s)
 {
-    // Conversion from QString size()'s int to OUString's sal_Int32 should be 
non-narrowing:
-    return { reinterpret_cast<char16_t const*>(s.utf16()), s.size() };
+    return OUString(reinterpret_cast<const sal_Unicode*>(s.data()), 
s.length());
 }
 }
 

Reply via email to