Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index



From 3905c71ebeb7f1a0c5607c18a61abeb7c62574be Mon Sep 17 00:00:00 2001
From: Urmas <davian818@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


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.