diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2005-09-29 11:46:06 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2005-09-29 11:46:06 +0000 |
commit | 54e1c865975e3f281a182a245e533ee4d6c95cf2 (patch) | |
tree | 5f71463ef1e3a764f96e68693f83b7e81adb2e40 | |
parent | 014819d7d1c2f1e6d772e8f3dd86f2e2c8ca2f4a (diff) |
INTEGRATION: CWS ab17fixes (1.8.10); FILE MERGED
2005/05/04 14:16:27 ab 1.8.10.1: #i45570# SbiExprNode::FoldConstants(): Block large strings
-rw-r--r-- | basic/source/comp/exprnode.cxx | 147 |
1 files changed, 94 insertions, 53 deletions
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx index a08920c0f6bf..b205a2bee9c1 100644 --- a/basic/source/comp/exprnode.cxx +++ b/basic/source/comp/exprnode.cxx @@ -1,35 +1,61 @@ /************************************************************************* * - * OpenOffice.org - a multi-platform office productivity suite - * * $RCSfile: exprnode.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ + * + * last change: $Author: hr $ $Date: 2005-09-29 12:46:06 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * last change: $Author: rt $ $Date: 2005-09-07 21:28:30 $ + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA * ************************************************************************/ @@ -273,18 +299,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 +314,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 |