[Libreoffice-commits] core.git: Branch 'distro/suse/suse-3.6' - comphelper/inc comphelper/source filter/source sc/source sd/source sw/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue Feb 5 06:38:26 PST 2013


 comphelper/inc/comphelper/mediadescriptor.hxx |    2 ++
 comphelper/source/misc/mediadescriptor.cxx    |    9 ++++++---
 filter/source/config/cache/typedetection.cxx  |    2 ++
 sc/source/ui/unoobj/scdetect.cxx              |   12 +++++++++---
 sd/source/ui/unoidl/sddetect.cxx              |    7 +++++++
 sw/source/ui/uno/swdetect.cxx                 |    7 +++++++
 6 files changed, 33 insertions(+), 6 deletions(-)

New commits:
commit 278b3534e3aa27b92f7d681f086cb071df75bffd
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Feb 4 14:14:15 2013 -0500

    fdo#59426: Don't try to repair package during flat detection phase.
    
    Conflicts:
    	comphelper/source/misc/mediadescriptor.cxx
    	sc/source/ui/unoobj/scdetect.cxx
    
    Change-Id: I35968241a79db0aabe06e25c0efac2aa3d1c5b84

diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx
index 55b89a2..b8278a8 100644
--- a/comphelper/inc/comphelper/mediadescriptor.hxx
+++ b/comphelper/inc/comphelper/mediadescriptor.hxx
@@ -113,6 +113,8 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
         static const ::rtl::OUString& PROP_VIEWONLY();
         static const ::rtl::OUString& PROP_DOCUMENTBASEURL();
 
+        static const rtl::OUString& PROP_DEEPDETECTION();
+
     //-------------------------------------------
     // interface
     public:
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 544d4e5..e87a4e3 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -306,9 +306,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTBASEURL()
     return sProp;
 }
 
-/*-----------------------------------------------
-    10.03.2004 08:09
------------------------------------------------*/
+const rtl::OUString& MediaDescriptor::PROP_DEEPDETECTION()
+{
+    static const rtl::OUString aProp("DeepDetection");
+    return aProp;
+}
+
 MediaDescriptor::MediaDescriptor()
     : SequenceAsHashMap()
 {
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 49e5e24..f76965b 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -318,6 +318,8 @@ struct EqualByName : public std::binary_function<FlatDetectionInfo, FlatDetectio
             (bAllowDeep        )
            )
         {
+            // Let's the detection service know we are in a deep detection phase.
+            stlDescriptor[comphelper::MediaDescriptor::PROP_DEEPDETECTION()] <<= sal_True;
             sType = impl_detectTypeDeepOnly(stlDescriptor, lUsedDetectors);
         }
 
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 43d0bb5..d07735f 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -254,6 +254,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
 
     sal_Bool bRepairPackage = false;
     sal_Bool bRepairAllowed = 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
@@ -310,6 +311,8 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
             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
@@ -392,6 +395,10 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
                     }
                     catch( const lang::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
@@ -434,9 +441,8 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
                         aTypeName.Erase();
                     }
 
-                       if ( aTypeName.Len() )
-                           pFilter = SfxFilterMatcher( String::CreateFromAscii("scalc") ).GetFilter4EA( aTypeName );
-
+                    if ( aTypeName.Len() )
+                        pFilter = SfxFilterMatcher( rtl::OUString("scalc") ).GetFilter4EA( aTypeName );
                 }
             }
             else
diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx
index ba0fd11..1a5da08 100644
--- a/sd/source/ui/unoidl/sddetect.cxx
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -112,6 +112,7 @@ SdFilterDetect::~SdFilterDetect()
 
     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
@@ -162,6 +163,8 @@ SdFilterDetect::~SdFilterDetect()
             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
@@ -268,6 +271,10 @@ SdFilterDetect::~SdFilterDetect()
                         }
                         catch( const lang::WrappedTargetException& aWrap )
                         {
+                            if (!bDeepDetection)
+                                // Bail out early unless it's a deep detection.
+                                return OUString();
+
                             packages::zip::ZipIOException aZipException;
                             if ( ( aWrap.TargetException >>= aZipException ) && aTypeName.Len() )
                             {
diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index 7fec1f5..caac2d5 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -107,6 +107,7 @@ SwFilterDetect::~SwFilterDetect()
 
     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
@@ -161,6 +162,8 @@ SwFilterDetect::~SwFilterDetect()
             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>();
     }
 
     SolarMutexGuard aGuard;
@@ -249,6 +252,10 @@ SwFilterDetect::~SwFilterDetect()
                     }
                     catch (const lang::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