sw/qa/core/data/rtf/pass/fdo79384.rtf          |    1 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 9428815bb8c4cf3bd67e8ac40781a59fc2161756
Author: Michael Stahl <mst...@redhat.com>
Date:   Tue Jun 3 19:32:10 2014 +0200

    fdo#79384: replace the work-around with a different one
    
    Word will reject Shift-JIS following \loch, but apparently OOo could read
    and (worse) write such documents, so accept Shift-JIS regardless of run
    charset type.
    
    (cherry picked from commit d71387ca81b61416b9a7b82cd6cf67d496b81fc2)
    
    Conflicts:
        writerfilter/source/rtftok/rtfdocumentimpl.cxx
    
    Change-Id: Ib181956e9f218548a52037dd76fa1d3ecdc006bd
    Reviewed-on: https://gerrit.libreoffice.org/9633
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/qa/core/data/rtf/pass/fdo79384.rtf 
b/sw/qa/core/data/rtf/pass/fdo79384.rtf
index 84875a9..c9d6b33 100644
--- a/sw/qa/core/data/rtf/pass/fdo79384.rtf
+++ b/sw/qa/core/data/rtf/pass/fdo79384.rtf
@@ -1,4 +1,5 @@
 {\rtf1
+{\fonttbl{\f5\fnil\fprq0\fcharset128 OpenSymbol;}}
 {\stylesheet
 {\*\cs35\snext35\hich\af5\dbch\af5\loch\f5 „M„p„‚„{„u„‚„ „ƒ„„y„ƒ„{„p;}
 }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9946de2..f1ac1d1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -940,11 +940,8 @@ int RTFDocumentImpl::resolveChars(char ch)
     bool bUnicodeChecked = false;
     bool bSkipped = false;
 
-    // Workaround for buggy input: if we're inside a style entry, then ignore
-    // the fact that '{' without a matching '}' is invalid.
-    bool bStyleEntry = m_aStates.top().nDestinationState == 
DESTINATION_STYLEENTRY;
-
-    while(!Strm().IsEof() && (m_aStates.top().nInternalState == INTERNAL_HEX 
|| ((ch != '{' || bStyleEntry) && 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))
         {
@@ -968,9 +965,12 @@ int RTFDocumentImpl::resolveChars(char ch)
         if (m_aStates.top().nInternalState == INTERNAL_HEX)
             break;
 
-        if (RTFParserState::DBCH == m_aStates.top().eRunType &&
-            RTL_TEXTENCODING_MS_932 == m_aStates.top().nCurrentEncoding)
+        if (RTL_TEXTENCODING_MS_932 == m_aStates.top().nCurrentEncoding)
         {
+            // fdo#79384: Word will reject Shift-JIS following \loch
+            // but apparently OOo could read and (worse) write such documents
+            SAL_INFO_IF(m_aStates.top().eRunType != RTFParserState::DBCH,
+                "writerfilter.rtftok", "invalid Shift-JIS without DBCH");
             unsigned char uch = ch;
             if ((uch >= 0x80 && uch <= 0x9F) || uch >= 0xE0)
             {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to