basic/source/comp/scanner.cxx | 93 +++++++++++++++++--------------- sc/source/core/data/compressedarray.cxx | 4 - unusedcode.easy | 3 - 3 files changed, 53 insertions(+), 47 deletions(-)
New commits: commit 28f16e4c2580e07ce05244d2b0672e5ef9e57ace Author: August Sodora <aug...@gmail.com> Date: Mon Jan 9 00:33:45 2012 -0500 Only set bSpaces once here diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 0c359c5..23599d4 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -234,8 +234,12 @@ bool SbiScanner::NextSym() nOldCol1 = nOldCol2 = 0; } - while(nCol < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[nCol])) - ++pLine, ++nCol, bSpaces = true; + if(nCol < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[nCol])) + { + bSpaces = true; + while(nCol < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[nCol])) + ++pLine, ++nCol; + } nCol1 = nCol; @@ -257,20 +261,24 @@ bool SbiScanner::NextSym() if(nCol < aLine.getLength() && (theBasicCharClass::get().isAlpha(aLine[nCol], bCompatible) || aLine[nCol] == '_')) { // if there's nothing behind '_' , it's the end of a line! - if( *pLine == '_' && !*(pLine+1) ) - { ++pLine; - goto eoln; } + if(nCol + 1 == aLine.getLength() && aLine[nCol] == '_') + { + // Note that nCol is not incremented here... + ++pLine; + goto eoln; + } + bSymbol = true; scanAlphanumeric(); // Special handling for "go to" - if( bCompatible && *pLine && aSym.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("go") ) ) + if(nCol < aLine.getLength() && bCompatible && aSym.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("go"))) scanGoto(); // replace closing '_' by space when end of line is following // (wrong line continuation otherwise) - if( !*pLine && *(pLine-1) == '_' ) + if(nCol == aLine.getLength() && aLine[nCol - 1] == '_' ) { // We are going to modify a potentially shared string, so force // a copy, so that aSym is not modified by the following operation @@ -280,17 +288,22 @@ bool SbiScanner::NextSym() // HACK: modifying a potentially shared string here! *((sal_Unicode*)(pLine-1)) = ' '; } + // type recognition? // don't test the exclamation mark // if there's a symbol behind it - else if( *pLine != '!' || !theBasicCharClass::get().isAlpha( pLine[ 1 ], bCompatible ) ) + else if((nCol >= aLine.getLength() || aLine[nCol] != '!') || + (nCol + 1 >= aLine.getLength() || !theBasicCharClass::get().isAlpha(aLine[nCol + 1], bCompatible))) { - SbxDataType t = GetSuffixType( *pLine ); - if( t != SbxVARIANT ) + if(nCol < aLine.getLength()) { - eScanType = t; - ++pLine; - ++nCol; + SbxDataType t = GetSuffixType( *pLine ); + if( t != SbxVARIANT ) + { + eScanType = t; + ++pLine; + ++nCol; + } } } } commit ed5b6ace8974e37f51f915d731d3b71dffdc8b49 Author: August Sodora <aug...@gmail.com> Date: Mon Jan 9 00:27:16 2012 -0500 Remove use of pLine in scanner diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index ff6b018..0c359c5 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -219,12 +219,10 @@ bool SbiScanner::NextSym() sal_Int32 nOldCol1 = nCol1; sal_Int32 nOldCol2 = nCol2; sal_Unicode buf[ BUF_SIZE ], *p = buf; - bHash = false; eScanType = SbxVARIANT; aSym = ::rtl::OUString(); - bSymbol = - bNumber = bSpaces = false; + bHash = bSymbol = bNumber = bSpaces = false; // read in line? if( !pLine ) @@ -236,7 +234,7 @@ bool SbiScanner::NextSym() nOldCol1 = nOldCol2 = 0; } - while( theBasicCharClass::get().isWhitespace( *pLine ) ) + while(nCol < aLine.getLength() && theBasicCharClass::get().isWhitespace(aLine[nCol])) ++pLine, ++nCol, bSpaces = true; nCol1 = nCol; @@ -256,7 +254,7 @@ bool SbiScanner::NextSym() } // copy character if symbol - if( theBasicCharClass::get().isAlpha( *pLine, bCompatible ) || *pLine == '_' ) + if(nCol < aLine.getLength() && (theBasicCharClass::get().isAlpha(aLine[nCol], bCompatible) || aLine[nCol] == '_')) { // if there's nothing behind '_' , it's the end of a line! if( *pLine == '_' && !*(pLine+1) ) commit c3259776aa138ef6afb9fa589edf47554e6524dd Author: August Sodora <aug...@gmail.com> Date: Mon Jan 9 00:24:54 2012 -0500 Prefer prefix increment diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 137da1e..ff6b018 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -116,7 +116,7 @@ bool SbiScanner::DoesColonFollow() { if(nCol < aLine.getLength() && aLine[nCol] == ':') { - pLine++; nCol++; + ++pLine; ++nCol; return true; } else @@ -154,8 +154,8 @@ void SbiScanner::scanAlphanumeric() sal_Int32 n = nCol; while(nCol < aLine.getLength() && (theBasicCharClass::get().isAlphaNumeric(aLine[nCol], bCompatible) || aLine[nCol] == '_')) { - pLine++; - nCol++; + ++pLine; + ++nCol; } aSym = aLine.copy(n, nCol - n); } @@ -200,7 +200,7 @@ bool SbiScanner::readLine() if(n + 1 < nLen && aBuf[n] == '\r' && aBuf[n + 1] == '\n') n += 2; else if(n < nLen) - n++; + ++n; nBufPos = n; pLine = aLine.getStr(); @@ -237,7 +237,7 @@ bool SbiScanner::NextSym() } while( theBasicCharClass::get().isWhitespace( *pLine ) ) - pLine++, nCol++, bSpaces = true; + ++pLine, ++nCol, bSpaces = true; nCol1 = nCol; @@ -250,8 +250,8 @@ bool SbiScanner::NextSym() if(nCol < aLine.getLength() && aLine[nCol] == '#') { - pLine++; - nCol++; + ++pLine; + ++nCol; bHash = true; } @@ -260,7 +260,7 @@ bool SbiScanner::NextSym() { // if there's nothing behind '_' , it's the end of a line! if( *pLine == '_' && !*(pLine+1) ) - { pLine++; + { ++pLine; goto eoln; } bSymbol = true; @@ -291,8 +291,8 @@ bool SbiScanner::NextSym() if( t != SbxVARIANT ) { eScanType = t; - pLine++; - nCol++; + ++pLine; + ++nCol; } } } @@ -313,7 +313,7 @@ bool SbiScanner::NextSym() if( (p-buf) == (BUF_SIZE-1) ) { bBufOverflow = true; - pLine++, nCol++; + ++pLine, ++nCol; continue; } // point or exponent? @@ -321,30 +321,30 @@ bool SbiScanner::NextSym() { if( ++comma > 1 ) { - pLine++; nCol++; continue; + ++pLine; ++nCol; continue; } - else *p++ = *pLine++, nCol++; + else *p++ = *pLine++, ++nCol; } else if( strchr( "DdEe", *pLine ) ) { if (++exp > 1) { - pLine++; nCol++; continue; + ++pLine; ++nCol; continue; } - *p++ = 'E'; pLine++; nCol++; + *p++ = 'E'; ++pLine; ++nCol; if( *pLine == '+' ) - pLine++, nCol++; + ++pLine, ++nCol; else if( *pLine == '-' ) - *p++ = *pLine++, nCol++; + *p++ = *pLine++, ++nCol; } else { - *p++ = *pLine++, nCol++; - if( comma && !exp ) ncdig++; + *p++ = *pLine++, ++nCol; + if( comma && !exp ) ++ncdig; } - if (!exp) ndig++; + if (!exp) ++ndig; } *p = 0; aSym = p; bNumber = true; @@ -373,21 +373,21 @@ bool SbiScanner::NextSym() if( t != SbxVARIANT ) { eScanType = t; - pLine++; - nCol++; + ++pLine; + ++nCol; } } // Hex/octal number? Read in and convert: else if( *pLine == '&' ) { - pLine++; nCol++; + ++pLine; ++nCol; sal_Unicode cmp1[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F', 0 }; sal_Unicode cmp2[] = { '0', '1', '2', '3', '4', '5', '6', '7', 0 }; sal_Unicode *cmp = cmp1; sal_Unicode base = 16; sal_Unicode ndig = 8; - sal_Unicode xch = *pLine++ & 0xFF; nCol++; + sal_Unicode xch = *pLine++ & 0xFF; ++nCol; switch( toupper( xch ) ) { case 'O': @@ -396,7 +396,7 @@ bool SbiScanner::NextSym() break; default : // treated as an operator - pLine--; nCol--; nCol1 = nCol-1; + --pLine; --nCol; nCol1 = nCol-1; aSym = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("&")); return SYMBOL; } @@ -408,7 +408,7 @@ bool SbiScanner::NextSym() { sal_Unicode ch = sal::static_int_cast< sal_Unicode >( toupper( *pLine & 0xFF ) ); - pLine++; nCol++; + ++pLine; ++nCol; // from 4.1.1996: buffer full, go on scanning empty if( (p-buf) == (BUF_SIZE-1) ) bBufOverflow = true; @@ -422,7 +422,7 @@ bool SbiScanner::NextSym() } } *p = 0; - for( p = buf; *p; p++ ) + for( p = buf; *p; ++p ) { i = (*p & 0xFF) - '0'; if( i > 9 ) i -= 7; @@ -432,7 +432,7 @@ bool SbiScanner::NextSym() GenError( SbERR_MATH_OVERFLOW ); break; } } - if( *pLine == '&' ) pLine++, nCol++; + if( *pLine == '&' ) ++pLine, ++nCol; nVal = (double) l; eScanType = ( l >= SbxMININT && l <= SbxMAXINT ) ? SbxINTEGER : SbxLONG; if( bBufOverflow ) commit 8917da2a2b63e8c7df79f37b90303827ebc6e158 Author: August Sodora <aug...@gmail.com> Date: Sun Jan 8 13:21:37 2012 -0500 callcatcher: Remove unused code diff --git a/sc/source/core/data/compressedarray.cxx b/sc/source/core/data/compressedarray.cxx index 9e47be1..2738809 100644 --- a/sc/source/core/data/compressedarray.cxx +++ b/sc/source/core/data/compressedarray.cxx @@ -487,9 +487,5 @@ void ScCompressedArrayIterator<A,D>::Follow( template class ScCompressedArray< SCROW, sal_uInt16>; // heights, base class template class ScCompressedArray< SCROW, sal_uInt8>; // flags, base class template class ScBitMaskCompressedArray< SCROW, sal_uInt8>; // flags -template void ScCompressedArrayIterator< SCROW, sal_uInt16>::Follow( - const ScCompressedArrayIterator< SCROW, sal_uInt8>&); - -// === EOF =================================================================== /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unusedcode.easy b/unusedcode.easy index d583b25..e54f380 100644 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -1971,5 +1971,4 @@ vcl::PDFExtOutDevData::SetOutlineItemText(int, rtl::OUString const&) vcl::PDFWriter::DrawPixel(Polygon const&, Color const*) vcl::PDFWriterImpl::drawPolyPolygon(PolyPolygon const&, int, bool) vcl::unx::GtkPrintWrapper::print_operation_set_has_selection(_GtkPrintOperation*, int) const -vcl::unx::GtkPrintWrapper::print_operation_set_support_selection(_GtkPrintOperation*, int) const -void ScCompressedArrayIterator<int, unsigned short>::Follow<unsigned char>(ScCompressedArrayIterator<int, unsigned char> const&) +vcl::unx::GtkPrintWrapper::print_operation_set_support_selection(_GtkPrintOperation*, int) const \ No newline at end of file _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits