diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-23 22:39:08 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-27 22:59:27 -0600 |
commit | 1facdbd5cebc72259dbb99b533843b1075c64448 (patch) | |
tree | db893d3dafac61edf527b3874886989853cc6328 /svl | |
parent | bedca5cee7d0c1adbf42b894aaec5098d9224443 (diff) |
remove String use in SvNumberformat::Load
Change-Id: Ie7cb50605d9e1e1a21d50a962bdc9b9880c8d06a
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 91b54f33e2b8..bb5c15032923 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1738,7 +1738,7 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream, } eOp1 = (SvNumberformatLimitOps) nOp1; eOp2 = (SvNumberformatLimitOps) nOp2; - String aComment; // wird nach dem NewCurrency-Geraffel richtig gesetzt + OUString aComment; // wird nach dem NewCurrency-Geraffel richtig gesetzt if ( rHdr.BytesLeft() ) { // ab SV_NUMBERFORMATTER_VERSION_NEWSTANDARD @@ -1746,9 +1746,9 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream, rStream >> nNewStandardDefined; } - xub_StrLen nNewCurrencyEnd = STRING_NOTFOUND; - bool bNewCurrencyComment = ( aComment.GetChar(0) == cNewCurrencyMagic && - (nNewCurrencyEnd = aComment.Search( cNewCurrencyMagic, 1 )) != STRING_NOTFOUND ); + sal_Int32 nNewCurrencyEnd = -1; + bool bNewCurrencyComment = ( aComment.getLength() > 1 && aComment[0] == cNewCurrencyMagic && + (nNewCurrencyEnd = aComment.indexOf( cNewCurrencyMagic, 1 )) >= 0 ); bool bNewCurrencyLoaded = false; bool bNewCurrency = false; @@ -1790,16 +1790,30 @@ NfHackConversion SvNumberformat::Load( SvStream& rStream, { if ( bNewCurrency && bNewCurrencyComment ) { // original Formatstring und Kommentar wiederherstellen - sFormatstring = aComment.Copy( 1, nNewCurrencyEnd-1 ); - aComment.Erase( 0, nNewCurrencyEnd+1 ); + sFormatstring = aComment.copy( 1, nNewCurrencyEnd-1 ); + if(nNewCurrencyEnd + 1 < aComment.getLength()) + { + aComment = aComment.copy(nNewCurrencyEnd + 1 ); + } + else + { + aComment = ""; + } } } else if ( bNewCurrencyComment ) { // neu, aber mit Version vor SV_NUMBERFORMATTER_VERSION_NEW_CURR gespeichert // original Formatstring und Kommentar wiederherstellen - sFormatstring = aComment.Copy( 1, nNewCurrencyEnd-1 ); - aComment.Erase( 0, nNewCurrencyEnd+1 ); + sFormatstring = aComment.copy( 1, nNewCurrencyEnd - 1 ); + if(nNewCurrencyEnd + 1 < aComment.getLength()) + { + aComment = aComment.copy(nNewCurrencyEnd + 1 ); + } + else + { + aComment = ""; + } // Zustaende merken short nDefined = ( eType & NUMBERFORMAT_DEFINED ); sal_uInt16 nNewStandard = nNewStandardDefined; |