gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2446 - in Extractor: . src/main src/plugins/ole2


From: grothoff
Subject: [GNUnet-SVN] r2446 - in Extractor: . src/main src/plugins/ole2
Date: Wed, 11 Jan 2006 18:13:55 -0800 (PST)

Author: grothoff
Date: 2006-01-11 18:13:48 -0800 (Wed, 11 Jan 2006)
New Revision: 2446

Modified:
   Extractor/ChangeLog
   Extractor/src/main/extractor.c
   Extractor/src/plugins/ole2/ole2extractor.c
Log:
update

Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2006-01-10 16:16:11 UTC (rev 2445)
+++ Extractor/ChangeLog 2006-01-12 02:13:48 UTC (rev 2446)
@@ -1,3 +1,7 @@
+Wed Jan 11 11:33:46 PST 2006
+       More Mime-types for the OLE2 extractor.  Also ignore (harmless) 
+       libc errors in plugins when extracting.
+
 Thu Jan  5 16:51:36 PST 2006
        More TAR improvements: keywords 'date' and 'format' are 
        extracted. More checksums variants were added. Long filenames

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2006-01-10 16:16:11 UTC (rev 2445)
+++ Extractor/src/main/extractor.c      2006-01-12 02:13:48 UTC (rev 2446)
@@ -868,6 +868,7 @@
   }
   if (buf != NULL)
     free(buf);
+  errno = 0; /* kill transient errors */
   return result;
 }
 

Modified: Extractor/src/plugins/ole2/ole2extractor.c
===================================================================
--- Extractor/src/plugins/ole2/ole2extractor.c  2006-01-10 16:16:11 UTC (rev 
2445)
+++ Extractor/src/plugins/ole2/ole2extractor.c  2006-01-12 02:13:48 UTC (rev 
2446)
@@ -2156,7 +2156,7 @@
 
 struct EXTRACTOR_Keywords *
 libextractor_ole2_extract(const char * filename,
-                         const char * date,
+                         const char * data,
                          size_t size,
                          struct EXTRACTOR_Keywords * prev) {
   struct GsfInput   *input;
@@ -2166,7 +2166,7 @@
   const char * software = 0;
   int i;
 
-  input = gsf_input_new((const unsigned char*) date,
+  input = gsf_input_new((const unsigned char*) data,
                        (off_t) size,
                        0);
   if (input == NULL)
@@ -2203,6 +2203,15 @@
    * Hack to return an appropriate mimetype
    */
   software = EXTRACTOR_extractLast(EXTRACTOR_SOFTWARE, prev);
+  if(NULL == software) {
+     /*
+      * when very puzzled, just look at file magic number
+      */
+    if( (8 < size)
+     && (0 == memcmp(data, "\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1", 8)) )
+      software = "Microsoft Office";
+  }
+
   if(NULL != software) {
     const char * mimetype = "application/vnd.ms-files";
  
@@ -2215,6 +2224,10 @@
     else if((0 == strncmp(software, "Microsoft PowerPoint", 20)) ||
             (0 == strncmp(software, "Microsoft Office PowerPoint", 27)))
       mimetype = "application/vnd.ms-powerpoint";
+    else if(0 == strncmp(software, "Microsoft Project", 17))
+      mimetype = "application/vnd.ms-project";
+    else if(0 == strncmp(software, "Microsoft Visio", 15))
+      mimetype = "application/vnd.visio";
     else if(0 == strncmp(software, "Microsoft Office", 16))
       mimetype = "application/vnd.ms-office";
   
@@ -2225,3 +2238,4 @@
 }
 
 /* end of ole2extractor.c */
+





reply via email to

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