libextractor

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

commit bf6014fb083266959fea01bc7eeb1be8c78e02cd
parent 53927ee773cd5b49cf58f29c23c1ef24ac2fc477
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 19 Jun 2005 16:14:32 +0000

update

Diffstat:
MChangeLog | 4++++
Msrc/include/extractor.h | 2+-
Msrc/main/extractor.c | 1-
Msrc/plugins/Makefile.am | 2+-
Msrc/plugins/debextractor.c | 10++++------
Msrc/plugins/elfextractor.c | 1+
Msrc/plugins/id3v23extractor.c | 2+-
Msrc/plugins/id3v24extractor.c | 2+-
Msrc/plugins/ole2/ole2extractor.c | 2--
Msrc/plugins/oo/Makefile.am | 2+-
Msrc/plugins/oo/unzip.c | 15++++++++-------
Msrc/plugins/pngextractor.c | 28+++++++++++++++++++++-------
Msrc/plugins/tarextractor.c | 2+-
Msrc/plugins/tiffextractor.c | 1-
Msrc/plugins/wavextractor.c | 1-
15 files changed, 44 insertions(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,7 @@ +Sat Jun 18 14:56:38 EST 2005 + Fixed a score of compiler warnings and some minor bugs, + none of which should have been observable. + Sat May 21 13:42:46 EST 2005 Releasing libextractor 0.5.0. 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 0x00050001 +#define EXTRACTOR_VERSION 0x00050002 #include <stdio.h> diff --git a/src/main/extractor.c b/src/main/extractor.c @@ -479,7 +479,6 @@ EXTRACTOR_ExtractorList * EXTRACTOR_loadConfigLibraries (EXTRACTOR_ExtractorList * prev, const char *config) { - EXTRACTOR_ExtractorList * exlast; char *cpy; int pos; int last; diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am @@ -20,7 +20,7 @@ endif SUBDIRS = . oo $(printdir) hash $(oledir) rpm pdf $(thumbdir) -PLUGINFLAGS = -export-dynamic -avoid-version -module +PLUGINFLAGS = -export-dynamic -avoid-version -module if HAVE_VORBISFILE diff --git a/src/plugins/debextractor.c b/src/plugins/debextractor.c @@ -115,9 +115,9 @@ static struct EXTRACTOR_Keywords * processControl(const char * data, colon++; eol = colon; while ( (eol < size) && - (data[eol] != '\n') || - ( (eol+1 < size) && - (data[eol+1] == ' ') ) ) + ( (data[eol] != '\n') || + ( (eol+1 < size) && + (data[eol+1] == ' ') ) ) ) eol++; if ( (eol == colon) || (eol > size) ) return prev; @@ -211,7 +211,7 @@ processControlTar(const char * data, prev); } if ( (fsize & 511) != 0) - fsize = (fsize |= 511)+1; /* round up! */ + fsize = (fsize | 511)+1; /* round up! */ if (pos + fsize < pos) return prev; pos += fsize; @@ -259,8 +259,6 @@ processControlTGZ(const unsigned char * data, gzFile gzf; int fdes[2]; char * buf; - int flags; - size_t ret; WTC wtc; pthread_t pt; void * error; diff --git a/src/plugins/elfextractor.c b/src/plugins/elfextractor.c @@ -20,6 +20,7 @@ #include "platform.h" #include "extractor.h" +#include "pack.h" static void addKeyword(struct EXTRACTOR_Keywords ** list, const char * keyword, diff --git a/src/plugins/id3v23extractor.c b/src/plugins/id3v23extractor.c @@ -151,7 +151,7 @@ libextractor_id3v23_extract(const char * filename, (csize > tsize) || (csize == 0) ) break; - flags = data[pos+8]<<8 + data[pos+9]; + flags = (data[pos+8]<<8) + data[pos+9]; if ( ( (flags & 0x80) > 0) /* compressed, not yet supported */ || ( (flags & 0x40) > 0) /* encrypted, not supported */ ) { pos += 10 + csize; diff --git a/src/plugins/id3v24extractor.c b/src/plugins/id3v24extractor.c @@ -148,7 +148,7 @@ libextractor_id3v24_extract(const char * filename, (csize > tsize) || (csize == 0) ) break; - flags = data[pos+8]<<8 + data[pos+9]; + flags = (data[pos+8]<<8) + data[pos+9]; if ( ( (flags & 0x80) > 0) /* compressed, not yet supported */ || ( (flags & 0x40) > 0) /* encrypted, not supported */ ) { pos += 10 + csize; diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c @@ -923,8 +923,6 @@ struct EXTRACTOR_Keywords * libextractor_ole2_extract(const char * filename, struct EXTRACTOR_Keywords * prev) { GsfInput *input; GsfInfile *infile; - guint8 const *data; - size_t len; int i; input = gsf_input_memory_new((guint8 const *) date, diff --git a/src/plugins/oo/Makefile.am b/src/plugins/oo/Makefile.am @@ -23,4 +23,4 @@ libextractor_oo_la_LDFLAGS = \ -export-dynamic -avoid-version -module libextractor_oo_la_LIBADD = \ - -lz + -lz diff --git a/src/plugins/oo/unzip.c b/src/plugins/oo/unzip.c @@ -592,12 +592,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file, /* we check the magic */ - if (err==UNZ_OK) + if (err==UNZ_OK) { if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x02014b50) err=UNZ_BADZIPFILE; - + } if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) err=UNZ_ERRNO; @@ -672,11 +672,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file, else uSizeRead = extraFieldBufferSize; - if (lSeek!=0) + if (lSeek!=0) { if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; + } if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead) err=UNZ_ERRNO; @@ -697,11 +698,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file, else uSizeRead = commentBufferSize; - if (lSeek!=0) + if (lSeek!=0) { if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; + } if ((file_info.size_file_comment>0) && (commentBufferSize>0)) if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) err=UNZ_ERRNO; @@ -960,12 +962,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, return UNZ_ERRNO; - if (err==UNZ_OK) + if (err==UNZ_OK) { if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x04034b50) err=UNZ_BADZIPFILE; - + } if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) err=UNZ_ERRNO; /* @@ -1504,7 +1506,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) char *szComment; uLong uSizeBuf; { - int err=UNZ_OK; unz_s* s; uLong uReadThis ; if (file==NULL) diff --git a/src/plugins/pngextractor.c b/src/plugins/pngextractor.c @@ -32,6 +32,20 @@ static char * stndup(const char * str, return tmp; } +/** + * strnlen is GNU specific, let's redo it here to be + * POSIX compliant. + */ +static size_t stnlen(const char * str, + size_t maxlen) { + size_t ret; + ret = 0; + while ( (ret < maxlen) && + (str[ret] != '\0') ) + ret++; + return ret; +} + static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, char * keyword, struct EXTRACTOR_Keywords * next) { @@ -80,7 +94,7 @@ static struct EXTRACTOR_Keywords * processtEXt(const unsigned char * data, int i; data += 4; - off = strnlen(data, length) + 1; + off = stnlen(data, length) + 1; if (off >= length) return prev; /* failed to find '\0' */ keyword = convertToUtf8(&data[off], @@ -113,26 +127,26 @@ static struct EXTRACTOR_Keywords * processiTXt(const unsigned char * data, uLongf bufLen; int ret; - pos = strnlen(data, length)+1; + pos = stnlen(data, length)+1; if (pos+3 >= length) return prev; compressed = data[pos++]; if (compressed && (data[pos++] != 0)) return prev; /* bad compression method */ language = &data[pos]; - if (strnlen(language, length-pos) > 0) + if (stnlen(language, length-pos) > 0) prev = addKeyword(EXTRACTOR_LANGUAGE, stndup(language, length-pos), prev); - pos += strnlen(language, length-pos)+1; + pos += stnlen(language, length-pos)+1; if (pos+1 >= length) return prev; translated = &data[pos]; /* already in utf-8! */ - if (strnlen(translated, length-pos) > 0) + if (stnlen(translated, length-pos) > 0) prev = addKeyword(EXTRACTOR_TRANSLATED, stndup(translated, length-pos), prev); - pos += strnlen(translated, length-pos)+1; + pos += stnlen(translated, length-pos)+1; if (pos >= length) return prev; @@ -213,7 +227,7 @@ static struct EXTRACTOR_Keywords * processzTXt(const unsigned char * data, int ret; data += 4; - off = strnlen(data, length) + 1; + off = stnlen(data, length) + 1; if (off >= length) return prev; /* failed to find '\0' */ if (data[off] != 0) diff --git a/src/plugins/tarextractor.c b/src/plugins/tarextractor.c @@ -128,7 +128,7 @@ tar_extract(const char * data, 100), prev); if ( (fsize & 511) != 0) - fsize = (fsize |= 511)+1; /* round up! */ + fsize = (fsize | 511)+1; /* round up! */ if (pos + fsize < pos) return prev; pos += fsize; diff --git a/src/plugins/tiffextractor.c b/src/plugins/tiffextractor.c @@ -109,7 +109,6 @@ struct EXTRACTOR_Keywords * libextractor_tiff_extract(char * filename, size_t size, struct EXTRACTOR_Keywords * prev) { TIFF_HEADER hdr; - struct EXTRACTOR_Keywords * pos; int byteOrder; /* 0: do not convert; 1: do convert */ int current_ifd; diff --git a/src/plugins/wavextractor.c b/src/plugins/wavextractor.c @@ -71,7 +71,6 @@ struct EXTRACTOR_Keywords * libextractor_wav_extract(char * filename, unsigned int sampleRate; unsigned int dataLen; unsigned int samples; - int bytesProcessed; char * scratch;