[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source

Urmas davian818 at gmail.com
Thu May 30 14:02:45 PDT 2013


 sw/qa/extras/rtfimport/data/fdo64671.rtf       |    3 +++
 sw/qa/extras/rtfimport/rtfimport.cxx           |    8 ++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 4f5f14320b61bea61c73699a42030e8aa5960c80
Author: Urmas <davian818 at gmail.com>
Date:   Mon May 27 09:49:55 2013 +0200

    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.
    
    (cherry picked from commits bfb93ffc6d72d22a833acf9d8c9d166153dad7c0 and
    ec8e012e980c88c8f24a7de44e44d0319bae2801)
    
    Conflicts:
    	sw/qa/extras/rtfimport/rtfimport.cxx
    
    Change-Id: I19b66a290cd9880924774fa89bb29df280e44a3c
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sw/qa/extras/rtfimport/data/fdo64671.rtf b/sw/qa/extras/rtfimport/data/fdo64671.rtf
new file mode 100644
index 0000000..385dca4
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo64671.rtf
@@ -0,0 +1,3 @@
+{\rtf1
+\u381\'7d
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index e31fa98..3a41731 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -148,6 +148,7 @@ public:
     void testFdo61193();
     void testFdo63023();
     void testN818997();
+    void testFdo64671();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -266,6 +267,7 @@ void Test::run()
         {"hello.rtf", &Test::testFdo61193},
         {"fdo63023.rtf", &Test::testFdo63023},
         {"n818997.rtf", &Test::testN818997},
+        {"fdo64671.rtf", &Test::testFdo64671},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1222,6 +1224,12 @@ void Test::testN818997()
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+void Test::testFdo64671()
+{
+    // Additional '}' was inserted before the special character.
+    getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 15ff924..951adc4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -880,7 +880,7 @@ int RTFDocumentImpl::resolveChars(char ch)
 
     bool bUnicodeChecked = false;
     bool bSkipped = false;
-    while(!Strm().IsEof() && ch != '{' && ch != '}' && ch != '\\')
+    while(!Strm().IsEof() && (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != '{' && ch != '}' && ch != '\\')))
     {
         if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d && ch != 0x0a))
         {


More information about the Libreoffice-commits mailing list