[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/filters/kword/rtf/import
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2005-11-28 19:09:18
Message-ID: 1133204958.551251.18750.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 483925 by rempt:

Tommi Rantala's rtf bug:

The KWord RTF import filter has some problems with hex values (e.g. \'2d), it
skips some bytes and can eat for example commands right after the hex value.
Here's a small patch that should fix this bug.



 M  +17 -16    rtfimport_tokenizer.cpp  


--- trunk/koffice/filters/kword/rtf/import/rtfimport_tokenizer.cpp #483924:483925
@@ -2,6 +2,7 @@
    This file is part of the KDE project
    Copyright (C) 2001 Ewald Snel <ewald@rambo.its.tudelft.nl>
    Copyright (C) 2001 Tomasz Grobelny <grotk@poczta.onet.pl>
+   Copyright (C) 2005 Tommi Rantala <tommi.rantala@cs.helsinki.fi>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -169,31 +170,31 @@
 	}
 	else if (ch=='\'')
 	{
+	    // Got hex value, for example \'2d
+
 	    type = RTFTokenizer::ControlWord;
 	    *_text++ = ch;
 
-            int n = nextChar();
-
-            if ( n <= 0 ) {
-                type = RTFTokenizer::CloseGroup;
-                return;
-            }
-	    ch = *fileBufferPtr++;
 	    for(int i=0;i<2;i++)
 	    {
+		int n = nextChar();
+
+		if ( n <= 0 ) {
+		    if ( i == 0 ) {
+		        type = RTFTokenizer::CloseGroup;
+		        return;
+		    } else {
+                        ch = ' ';
+			break;
+		    }
+		}
+
+		ch = n;
+
 		hasParam = true;
 		value<<=4;
 		value=value|((ch + ((ch & 16) ? 0 : 9)) & 0xf);
-
-                int n = nextChar();
-
-                if ( n <= 0 ) {
-                    ch = ' ';
-                    break;
-                }
-		ch = *fileBufferPtr++;
 	    }
-            --fileBufferPtr;
         }
 	else
 	{
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic