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


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1984

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/84/1984/1

fdo#59426: Don't try to repair package during flat detection phase.

Change-Id: I35968241a79db0aabe06e25c0efac2aa3d1c5b84
---
M comphelper/inc/comphelper/mediadescriptor.hxx
M comphelper/source/misc/mediadescriptor.cxx
M filter/source/config/cache/typedetection.cxx
M sc/source/ui/unoobj/scdetect.cxx
M sd/source/ui/unoidl/sddetect.cxx
M sw/source/ui/uno/swdetect.cxx
6 files changed, 33 insertions(+), 3 deletions(-)



diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx 
b/comphelper/inc/comphelper/mediadescriptor.hxx
index 53dcffc..8c55f85 100644
--- a/comphelper/inc/comphelper/mediadescriptor.hxx
+++ b/comphelper/inc/comphelper/mediadescriptor.hxx
@@ -94,6 +94,8 @@
         static const ::rtl::OUString& PROP_VIEWONLY();
         static const ::rtl::OUString& PROP_DOCUMENTBASEURL();
 
+        static const OUString& PROP_DEEPDETECTION();
+
     //-------------------------------------------
     // interface
     public:
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 1957ab6..ce1f3e9 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -296,6 +296,12 @@
     return sProp;
 }
 
+const OUString& MediaDescriptor::PROP_DEEPDETECTION()
+{
+    static const 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 0732f06..9eae711 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -305,6 +305,8 @@
             (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 c9d892f..44163a3 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -244,6 +244,7 @@
 
     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
@@ -300,6 +301,8 @@
             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
@@ -382,6 +385,10 @@
                     }
                     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
@@ -424,9 +431,8 @@
                         aTypeName.Erase();
                     }
 
-                       if ( aTypeName.Len() )
-                           pFilter = SfxFilterMatcher( rtl::OUString("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 0431e6e..4ff9a46 100644
--- a/sd/source/ui/unoidl/sddetect.cxx
+++ b/sd/source/ui/unoidl/sddetect.cxx
@@ -102,6 +102,7 @@
 
     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
@@ -152,6 +153,8 @@
             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
@@ -258,6 +261,10 @@
                         }
                         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 4ccf329..ba8fd2e 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -97,6 +97,7 @@
 
     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
@@ -151,6 +152,8 @@
             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;
@@ -239,6 +242,10 @@
                     }
                     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

-- 
To view, visit https://gerrit.libreoffice.org/1984
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I35968241a79db0aabe06e25c0efac2aa3d1c5b84
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Kohei Yoshida <kohei.yoshida@gmail.com>

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.