diff options
Diffstat (limited to 'src/plugins/ole2_extractor.c')
-rw-r--r-- | src/plugins/ole2_extractor.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/plugins/ole2_extractor.c b/src/plugins/ole2_extractor.c index ccfc3cb..4b14256 100644 --- a/src/plugins/ole2_extractor.c +++ b/src/plugins/ole2_extractor.c | |||
@@ -21,8 +21,7 @@ | |||
21 | -- the Gnome Structured File Library | 21 | -- the Gnome Structured File Library |
22 | Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) | 22 | Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) |
23 | 23 | ||
24 | Part of this code was borrowed from wordleaker.cpp. See also | 24 | Part of this code was adapted from wordleaker. |
25 | the README file in this directory. | ||
26 | */ | 25 | */ |
27 | /** | 26 | /** |
28 | * @file plugins/ole2_extractor.c | 27 | * @file plugins/ole2_extractor.c |
@@ -67,10 +66,13 @@ | |||
67 | */ | 66 | */ |
68 | static int | 67 | static int |
69 | add_metadata (EXTRACTOR_MetaDataProcessor proc, | 68 | add_metadata (EXTRACTOR_MetaDataProcessor proc, |
70 | void *proc_cls, | 69 | void *proc_cls, |
71 | const char *phrase, | 70 | const char *phrase, |
72 | enum EXTRACTOR_MetaType type) | 71 | enum EXTRACTOR_MetaType type) |
73 | { | 72 | { |
73 | char *tmp; | ||
74 | int ret; | ||
75 | |||
74 | if (0 == strlen (phrase)) | 76 | if (0 == strlen (phrase)) |
75 | return 0; | 77 | return 0; |
76 | if (0 == strcmp (phrase, "\"\"")) | 78 | if (0 == strcmp (phrase, "\"\"")) |
@@ -79,13 +81,21 @@ add_metadata (EXTRACTOR_MetaDataProcessor proc, | |||
79 | return 0; | 81 | return 0; |
80 | if (0 == strcmp (phrase, " ")) | 82 | if (0 == strcmp (phrase, " ")) |
81 | return 0; | 83 | return 0; |
82 | return proc (proc_cls, | 84 | if (NULL == (tmp = strdup (phrase))) |
83 | "ole2", | 85 | return 0; |
84 | type, | 86 | |
85 | EXTRACTOR_METAFORMAT_UTF8, | 87 | while ( (strlen (tmp) > 0) && |
86 | "text/plain", | 88 | (isblank ((unsigned char) tmp [strlen (tmp) - 1])) ) |
87 | phrase, | 89 | tmp [strlen (tmp) - 1] = '\0'; |
88 | strlen (phrase) +1); | 90 | ret = proc (proc_cls, |
91 | "ole2", | ||
92 | type, | ||
93 | EXTRACTOR_METAFORMAT_UTF8, | ||
94 | "text/plain", | ||
95 | tmp, | ||
96 | strlen (tmp) + 1); | ||
97 | free (tmp); | ||
98 | return ret; | ||
89 | } | 99 | } |
90 | 100 | ||
91 | 101 | ||
@@ -212,9 +222,6 @@ process_metadata (gpointer key, | |||
212 | } | 222 | } |
213 | if (NULL == contents) | 223 | if (NULL == contents) |
214 | return; | 224 | return; |
215 | if ( (strlen (contents) > 0) && | ||
216 | ('\n' == contents[strlen (contents) - 1]) ) | ||
217 | contents [strlen (contents) - 1] = '\0'; | ||
218 | if (0 == strcmp (type, "meta:generator")) | 225 | if (0 == strcmp (type, "meta:generator")) |
219 | { | 226 | { |
220 | const char *mimetype = "application/vnd.ms-files"; | 227 | const char *mimetype = "application/vnd.ms-files"; |