From e26e167837c059e277793d68ed1e546a85813642 Mon Sep 17 00:00:00 2001 From: Andreas Bille Date: Fri, 23 Nov 2001 12:54:35 +0000 Subject: Including rtti-switch for gcc in makefiles. The cause of the bug is not understood: Adding KeywordElements to a vector and sorting afterwards, everything works fine. Inserting it into a set and iterating over the set afterwards gives an inconsistent set. I have currently removed the previous introduced workaround for the solaris compiler!! Needs to be checked. --- xmlhelp/source/cxxhelp/db/makefile.mk | 7 +- xmlhelp/source/cxxhelp/provider/databases.cxx | 172 +++++++++++--------------- xmlhelp/source/cxxhelp/provider/makefile.mk | 9 +- xmlhelp/source/cxxhelp/qe/makefile.mk | 8 +- xmlhelp/source/cxxhelp/util/makefile.mk | 7 +- 5 files changed, 95 insertions(+), 108 deletions(-) (limited to 'xmlhelp') diff --git a/xmlhelp/source/cxxhelp/db/makefile.mk b/xmlhelp/source/cxxhelp/db/makefile.mk index 6b2d81ff1652..bd6e8594135c 100644 --- a/xmlhelp/source/cxxhelp/db/makefile.mk +++ b/xmlhelp/source/cxxhelp/db/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: abi $ $Date: 2001-06-13 16:26:35 $ +# last change: $Author: abi $ $Date: 2001-11-23 13:54:35 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -75,6 +75,9 @@ ENABLE_EXCEPTIONS=TRUE .IF "$(GUI)"=="WNT" CFLAGS+=/GR .ENDIF +.IF "$(COM)"=="GCC" +CFLAGSCXX+=-frtti +.ENDIF # --- Files -------------------------------------------------------- diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 506eebc06a57..c0a815f60597 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -2,9 +2,9 @@ * * $RCSfile: databases.cxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * - * last change: $Author: abi $ $Date: 2001-11-08 15:36:53 $ + * last change: $Author: abi $ $Date: 2001-11-23 13:54:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,6 +59,7 @@ * ************************************************************************/ + #include #ifndef _VOS_DIAGNOSE_HXX_ #include @@ -88,7 +89,7 @@ #include #endif #include "inputstream.hxx" - +#include using namespace chelp; using namespace com::sun::star::uno; @@ -223,65 +224,6 @@ void Databases::replaceName( rtl::OUString& oustring ) const aStrBuf.append( &oustring.getStr()[k],oustring.getLength()-k ); oustring = aStrBuf.makeStringAndClear(); } -// sal_Int32 idx = -1,k = 0,add,off; -// bool cap = false; -// rtl::OUStringBuffer aStrBuf( 0 ); - -// while( ( idx = oustring.indexOf( sal_Unicode('%'),++idx ) ) != -1 ) -// { -// if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTNAME" ), -// idx ) == idx ) -// { -// add = 12; -// off = PRODUCTNAME; -// } -// else if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTVERSION" ), -// idx ) == idx ) -// { -// add = 15; -// off = PRODUCTVERSION; -// } -// else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORNAME" ), -// idx ) == idx ) -// { -// add = 11; -// off = VENDORNAME; -// } -// else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORVERSION" ), -// idx ) == idx ) -// { -// add = 14; -// off = VENDORVERSION; -// } -// else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORSHORT" ), -// idx ) == idx ) -// { -// add = 12; -// off = VENDORSHORT; -// } -// else -// add = 0; - -// if( add ) -// { -// if( ! cap ) -// { -// cap = true; -// aStrBuf.ensureCapacity( 256 ); -// } - -// aStrBuf.append( &oustring.getStr()[k],idx - k ); -// aStrBuf.append( m_vReplacement[off] ); -// k = idx + add; -// } -// } - -// if( cap ) -// { -// if( k < oustring.getLength() ) -// aStrBuf.append( &oustring.getStr()[k],oustring.getLength()-k ); -// oustring = aStrBuf.makeStringAndClear(); -// } } @@ -609,12 +551,47 @@ KeywordInfo::KeywordElement::KeywordElement( Databases *pDatabases, } -bool KeywordInfo::KeywordElement::compare( const KeywordElement& ra ) const +// std::vector *globSet = 0; + +// bool check(const KeywordInfo::KeywordElement& aElement) +// { +// std::vector aVec = *globSet; + +// if( aElement.key.getLength() == 0 ) +// fprintf(stderr,"...found zero element at position %d\n",aVec.size()); + +// for(int i = 0; i < aVec.size(); ++i) +// { +// for(int j = i; j < aVec.size(); ++j) +// { +// bool b12 = aVec[i]compareSubstring( l,0,l3,r,0,r3 ); if( c1 == +1 ) @@ -645,27 +620,6 @@ bool KeywordInfo::KeywordElement::compare( const KeywordElement& ra ) const } - -// This is a workaround for a solaris compiler bug -// it enforces an additional stack frame for operator< -void inc( int& k ) -{ - return; -} - - - -bool KeywordInfo::KeywordElement::operator<( const KeywordElement& ra ) const -{ -// This is a workaround for a compiler bug - int k = 0; - inc(k); -// - bool temp = compare( ra ); - return temp; -} - - void KeywordInfo::KeywordElement::init( Databases *pDatabases,Db* pDb,const rtl::OUString& ids ) { const sal_Unicode* idstr = ids.getStr(); @@ -732,6 +686,22 @@ KeywordInfo::KeywordInfo( const std::set< KeywordElement >& aSet ) } +KeywordInfo::KeywordInfo( const std::vector< KeywordElement >& aVec ) + : listKey( aVec.size() ), + listId( aVec.size() ), + listAnchor( aVec.size() ), + listTitle( aVec.size() ) +{ + for( int i = 0; i < aVec.size(); ++i ) + { + listKey[i] = aVec[i].key; + listId[i] = aVec[i].listId; + listAnchor[i] = aVec[i].listAnchor; + listTitle[i] = aVec[i].listTitle; + } +} + + KeywordInfo* Databases::getKeyword( const rtl::OUString& Database, const rtl::OUString& Language ) @@ -752,22 +722,24 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database, key + rtl::OUString::createFromAscii( ".key" ); - rtl::OString fileName( fileNameOU.getStr(),fileNameOU.getLength(),osl_getThreadTextEncoding() ); + rtl::OString fileName( fileNameOU.getStr(), + fileNameOU.getLength(), + osl_getThreadTextEncoding() ); + Db table( 0,DB_CXX_NO_EXCEPTIONS ); if( 0 == table.open( fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) ) { - std::set aSet; + std::vector aVector; Db* idmap = getBerkeley( Database,Language ); Reference< XCollator > xCollator = getCollator( Language,rtl::OUString() ); bool first = true; - Dbt key,data; - key.set_flags( DB_DBT_MALLOC ); // Initially the cursor must allocate the necessary memory - data.set_flags( DB_DBT_MALLOC ); Dbc* cursor = 0; table.cursor( 0,&cursor,0 ); - + Dbt key,data; + key.set_flags( DB_DBT_MALLOC ); // Initially the cursor must allocate the necessary memory + data.set_flags( DB_DBT_MALLOC ); while( cursor && DB_NOTFOUND != cursor->get( &key,&data,DB_NEXT ) ) { rtl::OUString keyword( static_cast(key.get_data()), @@ -777,12 +749,11 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database, data.get_size(), RTL_TEXTENCODING_UTF8 ); - aSet.insert( - KeywordInfo::KeywordElement( this, - idmap, - xCollator, - keyword, - doclist ) ); + aVector.push_back( KeywordInfo::KeywordElement( this, + idmap, + xCollator, + keyword, + doclist ) ); if( first ) { key.set_flags( DB_DBT_REALLOC ); @@ -790,8 +761,9 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database, first = false; } } - cursor->close(); - KeywordInfo* info = it->second = new KeywordInfo( aSet ); + std::sort( aVector.begin(),aVector.end() ); + if( cursor ) cursor->close(); + KeywordInfo* info = it->second = new KeywordInfo( aVector ); } table.close( 0 ); } diff --git a/xmlhelp/source/cxxhelp/provider/makefile.mk b/xmlhelp/source/cxxhelp/provider/makefile.mk index 55ef6d6d2f89..2018489a7820 100644 --- a/xmlhelp/source/cxxhelp/provider/makefile.mk +++ b/xmlhelp/source/cxxhelp/provider/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.9 $ # -# last change: $Author: abi $ $Date: 2001-09-28 15:01:59 $ +# last change: $Author: abi $ $Date: 2001-11-23 13:54:35 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -79,6 +79,11 @@ CFLAGS += -DHAVE_EXPAT_H CFLAGS+=/GR .ENDIF +.IF "$(COM)"=="GCC" +CFLAGSCXX+=-frtti +.ENDIF + + # --- General ----------------------------------------------------- SLOFILES=\ diff --git a/xmlhelp/source/cxxhelp/qe/makefile.mk b/xmlhelp/source/cxxhelp/qe/makefile.mk index 01f93be50b54..99c9573daad8 100644 --- a/xmlhelp/source/cxxhelp/qe/makefile.mk +++ b/xmlhelp/source/cxxhelp/qe/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: abi $ $Date: 2001-06-13 16:26:35 $ +# last change: $Author: abi $ $Date: 2001-11-23 13:54:35 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -76,6 +76,10 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+=/GR .ENDIF +.IF "$(COM)"=="GCC" +CFLAGSCXX+=-frtti +.ENDIF + SLOFILES=\ $(SLO)$/ConceptData.obj \ $(SLO)$/ContextTables.obj \ diff --git a/xmlhelp/source/cxxhelp/util/makefile.mk b/xmlhelp/source/cxxhelp/util/makefile.mk index 33a564376ef1..63ea1c966dc6 100644 --- a/xmlhelp/source/cxxhelp/util/makefile.mk +++ b/xmlhelp/source/cxxhelp/util/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: abi $ $Date: 2001-06-13 16:26:36 $ +# last change: $Author: abi $ $Date: 2001-11-23 13:54:35 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -75,6 +75,9 @@ ENABLE_EXCEPTIONS=TRUE .IF "$(GUI)"=="WNT" CFLAGS+=/GR .ENDIF +.IF "$(COM)"=="GCC" +CFLAGSCXX+=-frtti +.ENDIF SLOFILES=\ $(SLO)$/Decompressor.obj \ -- cgit