[Libreoffice-commits] core.git: basic/source
LuboÅ¡ LuÅák
l.lunak at collabora.com
Wed Oct 1 02:45:31 PDT 2014
basic/source/comp/scanner.cxx | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
New commits:
commit dc7ca91a0494713a057da33cf33f1a83640f6a75
Author: LuboÅ¡ LuÅák <l.lunak at collabora.com>
Date: Tue Sep 30 19:21:10 2014 +0200
avoid calling OUString::copy() with length being -1
Which asserts in dbgutil build.
Change-Id: I0f8205ae98c5a57c430b7d8a574e4c0019855841
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 042518d..6065e26 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -491,25 +491,28 @@ bool SbiScanner::NextSym()
if( *pLine == cSep )
{
pLine++; nCol++;
- if( *pLine != cSep || cSep == ']' ) break;
+ if( *pLine != cSep || cSep == ']' )
+ {
+ // If VBA Interop then doen't eat the [] chars
+ if ( cSep == ']' && bVBASupportOn )
+ aSym = aLine.copy( n - 1, nCol - n + 1);
+ else
+ aSym = aLine.copy( n, nCol - n - 1 );
+ // get out duplicate string delimiters
+ OUStringBuffer aSymBuf;
+ for ( sal_Int32 i = 0, len = aSym.getLength(); i < len; ++i )
+ {
+ aSymBuf.append( aSym[i] );
+ if ( aSym[i] == cSep && ( i+1 < len ) && aSym[i+1] == cSep )
+ ++i;
+ }
+ aSym = aSymBuf.makeStringAndClear();
+ if( cSep != ']' )
+ eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING;
+ break;
+ }
} else aError = OUString(cSep), GenError( SbERR_EXPECTED );
}
- // If VBA Interop then doen't eat the [] chars
- if ( cSep == ']' && bVBASupportOn )
- aSym = aLine.copy( n - 1, nCol - n + 1);
- else
- aSym = aLine.copy( n, nCol - n - 1 );
- // get out duplicate string delimiters
- OUStringBuffer aSymBuf;
- for ( sal_Int32 i = 0, len = aSym.getLength(); i < len; ++i )
- {
- aSymBuf.append( aSym[i] );
- if ( aSym[i] == cSep && ( i+1 < len ) && aSym[i+1] == cSep )
- ++i;
- }
- aSym = aSymBuf.makeStringAndClear();
- if( cSep != ']' )
- eScanType = ( cSep == '#' ) ? SbxDATE : SbxSTRING;
}
// invalid characters:
else if( ( *pLine & 0xFF ) >= 0x7F )
More information about the Libreoffice-commits
mailing list