Kaydet (Commit) 54013188 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

cleanup some unnecessary direct usage of the OString/OUString C API.

Change-Id: I6edee95aae1c169ce70063562a0c1b287e0c4735
Reviewed-on: https://gerrit.libreoffice.org/16861Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst fd274945
......@@ -305,12 +305,7 @@ bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const
case DataType::LONGVARCHAR:
{
OUString sLH = aLH, sRH = aRH;
sal_Int32 nRes = rtl_ustr_compareIgnoreAsciiCase_WithLength
(
sLH.pData->buffer,
sLH.pData->length,
sRH.pData->buffer,
sRH.pData->length );
sal_Int32 nRes = sLH.compareToIgnoreAsciiCase(sRH);
switch(aPredicateType)
{
case SQLFilterOperator::EQUAL: bResult = (nRes == 0); break;
......
......@@ -769,9 +769,7 @@ OString extractSingleTableFromSelect( const OStringVector &vec )
token ++;
}
if( token < vec.size() && rtl_str_compare_WithLength(
vec[token].getStr(), vec[token].getLength(),
RTL_CONSTASCII_STRINGPARAM("(") ) )
if( token < vec.size() && vec[token] == "(" )
{
// it is a table or a function name
OStringBuffer buf(128);
......@@ -783,9 +781,7 @@ OString extractSingleTableFromSelect( const OStringVector &vec )
if( token < vec.size() )
{
if( rtl_str_compare_WithLength(
vec[token].getStr(), vec[token].getLength(),
RTL_CONSTASCII_STRINGPARAM( "." ) ) == 0 )
if( vec[token] == "." )
{
buf.append( vec[token] );
token ++;
......@@ -803,9 +799,7 @@ OString extractSingleTableFromSelect( const OStringVector &vec )
ret = buf.makeStringAndClear();
// now got my table candidate
if( token < vec.size() && rtl_str_compare_WithLength(
vec[token].getStr(), vec[token].getLength(),
RTL_CONSTASCII_STRINGPARAM( "(" ) ) == 0 )
if( token < vec.size() && vec[token] == "(" )
{
// whoops, it is a function
ret.clear();
......@@ -823,9 +817,7 @@ OString extractSingleTableFromSelect( const OStringVector &vec )
if( token < vec.size() )
{
if( rtl_str_compare_WithLength(
vec[token].getStr(), vec[token].getLength(),
RTL_CONSTASCII_STRINGPARAM( "," ) ) == 0 )
if( vec[token] == "," )
{
// whoops, multiple tables are used
ret.clear();
......
......@@ -91,8 +91,7 @@ bool SAL_CALL osl_detail_ObjectRegistry_storeAddresses( char const* pName )
return false;
// check for "all":
rtl::OString const& rFirst = rVec[0];
if (rtl_str_compare_WithLength( rFirst.getStr(), rFirst.getLength(),
RTL_CONSTASCII_STRINGPARAM("all") ) == 0)
if ( rFirst == "all" )
return true;
OStringVec::const_iterator const iEnd( rVec.end() );
return std::find_if( rVec.begin(), iEnd,
......
......@@ -427,9 +427,7 @@ SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, oslDirectoryItem b)
if (a == b)
return sal_True;
/* same name => same item, unless renaming / moving madness has occurred */
if (rtl_ustr_compare_WithLength(
pA->m_ustrFilePath->buffer, pA->m_ustrFilePath->length,
pB->m_ustrFilePath->buffer, pB->m_ustrFilePath->length ) == 0)
if (pA->m_ustrFilePath == pB->m_ustrFilePath)
return sal_True;
struct stat a_stat, b_stat;
......
......@@ -1151,9 +1151,7 @@ SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, oslDirectoryItem b)
if (a == b)
return sal_True;
/* same name => same item, unless renaming / moving madness has occurred */
if (rtl_ustr_compare_WithLength(
pA->m_pFullPath->buffer, pA->m_pFullPath->length,
pB->m_pFullPath->buffer, pB->m_pFullPath->length ) == 0)
if (pA->m_pFullPath == pB->m_pFullPath)
return sal_True;
// FIXME: as/when/if this is used in anger on Windows we could
......
......@@ -106,9 +106,8 @@ using ::oox::core::XmlFilterBase;
bool IgnoreCaseCompare::operator()( const OUString& rName1, const OUString& rName2 ) const
{
// there is no wrapper in OUString, TODO: compare with collator
return ::rtl_ustr_compareIgnoreAsciiCase_WithLength(
rName1.getStr(), rName1.getLength(), rName2.getStr(), rName2.getLength() ) < 0;
// TODO: compare with collator
return rName1.compareToIgnoreAsciiCase(rName2 ) < 0;
}
class WorkbookGlobals : boost::noncopyable
......
......@@ -380,8 +380,7 @@ bool FilePermission::implies( Permission const & perm ) const
if (m_url.getLength() > demanded.m_url.getLength())
return false;
// check /- wildcard: all files and recursive in that path
if (1 < m_url.getLength() &&
0 == ::rtl_ustr_ascii_compare_WithLength( m_url.getStr() + m_url.getLength() - 2, 2, "/-" ))
if (m_url.endsWith("/-"))
{
// demanded url must start with granted path (including path trailing path sep)
sal_Int32 len = m_url.getLength() -1;
......@@ -394,8 +393,7 @@ bool FilePermission::implies( Permission const & perm ) const
#endif
}
// check /* wildcard: all files in that path (not recursive!)
if (1 < m_url.getLength() &&
0 == ::rtl_ustr_ascii_compare_WithLength( m_url.getStr() + m_url.getLength() - 2, 2, "/*" ))
if (m_url.endsWith("/*"))
{
// demanded url must start with granted path (including path trailing path sep)
sal_Int32 len = m_url.getLength() -1;
......
......@@ -259,7 +259,7 @@ FileProvider::compareContentIds(
error = osl::FileBase::getSystemPathFromFileURL( aStatus2.getFileURL(), aPath2 );
if ( error == osl::FileBase::E_None )
iComp = rtl_ustr_compareIgnoreAsciiCase( aPath1.getStr(), aPath2.getStr() );
iComp = aPath1.compareToIgnoreAsciiCase( aPath2 );
}
#endif
}
......
......@@ -484,27 +484,22 @@ SectionPropertyMap::~SectionPropertyMap()
OUString lcl_FindUnusedPageStyleName(const uno::Sequence< OUString >& rPageStyleNames)
{
static const sal_Char cDefaultStyle[] = "Converted";
//find the hightest number x in each style with the name "cDefaultStyle+x" and
static const char DEFAULT_STYLE[] = "Converted";
//find the highest number x in each style with the name "DEFAULT_STYLE+x" and
//return an incremented name
sal_Int32 nMaxIndex = 0;
const sal_Int32 nDefaultLength = sizeof(cDefaultStyle)/sizeof(sal_Char) - 1;
const OUString sDefaultStyle( cDefaultStyle, nDefaultLength, RTL_TEXTENCODING_ASCII_US );
const OUString* pStyleNames = rPageStyleNames.getConstArray();
for( sal_Int32 nStyle = 0; nStyle < rPageStyleNames.getLength(); ++nStyle)
{
if( pStyleNames[nStyle].getLength() > nDefaultLength &&
!rtl_ustr_compare_WithLength( sDefaultStyle.getStr(), nDefaultLength, pStyleNames[nStyle].getStr(), nDefaultLength))
if( pStyleNames[nStyle].startsWith(DEFAULT_STYLE) )
{
sal_Int32 nIndex = pStyleNames[nStyle].copy( nDefaultLength ).toInt32();
sal_Int32 nIndex = pStyleNames[nStyle].copy( strlen(DEFAULT_STYLE) ).toInt32();
if( nIndex > nMaxIndex)
nMaxIndex = nIndex;
}
}
OUString sRet( sDefaultStyle );
sRet += OUString::number( nMaxIndex + 1);
return sRet;
return DEFAULT_STYLE + OUString::number( nMaxIndex + 1);
}
......
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