[Libreoffice-commits] core.git: 3 commits - unotools/source
Stephan Bergmann
sbergman at redhat.com
Tue Mar 19 06:46:18 PDT 2013
unotools/source/config/lingucfg.cxx | 39 +++++++++++-------------------------
1 file changed, 12 insertions(+), 27 deletions(-)
New commits:
commit a2d33e2d4cda5e2c4217403bfe94ec0b89d47202
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 19 14:44:01 2013 +0100
compareToAscii(RTL_CONSTASCII_STRINGPARAM(s)) != compareTo(s)
...broken with 407b51db1831bb2cf21def88241323e35c612005 "Remove
RTL_CONSTASCII_STRINGPARAM (unotools)."
Change-Id: Id810c157a6e10380d28e4d6e85f908dc79cf0057
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index e665ccd..f0e8d13 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -938,7 +938,7 @@ static bool lcl_GetFileUrlFromOrigin(
if (!rOrigin.isEmpty())
{
OUString aURL( rOrigin );
- if ( aURL.compareTo( EXPAND_PROTOCOL ) == 0 )
+ if ( aURL.startsWith( EXPAND_PROTOCOL ) )
{
// cut protocol
OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
@@ -949,7 +949,7 @@ static bool lcl_GetFileUrlFromOrigin(
comphelper::getProcessComponentContext() )->expandMacros(
aMacro );
- bool bIsFileUrl = aURL.compareTo( FILE_PROTOCOL ) == 0;
+ bool bIsFileUrl = aURL.startsWith( FILE_PROTOCOL );
if (bIsFileUrl)
{
rFileUrl = aURL;
commit 61e0ce089d2cff59c4144c05263cf6e83a92fd76
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 19 14:38:29 2013 +0100
DBG_ASSERT -> SAL_WARN
Change-Id: I29a13ac9631027d7c527c3b395d4a887c290acc7
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index f5317f0..e665ccd 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -957,12 +957,14 @@ static bool lcl_GetFileUrlFromOrigin(
}
else
{
- DBG_ASSERT( bIsFileUrl, "not a file URL");
+ SAL_WARN(
+ "unotools.config", "not a file URL, <" << aURL << ">" );
}
}
else
{
- DBG_ASSERT( 0, "failed to get file URL" );
+ SAL_WARN(
+ "unotools.config", "failed to get file URL, <" << aURL << ">" );
}
}
return bSuccess;
commit 3968f5e874038ddfdcf70080ba6f122a48753b60
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Mar 19 14:34:52 2013 +0100
Simply obtain theMacroExpander on demand
Change-Id: I919c8f5c26d1c879dd77e691babaa4eb7f608c35
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 517a6ca..f5317f0 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -930,39 +930,24 @@ sal_Bool SvtLinguConfig::GetSupportedDictionaryFormatsFor(
return bSuccess;
}
-static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander()
-{
- static uno::WeakReference< util::XMacroExpander > aG_xMacroExpander;
-
- uno::Reference< util::XMacroExpander > xMacroExpander( aG_xMacroExpander );
- if ( !xMacroExpander.is() )
- {
- aG_xMacroExpander = util::theMacroExpander::get( comphelper::getProcessComponentContext() );
- xMacroExpander = aG_xMacroExpander;
- }
-
- return xMacroExpander;
-}
-
-
static bool lcl_GetFileUrlFromOrigin(
OUString /*out*/ &rFileUrl,
- const OUString &rOrigin,
- uno::Reference< util::XMacroExpander > &rxMacroExpander )
+ const OUString &rOrigin )
{
bool bSuccess = false;
if (!rOrigin.isEmpty())
{
OUString aURL( rOrigin );
- if (( aURL.compareTo( EXPAND_PROTOCOL ) == 0 ) &&
- rxMacroExpander.is() )
+ if ( aURL.compareTo( EXPAND_PROTOCOL ) == 0 )
{
// cut protocol
OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
// decode uric class chars
aMacro = Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
// expand macro string
- aURL = rxMacroExpander->expandMacros( aMacro );
+ aURL = util::theMacroExpander::get(
+ comphelper::getProcessComponentContext() )->expandMacros(
+ aMacro );
bool bIsFileUrl = aURL.compareTo( FILE_PROTOCOL ) == 0;
if (bIsFileUrl)
@@ -1013,11 +998,10 @@ sal_Bool SvtLinguConfig::GetDictionaryEntry(
if (bSuccess)
{
// get file URL's for the locations
- uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() );
for (sal_Int32 i = 0; i < aLocations.getLength(); ++i)
{
rtl::OUString &rLocation = aLocations[i];
- if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation, xMacroExpander ))
+ if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation ))
bSuccess = false;
}
@@ -1156,8 +1140,7 @@ rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl(
rtl::OUString aTmp;
if (aAny >>= aTmp)
{
- uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() );
- if (lcl_GetFileUrlFromOrigin( aTmp, aTmp, xMacroExpander ))
+ if (lcl_GetFileUrlFromOrigin( aTmp, aTmp ))
aRes = aTmp;
}
}
More information about the Libreoffice-commits
mailing list