ooo-build r11602 - in trunk: . patches/src680



Author: thorstenb
Date: Mon Feb 18 00:22:43 2008
New Revision: 11602
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11602&view=rev

Log:
          patches/src680/oox-fasttokenizer-fix.diff: extracting fix from
          CWS xmlfilter03 that corrects FastTokenHandler::getIdentifier()
          behaviour.


Added:
   trunk/patches/src680/oox-fasttokenizer-fix.diff
Modified:
   trunk/ChangeLog
   trunk/patches/src680/apply

Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply	(original)
+++ trunk/patches/src680/apply	Mon Feb 18 00:22:43 2008
@@ -1612,6 +1612,7 @@
 win32-installer-register-moox-types.diff
 
 oox-depends-on-tools.diff, i#85614
+oox-fasttokenizer-fix.diff
 writerfilter-module-writer.diff
 
 [ OOXML < ooh680-m6 ]

Added: trunk/patches/src680/oox-fasttokenizer-fix.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/oox-fasttokenizer-fix.diff	Mon Feb 18 00:22:43 2008
@@ -0,0 +1,278 @@
+diff -uprN oox/inc/oox/core/CVS/Entries oox-new/inc/oox/core/CVS/Entries
+--- oox/inc/oox/core/CVS/Entries	2008-01-29 15:13:31.000000000 +0100
++++ oox-new/inc/oox/core/CVS/Entries	2008-02-18 00:00:55.000000000 +0100
+@@ -1,7 +1,6 @@
+ /binarycodec.hxx/1.2/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+ /binaryfilterbase.hxx/1.2/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+ /context.hxx/1.2/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+-/fasttokenhandler.hxx/1.2/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+ /filterbase.hxx/1.2/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+ /fragmenthandler.hxx/1.2.4.1/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+ /namespaces.hxx/1.2.4.2/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+@@ -11,4 +10,5 @@
+ /relationshandler.hxx/1.2/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+ /skipcontext.hxx/1.2/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
+ /xmlfilterbase.hxx/1.2.4.1/Tue Jan 29 14:13:31 2008//Tcws_src680_xmlfilter03
++/fasttokenhandler.hxx/1.2.4.1/Sun Feb 17 23:00:55 2008//Tcws_src680_xmlfilter03
+ D
+diff -uprN oox/inc/oox/core/CVS/Root oox-new/inc/oox/core/CVS/Root
+--- oox/inc/oox/core/CVS/Root	2008-01-29 15:57:54.000000000 +0100
++++ oox-new/inc/oox/core/CVS/Root	2008-02-18 00:00:52.000000000 +0100
+@@ -1 +1 @@
+-:pserver:fridrich_strba localhost:/cvs
++:pserver:thb localhost:/cvs
+diff -uprN oox/inc/oox/core/fasttokenhandler.hxx oox-new/inc/oox/core/fasttokenhandler.hxx
+--- oox/inc/oox/core/fasttokenhandler.hxx	2008-01-29 15:13:31.000000000 +0100
++++ oox-new/inc/oox/core/fasttokenhandler.hxx	2008-02-18 00:00:55.000000000 +0100
+@@ -4,9 +4,9 @@
+  *
+  *  $RCSfile: fasttokenhandler.hxx,v $
+  *
+- *  $Revision: 1.2 $
++ *  $Revision: 1.2.4.1 $
+  *
+- *  last change: $Author: rt $ $Date: 2008/01/17 08:05:44 $
++ *  last change: $Author: dr $ $Date: 2008/02/15 12:56:11 $
+  *
+  *  The Contents of this file are made available subject to
+  *  the terms of GNU Lesser General Public License Version 2.1.
+@@ -44,6 +44,9 @@ namespace oox {
+ class FastTokenHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastTokenHandler >
+ {
+ public:
++    explicit            FastTokenHandler();
++    virtual             ~FastTokenHandler();
++
+     virtual ::sal_Int32 SAL_CALL getToken( const ::rtl::OUString& Identifier ) throw (::com::sun::star::uno::RuntimeException);
+     virtual ::rtl::OUString SAL_CALL getIdentifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
+     virtual ::sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
+diff -uprN oox/source/token/CVS/Entries oox-new/source/token/CVS/Entries
+--- oox/source/token/CVS/Entries	2008-01-29 15:13:53.000000000 +0100
++++ oox-new/source/token/CVS/Entries	2008-02-18 00:00:17.000000000 +0100
+@@ -1,6 +1,6 @@
+-/gentoken.pl/1.2.4.1/Tue Jan 29 14:13:34 2008//Tcws_src680_xmlfilter03
+ /parsexsd.pl/1.2/Tue Jan 29 14:13:34 2008//Tcws_src680_xmlfilter03
+-/tokenmap.cxx/1.2.4.1/Tue Jan 29 14:13:34 2008//Tcws_src680_xmlfilter03
+-/tokens.txt/1.2.4.2/Tue Jan 29 14:13:34 2008//Tcws_src680_xmlfilter03
+-/makefile.mk/1.2.4.1/Tue Jan 29 14:13:34 2008//Tcws_src680_xmlfilter03
++/gentoken.pl/1.2.4.2/Sun Feb 17 23:00:17 2008//Tcws_src680_xmlfilter03
++/makefile.mk/1.2.4.2/Sun Feb 17 23:00:17 2008//Tcws_src680_xmlfilter03
++/tokenmap.cxx/1.2.4.2/Sun Feb 17 23:00:17 2008//Tcws_src680_xmlfilter03
++/tokens.txt/1.2.4.3/Sun Feb 17 23:00:17 2008//Tcws_src680_xmlfilter03
+ D
+diff -uprN oox/source/token/CVS/Root oox-new/source/token/CVS/Root
+--- oox/source/token/CVS/Root	2008-01-29 15:57:55.000000000 +0100
++++ oox-new/source/token/CVS/Root	2008-02-18 00:00:11.000000000 +0100
+@@ -1 +1 @@
+-:pserver:fridrich_strba localhost:/cvs
++:pserver:thb localhost:/cvs
+diff -uprN oox/source/token/gentoken.pl oox-new/source/token/gentoken.pl
+--- oox/source/token/gentoken.pl	2008-01-29 15:13:34.000000000 +0100
++++ oox-new/source/token/gentoken.pl	2008-02-18 00:00:17.000000000 +0100
+@@ -1,53 +1,60 @@
+ $ARGV0 = shift @ARGV;
+ $ARGV1 = shift @ARGV;
+ $ARGV2 = shift @ARGV;
++$ARGV3 = shift @ARGV;
+ 
+ open ( TOKENS, $ARGV0 ) || die "can't open token file: $!";
+ my %tokens;
+ 
+-while ( defined ($line = <TOKENS>) )
++while ( <TOKENS> )
+ {
+-	chomp($line);
+-	@token = split(/\s+/,$line);
+-	if ( not defined ($token[1]) )
+-	{
+-		$token[1] = "XML_".$token[0];
+-		$token[1] =~ tr/\-\.\:/___/;
+-		$token[1] =~ s/\+/PLUS/g;
+-		$token[1] =~ s/\-/MINUS/g;
+-	}
+-
+-	$tokens{$token[0]} = $token[1];
++    chomp( $_ );
++    $_ =~ s/\s*//g;
++    $_ =~ /^[a-zA-Z0-9-_]+$/ or die "invalid character in token '$_'";
++    $id = "XML_$_";
++    $id =~ s/-/_/g;
++    $tokens{$_} = $id;
+ }
+ close ( TOKENS );
+ 
+-open ( HXX, ">$ARGV1" ) || die "can't open tokens.hxx file: $!";
+-open ( GPERF, ">$ARGV2" ) || die "can't open tokens.gperf file: $!";
++open ( HXX, ">$ARGV1" ) or die "can't open tokens.hxx file: $!";
++open ( WORDS, ">$ARGV2" ) or die "can't open tokenwords.inl file: $!";
++open ( GPERF, ">$ARGV3" ) or die "can't open tokens.gperf file: $!";
++
++print ( HXX "#ifndef OOX_TOKENS_HXX\n" );
++print ( HXX "#define OOX_TOKENS_HXX\n\n" );
++print ( HXX "#include <sal/types.h>\n" );
++
++print ( WORDS "static const sal_Char* tokentowordlist[] = {\n" );
+ 
+ print ( GPERF "%language=C++\n" );
+ print ( GPERF "%global-table\n" );
+ print ( GPERF "%null-strings\n" );
+ print ( GPERF "%struct-type\n" );
+-print ( GPERF "struct xmltoken\n" );
+-print ( GPERF "{\n" );
+-print ( GPERF "  const sal_Char *name; sal_Int32 nToken; \n" );
++print ( GPERF "struct xmltoken {\n" );
++print ( GPERF "    const sal_Char *name;\n" );
++print ( GPERF "    sal_Int32 nToken;\n" );
+ print ( GPERF "};\n" );
+ print ( GPERF "%%\n" );
+ 
+-print ( HXX "#ifndef OOX_TOKENS_HXX\n" );
+-print ( HXX "#define OOX_TOKENS_HXX\n\n" );
+-print ( HXX "#include <sal/types.h>\n" );
+-
+ $i = 0;
+-foreach( sort(keys(%tokens)) )
++foreach( sort( keys( %tokens ) ) )
+ {
+-	print( HXX "const sal_Int32 $tokens{$_} = $i;\n" );
+-	print( GPERF "$_,$tokens{$_}\n" );
+-	$i = $i + 1;
++    print ( HXX "const sal_Int32 $tokens{$_} = $i;\n" );
++    print ( WORDS "    \"$_\",\n" );
++    print ( GPERF "$_,$tokens{$_}\n" );
++    ++$i;
+ }
+-print ( GPERF "%%\n" );
++
+ print ( HXX "const sal_Int32 XML_TOKEN_COUNT = $i;\n" );
+ print ( HXX "const sal_Int32 XML_TOKEN_INVALID = -1;\n\n" );
+ print ( HXX "#endif\n" );
++
++print ( WORDS "    \"\"\n" );
++print ( WORDS "};\n" );
++
++print ( GPERF "%%\n" );
++
+ close ( HXX );
++close ( WORDS );
+ close ( GPERF );
+diff -uprN oox/source/token/makefile.mk oox-new/source/token/makefile.mk
+--- oox/source/token/makefile.mk	2008-01-29 15:13:34.000000000 +0100
++++ oox-new/source/token/makefile.mk	2008-02-18 00:00:17.000000000 +0100
+@@ -4,9 +4,9 @@
+ #
+ #   $RCSfile: makefile.mk,v $
+ #
+-#   $Revision: 1.2.4.1 $
++#   $Revision: 1.2.4.2 $
+ #
+-#   last change: $Author: fridrich_strba $ $Date: 2008/01/23 13:35:11 $
++#   last change: $Author: dr $ $Date: 2008/02/15 12:56:35 $
+ #
+ #   The Contents of this file are made available subject to
+ #   the terms of GNU Lesser General Public License Version 2.1.
+@@ -54,12 +54,12 @@ SLOFILES =	\
+ 
+ .INCLUDE :  target.mk
+ 
+-$(INCCOM)$/tokens.hxx $(MISC)$/tokens.gperf : tokens.txt gentoken.pl
+-		$(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(MISC)$/tokens.gperf
++$(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf : tokens.txt gentoken.pl
++		$(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf
+ 
+-$(INCCOM)$/tokens.cxx : $(MISC)$/tokens.gperf
+-		gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" >$(INCCOM)$/tokens.cxx
++$(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf
++		gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" >$(INCCOM)$/tokens.inc
+ 
+-$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.cxx $(INCCOM)$/tokens.hxx
++$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx
+ 
+ $(INCCOM)$/tokens.gperf : $(INCCOM)$/tokens.hxx
+diff -uprN oox/source/token/tokenmap.cxx oox-new/source/token/tokenmap.cxx
+--- oox/source/token/tokenmap.cxx	2008-01-29 15:13:34.000000000 +0100
++++ oox-new/source/token/tokenmap.cxx	2008-02-18 00:00:17.000000000 +0100
+@@ -4,9 +4,9 @@
+  *
+  *  $RCSfile: tokenmap.cxx,v $
+  *
+- *  $Revision: 1.2.4.1 $
++ *  $Revision: 1.2.4.2 $
+  *
+- *  last change: $Author: dr $ $Date: 2008/01/28 14:33:25 $
++ *  last change: $Author: dr $ $Date: 2008/02/15 12:56:35 $
+  *
+  *  The Contents of this file are made available subject to
+  *  the terms of GNU Lesser General Public License Version 2.1.
+@@ -35,11 +35,13 @@
+ 
+ #include <string.h>
+ #include <osl/mutex.hxx>
++#include <rtl/strbuf.hxx>
+ #include <com/sun/star/xml/sax/FastToken.hpp>
+ #include "oox/core/fasttokenhandler.hxx"
+ #include "tokens.hxx"
+ 
+ using ::rtl::OString;
++using ::rtl::OStringBuffer;
+ using ::rtl::OUString;
+ using ::rtl::OUStringToOString;
+ using ::osl::Mutex;
+@@ -50,7 +52,8 @@ using ::com::sun::star::xml::sax::FastTo
+ 
+ namespace oox {
+ 
+-#include "tokens.cxx"
++#include "tokens.inc"
++#include "tokenwords.inc"
+ 
+ // ============================================================================
+ 
+@@ -66,6 +69,27 @@ Mutex& lclGetTokenMutex()
+ 
+ // ============================================================================
+ 
++FastTokenHandler::FastTokenHandler()
++{
++#if OSL_DEBUG_LEVEL > 0
++    MutexGuard aGuard( lclGetTokenMutex() );
++    bool bOk = true;
++    for( sal_Int32 nIdx = 0; bOk && (nIdx < XML_TOKEN_COUNT); ++nIdx )
++    {
++        // check that the getIdentifier <-> getToken roundtrip works
++        OUString aToken = getIdentifier( nIdx );
++        bOk = getToken( aToken ) == nIdx;
++        OSL_ENSURE( bOk, OStringBuffer( "FastTokenHandler::FastTokenHandler - token list broken, #" ).
++            append( nIdx ).append( ", '" ).
++            append( OUStringToOString( aToken, RTL_TEXTENCODING_ASCII_US ) ).append( '\'' ).getStr() );
++    }
++#endif
++}
++
++FastTokenHandler::~FastTokenHandler()
++{
++}
++
+ sal_Int32 FastTokenHandler::getToken( const OUString& rIdentifier ) throw( RuntimeException )
+ {
+     MutexGuard aGuard( lclGetTokenMutex() );
+@@ -86,7 +110,7 @@ OUString FastTokenHandler::getIdentifier
+ 	static OUString aTokens[XML_TOKEN_COUNT];
+ 
+ 	if( aTokens[nToken].getLength() == 0 )
+-        aTokens[nToken] = OUString::createFromAscii( wordlist[nToken].name );
++        aTokens[nToken] = OUString::createFromAscii( tokentowordlist[nToken] );
+ 
+ 	return aTokens[nToken];
+ }
+diff -uprN oox/source/token/tokens.txt oox-new/source/token/tokens.txt
+--- oox/source/token/tokens.txt	2008-01-29 15:13:34.000000000 +0100
++++ oox-new/source/token/tokens.txt	2008-02-18 00:00:17.000000000 +0100
+@@ -2963,7 +2963,6 @@ linen
+ lines
+ linesAndChars
+ linestyle
+-lineStyleLst
+ link
+ linkStyles
+ linkTarget



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]