summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2005-09-29 17:39:17 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2005-09-29 17:39:17 +0000
commit7135093986831a7664ccd18a5377eca0c7a81cdf (patch)
tree2433f4fb0efe21e1b5d315665dab3bd94ab86a4c /basic
parented00d2c7c2fb45561c95dabb0de5583031ce67c9 (diff)
INTEGRATION: CWS ab17fixes (1.8.10); FILE MERGED
2005/09/29 18:28:52 hr 1.8.10.2: #i10000: manual resync; repair broken CWS 2005/05/04 14:16:27 ab 1.8.10.1: #i45570# SbiExprNode::FoldConstants(): Block large strings
Diffstat (limited to 'basic')
-rw-r--r--basic/source/comp/exprnode.cxx83
1 files changed, 49 insertions, 34 deletions
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 91ac54569753..d633a20fefef 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: exprnode.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: hr $ $Date: 2005-09-29 16:35:53 $
+ * last change: $Author: hr $ $Date: 2005-09-29 18:39:17 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -273,18 +273,14 @@ void SbiExprNode::FoldConstants()
{
String rl( pLeft->GetString() );
String rr( pRight->GetString() );
- delete pLeft; pLeft = NULL;
- delete pRight; pRight = NULL;
- eType = SbxDOUBLE;
- eNodeType = SbxNUMVAL;
- bComposite = FALSE;
- StringCompare eRes = rr.CompareTo( rl );
- //StringCompare eRes = rl.Compare( rr );
String s;
- switch( eTok )
+ bool bOk = true;
+ if( eTok == PLUS || eTok == CAT )
{
- case PLUS:
- case CAT:
+ // #i45570: Block long strings
+ UINT32 nTotalLen = rl.Len() + rr.Len();
+ if( nTotalLen < 0x50 )
+ {
eTok = CAT;
// Verkettung:
s = rl;
@@ -292,28 +288,47 @@ void SbiExprNode::FoldConstants()
nStringId = pGen->GetParser()->aGblStrings.Add( s, TRUE );
eType = SbxSTRING;
eNodeType = SbxSTRVAL;
- break;
- case EQ:
- nVal = ( eRes == COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE;
- break;
- case NE:
- nVal = ( eRes != COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE;
- break;
- case LT:
- nVal = ( eRes == COMPARE_LESS ) ? SbxTRUE : SbxFALSE;
- break;
- case GT:
- nVal = ( eRes == COMPARE_GREATER ) ? SbxTRUE : SbxFALSE;
- break;
- case LE:
- nVal = ( eRes != COMPARE_GREATER ) ? SbxTRUE : SbxFALSE;
- break;
- case GE:
- nVal = ( eRes != COMPARE_LESS ) ? SbxTRUE : SbxFALSE;
- break;
- default:
- pGen->GetParser()->Error( SbERR_CONVERSION );
- bError = TRUE;
+ }
+ else
+ {
+ bOk = false;
+ }
+ }
+ else
+ {
+ eType = SbxDOUBLE;
+ eNodeType = SbxNUMVAL;
+ StringCompare eRes = rr.CompareTo( rl );
+ switch( eTok )
+ {
+ case EQ:
+ nVal = ( eRes == COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE;
+ break;
+ case NE:
+ nVal = ( eRes != COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE;
+ break;
+ case LT:
+ nVal = ( eRes == COMPARE_LESS ) ? SbxTRUE : SbxFALSE;
+ break;
+ case GT:
+ nVal = ( eRes == COMPARE_GREATER ) ? SbxTRUE : SbxFALSE;
+ break;
+ case LE:
+ nVal = ( eRes != COMPARE_GREATER ) ? SbxTRUE : SbxFALSE;
+ break;
+ case GE:
+ nVal = ( eRes != COMPARE_LESS ) ? SbxTRUE : SbxFALSE;
+ break;
+ default:
+ pGen->GetParser()->Error( SbERR_CONVERSION );
+ bError = TRUE;
+ }
+ }
+ if( bOk )
+ {
+ delete pLeft; pLeft = NULL;
+ delete pRight; pRight = NULL;
+ bComposite = FALSE;
}
}
else