[Libreoffice-commits] core.git: 3 commits - cui/source include/tools tools/source vcl/source
Caolán McNamara
caolanm at redhat.com
Mon Oct 21 03:25:21 PDT 2013
cui/source/options/optdict.cxx | 4 ++--
include/tools/string.hxx | 19 +------------------
tools/source/string/tustring.cxx | 21 ---------------------
vcl/source/control/ilstbox.cxx | 18 ++++++++----------
4 files changed, 11 insertions(+), 51 deletions(-)
New commits:
commit 28977ea778cc7c8c16c16f1c8b2b6bb6a53b48f7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 21 09:56:41 2013 +0100
drop StringCompare from cui
Change-Id: Iec7a797581ab899e93ad6cebb06c3622ca2360b9
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index 722a483..bde7de1 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -371,9 +371,9 @@ sal_uInt16 SvxEditDictionaryDialog::GetLBInsertPos(const OUString &rDicWord)
SvTreeListEntry* pEntry = pWordsLB->GetEntry(j);
DBG_ASSERT( pEntry, "NULL pointer");
OUString aNormEntry( getNormDicEntry_Impl( rDicWord ) );
- StringCompare eCmpRes = (StringCompare)pCollator->
+ sal_Int32 nCmpRes = pCollator->
compareString( aNormEntry, getNormDicEntry_Impl( pWordsLB->GetEntryText(pEntry, 0) ) );
- if( COMPARE_LESS == eCmpRes )
+ if (nCmpRes < 0)
break;
}
if (j < pWordsLB->GetEntryCount()) // entry found?
commit df29825ec68c7cdba90a85fff49ac969522a43f7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 21 09:53:30 2013 +0100
drop StringCompare from vcl
Change-Id: If41503f382115affb42068d9a441241543197147
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index a5bc8bf..fa9c277 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -184,12 +184,10 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
try
{
- // XXX even though XCollator::compareString returns a sal_Int32 the only
- // defined values are {-1, 0, 1} which is compatible with StringCompare
- StringCompare eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
+ sal_Int32 nComp = rSorter.compare(rStr, pTemp->maStr);
// fast insert for sorted data
- if ( eComp != COMPARE_LESS )
+ if ( nComp >= 0 )
{
insPos = maEntries.size();
maEntries.push_back(pNewEntry);
@@ -199,8 +197,8 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
nLow = mnMRUCount;
pTemp = (ImplEntryType*)GetEntry( (sal_uInt16)nLow );
- eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
- if ( eComp != COMPARE_GREATER )
+ nComp = rSorter.compare(rStr, pTemp->maStr);
+ if ( nComp <= 0 )
{
insPos = 0;
maEntries.insert(maEntries.begin(),pNewEntry);
@@ -214,13 +212,13 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
nMid = (nLow + nHigh) / 2;
pTemp = (ImplEntryType*)GetEntry( nMid );
- eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
+ nComp = rSorter.compare(rStr, pTemp->maStr);
- if ( eComp == COMPARE_LESS )
+ if ( nComp < 0 )
nHigh = nMid-1;
else
{
- if ( eComp == COMPARE_GREATER )
+ if ( nComp > 0 )
nLow = nMid + 1;
else
break;
@@ -228,7 +226,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
}
while ( nLow <= nHigh );
- if ( eComp != COMPARE_LESS )
+ if ( nComp >= 0 )
nMid++;
insPos = nMid;
commit d486b2b324364dd99bea686b6969f7a796f5e329
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 21 09:30:09 2013 +0100
Related: fdo#38838 remove/privatize String::Append
Change-Id: I5ae90b02e7ae5ddd19495fd0847b7e9dfc4419e8
diff --git a/include/tools/string.hxx b/include/tools/string.hxx
index f32d668..21eb3c5 100644
--- a/include/tools/string.hxx
+++ b/include/tools/string.hxx
@@ -107,6 +107,7 @@ private:
xub_StrLen nLen = STRING_LEN ) const;
UniString& Assign( const OUString& rStr );
+ UniString& Append( const UniString& rStr );
UniString( const int* pDummy ); // not implemented: to prevent UniString( NULL )
UniString(int); // not implemented; to detect misuses of
@@ -115,8 +116,6 @@ private:
// of operator =(sal_Unicode)
void Append(int); // not implemented; to detect misuses of
// Append(sal_Unicode)
- void operator +=(int); // not implemented; to detect misuses
- // of operator +=(sal_Unicode)
//detect and reject use of RTL_CONSTASCII_STRINGPARAM instead of RTL_CONSTASCII_USTRINGPARAM
TOOLS_DLLPRIVATE UniString( const sal_Char*, sal_Int32 );
@@ -133,12 +132,6 @@ private:
TOOLS_DLLPRIVATE UniString( const sal_Unicode* pCharStr );
TOOLS_DLLPRIVATE UniString( const sal_Unicode* pCharStr, xub_StrLen nLen );
TOOLS_DLLPRIVATE UniString( sal_Unicode c );
- TOOLS_DLLPRIVATE UniString& Append( const sal_Unicode* pCharStr );
- TOOLS_DLLPRIVATE UniString& Append( const sal_Unicode* pCharStr, xub_StrLen nLen );
- TOOLS_DLLPRIVATE UniString& Expand( xub_StrLen nCount, sal_Unicode cExpandChar );
-
- TOOLS_DLLPRIVATE UniString& operator +=( const sal_Unicode* pCharStr );
-
public:
UniString();
UniString( const ResId& rResId );
@@ -175,18 +168,8 @@ public:
UniString& operator =( const OUString& rStr )
{ return Assign( rStr ); }
- UniString& Append( const UniString& rStr );
- UniString& Append( sal_Unicode c );
- UniString & Append(char c) // ...but allow "Append('a')"
- { return Append(static_cast< sal_Unicode >(c)); }
- UniString& operator +=( const UniString& rStr )
- { return Append( rStr ); }
UniString& operator +=( const OUString& rStr )
{ return Append( UniString(rStr) ); }
- UniString& operator +=( sal_Unicode c )
- { return Append( c ); }
- UniString & operator +=(char c) // ...but allow "+= 'a'"
- { return operator +=(static_cast< sal_Unicode >(c)); }
xub_StrLen Len() const { return (xub_StrLen)mpData->mnLen; }
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 42c6947..f4f3bd2 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -79,27 +79,6 @@ sal_Bool operator==(const UniString& rStr1, const UniString& rStr2)
return (ImplStringCompareWithoutZero( rStr1.mpData->maStr, rStr2.mpData->maStr, rStr1.mpData->mnLen ) == 0);
}
-STRING& STRING::Append( STRCODE c )
-{
- // don't append null characters and keep string length < maxlen
- sal_Int32 nLen = mpData->mnLen;
- if ( c && (nLen < STRING_MAXLEN) )
- {
- // allocate string of new size
- STRINGDATA* pNewData = ImplAllocData( nLen+1 );
-
- // copy string
- memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
- pNewData->maStr[nLen] = c;
-
- // free old string
- STRING_RELEASE((STRING_TYPE *)mpData);
- mpData = pNewData;
- }
-
- return *this;
-}
-
xub_StrLen ImplStringLen( const sal_Char* pStr )
{
const sal_Char* pTempStr = pStr;
More information about the Libreoffice-commits
mailing list