desktop/source/splash/splash.cxx |   20 +++++---------------
 include/vcl/svapp.hxx            |    2 +-
 vcl/source/app/brand.cxx         |    4 ++--
 vcl/workben/vcldemo.cxx          |    2 +-
 4 files changed, 9 insertions(+), 19 deletions(-)

New commits:
commit 6c65c62c26a8aa4d04466545f8f04ec86b797012
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Oct 11 09:17:38 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Oct 11 12:45:09 2022 +0200

    Don't convert OUString to char* to get OUString in the end
    
    Which by the way fixes the mismatch between converting _sAppName to
    OString as UTF-8 in SplashScreen::SetScreenBitmap, and converting
    pName to OUString as ASCII in Application::LoadBrandBitmap.
    
    Change-Id: I2082f92693ca9633b64411dd668befaa30e978d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141202
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index c3b106cb3b44..1f5461ecaf21 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -472,25 +472,15 @@ void SplashScreen::SetScreenBitmap(BitmapEx &rBitmap)
     }
 
     // create file name from screen resolution information
-    OStringBuffer aStrBuf( 128 );
-    aStrBuf.append( "intro_" );
+    OUString aResBuf = "_" + OUString::number(nWidth) + "x" + 
OUString::number(nHeight);
     if ( !_sAppName.isEmpty() )
-    {
-        aStrBuf.append( OUStringToOString(_sAppName, RTL_TEXTENCODING_UTF8) );
-        aStrBuf.append( "_" );
-    }
-    OString aResBuf = OString::number( nWidth ) + "x" + OString::number( 
nHeight );
-
-    aStrBuf.append( aResBuf.getStr() );
-    if (Application::LoadBrandBitmap (aStrBuf.makeStringAndClear().getStr(), 
rBitmap))
-        return;
+        if (Application::LoadBrandBitmap(OUStringConcatenation("intro_" + 
_sAppName + aResBuf), rBitmap))
+            return;
 
-    aStrBuf.append( "intro_" );
-    aStrBuf.append( aResBuf.getStr() );
-    if (Application::LoadBrandBitmap (aStrBuf.getStr(), rBitmap))
+    if (Application::LoadBrandBitmap(OUStringConcatenation("intro" + aResBuf), 
rBitmap))
         return;
 
-    (void)Application::LoadBrandBitmap ("intro", rBitmap);
+    (void)Application::LoadBrandBitmap (u"intro", rBitmap);
 }
 
 void SplashScreen::determineProgressRatioValues(
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 93dd4873009b..5400157ffa57 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -926,7 +926,7 @@ public:
 
      @returns true if the PNG could be loaded, otherwise returns false.
     */
-    static bool                 LoadBrandBitmap (const char* pName, BitmapEx 
&rBitmap);
+    static bool                 LoadBrandBitmap (std::u16string_view pName, 
BitmapEx &rBitmap);
 
     ///@}
 
diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx
index 57db30d458e4..15615c35410b 100644
--- a/vcl/source/app/brand.cxx
+++ b/vcl/source/app/brand.cxx
@@ -52,13 +52,13 @@ namespace {
     }
 }
 
-bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap)
+bool Application::LoadBrandBitmap (std::u16string_view pName, BitmapEx 
&rBitmap)
 {
     // TODO - if we want more flexibility we could add a branding path
     // in an rc file perhaps fallback to "about.bmp"
     OUString aBaseDir( "$BRAND_BASE_DIR");
     rtl::Bootstrap::expandMacros( aBaseDir );
-    OUString aBaseName( "/" + OUString::createFromAscii( pName ) );
+    OUString aBaseName(OUStringChar('/') + pName);
     OUString aPng( ".png" );
 
     rtl_Locale *pLoc = nullptr;
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index f37a99666143..e6ef740dd6aa 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -141,7 +141,7 @@ public:
                    , mnBounceY(1)
 #endif
     {
-        if (!Application::LoadBrandBitmap("intro", maIntro))
+        if (!Application::LoadBrandBitmap(u"intro", maIntro))
             Application::Abort("Failed to load intro image");
 
         maIntroBW = maIntro.GetBitmap();

Reply via email to