Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 02/23/2012 02:35 PM, Lubos Lunak wrote:
On Thursday 23 of February 2012, Stephan Bergmann wrote:
On 02/23/2012 10:56 AM, Stephan Bergmann wrote:
On 02/23/2012 09:04 AM, Matúš Kukan wrote:
The patch helped me to build on Windows but I did not push because I
don't know what really was the problem, how my change helped to solve
that and especially if this is the proper solution.
Maybe it is related to the recent change in OUString class ?
If the patch is good, you can push, I will be here in the evening.

Yes, fix should be good. With the newly added rtl::OUString ctor, a
string literal can now implicitly be converted to an rtl::OUString,
which can lead to ambiguities. In this case, SimpleResMgr has ctors that
take either a char const * or an rtl::OUString const&. Probably
something that should be cleaned up, leaving SimpleResMgr with just one
of the two ctors. (And CREATEVERSIONRESMGR_NAME is just a glorious macro
to turn its argument into a string literal, so can safely be dropped.)

But then again, what is odd is that there are also other similar calls
to SimpleResMgr that should also cause this problem (e.g., in
svl/source/misc/getstringresource.cxx)?

  My guess would be it is because the second argument to SimpleResMgr is a
const reference for the const char* variant and a non-const reference for the
OUString variant, which avoids the ambiguity in all the other places where
the value passed is const.

  BTW, the two ctor variants even do different things, despite looking
semantically equivalent at a first look, so this looks like misdesigned API
to me.

OMG. In this case, it might be safer to change the code again to make it actually use the ctor variant it used before (char const * and Locale const &). Matúš, can you check whether the attached 0001-Rewrite-fix-to-use-the-same-SimpleResMgr-ctor-as-it-.patch would be sufficiently unambiguous for MSVC?

Stephan
From bab176a353f75e845fe6ca24bd204c5822b70a1c Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Thu, 23 Feb 2012 18:03:13 +0100
Subject: [PATCH] Rewrite fix to use the same SimpleResMgr ctor as it did
 before

...as the two actually behave subtly differently.
---
 fpicker/source/win32/misc/resourceprovider.cxx |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fpicker/source/win32/misc/resourceprovider.cxx 
b/fpicker/source/win32/misc/resourceprovider.cxx
index f288f7a..629d195 100644
--- a/fpicker/source/win32/misc/resourceprovider.cxx
+++ b/fpicker/source/win32/misc/resourceprovider.cxx
@@ -120,9 +120,8 @@ public:
     CResourceProvider_Impl( )
     {
         const SolarMutexGuard aGuard;
-
-        com::sun::star::lang::Locale aLoc( Application::GetSettings().GetUILocale() );
-        m_ResMgr = new SimpleResMgr( OUString( "fps_office" ), aLoc );
+        m_ResMgr = new SimpleResMgr(
+            "fps_office", Application::GetSettings().GetUILocale());
     }
 
     //-------------------------------------
-- 
1.7.7.6


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.