Kaydet (Commit) 548fc5db authored tarafından Jan Holesovsky's avatar Jan Holesovsky

A small cleanup after the String -> OUString conversion.

üst 48e2a853
...@@ -267,15 +267,13 @@ sal_Bool SbiScanner::NextSym() ...@@ -267,15 +267,13 @@ sal_Bool SbiScanner::NextSym()
// (wrong line continuation otherwise) // (wrong line continuation otherwise)
if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' ) if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' )
{ {
*((sal_Unicode*)(pLine-1)) = ' '; // cast because of const // We are going to modify a potentially shared string, so force
// a copy, so that aSym is not modified by the following operation
::rtl::OUString aSymCopy( aSym.getStr(), aSym.getLength() );
aSym = aSymCopy;
::rtl::OUStringBuffer aLineBuf(aLine); // HACK: modifying a potentially shared string here!
aLineBuf[nCol - 1] = ' '; // just to keep pLine and aLine in sync *((sal_Unicode*)(pLine-1)) = ' ';
aLine = aLineBuf.makeStringAndClear();
::rtl::OUStringBuffer aSymBuf(aSym);
aSymBuf[aSymBuf.getLength() - 1] = '_'; // to match behavior from back when GetBufferAccess was used
aSym = aSymBuf.makeStringAndClear();
} }
// type recognition? // type recognition?
// don't test the exclamation mark // don't test the exclamation mark
...@@ -457,20 +455,14 @@ sal_Bool SbiScanner::NextSym() ...@@ -457,20 +455,14 @@ sal_Bool SbiScanner::NextSym()
else else
aSym = aLine.copy( n, nCol - n - 1 ); aSym = aLine.copy( n, nCol - n - 1 );
// get out duplicate string delimiters // get out duplicate string delimiters
String s( cSep ); ::rtl::OUStringBuffer aSymBuf;
s += cSep; for ( sal_Int32 i = 0, len = aSym.getLength(); i < len; ++i )
sal_Int32 nIdx = 0;
do
{ {
nIdx = aSym.indexOf( s, nIdx ); aSymBuf.append( aSym[i] );
if( nIdx < 0 ) if ( aSym[i] == cSep && ( i+1 < len ) && aSym[i+1] == cSep )
break; ++i;
::rtl::OUStringBuffer aSymBuf( aSym );
aSymBuf.remove( nIdx, 1 );
aSym = aSymBuf.makeStringAndClear();
nIdx++;
} }
while( true ); aSym = aSymBuf.makeStringAndClear();
if( cSep != ']' ) if( cSep != ']' )
eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING; eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING;
} }
......
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