gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r1642 - in Extractor: . src/include src/main src/plugins sr


From: grothoff
Subject: [GNUnet-SVN] r1642 - in Extractor: . src/include src/main src/plugins src/plugins/exiv2 src/plugins/oo
Date: Sat, 13 Aug 2005 00:00:14 -0700 (PDT)

Author: grothoff
Date: 2005-08-13 00:00:05 -0700 (Sat, 13 Aug 2005)
New Revision: 1642

Modified:
   Extractor/AUTHORS
   Extractor/ChangeLog
   Extractor/src/include/extractor.h
   Extractor/src/main/extractor.c
   Extractor/src/plugins/exiv2/exiv2extractor.cc
   Extractor/src/plugins/oo/ooextractor.c
   Extractor/src/plugins/zipextractor.c
Log:
fix

Modified: Extractor/AUTHORS
===================================================================
--- Extractor/AUTHORS   2005-08-13 06:33:36 UTC (rev 1641)
+++ Extractor/AUTHORS   2005-08-13 07:00:05 UTC (rev 1642)
@@ -38,6 +38,7 @@
 Bruno Haible <address@hidden>
 Nils Durner <address@hidden>
 Heiko Wundram <address@hidden>
+Ronan MELENNEC <address@hidden>
 
 Translations:
 German - Karl Eichwalder <address@hidden>

Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2005-08-13 06:33:36 UTC (rev 1641)
+++ Extractor/ChangeLog 2005-08-13 07:00:05 UTC (rev 1642)
@@ -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.

Modified: Extractor/src/include/extractor.h
===================================================================
--- Extractor/src/include/extractor.h   2005-08-13 06:33:36 UTC (rev 1641)
+++ Extractor/src/include/extractor.h   2005-08-13 07:00:05 UTC (rev 1642)
@@ -29,7 +29,7 @@
  * 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 @@
  * @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_KeywordList *
 EXTRACTOR_removeDuplicateKeywords(EXTRACTOR_KeywordList * list,
-                                 const unsigned int options);
+                                 unsigned int options);
 
 
 /**
@@ -314,6 +314,16 @@
  */
 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 @@
  *  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);
 
 /**

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2005-08-13 06:33:36 UTC (rev 1641)
+++ Extractor/src/main/extractor.c      2005-08-13 07:00:05 UTC (rev 1642)
@@ -807,6 +807,39 @@
   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"
 
 /**

Modified: Extractor/src/plugins/exiv2/exiv2extractor.cc
===================================================================
--- Extractor/src/plugins/exiv2/exiv2extractor.cc       2005-08-13 06:33:36 UTC 
(rev 1641)
+++ Extractor/src/plugins/exiv2/exiv2extractor.cc       2005-08-13 07:00:05 UTC 
(rev 1642)
@@ -88,7 +88,7 @@
                                                            size_t size,
                                                            struct 
EXTRACTOR_Keywords * prev) 
     {
-        struct EXTRACTOR_Keywords * result = 0;
+        struct EXTRACTOR_Keywords * result = prev;
 
         try {
 

Modified: Extractor/src/plugins/oo/ooextractor.c
===================================================================
--- Extractor/src/plugins/oo/ooextractor.c      2005-08-13 06:33:36 UTC (rev 
1641)
+++ Extractor/src/plugins/oo/ooextractor.c      2005-08-13 07:00:05 UTC (rev 
1642)
@@ -183,7 +183,7 @@
   default:
     return -1;
   }
-  return e->pos;
+  return 0;
 }
 
 static int Eclose_file_func(voidpf opaque, 

Modified: Extractor/src/plugins/zipextractor.c
===================================================================
--- Extractor/src/plugins/zipextractor.c        2005-08-13 06:33:36 UTC (rev 
1641)
+++ Extractor/src/plugins/zipextractor.c        2005-08-13 07:00:05 UTC (rev 
1642)
@@ -94,7 +94,19 @@
   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) )
     return prev;  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]