diff options
author | Szabolcs Dezsi <dezsiszabi@hotmail.com> | 2012-04-06 19:49:53 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2012-04-06 20:03:42 +0200 |
commit | d6bc02f8c4cd0f50f0a2631ac7634dab408efc1f (patch) | |
tree | b5a12df1fcae025715633469b75ab4c9b6f6d279 /cppuhelper | |
parent | 0e1c0587617e0a6e4295a13599e97cdf6d1d2ea9 (diff) |
Replaced equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(...)) with == operator
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/implbase_ex.cxx | 2 | ||||
-rw-r--r-- | cppuhelper/source/propertysetmixin.cxx | 13 | ||||
-rw-r--r-- | cppuhelper/source/servicefactory.cxx | 6 | ||||
-rw-r--r-- | cppuhelper/test/cfg_test.cxx | 10 | ||||
-rw-r--r-- | cppuhelper/test/testimplhelper.cxx | 41 |
5 files changed, 30 insertions, 42 deletions
diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx index 2e5e9523eb3a..1759c4a72af4 100644 --- a/cppuhelper/source/implbase_ex.cxx +++ b/cppuhelper/source/implbase_ex.cxx @@ -72,7 +72,7 @@ static inline void checkInterface( Type const & rType ) //-------------------------------------------------------------------------------------------------- static inline bool isXInterface( rtl_uString * pStr ) SAL_THROW(()) { - return (((OUString const *)&pStr)->equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.uno.XInterface") ) != sal_False); + return (*((OUString const *)&pStr) == "com.sun.star.uno.XInterface"); } //-------------------------------------------------------------------------------------------------- static inline void * makeInterface( sal_IntPtr nOffset, void * that ) SAL_THROW(()) diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx index e4cddeb2add4..85a4d80a1d35 100644 --- a/cppuhelper/source/propertysetmixin.cxx +++ b/cppuhelper/source/propertysetmixin.cxx @@ -219,9 +219,7 @@ void Data::initProperties( // works if the specified exceptions are of the exact type, not // of a supertype: for (sal_Int32 j = 0; j < excs.getLength(); ++j) { - if (excs[j]->getName().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( - "com.sun.star.beans.UnknownPropertyException"))) + if ( excs[j]->getName() == "com.sun.star.beans.UnknownPropertyException" ) { getUnknown = true; break; @@ -229,15 +227,10 @@ void Data::initProperties( } excs = attr->getSetExceptions(); for (sal_Int32 j = 0; j < excs.getLength(); ++j) { - if (excs[j]->getName().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( - "com.sun.star.beans.UnknownPropertyException"))) + if ( excs[j]->getName() == "com.sun.star.beans.UnknownPropertyException" ) { setUnknown = true; - } else if (excs[j]->getName().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( - "com.sun.star.beans." - "PropertyVetoException"))) + } else if ( excs[j]->getName() == "com.sun.star.beans.PropertyVetoException" ) { attrAttribs |= css::beans::PropertyAttribute::CONSTRAINED; diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx index ff4f41769b56..db8835f5c9e9 100644 --- a/cppuhelper/source/servicefactory.cxx +++ b/cppuhelper/source/servicefactory.cxx @@ -256,8 +256,7 @@ static void add_access_control_entries( "single-user-id"); entry.value <<= ac_user; context_values.push_back( entry ); - if (! ac_mode.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("single-user") )) + if ( ac_mode != "single-user" ) { throw SecurityException( OUSTR("set UNO_AC=single-user " @@ -267,8 +266,7 @@ static void add_access_control_entries( } else { - if (! ac_mode.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("single-default-user") )) + if ( ac_mode != "single-default-user" ) { throw SecurityException( OUSTR("set UNO_AC=single-default-user " diff --git a/cppuhelper/test/cfg_test.cxx b/cppuhelper/test/cfg_test.cxx index 2dd1d57b47da..ac976be57740 100644 --- a/cppuhelper/test/cfg_test.cxx +++ b/cppuhelper/test/cfg_test.cxx @@ -113,14 +113,14 @@ ServiceImpl0::ServiceImpl0( Reference< XComponentContext > const & xContext ) SA OSL_VERIFY( n == 13 ); OSL_VERIFY( m_xContext->getValueByName( OUSTR("/services/com.sun.star.bootstrap.TestComponent0/context-properties/serviceprop1") ) >>= val ); - OSL_VERIFY( val.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("value of serviceprop1") ) ); + OSL_VERIFY( val == "value of serviceprop1" ); // impl properties OSL_VERIFY( m_xContext->getValueByName( OUSTR("/implementations/com.sun.star.comp.bootstrap.TestComponent0/context-properties/implprop0") ) >>= n ); OSL_VERIFY( n == 15 ); OSL_VERIFY( m_xContext->getValueByName( OUSTR("/implementations/com.sun.star.comp.bootstrap.TestComponent0/context-properties/implprop1") ) >>= val ); - OSL_VERIFY( val.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("value of implprop1") ) ); + OSL_VERIFY( val == "value of implprop1" ); } // XInitialization //__________________________________________________________________________________________________ @@ -131,11 +131,11 @@ void ServiceImpl0::initialize( const Sequence< Any >& rArgs ) OUString val; OSL_VERIFY( rArgs.getLength() == 3 ); OSL_VERIFY( rArgs[ 0 ] >>= val ); - OSL_VERIFY( val.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("first argument") ) ); + OSL_VERIFY( val == "first argument" ); OSL_VERIFY( rArgs[ 1 ] >>= val ); - OSL_VERIFY( val.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("second argument") ) ); + OSL_VERIFY( val == "second argument" ); OSL_VERIFY( rArgs[ 2 ] >>= val ); - OSL_VERIFY( val.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("third argument") ) ); + OSL_VERIFY( val == "third argument" ); } // XServiceInfo //__________________________________________________________________________________________________ diff --git a/cppuhelper/test/testimplhelper.cxx b/cppuhelper/test/testimplhelper.cxx index cfeeb51c403e..f38f2610b40b 100644 --- a/cppuhelper/test/testimplhelper.cxx +++ b/cppuhelper/test/testimplhelper.cxx @@ -349,24 +349,24 @@ static void dotest( const Reference< XInterface > & xOriginal ) } Reference< A > xa( xOriginal, UNO_QUERY ); - OSL_ENSURE( xa->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### A failed!" ); + OSL_ENSURE( xa->a() == "a", "### A failed!" ); Reference< BA > xba( xa, UNO_QUERY ); - OSL_ENSURE( xba->ba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ba") ), "### BA failed!" ); - OSL_ENSURE( xba->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### BA failed!" ); + OSL_ENSURE( xba->ba() == "ba", "### BA failed!" ); + OSL_ENSURE( xba->a() == "a" ), "### BA failed!" ); Reference< CA > xca( xba, UNO_QUERY ); - OSL_ENSURE( xca->ca().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ca") ), "### CA failed!" ); - OSL_ENSURE( xca->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### CA failed!" ); + OSL_ENSURE( xca->ca() == "ca", "### CA failed!" ); + OSL_ENSURE( xca->a() == "a", "### CA failed!" ); Reference< DBA > xdba( xca, UNO_QUERY ); - OSL_ENSURE( xdba->dba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dba") ), "### DBA failed!" ); - OSL_ENSURE( xdba->ba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ba") ), "### DBA failed!" ); - OSL_ENSURE( xdba->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### DBA failed!" ); + OSL_ENSURE( xdba->dba() == "dba", "### DBA failed!" ); + OSL_ENSURE( xdba->ba() == "ba", "### DBA failed!" ); + OSL_ENSURE( xdba->a() == "a", "### DBA failed!" ); Reference< E > xe( xdba, UNO_QUERY ); - OSL_ENSURE( xe->e().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("e") ), "### E failed!" ); + OSL_ENSURE( xe->e() == "e", "### E failed!" ); Reference< FE > xfe( xe, UNO_QUERY ); - OSL_ENSURE( xfe->fe().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fe") ), "### FE failed!" ); + OSL_ENSURE( xfe->fe() == "fe", "### FE failed!" ); Reference< G > xg( xfe, UNO_QUERY ); - OSL_ENSURE( xg->g().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("g") ), "### G failed!" ); - OSL_ENSURE( xg->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### G failed!" ); + OSL_ENSURE( xg->g() == "g", "### G failed!" ); + OSL_ENSURE( xg->a() == "a", "### G failed!" ); // type provider Reference< lang::XTypeProvider > xProv( xg, UNO_QUERY ); @@ -466,16 +466,16 @@ void test_ImplHelper( const Reference< lang::XMultiServiceFactory > & /*xSF*/ ) dotest( xWeakImpl ); Reference< H > xH( xWeakImpl, UNO_QUERY ); Reference< I > xI( xH, UNO_QUERY ); - OSL_ASSERT( xH->h().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("h") ) ); - OSL_ASSERT( xI->i().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("i") ) ); + OSL_ASSERT( xH->h() == "h" ); + OSL_ASSERT( xI->i() == "i" ); xWeakAggImpl = (OWeakObject *)new TestAggImplInh(); Reference< lang::XTypeProvider > xTP7( xWeakAggImpl, UNO_QUERY ); dotest( xWeakAggImpl ); xH.set( xWeakAggImpl, UNO_QUERY ); xI.set( xH, UNO_QUERY ); - OSL_ASSERT( xH->h().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("h2") ) ); - OSL_ASSERT( xI->i().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("i2") ) ); + OSL_ASSERT( xH->h() == "h2" ); + OSL_ASSERT( xI->i() == "i2" ); // OSL_ASSERT( @@ -545,8 +545,7 @@ void test_ImplHelper( const Reference< lang::XMultiServiceFactory > & /*xSF*/ ) } catch (RuntimeException & rExc) { - OSL_ENSURE( rExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("runtime exc") ) && rExc.Context == xImpl, - "### unexpected exception content!" ); + OSL_ENSURE( rExc.Message == "runtime exc" && rExc.Context == xImpl, "### unexpected exception content!" ); try { throwException( makeAny( Exception( @@ -558,8 +557,7 @@ void test_ImplHelper( const Reference< lang::XMultiServiceFactory > & /*xSF*/ ) } catch (Exception & rExc2) { - OSL_ENSURE( rExc2.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("exc") ) && rExc2.Context == xImpl, - "### unexpected exception content!" ); + OSL_ENSURE( rExc2.Message == "exc" && rExc2.Context == xImpl, "### unexpected exception content!" ); try { throwException( makeAny( lang::IllegalAccessException( @@ -567,8 +565,7 @@ void test_ImplHelper( const Reference< lang::XMultiServiceFactory > & /*xSF*/ ) } catch (lang::IllegalAccessException & rExc3) { - OSL_ENSURE( rExc3.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("axxess exc") ) && rExc3.Context == xImpl, - "### unexpected exception content!" ); + OSL_ENSURE( rExc3.Message == "axxess exc" && rExc3.Context == xImpl, "### unexpected exception content!" ); return; } } |