[tracker] tracker-extract-msoffice-xml: Time limit extraction to 5s
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-extract-msoffice-xml: Time limit extraction to 5s
- Date: Thu, 31 Mar 2011 12:25:02 +0000 (UTC)
commit dc8275f6ca3942f426904e80e74d043d583b914d
Author: Jürg Billeter <j bitron ch>
Date: Thu Mar 31 14:22:43 2011 +0200
tracker-extract-msoffice-xml: Time limit extraction to 5s
Based on patch by Lassi Nieminen.
Fixes GB#645380.
Fixes NB#235445.
src/tracker-extract/tracker-extract-msoffice-xml.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-msoffice-xml.c b/src/tracker-extract/tracker-extract-msoffice-xml.c
index c574090..5c2ef81 100644
--- a/src/tracker-extract/tracker-extract-msoffice-xml.c
+++ b/src/tracker-extract/tracker-extract-msoffice-xml.c
@@ -88,6 +88,8 @@ typedef struct {
gulong bytes_pending;
gboolean style_element_present;
gboolean preserve_attribute_present;
+ GTimer *timer;
+ gboolean limit_reached;
} MsOfficeXMLParserInfo;
static void msoffice_xml_content_parse_start (GMarkupParseContext *context,
@@ -644,8 +646,17 @@ msoffice_xml_content_types_parse_start (GMarkupParseContext *context,
g_ascii_strcasecmp (content_type, "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml") == 0))) {
/* If reached max bytes to extract, don't event start parsing the file... just return */
if (info->bytes_pending == 0) {
- g_debug ("Skipping '%s' as already reached max bytes to extract",
- part_name + 1);
+ if (!info->limit_reached) {
+ g_debug ("Skipping '%s' as already reached max bytes to extract",
+ part_name + 1);
+ info->limit_reached = TRUE;
+ }
+ } else if (g_timer_elapsed (info->timer, NULL) > 5) {
+ if (!info->limit_reached) {
+ g_debug ("Skipping '%s' as already reached max time to extract",
+ part_name + 1);
+ info->limit_reached = TRUE;
+ }
} else {
xml_read (info, part_name + 1, MS_OFFICE_XML_TAG_DOCUMENT_TEXT_DATA);
}
@@ -752,6 +763,8 @@ tracker_extract_get_metadata (const gchar *uri,
&info,
NULL);
+ info.limit_reached = FALSE;
+ info.timer = g_timer_new ();
/* Load the internal XML file from the Zip archive, and parse it
* using the given context */
tracker_gsf_parse_xml_in_zip (uri,
@@ -778,6 +791,7 @@ tracker_extract_get_metadata (const gchar *uri,
}
}
+ g_timer_destroy (info.timer);
g_markup_parse_context_free (context);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]