[Libreoffice-commits] core.git: 2 commits - starmath/source sw/source

Fridrich Å trba fridrich.strba at bluewin.ch
Wed Jul 3 08:15:29 PDT 2013


 starmath/source/smdetect.cxx  |    7 +++++++
 sw/source/ui/uno/swdetect.cxx |    8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 36c64c875f5819bf5ada2bb657c490441bc24644
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Wed Jul 3 17:14:32 2013 +0200

    Ugly workaround for historic sxw files produced once by libwpd/wpd2sxw
    
    Change-Id: I2d22c12896b241d79ded723acb0a6753cc1468ee

diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index fd23917..5c3d987 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -116,7 +116,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
             lDescriptor[nProperty].Value >>= sTemp;
             aURL = sTemp;
         }
-        else if( !aURL.Len() && lDescriptor[nProperty].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FileName")) )
+        else if( !aURL.Len() && lDescriptor[nProperty].Name == "FileName" )
         {
             lDescriptor[nProperty].Value >>= sTemp;
             aURL = sTemp;
@@ -241,7 +241,11 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
                     }
                     catch (const WrappedTargetException& aWrap)
                     {
-                        if (!bDeepDetection)
+                        /* Cater for non-compliant sxw files created once upon a time by old libwpd/wpd2sxw combo
+                           Don't bail-out early if the document is considered as corrupted. This allows us not to
+                           reach the -- apparently -- catch-all SmFilterDetect::detect.
+                         */
+                        if (!bDeepDetection && aTypeName != "writer_StarOffice_XML_Writer")
                             // Bail out early unless it's a deep detection.
                             return OUString();
 
commit 9a9b8f0b34bc647a923fc7e79d8b5f61535c1f7b
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Wed Jul 3 17:09:02 2013 +0200

    Bail early the same way as in 709f6ba6a
    
    Change-Id: I8447d776ba315db5ef961818bc577d13e4f35a20

diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index 39b67b7..d82fa03 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -95,6 +95,7 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
 
     sal_Bool bRepairPackage = sal_False;
     sal_Bool bRepairAllowed = sal_False;
+    bool bDeepDetection = false;
 
     // now some parameters that can already be in the array, but may be overwritten or new inserted here
     // remember their indices in the case new values must be added to the array
@@ -145,6 +146,8 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
             lDescriptor[nProperty].Value >>= bRepairPackage;
         else if( lDescriptor[nProperty].Name == "DocumentTitle" )
             nIndexOfDocumentTitle = nProperty;
+        else if (lDescriptor[nProperty].Name == "DeepDetection")
+            bDeepDetection = lDescriptor[nProperty].Value.get<sal_Bool>();
     }
 
     // can't check the type for external filters, so set the "dont" flag accordingly
@@ -230,6 +233,10 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
                     }
                     catch( const WrappedTargetException& aWrap )
                     {
+                        if (!bDeepDetection)
+                            // Bail out early unless it's a deep detection.
+                            return OUString();
+
                         packages::zip::ZipIOException aZipException;
 
                         // repairing is done only if this type is requested from outside


More information about the Libreoffice-commits mailing list