Related: fdo#38838 String::ReleaseBufferAccess is now no more
Change-Id: Ib5390183e3d98a23f9243debfe3624561ca92535
This commit is contained in:
@@ -274,7 +274,6 @@ public:
|
|||||||
|
|
||||||
const sal_Unicode* GetBuffer() const { return mpData->maStr; }
|
const sal_Unicode* GetBuffer() const { return mpData->maStr; }
|
||||||
sal_Unicode* GetBufferAccess();
|
sal_Unicode* GetBufferAccess();
|
||||||
void ReleaseBufferAccess( xub_StrLen nLen = STRING_LEN );
|
|
||||||
|
|
||||||
friend sal_Bool operator == ( const UniString& rStr1, const UniString& rStr2 )
|
friend sal_Bool operator == ( const UniString& rStr1, const UniString& rStr2 )
|
||||||
{ return rStr1.Equals( rStr2 ); }
|
{ return rStr1.Equals( rStr2 ); }
|
||||||
|
@@ -3158,31 +3158,25 @@ void ScInterpreter::ScUpper()
|
|||||||
void ScInterpreter::ScPropper()
|
void ScInterpreter::ScPropper()
|
||||||
{
|
{
|
||||||
//2do: what to do with I18N-CJK ?!?
|
//2do: what to do with I18N-CJK ?!?
|
||||||
String aStr( GetString() );
|
OUStringBuffer aStr(GetString());
|
||||||
const xub_StrLen nLen = aStr.Len();
|
const sal_Int32 nLen = aStr.getLength();
|
||||||
// #i82487# don't try to write to empty string's BufferAccess
|
|
||||||
// (would crash now that the empty string is const)
|
|
||||||
if ( nLen > 0 )
|
if ( nLen > 0 )
|
||||||
{
|
{
|
||||||
String aUpr( ScGlobal::pCharClass->uppercase( aStr ) );
|
OUString aUpr(ScGlobal::pCharClass->uppercase(aStr.toString()));
|
||||||
String aLwr( ScGlobal::pCharClass->lowercase( aStr ) );
|
OUString aLwr(ScGlobal::pCharClass->lowercase(aStr.toString()));
|
||||||
sal_Unicode* pStr = aStr.GetBufferAccess();
|
aStr[0] = aUpr[0];
|
||||||
const sal_Unicode* pUpr = aUpr.GetBuffer();
|
sal_Int32 nPos = 1;
|
||||||
const sal_Unicode* pLwr = aLwr.GetBuffer();
|
|
||||||
*pStr = *pUpr;
|
|
||||||
xub_StrLen nPos = 1;
|
|
||||||
while( nPos < nLen )
|
while( nPos < nLen )
|
||||||
{
|
{
|
||||||
OUString aTmpStr( pStr[nPos-1] );
|
OUString aTmpStr( aStr[nPos-1] );
|
||||||
if ( !ScGlobal::pCharClass->isLetter( aTmpStr, 0 ) )
|
if ( !ScGlobal::pCharClass->isLetter( aTmpStr, 0 ) )
|
||||||
pStr[nPos] = pUpr[nPos];
|
aStr[nPos] = aUpr[nPos];
|
||||||
else
|
else
|
||||||
pStr[nPos] = pLwr[nPos];
|
aStr[nPos] = aLwr[nPos];
|
||||||
nPos++;
|
++nPos;
|
||||||
}
|
}
|
||||||
aStr.ReleaseBufferAccess( nLen );
|
|
||||||
}
|
}
|
||||||
PushString( aStr );
|
PushString(aStr.makeStringAndClear());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -240,31 +240,6 @@ STRCODE* STRING::GetBufferAccess()
|
|||||||
return mpData->maStr;
|
return mpData->maStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STRING::ReleaseBufferAccess( xub_StrLen nLen )
|
|
||||||
{
|
|
||||||
// String not consinstent, thus no functionality test
|
|
||||||
DBG_CHKTHIS( STRING, NULL );
|
|
||||||
DBG_ASSERT( mpData->mnRefCount == 1, "String::ReleaseCharStr() called for String with RefCount" );
|
|
||||||
|
|
||||||
if ( nLen > mpData->mnLen )
|
|
||||||
nLen = ImplStringLen( mpData->maStr );
|
|
||||||
OSL_ASSERT(nLen <= mpData->mnLen);
|
|
||||||
if ( !nLen )
|
|
||||||
{
|
|
||||||
STRING_NEW((STRING_TYPE **)&mpData);
|
|
||||||
}
|
|
||||||
// shorten buffer is difference > 8 chars
|
|
||||||
else if ( mpData->mnLen - nLen > 8 )
|
|
||||||
{
|
|
||||||
STRINGDATA* pNewData = ImplAllocData( nLen );
|
|
||||||
memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
|
|
||||||
STRING_RELEASE((STRING_TYPE *)mpData);
|
|
||||||
mpData = pNewData;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mpData->mnLen = nLen;
|
|
||||||
}
|
|
||||||
|
|
||||||
STRING& STRING::Insert( STRCODE c, xub_StrLen nIndex )
|
STRING& STRING::Insert( STRCODE c, xub_StrLen nIndex )
|
||||||
{
|
{
|
||||||
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
|
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
|
||||||
|
Reference in New Issue
Block a user