diff options
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/field2.cxx | 7 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index a2c740b948ce..9fa92591f04f 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -1963,8 +1963,11 @@ static bool ImplIsValidTimePortion( bool _bSkipInvalidCharacters, const OUString static bool ImplCutTimePortion( OUStringBuffer& _rStr, sal_Int32 _nSepPos, bool _bSkipInvalidCharacters, short* _pPortion ) { OUString sPortion(_rStr.getStr(), _nSepPos ); - _rStr = _nSepPos < _rStr.getLength() - ? _rStr.copy( _nSepPos + 1 ) : OUStringBuffer(); + + if (_nSepPos < _rStr.getLength()) + _rStr = _rStr.copy(_nSepPos + 1); + else + _rStr.truncate(); if ( !ImplIsValidTimePortion( _bSkipInvalidCharacters, sPortion ) ) return false; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index fc4e3021f4d0..46eb2bdfd237 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1962,7 +1962,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, sal_Int32 nEraseChars = std::max<sal_Int32>(4, aStr.getLength() - (nIndex*4)/3); while( nEraseChars < aStr.getLength() && _rLayout.GetTextWidth( aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth ) { - aTmpStr = OUStringBuffer(aStr); + aTmpStr = aStr; sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2; aTmpStr.remove(i, nEraseChars++); aTmpStr.insert(i, "..."); |