[Libreoffice-commits] core.git: dbaccess/source
Lionel Elie Mamane
lionel at mamane.lu
Tue Jan 27 01:39:07 PST 2015
dbaccess/source/core/misc/dsntypes.cxx | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
New commits:
commit 42685b663388dd81fed5d6a6f2c0168a22e84f02
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Mon Jan 26 05:22:12 2015 +0100
fix damage done by OUString conversion
OUString equalsIgnoreAsciiCaseAsciiL and
String EqualsIgnoreAsciiCaseAsciiL
do *not* have the same semantics.
This seems to be the intent of the code,
and hopefully what it was doing before the OUString conversion.
Change-Id: Ib1686254876f2b3105275a7f7c53eef1e20c39b6
Reviewed-on: https://gerrit.libreoffice.org/14180
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index f2a99f6..13b2cfa 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -371,16 +371,28 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
struct KnownPrefix
{
- const sal_Char* pAsciiPrefix;
+ const OUString sPrefix;
const DATASOURCE_TYPE eType;
const bool bMatchComplete;
- KnownPrefix( const sal_Char* _p, const DATASOURCE_TYPE _t, const bool _m )
- :pAsciiPrefix( _p )
+ KnownPrefix( const OUString &_s, const DATASOURCE_TYPE _t, const bool _m )
+ :sPrefix( _s )
,eType ( _t )
,bMatchComplete( _m )
{
}
+
+ bool match( const OUString &url)
+ {
+ if(bMatchComplete)
+ {
+ return url.equalsIgnoreAsciiCase(sPrefix);
+ }
+ else
+ {
+ return url.startsWithIgnoreAsciiCase(sPrefix);
+ }
+ }
};
KnownPrefix aKnowPrefixes[] =
{
@@ -408,9 +420,10 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
for ( size_t i=0; i < sizeof( aKnowPrefixes ) / sizeof( aKnowPrefixes[0] ); ++i )
{
- sal_uInt16 nMatchLen = aKnowPrefixes[i].bMatchComplete ? sDsn.getLength() : (sal_uInt16)rtl_str_getLength( aKnowPrefixes[i].pAsciiPrefix );
- if ( sDsn.equalsIgnoreAsciiCaseAsciiL( aKnowPrefixes[i].pAsciiPrefix, nMatchLen ) )
+ if( aKnowPrefixes[i].match(sDsn) )
+ {
return aKnowPrefixes[i].eType;
+ }
}
return DST_UNKNOWN;
More information about the Libreoffice-commits
mailing list