libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 54ff1f3a0a7764740121863bec51c2fd4a44ed6d
parent 255c8b59c2b3890bba1593f312e12e89f120f33c
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 12 Jan 2006 02:13:48 +0000

update

Diffstat:
MChangeLog | 4++++
Msrc/main/extractor.c | 1+
Msrc/plugins/ole2/ole2extractor.c | 18++++++++++++++++--
3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -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 diff --git a/src/main/extractor.c b/src/main/extractor.c @@ -868,6 +868,7 @@ getKeywords (EXTRACTOR_ExtractorList * extractor, } if (buf != NULL) free(buf); + errno = 0; /* kill transient errors */ return result; } diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c @@ -2156,7 +2156,7 @@ static struct EXTRACTOR_Keywords * processSO(struct GsfInput * src, 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 @@ libextractor_ole2_extract(const char * filename, 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 @@ libextractor_ole2_extract(const char * filename, * 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 @@ libextractor_ole2_extract(const char * filename, 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 @@ libextractor_ole2_extract(const char * filename, } /* end of ole2extractor.c */ +