dbaccess/source/core/misc/dsntypes.cxx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
New commits: commit 42685b663388dd81fed5d6a6f2c0168a22e84f02 Author: Lionel Elie Mamane <lio...@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 <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@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;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits