summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2015-01-26 05:22:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-01-27 09:38:16 +0000
commit42685b663388dd81fed5d6a6f2c0168a22e84f02 (patch)
tree68467c40f48b2fda97a5e4bd2ee3583affbf6a71 /dbaccess
parent9b7b1774459edb93f2d3a11b2441851f4355a613 (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index f2a99f6dab82..13b2cfa822dc 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;