>From 3905c71ebeb7f1a0c5607c18a61abeb7c62574be Mon Sep 17 00:00:00 2001
From: Urmas <davian...@gmail.com>
Date: Sun, 26 May 2013 02:06:22 +0700
Subject: [PATCH] fdo#64671 Some special RTF characters were not skipped
 correctly

Some special characters, like { and }, were not skipped when they
occured as a replacement character for \uN keyword.

Change-Id: I54c5ee67179f927f70fc7cac1b3f896017077d62
---
 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a5e3f75..07070a4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -887,9 +887,10 @@ int RTFDocumentImpl::resolveChars(char ch)
 
     bool bUnicodeChecked = false;
     bool bSkipped = false;
-    while(!Strm().IsEof() && ch != '{' && ch != '}' && ch != '\\')
+    bool bHex = (m_aStates.top().nInternalState == INTERNAL_HEX);
+    while(bHex || !Strm().IsEof() && ch != '{' && ch != '}' && ch != '\\')
     {
-        if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d && ch != 0x0a))
+        if (bHex || (ch != 0x0d && ch != 0x0a))
         {
             if (m_aStates.top().nCharsToSkip == 0)
             {
@@ -907,7 +908,7 @@ int RTFDocumentImpl::resolveChars(char ch)
             }
         }
         // read a single char if we're in hex mode
-        if (m_aStates.top().nInternalState == INTERNAL_HEX)
+        if (bHex)
             break;
         Strm() >> ch;
     }
@@ -1714,6 +1715,11 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
     }
     if (cCh > 0)
     {
+        if (m_aStates.top().nCharsToSkip > 0)
+        {
+            m_aStates.top().nCharsToSkip--;
+            return 0;
+        }
         OUString aStr(OStringToOUString(OString(cCh), RTL_TEXTENCODING_MS_1252));
         text(aStr);
         return 0;
-- 
1.8.1.2

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to