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


Hi there,

I'd like to have the attached patch pushed to the 3-5 branch and
preferably to the 3-5-0 branch as well.

It fixes 

https://bugs.freedesktop.org/show_bug.cgi?id=45084

I haven't committed this yet to master, since I wanted to have someone
else's opinion first.  To the best of my knowledge this change makes
sense.  Why clear the type and filter just because one of the type
detections fail?

*But*, since this type detection code is incredibly complex, not to
mention for the HTML type, in particular, there are multiple type
detection services involved with some sort of special handling (html
disguided as xls by virtue of the extension is just one of those special
cases), it's possible that in some dark weird corners it may do some
totally unexpected, surprising things.  But I hope not.

Anyhow, review and sign-off appreciated if appropriate.  If not,
suggestions welcome.

Oh, BTW, I've already tested the case of opening an html file having a
xls extension.  It still works after my change.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
From 8bedc07d832aa45ef1cf809132507002ee967937 Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@suse.com>
Date: Fri, 27 Jan 2012 16:55:09 -0500
Subject: [PATCH] fdo#45084: Don't clear type and filter on every deep detection failure.

Because pre-selected filter is stored in the media descriptor, clearing
it every time a deep detection fails (which is bound to happen at least
once or twice during each type detection run) is probably not a good
idea.  Pre-selected filter data is used after all possible deep detection
runs are performed.
---
 filter/source/config/cache/typedetection.cxx |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/filter/source/config/cache/typedetection.cxx 
b/filter/source/config/cache/typedetection.cxx
index 7a5ec96..e34fc0b 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -1050,6 +1050,9 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& 
rDescript
     // b) returned type is unknown  => return "" too and remove TYPE/FILTER prop from descriptor
     // c) returned type is valid    => check TYPE/FILTER props inside descriptor and return the 
type
 
+    if (sDeepType.isEmpty())
+        return rtl::OUString();
+
     // this special helper checks for a valid type
     // and set right values on the descriptor!
     sal_Bool bValidType = impl_validateAndSetTypeOnDescriptor(rDescriptor, sDeepType);
-- 
1.7.3.4


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.