commit 273918eeac851a18e00dcd37cccf02e6911006c3
parent 0ba7a8ea930fd8b0cd137d8529e53fce610c0475
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 13 Aug 2005 07:00:05 +0000
fix
Diffstat:
7 files changed, 68 insertions(+), 6 deletions(-)
diff --git a/AUTHORS b/AUTHORS
@@ -38,6 +38,7 @@ Blake Matheny <bmatheny@mobocracy.net>
Bruno Haible <bruno@clisp.org>
Nils Durner <n.durner@t-online.de>
Heiko Wundram <modelnine@ceosg.de>
+Ronan MELENNEC <ronan.melennec@cena.fr>
Translations:
German - Karl Eichwalder <ke@gnu.franken.de>
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Aug 12 23:53:54 PDT 2005
+ Fixed bug in OO extractor that made it not work.
+ Fixed bug in exiv2 extractor that killed keywords
+ found by other extractors.
+ Improved OO extractor mime-type detection.
+
Mon Aug 8 12:18:44 PDT 2005
Somehow addKeyword2 got lost. Added (again?).
Fixed compilation problems with gcc-2.95.
diff --git a/src/include/extractor.h b/src/include/extractor.h
@@ -29,7 +29,7 @@ extern "C" {
* 0.2.6-1 => 0x00020601
* 4.5.2-0 => 0x04050200
*/
-#define EXTRACTOR_VERSION 0x00050201
+#define EXTRACTOR_VERSION 0x00050202
#include <stdio.h>
@@ -205,7 +205,7 @@ EXTRACTOR_ExtractorList * EXTRACTOR_loadDefaultLibraries(void);
* @return NULL if the type is not known
*/
const char *
-EXTRACTOR_getKeywordTypeAsString(const EXTRACTOR_KeywordType type);
+EXTRACTOR_getKeywordTypeAsString(EXTRACTOR_KeywordType type);
/**
* Return the highest type number, exclusive as in [0,highest).
@@ -304,7 +304,7 @@ EXTRACTOR_getKeywords2(EXTRACTOR_ExtractorList * extractor,
*/
EXTRACTOR_KeywordList *
EXTRACTOR_removeDuplicateKeywords(EXTRACTOR_KeywordList * list,
- const unsigned int options);
+ unsigned int options);
/**
@@ -314,6 +314,16 @@ EXTRACTOR_removeDuplicateKeywords(EXTRACTOR_KeywordList * list,
*/
EXTRACTOR_KeywordList *
EXTRACTOR_removeEmptyKeywords (EXTRACTOR_KeywordList * list);
+
+/**
+ * Remove keywords of a particular type from the list.
+ * @param list the original keyword list (altered in the process!)
+ * @param type the type to remove
+ * @return a list of keywords without entries of given type
+ */
+EXTRACTOR_KeywordList *
+EXTRACTOR_removeKeywordsOfType(EXTRACTOR_KeywordList * list,
+ EXTRACTOR_KeywordType type);
/**
* Print a keyword list to a file.
@@ -340,7 +350,7 @@ void EXTRACTOR_freeKeywords(EXTRACTOR_KeywordList * keywords);
* not be freed or manipulated by the client. It will become
* invalid once the keyword list is freed.
*/
-const char * EXTRACTOR_extractLast(const EXTRACTOR_KeywordType type,
+const char * EXTRACTOR_extractLast(EXTRACTOR_KeywordType type,
EXTRACTOR_KeywordList * keywords);
/**
diff --git a/src/main/extractor.c b/src/main/extractor.c
@@ -807,6 +807,39 @@ EXTRACTOR_removeEmptyKeywords (EXTRACTOR_KeywordList * list)
return list;
}
+/**
+ * Remove keywords of a particular type from the list.
+ * @param list the original keyword list (altered in the process!)
+ * @param type the type to remove
+ * @return a list of keywords without entries of given type
+ */
+EXTRACTOR_KeywordList *
+EXTRACTOR_removeKeywordsOfType(EXTRACTOR_KeywordList * list,
+ EXTRACTOR_KeywordType type) {
+ EXTRACTOR_KeywordList * pos;
+ EXTRACTOR_KeywordList * last;
+
+ last = NULL;
+ pos = list;
+ while (pos != NULL) {
+ if (pos->keywordType == type) {
+ EXTRACTOR_KeywordList * next;
+ next = pos->next;
+ if (last == NULL)
+ list = next;
+ else
+ last->next = next;
+ free(pos->keyword);
+ free(pos);
+ pos = next;
+ } else {
+ last = pos;
+ pos = pos->next;
+ }
+ }
+ return list;
+}
+
#include "iconv.c"
/**
diff --git a/src/plugins/exiv2/exiv2extractor.cc b/src/plugins/exiv2/exiv2extractor.cc
@@ -88,7 +88,7 @@ extern "C" {
size_t size,
struct EXTRACTOR_Keywords * prev)
{
- struct EXTRACTOR_Keywords * result = 0;
+ struct EXTRACTOR_Keywords * result = prev;
try {
diff --git a/src/plugins/oo/ooextractor.c b/src/plugins/oo/ooextractor.c
@@ -183,7 +183,7 @@ static long Eseek_file_func(voidpf opaque,
default:
return -1;
}
- return e->pos;
+ return 0;
}
static int Eclose_file_func(voidpf opaque,
diff --git a/src/plugins/zipextractor.c b/src/plugins/zipextractor.c
@@ -94,6 +94,18 @@ struct EXTRACTOR_Keywords * libextractor_zip_extract(char * filename,
unsigned int filecomment_length;
unsigned int entry_total, entry_count;
EXTRACTOR_KeywordList * keyword;
+ const char * mimetype;
+
+ mimetype = EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE,
+ prev);
+ if (NULL != mimetype) {
+ if ( (0 != strcmp(mimetype, "application/x-zip")) &&
+ (0 != strcmp(mimetype, "application/zip")) ) {
+ /* we think we already know what's in here,
+ and it is not a zip */
+ return prev;
+ }
+ }
/* I think the smallest zipfile you can have is about 120 bytes */
if ( (NULL==data) || (size < 100) )