Kaydet (Commit) 98e90120 authored tarafından Luboš Luňák's avatar Luboš Luňák

make fast string concat comparisons non-ambiguous

Follow-up to https://gerrit.libreoffice.org/#/c/1803/ .

Change-Id: I9131854a579ef57e38dfef7faa539bec98fc305b
üst fea25896
...@@ -910,7 +910,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry ) ...@@ -910,7 +910,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
} }
for( sal_Int32 index = 0; index < childNodes.getLength(); index++ ) for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
{ {
if (OUString(aNewName+extn) == childNodes[index]->getName()) if (aNewName+extn == childNodes[index]->getName())
{ {
bFound = sal_True; bFound = sal_True;
break; break;
...@@ -939,8 +939,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry ) ...@@ -939,8 +939,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
bValid = sal_True; bValid = sal_True;
for( sal_Int32 index = 0; index < childNodes.getLength(); index++ ) for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
{ {
if (OUString(aUserSuppliedName+extn) if (aUserSuppliedName+extn == childNodes[index]->getName())
== childNodes[index]->getName())
{ {
bValid = sal_False; bValid = sal_False;
String aError( m_createErrStr ); String aError( m_createErrStr );
......
...@@ -355,6 +355,58 @@ inline bool operator!=(::rtl::OUString const& rLeft, UniString const& rRight) ...@@ -355,6 +355,58 @@ inline bool operator!=(::rtl::OUString const& rLeft, UniString const& rRight)
return rLeft != ::rtl::OUString(rRight); return rLeft != ::rtl::OUString(rRight);
} }
#ifdef RTL_FAST_STRING
// The above operators make comparisons involving fast string concatenation ambiguous, so provide explicit overloads.
template< typename T1, typename T2 >
inline bool operator==( const rtl::OUStringConcat< T1, T2 >& concat, const OUString& str )
{
return OUString( concat ) == str;
}
template< typename T1, typename T2 >
inline bool operator!=( const rtl::OUStringConcat< T1, T2 >& concat, const OUString& str )
{
return OUString( concat ) == str;
}
template< typename T1, typename T2 >
inline bool operator==( const OUString& str, const rtl::OUStringConcat< T1, T2 >& concat )
{
return str == OUString( concat );
}
template< typename T1, typename T2 >
inline bool operator!=( const OUString& str, const rtl::OUStringConcat< T1, T2 >& concat )
{
return str != OUString( concat );
}
template< typename T1, typename T2 >
inline bool operator==( const rtl::OUStringConcat< T1, T2 >& concat, const UniString& str )
{
return UniString( concat ) == str;
}
template< typename T1, typename T2 >
inline bool operator!=( const rtl::OUStringConcat< T1, T2 >& concat, const UniString& str )
{
return UniString( concat ) == str;
}
template< typename T1, typename T2 >
inline bool operator==( const UniString& str, const rtl::OUStringConcat< T1, T2 >& concat )
{
return str == UniString( concat );
}
template< typename T1, typename T2 >
inline bool operator!=( const UniString& str, const rtl::OUStringConcat< T1, T2 >& concat )
{
return str != UniString( concat );
}
#endif
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment