gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3371 - in Extractor: . src/plugins


From: grothoff
Subject: [GNUnet-SVN] r3371 - in Extractor: . src/plugins
Date: Wed, 6 Sep 2006 12:42:49 -0700 (PDT)

Author: grothoff
Date: 2006-09-06 12:42:46 -0700 (Wed, 06 Sep 2006)
New Revision: 3371

Modified:
   Extractor/ChangeLog
   Extractor/src/plugins/pngextractor.c
Log:
adding tIME support to PNG extractor

Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2006-09-06 18:57:01 UTC (rev 3370)
+++ Extractor/ChangeLog 2006-09-06 19:42:46 UTC (rev 3371)
@@ -1,3 +1,6 @@
+Wed Sep  6 13:38:55 PDT 2006
+       Added tIME support to PNG extractor.  Bugfixes in PDF extractors.
+
 Wed May 17 02:05:37 PDT 2006
         Switched mpegextractor to use libmpeg2 (improves correctness,
        adds dependency!).  Releasing libextractor 0.5.14.

Modified: Extractor/src/plugins/pngextractor.c
===================================================================
--- Extractor/src/plugins/pngextractor.c        2006-09-06 18:57:01 UTC (rev 
3370)
+++ Extractor/src/plugins/pngextractor.c        2006-09-06 19:42:46 UTC (rev 
3371)
@@ -215,7 +215,6 @@
                    prev);
 }
 
-/* not supported... */
 static struct EXTRACTOR_Keywords * processzTXt(const char * data,
                                               unsigned int length,
                                               struct EXTRACTOR_Keywords * 
prev) {
@@ -278,6 +277,42 @@
                    prev);
 }
 
+static struct EXTRACTOR_Keywords * processtIME(const char * data,
+                                              unsigned int length,
+                                              struct EXTRACTOR_Keywords * 
prev) {
+  unsigned short y;
+  unsigned int year;
+  unsigned int mo;
+  unsigned int day;
+  unsigned int h;
+  unsigned int m;
+  unsigned int s;
+  char val[256];
+
+  if (length != 7)
+    return prev;
+  memcpy(&y,
+        &data[4],
+        sizeof(unsigned short));
+  year = ntohs(y);
+  mo   = (unsigned char) data[6];
+  day  = (unsigned char) data[7];
+  h    = (unsigned char) data[8];
+  m    = (unsigned char) data[9];
+  s    = (unsigned char) data[10];
+  sprintf(val,
+         "%04u-%02u-%02u %02d:%02d:%02d",
+         year,
+         mo,
+         day,
+         h,
+         m,
+         s);
+  return addKeyword(EXTRACTOR_MODIFICATION_DATE,
+                   strdup(val),
+                   prev);
+}
+
 #define PNG_HEADER "\211PNG\r\n\032\n"
 
 
@@ -318,6 +353,8 @@
       result = processtEXt(pos, length, result);
     if (0 == strncmp(pos, "zTXt", 4))
       result = processzTXt(pos, length, result);
+    if (0 == strncmp(pos, "tIME", 4))
+      result = processtIME(pos, length, result);
     pos += 4+length+4; /* Chunk type, data, crc */
   }
   return result;





reply via email to

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