commit 84211d9bcce76cfd7deea159a6f1972164689df4 parent 9c117f0646f795b76d68c09779c1c03b769a5202 Author: Christian Grothoff <christian@grothoff.org> Date: Fri, 29 Dec 2006 03:47:54 +0000 whitespace Diffstat:
37 files changed, 270 insertions(+), 270 deletions(-)
diff --git a/AUTHORS b/AUTHORS @@ -69,7 +69,7 @@ sha1 - Scott G. Miller and Robert Klep <robert@ilse.nl> Libraries used: libz - -ogg-vorbis - -glib - -libltdl - -gtk (pixbuf)- +ogg-vorbis - +glib - +libltdl - +gtk (pixbuf)- diff --git a/ChangeLog b/ChangeLog @@ -2,10 +2,10 @@ Thu Dec 28 20:22:20 MST 2006 Fixed bug in splitextractor, addressing also Mantis #1125. Thu Dec 28 18:12:15 MST 2006 - Added -g (greppable output, Mantis #1157) option to extact. + Added -g (greppable output, Mantis #1157) option to extact. Mon Nov 20 22:08:55 EET 2006 - Added an SID (C64 music file) plugin + Added an SID (C64 music file) plugin. Sat Nov 11 16:04:38 MST 2006 Fixed libltdl side-effect of loading libextractor; code @@ -14,7 +14,7 @@ Sat Nov 11 16:04:38 MST 2006 libgsf (as workaround for GSF bug). Releasing libextractor 0.5.16. Sat Nov 11 00:04:34 EET 2006 - Added an NSF (NES Sound Format) plugin + Added an NSF (NES Sound Format) plugin. Sat Sep 16 12:36:42 MDT 2006 Added support for various additional tags to ID3v2 extractors. @@ -78,13 +78,13 @@ Tue Jan 31 12:51:55 PST 2006 Mis-detection of man pages as part of TAR archives fixed. Wed Jan 11 11:33:46 PST 2006 - More Mime-types for the OLE2 extractor. Also ignore (harmless) + 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 + More TAR improvements: keywords 'date' and 'format' are extracted. More checksums variants were added. Long filenames - as produced by GNU and Schilling tar (possibly Solaris pax also) + as produced by GNU and Schilling tar (possibly Solaris pax also) are extracted. Fri Dec 23 11:28:23 PST 2005 @@ -161,7 +161,7 @@ Wed Sep 14 15:02:49 PDT 2005 problems with very large files where malloc may run into problems). Wed Sep 14 13:50:15 PDT 2005 - Changed code for backwards-compatibility with zlib 1.1 + Changed code for backwards-compatibility with zlib 1.1 (thanks to Ronan Melennec). Tue Sep 13 04:49:43 PDT 2005 @@ -206,7 +206,7 @@ Thu Aug 18 21:18:28 PDT 2005 Sat Aug 13 18:41:02 PDT 2005 Fixed problems with ole2 extractor. Also removed - requirement for static version of glib (!). + requirement for static version of glib (!). Releasing libextractor 0.5.3. Fri Aug 12 23:53:54 PDT 2005 @@ -231,7 +231,7 @@ Thu Jul 14 18:52:17 CEST 2005 Mon Jul 4 18:10:14 CEST 2005 Preliminary integration of exiv2 support (not enabled by default due to bugs). Moved Python and Java - bindings into separate packages. + bindings into separate packages. Releasing libextractor 0.5.1. Wed Jun 29 15:37:51 CEST 2005 @@ -329,7 +329,7 @@ Fri Nov 12 19:20:37 EST 2004 4 GB file not taken care of properly). Sat Oct 30 20:18:21 EST 2004 - Fixing various problems on Sparc64 (bus errors). + Fixing various problems on Sparc64 (bus errors). Workaround for re-load glib problem of OLE2 extractor. Sat Oct 23 13:21:23 EST 2004 @@ -353,14 +353,14 @@ Sun Oct 17 13:52:25 EST 2004 Tue Oct 5 14:29:31 EST 2004 Updated xpdf extractor (to fix Mantis #754). Fixed bug in Id3v2 extractor (potential segfault). Added support for extracting - image size from jpeg. General code cleanup. 64-bit file + image size from jpeg. General code cleanup. 64-bit file support. Mon Oct 4 20:28:52 EST 2004 Fixed jpeg extractor to not hang on certain malformed JPEG files. Sat Oct 2 18:02:56 EST 2004 - Added support for dvi. Removed special code for OS X, + Added support for dvi. Removed special code for OS X, normal libtool works fine now (and suddenly LE works for OS X). Releasing libextractor 0.3.8. @@ -375,7 +375,7 @@ Thu Sep 23 11:25:42 EST 2004 Tue Sep 14 21:25:22 EST 2004 Improved performance of the HTML extractor by avoiding parsing after the header (factor of 25 improvement for a 4 MB HTML file - resulting in a total improvement for total extraction time for + resulting in a total improvement for total extraction time for running all extractors of about 50%). Improved performance of the ZIP extractor for non-zip files by testing for the ZIP header before trying to locate the central directory (for 5 MB @@ -439,7 +439,7 @@ Sat Apr 24 00:07:31 EST 2004 Fixed memory leak in PDF-extractor. Mon Apr 12 01:30:20 EST 2004 - Added Java binding. If jni.h is present (and working!), + Added Java binding. If jni.h is present (and working!), libextractor is build with a couple of tiny additional methods that are sufficient to build a Java class to access libextractor. The API is still incomplete but @@ -450,7 +450,7 @@ Sat Apr 10 01:34:04 EST 2004 Fixed memory-leak and potential segfault in zipextractor. Sat Apr 10 00:30:19 EST 2004 - Added MPEG (video) extractor based on AVInfo. Improved + Added MPEG (video) extractor based on AVInfo. Improved output of mp3 extractor. Fri Apr 9 22:58:51 EST 2004 @@ -476,13 +476,13 @@ Tue Oct 14 17:43:09 EST 2003 Releasing 0.2.6. Sun Oct 12 18:05:37 EST 2003 - Ported to OSX, fixing endianess issues with printable - extractors. + Ported to OSX, fixing endianess issues with printable + extractors. Tue Jul 22 11:38:42 CET 2003 Fixed segfault with option -b for no keywords found. -Wed Jul 16 13:41:34 EST 2003 +Wed Jul 16 13:41:34 EST 2003 Releasing 0.2.5. Mon Jun 30 21:27:42 EST 2003 @@ -510,7 +510,7 @@ Thu Apr 3 23:09:44 EST 2003 ASF file with meta-data in it. Thu Apr 3 04:04:19 EST 2003 - Fixing ogg-extractor to work with new version of libvorbis that + Fixing ogg-extractor to work with new version of libvorbis that requires us to link against libvorbisfile. Wed Apr 2 22:22:16 EST 2003 @@ -537,7 +537,7 @@ Tue Jan 7 18:31:38 EST 2003 Tue Dec 31 15:26:00 EST 2002 Added pdf extractor based on xpdf code. -Tue Dec 17 20:36:13 CET 2002 +Tue Dec 17 20:36:13 CET 2002 Added MIME-extractor. Fri Nov 22 21:54:10 EST 2002 @@ -572,7 +572,7 @@ Sun Jun 2 22:49:17 EST 2002 with libhtmlparse). Released v0.0.2. Sat May 25 16:56:59 EST 2002 - Added building of a description from artist, + Added building of a description from artist, title and album, fixed bugs. Tue May 21 22:24:07 EST 2002 diff --git a/NEWS b/NEWS @@ -1,8 +1,8 @@ Mon Nov 20 22:08:55 EET 2006 - Added an SID (C64 music file) plugin + Added an SID (C64 music file) plugin. Sat Nov 11 00:04:34 EET 2006 - Added an NSF ( NES Sound Format ) plugin + Added an NSF ( NES Sound Format ) plugin. Tue Apr 18 14:44:37 PDT 2006 Added dictionaries for Finnish, French, Gaelic and Swedish diff --git a/PLATFORMS b/PLATFORMS @@ -5,7 +5,7 @@ GNU/Linux (x86): - perfect, but with gcc 3.3 you must turn off optimizations! GNU/Linux (Ultra Sparc): -- perfect +- perfect GNU/Linux (Alpha): - perfect @@ -20,8 +20,8 @@ OpenBSD 3.8: - Chan Siu Ming <namely_void@yahoo.co.uk> writes: - libtool is good to have - OpenBSD 3.8 also doesn't have CODESET in langinfo.h (used in about three places.) I'm not sure how to cleanly overcome this. - - for some reason, convert.a is linked with a static version of libiconv.a, so that convert.a ends up containing convert.o - and libiconv.a, which confuses the linker, because archives aren't supposed to contain other archives. Removed the ICONV + - for some reason, convert.a is linked with a static version of libiconv.a, so that convert.a ends up containing convert.o + and libiconv.a, which confuses the linker, because archives aren't supposed to contain other archives. Removed the ICONV stuff from convert_la_LDFLAGS in some Makefiles and it seemed to get past that. - NetBSD: @@ -40,7 +40,7 @@ Solaris 10 MinGW: - linking against libstdc++ fails my workaround: rename libstdc++.la - Gerrit P. Haase writes: + Gerrit P. Haase writes: Linking -lstdc++ with the provided libtool fails also on Cygwin, this is a problem with libtool, there is unfortunately no flag to tell libtool how to do its job on Cygwin and it seems that it cannot be the diff --git a/README b/README @@ -6,7 +6,7 @@ does not support all formats but supports a simple plugging mechanism such that you can quickly add extractors for additional formats, even without recompiling libextractor. libextractor typically ships with a dozen helper-libraries that can be used to obtain keywords from common -file-types. +file-types. libextractor is a part of the GNU project (http://www.gnu.org/). diff --git a/TODO b/TODO @@ -1,5 +1,5 @@ FIX: -* check exiv2 memory consumption on very large files; +* check exiv2 memory consumption on very large files; also investigate 500kb (!) allocation/leak in exiv2 on test/test.html (reported by valgrind) * 500 kb leak for each load/unload of exiv2 plugin (glibc?) @@ -26,7 +26,7 @@ Desirable missing formats: * info pages (scan for 'Node: %s^?ID' - see end of .info files!) * sources (Java, C, C++, see doxygen!) * a.out (== ar?) -* rtf +* rtf * EXE * APEv2 (MPC file format, www.personal.uni-jena.de/~pfk/mpp/sv8/apetag.html) * PRC (Palm module, http://web.mit.edu/tytso/www/pilot/prc-format.html) diff --git a/doc/extract.1 b/doc/extract.1 @@ -21,7 +21,7 @@ extract .I library ] [ -.B \-p +.B \-p .I type ] [ @@ -32,17 +32,17 @@ extract \&... .br .SH DESCRIPTION -This manual page documents version 0.5.17 of the -.B extract +This manual page documents version 0.5.17 of the +.B extract command. .PP .B extract -tests each file specified in the argument list in an attempt to infer meta\-information from it. Each file is subjected to the meta\-data extraction libraries from -.I libextractor. +tests each file specified in the argument list in an attempt to infer meta\-information from it. Each file is subjected to the meta\-data extraction libraries from +.I libextractor. .PP -libextractor classifies meta\-information (also referred to as keywords) into types. A list of all types can be obtained with the -.B \-L -option. +libextractor classifies meta\-information (also referred to as keywords) into types. A list of all types can be obtained with the +.B \-L +option. .SH OPTIONS .TP 8 @@ -50,8 +50,8 @@ option. Do not remove any duplicates, even if the keywords match exactly and have the same type (i.e. because the same keyword was found by different extractor libraries). .TP 8 .B \-b -Display the output in BiBTeX format. This implies the -.B \-d +Display the output in BiBTeX format. This implies the +.B \-d option .TP 8 .B \-B LANG @@ -94,7 +94,7 @@ Be verbose. Run the printable extractor (costly, generic extractor for binaries) .TP 8 .BI \-l " libraries" -Use the specified libraries to extract keywords. The general format of libraries is .I [[\-]LIBRARYNAME[:[\-]LIBRARYNAME]*] where LIBRARYNAME is a libextractor compatible library and typically of the form .I libextractor_jpeg.so\. The minus before the libraryname indicates that this library should be run after all the libraries that were specified so far. If the minus is missing, the library is run before all previously specified libraries. +Use the specified libraries to extract keywords. The general format of libraries is .I [[\-]LIBRARYNAME[:[\-]LIBRARYNAME]*] where LIBRARYNAME is a libextractor compatible library and typically of the form .I libextractor_jpeg.so\. The minus before the libraryname indicates that this library should be run after all the libraries that were specified so far. If the minus is missing, the library is run before all previously specified libraries. .TP 8 .BI \-p " type" Print only the keywords matching the specified type. By default, all keywords that are found and not removed as duplicates are printed. diff --git a/src/include/extractor.h b/src/include/extractor.h @@ -143,9 +143,9 @@ typedef enum { EXTRACTOR_ORIENTATION = 87, EXTRACTOR_TEMPLATE = 88, EXTRACTOR_SPLIT = 89, - EXTRACTOR_PRODUCTVERSION = 90, + EXTRACTOR_PRODUCTVERSION = 90, EXTRACTOR_LAST_SAVED_BY = 91, - EXTRACTOR_LAST_PRINTED = 92, + EXTRACTOR_LAST_PRINTED = 92, EXTRACTOR_WORD_COUNT = 93, EXTRACTOR_CHARACTER_COUNT = 94, EXTRACTOR_TOTAL_EDITING_TIME = 95, diff --git a/src/main/extract.c b/src/main/extract.c @@ -169,7 +169,7 @@ printHelp () /** * Print a keyword list to a file. - * + * * @param handle the file to write to (stdout, stderr), may NOT be NULL * @param keywords the list of keywords to print, may be NULL * @param print array indicating which types to print @@ -194,7 +194,7 @@ printSelectedKeywords(FILE * handle, keyword = iconvHelper(cd, keywords->keyword); else - keyword = strdup(keywords->keyword); + keyword = strdup(keywords->keyword); if (NULL == EXTRACTOR_getKeywordTypeAsString(keywords->keywordType)) { if (verbose == YES) { fprintf(handle, @@ -241,7 +241,7 @@ printSelectedKeywordsGrepFriendly(FILE * handle, keyword = strdup(keywords->keyword); fprintf (handle, (keywords->next == NULL) ? "%s" : "%s ", - keyword); + keyword); free(keyword); } keywords = keywords->next; @@ -501,7 +501,7 @@ main (int argc, char *argv[]) case 'L': i = 0; while (NULL != EXTRACTOR_getKeywordTypeAsString (i)) - printf ("%s\n", + printf ("%s\n", _(EXTRACTOR_getKeywordTypeAsString (i++))); return 0; case 'n': @@ -526,7 +526,7 @@ main (int argc, char *argv[]) { if ( (0 == strcmp (optarg, EXTRACTOR_getKeywordTypeAsString (i))) || (0 == strcmp (optarg, _(EXTRACTOR_getKeywordTypeAsString (i)))) ) - + { print[i] = YES; break; @@ -641,7 +641,7 @@ main (int argc, char *argv[]) keywords = EXTRACTOR_getKeywords (extractors, argv[i]); if (0 != errno) { if (verbose == YES) { - fprintf(stderr, + fprintf(stderr, "%s: %s: %s\n", argv[0], argv[i], strerror(errno)); } @@ -654,8 +654,8 @@ main (int argc, char *argv[]) && (bibtex == NO) ) { if (grepfriendly == YES) printf ("%s", argv[i]); - else - printf (_("Keywords for file %s:"), + else + printf (_("Keywords for file %s:"), argv[i]); } if (bibtex == YES) diff --git a/src/main/extractor.c b/src/main/extractor.c @@ -147,7 +147,7 @@ static const char *keywordTypes[] = { gettext_noop("generator"), gettext_noop("character set"), gettext_noop("line count"), /* 105 */ - gettext_noop("paragraph count"), + gettext_noop("paragraph count"), gettext_noop("editing cycles"), gettext_noop("scale"), gettext_noop("manager"), @@ -298,7 +298,7 @@ static char * cut_lib(char * in) { * Note that this may fail if LE is installed in one directory * and the binary linking against it sits elsewhere. */ -static char * +static char * get_path_from_proc_exe() { char fn[64]; char line[1024]; @@ -307,7 +307,7 @@ get_path_from_proc_exe() { size_t size; FILE * f; - snprintf(fn, + snprintf(fn, 64, "/proc/%u/maps", getpid()); @@ -322,11 +322,11 @@ get_path_from_proc_exe() { strstr(dir, "libextractor")[0] = '\0'; fclose(f); return cut_lib(strdup(dir)); - } + } } } fclose(f); - snprintf(fn, + snprintf(fn, 64, "/proc/%u/exe", getpid()); @@ -358,16 +358,16 @@ get_path_from_proc_exe() { static char * get_path_from_module_filename() { char * path; char * idx; - + path = malloc(4097); GetModuleFileName(NULL, path, 4096); idx = path + strlen(idx); - while ( (idx > path) && + while ( (idx > path) && (path != '\\') && (path != '/') ) idx++; *idx = '\0'; - return cut_bin(path); + return cut_bin(path); } #endif @@ -375,7 +375,7 @@ static char * get_path_from_module_filename() { * This may also fail -- for example, if extract * is not also installed. */ -static char * +static char * get_path_from_PATH() { struct stat sbuf; char * path; @@ -416,7 +416,7 @@ get_path_from_PATH() { return NULL; } -static char * +static char * get_path_from_ENV_PREFIX() { const char * p; @@ -436,7 +436,7 @@ static char * os_get_installation_path() { char * lpref; char * pexe; char * modu; - char * path; + char * path; lpref = get_path_from_ENV_PREFIX(); #if LINUX @@ -527,7 +527,7 @@ void __attribute__ ((constructor)) le_ltdl_init() { strcat(cpath, ":"); strcat(cpath, path); lt_dlsetsearchpath(cpath); - free(path); + free(path); free(cpath); } else { lt_dlsetsearchpath(path); @@ -1013,7 +1013,7 @@ getKeywords (EXTRACTOR_ExtractorList * extractor, memset(&strm, 0, sizeof(z_stream)); -#ifdef ZLIB_VERNUM +#ifdef ZLIB_VERNUM gzip_header_length = 0; #endif if (size > gzip_header_length) { @@ -1027,14 +1027,14 @@ getKeywords (EXTRACTOR_ExtractorList * extractor, strm.zalloc = NULL; strm.zfree = NULL; strm.opaque = NULL; - + /* * note: maybe plain inflateInit(&strm) is adequate, * it looks more backward-compatible also ; * * ZLIB_VERNUM isn't defined by zlib version 1.1.4 ; * there might be a better check. - */ + */ #ifdef ZLIB_VERNUM if (Z_OK == inflateInit2(&strm, 15 + 32)) { @@ -1071,9 +1071,9 @@ getKeywords (EXTRACTOR_ExtractorList * extractor, free(buf); buf = NULL; } - } while ( (buf != NULL) && - (ret != Z_STREAM_END) ); - dsize = pos + strm.total_out; + } while ( (buf != NULL) && + (ret != Z_STREAM_END) ); + dsize = pos + strm.total_out; inflateEnd(&strm); if (dsize == 0) { free(buf); @@ -1116,7 +1116,7 @@ getKeywords (EXTRACTOR_ExtractorList * extractor, do { bret = BZ2_bzDecompress(&bstrm); if (bret == Z_OK) { - if (dsize == MAX_DECOMPRESS) + if (dsize == MAX_DECOMPRESS) break; bpos += bstrm.total_out_lo32; bstrm.total_out_lo32 = 0; @@ -1132,8 +1132,8 @@ getKeywords (EXTRACTOR_ExtractorList * extractor, buf = NULL; } } while ( (buf != NULL) && - (bret != BZ_STREAM_END) ); - dsize = bpos + bstrm.total_out_lo32; + (bret != BZ_STREAM_END) ); + dsize = bpos + bstrm.total_out_lo32; BZ2_bzDecompressEnd(&bstrm); if (dsize == 0) { free(buf); @@ -1302,9 +1302,9 @@ EXTRACTOR_removeDuplicateKeywords (EXTRACTOR_KeywordList * list, pos = list; while (pos != NULL) { - removeKeyword(pos->keyword, + removeKeyword(pos->keyword, pos->keywordType, - options, + options, &list, pos); pos = pos->next; diff --git a/src/plugins/asfextractor.c b/src/plugins/asfextractor.c @@ -519,7 +519,7 @@ static int asf_read_header(demux_asf_t *this) { get_le64(this); total_size = get_le32(this); if (total_size > sizeof(this->wavex)) - goto fail; + goto fail; stream_data_size = get_le32(this); stream_id = get_le16(this); /* stream id */ get_le32(this); diff --git a/src/plugins/exiv2/basicio.cpp b/src/plugins/exiv2/basicio.cpp @@ -343,7 +343,7 @@ namespace Exiv2 { isMalloced_(false) { } - + void MemIo::wrap(const byte *data, long size) { data_ = (byte *) data; @@ -362,7 +362,7 @@ namespace Exiv2 { if (need > size_) { if (need > sizeAlloced_) { // Allocate in blocks of 32kB - long want = 32768 * (1 + need / 32768); + long want = 32768 * (1 + need / 32768); if (size_ > 0) { if (!isMalloced_) { // "copy-on-expand" @@ -397,7 +397,7 @@ namespace Exiv2 { else isMalloced_ = false; - data_ = memIo->data_; + data_ = memIo->data_; idx_ = 0; } else{ diff --git a/src/plugins/hash/md5extractor.c b/src/plugins/hash/md5extractor.c @@ -3,7 +3,7 @@ (C) 2004, 2005 Vidyut Samanta and Christian Grothoff Copyright (C) 1995, 1996, 1999, 2000, 2003 Free Software Foundation, Inc. - NOTE: The canonical source of the MD5 code from this file is maintained + NOTE: The canonical source of the MD5 code from this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. libextractor is free software; you can redistribute it and/or modify @@ -412,11 +412,11 @@ md5_buffer (const char *buffer, size_t len, void *resblock) -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, const char *phrase, EXTRACTOR_KeywordType type) { - + EXTRACTOR_KeywordList * keyword; keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); keyword->next = oldhead; @@ -432,7 +432,7 @@ addKeyword(EXTRACTOR_KeywordList *oldhead, #define DIGEST_BIN_BYTES (DIGEST_BITS / 8) #define MAX_DIGEST_BIN_BYTES DIGEST_BIN_BYTES -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_hash_md5_extract(const char * filename, const char * data, size_t size, diff --git a/src/plugins/hash/rmd160extractor.c b/src/plugins/hash/rmd160extractor.c @@ -619,7 +619,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, #define rmd160_new() rmd160_copy(NULL,NULL) -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_hash_rmd160_extract(const char * filename, const unsigned char * data, size_t size, diff --git a/src/plugins/htmlextractor.c b/src/plugins/htmlextractor.c @@ -109,7 +109,7 @@ typedef struct TI { /** * Add a keyword. */ -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, char * keyword, struct EXTRACTOR_Keywords * next) { @@ -131,8 +131,8 @@ static int tagMatch(const char * tag, (0 == strncasecmp(tag, s, e-s)) ); } -static int lookFor(char c, - size_t * pos, +static int lookFor(char c, + size_t * pos, const char * data, size_t size) { size_t p = *pos; @@ -146,7 +146,7 @@ static int lookFor(char c, return p < size; } -static int skipWhitespace(size_t * pos, +static int skipWhitespace(size_t * pos, const char * data, size_t size) { size_t p = *pos; @@ -160,11 +160,11 @@ static int skipWhitespace(size_t * pos, return p < size; } -static int skipLetters(size_t * pos, +static int skipLetters(size_t * pos, const char * data, size_t size) { size_t p = *pos; - + while ( (p < size) && (isalpha(data[p])) ) { if (data[p] == '\0') return 0; @@ -174,8 +174,8 @@ static int skipLetters(size_t * pos, return p < size; } -static int lookForMultiple(const char * c, - size_t * pos, +static int lookForMultiple(const char * c, + size_t * pos, const char * data, size_t size) { size_t p = *pos; @@ -201,9 +201,9 @@ static void findEntry(const char * key, len = strlen(key); while (start < end - len - 1) { start++; - if (start[len] != '=') - continue; - if (0 == strncmp(start, + if (start[len] != '=') + continue; + if (0 == strncmp(start, key, len)) { start += len+1; @@ -230,7 +230,7 @@ static void findEntry(const char * key, * Search all tags that correspond to "tagname". Example: * If the tag is <meta name="foo" desc="bar">, and * tagname == "meta", keyname="name", keyvalue="foo", - * and searchname="desc", then this function returns a + * and searchname="desc", then this function returns a * copy (!) of "bar". Easy enough? * * @return NULL if nothing is found @@ -263,13 +263,13 @@ static char * findInTags(TagInfo * t, &pend); if (pstart != NULL) { char * ret = malloc(pend - pstart + 1); - memcpy(ret, + memcpy(ret, pstart, pend - pstart); ret[pend-pstart] = '\0'; return ret; } - } + } } t = t->next; } @@ -278,7 +278,7 @@ static char * findInTags(TagInfo * t, /* mimetype = text/html */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_html_extract(const char * filename, const char * data, const size_t size, @@ -325,19 +325,19 @@ libextractor_html_extract(const char * filename, if (! skipWhitespace(&pos, data, size)) break; STEP3: if (! lookForMultiple(">\"\'", &pos, data, size)) break; - if (data[pos] != '>') { + if (data[pos] != '>') { /* find end-quote, ignore escaped quotes (\') */ do { tpos = pos; pos++; - if (! lookFor(data[tpos], &pos, data, size)) + if (! lookFor(data[tpos], &pos, data, size)) break; } while (data[pos-1] == '\\'); pos++; goto STEP3; } pos++; - if (! skipWhitespace(&pos, data, size)) break; + if (! skipWhitespace(&pos, data, size)) break; tag.dataStart = &data[pos]; if (! lookFor('<', &pos, data, size)) break; tag.dataEnd = &data[pos]; @@ -354,12 +354,12 @@ libextractor_html_extract(const char * filename, break; } i++; - } + } /* abort early if we hit the body tag */ if (tagMatch("body", tag.tagStart, tag.tagEnd)) - break; + break; } /* fast exit */ @@ -370,7 +370,7 @@ libextractor_html_extract(const char * filename, /* first, try to determine mime type and/or character set */ tmp = findInTags(tags, - "meta", + "meta", "http-equiv", "content-type", "content"); if (tmp != NULL) { @@ -379,11 +379,11 @@ libextractor_html_extract(const char * filename, is present, we try to use that for character set conversion. */ if (0 == strncmp(tmp, "text/html", - strlen("text/html"))) + strlen("text/html"))) prev = addKeyword(EXTRACTOR_MIMETYPE, strdup("text/html"), prev); - + charset = strstr(tmp, "charset="); if (charset != NULL) @@ -392,8 +392,8 @@ libextractor_html_extract(const char * filename, } if (charset == NULL) charset = strdup("ISO-8859-1"); /* try a sensible default */ - - + + i = 0; while (tagmap[i].name != NULL) { tmp = findInTags(tags, @@ -405,23 +405,23 @@ libextractor_html_extract(const char * filename, convertToUtf8(tmp, strlen(tmp), charset), - prev); + prev); free(tmp); } i++; } - + while (tags != NULL) { t = tags; if (tagMatch("title", t->tagStart, - t->tagEnd)) + t->tagEnd)) prev = addKeyword(EXTRACTOR_TITLE, convertToUtf8(t->dataStart, t->dataEnd - t->dataStart, charset), - prev); + prev); tags = t->next; free(t); } diff --git a/src/plugins/id3v24extractor.c b/src/plugins/id3v24extractor.c @@ -36,7 +36,7 @@ #include "convert.h" -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, char *phrase, EXTRACTOR_KeywordType type) { diff --git a/src/plugins/id3v2extractor.c b/src/plugins/id3v2extractor.c @@ -84,7 +84,7 @@ static Matches tmap[] = { /* mimetype = audio/mpeg */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_id3v2_extract(const char * filename, const unsigned char * data, size_t size, diff --git a/src/plugins/language/languageextractor.c b/src/plugins/language/languageextractor.c @@ -41,8 +41,8 @@ /** * @file languageextractor.c * @author Christian Grothoff - * @brief try to identify the language of the document using - * letter and letter-pair statistics + * @brief try to identify the language of the document using + * letter and letter-pair statistics */ #include "platform.h" @@ -65,13 +65,13 @@ int LanguageList::compareItems( QCollection::Item item1, QCollection::Item item2 } -static void extractNGrams(const char * str, +static void extractNGrams(const char * str, QStringList& ngrams) { QString paddedString( str ); - + paddedString = paddedString.replace( QRegExp( " " ), "_" ); paddedString = '_' + paddedString + '_'; - + for( int i = 0; i < paddedString.length() - size + 1; i++ ) ngrams.append( paddedString.mid( i, size ) ); } @@ -120,7 +120,7 @@ static NGramsList createFingerprintFromQString(const char * buf ) return wngrams; } -static const char * identifyLanguage(const QString& buffer, +static const char * identifyLanguage(const QString& buffer, LanguageProfileMap lp ) { long distance; @@ -191,17 +191,17 @@ static const char * identifyLanguage(const QString& buffer, } } -static unsigned long long calculateDistance(NGramsList & file_ngrams, +static unsigned long long calculateDistance(NGramsList & file_ngrams, LanguageProfile & langNG) { unsigned long long fileNGPos = 0L; unsigned long long langNGPos = 0L; unsigned long long distance = 0L; - + NGramsList::Iterator file_ngram = file_ngrams.begin(); while ( file_ngram != file_ngrams.end() ) { NGram* currentFileNGram = *file_ngram; - + QMap<QString, unsigned long long>::iterator ng = langNG.find( currentFileNGram->ngram ); if ( ng == langNG.end() ) @@ -215,17 +215,17 @@ static unsigned long long calculateDistance(NGramsList & file_ngrams, langNGPos = ng.data(); distance = distance + labs( langNGPos - fileNGPos ); } - + fileNGPos++; file_ngram++; } - + return distance; } -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_language_extract(const char * filename, const char * buf, size_t size, diff --git a/src/plugins/lowerextractor.c b/src/plugins/lowerextractor.c @@ -33,7 +33,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, } /* convert other keywords to lower case */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_lower_extract(char * filename, char * data, size_t size, diff --git a/src/plugins/manextractor.c b/src/plugins/manextractor.c @@ -86,7 +86,7 @@ static void NEXT(size_t * end, -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_man_extract(const char * filename, const char * buf, size_t size, @@ -123,8 +123,8 @@ libextractor_man_extract(const char * filename, pos += xlen; end = pos; - NEXT(&end, buf, size); - if (end > size) + NEXT(&end, buf, size); + if (end > size) return prev; if (end - pos > 0) { prev = addKeyword(EXTRACTOR_TITLE, diff --git a/src/plugins/mimeextractor.c b/src/plugins/mimeextractor.c @@ -135,13 +135,13 @@ static int svgMatcher(const char *data, void * cls) { enum {XMLSTART, XMLCLOSE, SVGSTART} state; size_t i; - + i = 0; state = XMLSTART; - + while (i < len) { if (! isprint(data[i])) - return 0; + return 0; switch (state) { case XMLSTART: if (i + 6 >= len) @@ -164,9 +164,9 @@ static int svgMatcher(const char *data, default: /* do nothing */ break; - } + } i++; - } + } return 0; } @@ -223,7 +223,7 @@ static Pattern patterns[] = { { "II\x2a\x00", 4, "image/tiff", DEFAULT}, /* little-endian */ { "%PDF", 4, "application/pdf", DEFAULT}, { "%!PS-Adobe-", 11, "application/postscript", DEFAULT}, - { "\004%!PS-Adobe-", 12, "application/postscript", DEFAULT }, + { "\004%!PS-Adobe-", 12, "application/postscript", DEFAULT }, { "RIFF", 4, "video/x-msvideo", XPATTERN(AVI_XPATTERN)}, { "RIFF", 4, "audio/x-wav", XPATTERN(WAVE_XPATTERN)}, { "RIFX", 4, "video/x-msvideo", XPATTERN(AVI_XPATTERN)}, @@ -285,7 +285,7 @@ static Pattern patterns[] = { {NULL, 0, NULL, DISABLED}, }; -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_mime_extract(const char * filename, const char * data, size_t size, diff --git a/src/plugins/mp3extractor.c b/src/plugins/mp3extractor.c @@ -259,19 +259,19 @@ static int get_id3(const char * data, pos = &data[size - 128]; if (0 != strncmp("TAG", - pos, + pos, 3)) return INVALID_ID3; pos += 3; id3->title = convertToUtf8(pos, 30, - "ISO-8859-1"); + "ISO-8859-1"); trim(id3->title); pos += 30; id3->artist = convertToUtf8(pos, 30, - "ISO-8859-1"); + "ISO-8859-1"); trim(id3->artist); pos += 30; id3->album = convertToUtf8(pos, @@ -281,7 +281,7 @@ static int get_id3(const char * data, pos += 30; id3->year = convertToUtf8(pos, 4, - "ISO-8859-1"); + "ISO-8859-1"); trim(id3->year); pos += 4; id3->comment = convertToUtf8(pos, @@ -301,7 +301,7 @@ addkword(EXTRACTOR_KeywordList *oldhead, const char * phrase, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * keyword; - + keyword = malloc(sizeof(EXTRACTOR_KeywordList)); keyword->next = oldhead; keyword->keyword = strdup(phrase); diff --git a/src/plugins/mpegextractor.c b/src/plugins/mpegextractor.c @@ -35,7 +35,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, } /* video/mpeg */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_mpeg_extract(const char * filename, const unsigned char * data, size_t size, @@ -71,17 +71,17 @@ libextractor_mpeg_extract(const char * filename, } addKeyword(&prev, "video/mpeg", - EXTRACTOR_MIMETYPE); + EXTRACTOR_MIMETYPE); if (info->sequence != NULL) { snprintf(format, 256, "%ux%u", - info->sequence->width, + info->sequence->width, info->sequence->height); addKeyword(&prev, format, EXTRACTOR_SIZE); switch (info->sequence->flags & SEQ_VIDEO_FORMAT_UNSPECIFIED) { case SEQ_VIDEO_FORMAT_PAL: addKeyword(&prev, "PAL", EXTRACTOR_FORMAT); break; - case SEQ_VIDEO_FORMAT_NTSC: + case SEQ_VIDEO_FORMAT_NTSC: addKeyword(&prev, "NTSC", EXTRACTOR_FORMAT); break; case SEQ_VIDEO_FORMAT_SECAM: @@ -103,7 +103,7 @@ libextractor_mpeg_extract(const char * filename, often at the beginning of the stream (and we don't iterate over the stream hoping to find one). Hence we usually don't get the size. Not sure how - to *efficiently* get the gop (without scanning + to *efficiently* get the gop (without scanning through the entire file) */ snprintf(format, 256, "%u:%u:%u (%u frames)", info->gop->hours, @@ -113,5 +113,5 @@ libextractor_mpeg_extract(const char * filename, addKeyword(&prev, format, EXTRACTOR_DURATION); } mpeg2_close(handle); - return prev; + return prev; } diff --git a/src/plugins/nsfextractor.c b/src/plugins/nsfextractor.c @@ -1,17 +1,17 @@ /* * This file is part of libextractor. * (C) 2006 Toni Ruottu - * + * * libextractor is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2, or (at your * option) any later version. - * + * * libextractor is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with libextractor; see the file COPYING. If not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c @@ -17,7 +17,7 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - This code makes extensive use of libgsf + This code makes extensive use of libgsf -- the Gnome Structured File Library Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) @@ -54,7 +54,7 @@ addKeyword(EXTRACTOR_KeywordList *oldhead, const char *phrase, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * keyword; - + if (strlen(phrase) == 0) return oldhead; if (0 == strcmp(phrase, "\"\"")) @@ -128,7 +128,7 @@ static Matches tmap[] = { { "dc:description", EXTRACTOR_DESCRIPTION }, { "meta:creation-date", EXTRACTOR_CREATION_DATE }, /* { "meta:editing-duration", EXTRACTOR_TOTAL_EDITING_TIME }, // encoding? */ - { "meta:generator", EXTRACTOR_GENERATOR }, + { "meta:generator", EXTRACTOR_GENERATOR }, { "meta:template", EXTRACTOR_TEMPLATE }, /* { "meta:editing-cycles", EXTRACTOR_EDITING_CYCLES }, // usually "FALSE" */ /* { "msole:codepage", EXTRACTOR_CHARACTER_SET }, */ @@ -149,7 +149,7 @@ static void processMetadata(gpointer key, (value == NULL) ) return; gval = gsf_doc_prop_get_val(prop); - + if (G_VALUE_TYPE(gval) == G_TYPE_STRING) { contents = strdup(g_value_get_string(gval)); } else { @@ -173,15 +173,15 @@ static void processMetadata(gpointer key, contents, tmap[pos].type); #if DEBUG_OLE2 - else + else printf("No match for type `%s'\n", type); #endif - free(contents); + free(contents); } -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * process(GsfInput * in, struct EXTRACTOR_Keywords * prev) { GsfDocMetaData * sections; @@ -198,7 +198,7 @@ process(GsfInput * in, return prev; } -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * processSO(GsfInput * src, struct EXTRACTOR_Keywords * prev) { off_t size; @@ -253,9 +253,9 @@ processSO(GsfInput * src, static const char * lidToLanguage( unsigned int lid ) { switch ( lid ) { - case 0x0400: + case 0x0400: return _("No Proofing"); - case 0x0401: + case 0x0401: return __("Arabic"); case 0x0402: return __("Bulgarian"); @@ -346,7 +346,7 @@ static const char * lidToLanguage( unsigned int lid ) { case 0x0420: return __("Urdu"); case 0x0421: - return __("Bahasa"); + return __("Bahasa"); case 0x0422: return __("Ukrainian"); case 0x0423: @@ -368,19 +368,19 @@ static const char * lidToLanguage( unsigned int lid ) { case 0x0436: return __("Afrikaans"); case 0x043E: - return __("Malayalam"); + return __("Malayalam"); default: return NULL; } } - -static struct EXTRACTOR_Keywords * + +static struct EXTRACTOR_Keywords * history_extract(GsfInput * stream, unsigned int lcbSttbSavedBy, unsigned int fcSttbSavedBy, struct EXTRACTOR_Keywords * prev) { - unsigned int where = 0; + unsigned int where = 0; unsigned char * lbuffer; unsigned int i; unsigned int length; @@ -388,7 +388,7 @@ history_extract(GsfInput * stream, char * filename; char * rbuf; unsigned int nRev; - + // goto offset of revision gsf_input_seek(stream, fcSttbSavedBy, G_SEEK_SET); if (gsf_input_remaining(stream) < lcbSttbSavedBy) @@ -429,7 +429,7 @@ history_extract(GsfInput * stream, EXTRACTOR_REVISION_HISTORY); free(rbuf); } - free(lbuffer); + free(lbuffer); return prev; } @@ -477,7 +477,7 @@ libextractor_ole2_extract(const char * filename, if ( (0 == strcmp(name, "\005SummaryInformation")) || (0 == strcmp(name, "\005DocumentSummaryInformation")) ) { src = gsf_infile_child_by_index (infile, i); - if (src != NULL) + if (src != NULL) prev = process(src, prev); } @@ -518,7 +518,7 @@ libextractor_ole2_extract(const char * filename, } } } - } + } g_object_unref(G_OBJECT(infile)); g_object_unref(G_OBJECT(input)); @@ -537,7 +537,7 @@ libextractor_ole2_extract(const char * filename, if(NULL != generator) { const char * mimetype = "application/vnd.ms-files"; - + if((0 == strncmp(generator, "Microsoft Word", 14)) || (0 == strncmp(generator, "Microsoft Office Word", 21))) mimetype = "application/msword"; @@ -553,10 +553,10 @@ libextractor_ole2_extract(const char * filename, mimetype = "application/vnd.visio"; else if(0 == strncmp(generator, "Microsoft Office", 16)) mimetype = "application/vnd.ms-office"; - + prev = addKeyword(prev, mimetype, EXTRACTOR_MIMETYPE); } - + return prev; } diff --git a/src/plugins/pdf/Stream.cc b/src/plugins/pdf/Stream.cc @@ -1043,7 +1043,7 @@ LZWStream::LZWStream(Stream *strA, int predictor, int columns, int colors, if (! pred->isOk()) { delete pred; pred = NULL; - } + } } else { pred = NULL; } @@ -1295,9 +1295,9 @@ CCITTFaxStream::CCITTFaxStream(Stream *strA, int encodingA, GBool endOfLineA, if (columns < 1) columns = 1; - if (columns + 4 <= 0) - columns = INT_MAX - 4; - + if (columns + 4 <= 0) + columns = INT_MAX - 4; + rows = rowsA; endOfBlock = endOfBlockA; black = blackA; @@ -1316,7 +1316,7 @@ CCITTFaxStream::CCITTFaxStream(Stream *strA, int encodingA, GBool endOfLineA, columns = 0; } refLine = (short *)gmalloc((columns + 3) * sizeof(short)); - codingLine = (short *)gmalloc((columns + 2) * sizeof(short)); + codingLine = (short *)gmalloc((columns + 2) * sizeof(short)); } CCITTFaxStream::~CCITTFaxStream() { @@ -2940,7 +2940,7 @@ GBool DCTStream::readBaselineSOF() { width = read16(); numComps = str->getChar(); if (numComps <= 0 || numComps > 4) { - numComps = 0; + numComps = 0; return gFalse; } @@ -2971,7 +2971,7 @@ GBool DCTStream::readProgressiveSOF() { width = read16(); numComps = str->getChar(); if (numComps <= 0 || numComps > 4) { - numComps = 0; + numComps = 0; return gFalse; } if (prec != 8) { @@ -3085,7 +3085,7 @@ GBool DCTStream::readHuffmanTables() { numACHuffTables = index+1; tbl = &acHuffTables[index]; } else { - index &= 0x0f; + index &= 0x0f; if (index >= numDCHuffTables) numDCHuffTables = index+1; tbl = &dcHuffTables[index]; @@ -3312,10 +3312,10 @@ FlateStream::FlateStream(Stream *strA, int predictor, int columns, FilterStream(strA) { if (predictor != 1) { pred = new StreamPredictor(this, predictor, columns, colors, bits); - if (! pred->isOk()) { + if (! pred->isOk()) { delete pred; pred = NULL; - } + } } else { pred = NULL; } diff --git a/src/plugins/pdf/Stream.h b/src/plugins/pdf/Stream.h @@ -232,7 +232,7 @@ public: int widthA, int nCompsA, int nBitsA); GBool isOk() { return ok; } - + ~StreamPredictor(); int lookChar(); diff --git a/src/plugins/pdf/pdfextractor.cc b/src/plugins/pdf/pdfextractor.cc @@ -87,7 +87,7 @@ extern "C" { * * The following expression might be rewritten as * (! isspace(s[len - 1]) && 0xA0 != s[len - 1]). - * There seem to exist isspace() implementations + * There seem to exist isspace() implementations * which do return non-zero from NBSP (maybe locale-dependent). * Remove ISO-8859 non-breaking space (NBSP, hex value 0xA0) from * the expression if it looks suspicious (locale issues for instance). diff --git a/src/plugins/pdfextractor.c b/src/plugins/pdfextractor.c @@ -47,7 +47,7 @@ static char * stndup(const char * str, return tmp; } -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, char * keyword, struct EXTRACTOR_Keywords * next) { @@ -64,7 +64,7 @@ addKeyword(EXTRACTOR_KeywordType type, -static unsigned char * +static unsigned char * dateDecode(const char * pdfString) { if (pdfString == NULL) return NULL; @@ -73,7 +73,7 @@ dateDecode(const char * pdfString) { return (unsigned char*) stndup(&pdfString[3], strlen(pdfString) - 4); } -static unsigned char * +static unsigned char * stringDecode(const char * pdfString, size_t * size) { size_t slen; @@ -89,7 +89,7 @@ stringDecode(const char * pdfString, return NULL; switch (pdfString[0]) { case '(': - if (pdfString[slen-1] != ')') + if (pdfString[slen-1] != ')') return NULL; ret = malloc(slen); w = 0; @@ -146,7 +146,7 @@ stringDecode(const char * pdfString, } else { free(ret); return NULL; /* invalid! */ - } + } break; } default: /* invalid */ @@ -184,7 +184,7 @@ stringDecode(const char * pdfString, return NULL; } -static char * +static char * charsetDecode(const unsigned char * in, size_t size) { if (in == NULL) @@ -198,7 +198,7 @@ charsetDecode(const unsigned char * in, return convertToUtf8((const char*) in, size, "CSISOLATIN1"); - } else { + } else { return convertToUtf8((const char*) &in[2], size - 2, "UTF-16BE"); @@ -237,11 +237,11 @@ static struct { #define IS_NL(c) ((c == '\n') || (c == '\r')) #ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif #define SKIP(k,p,b,s) while ( (p<s) && (NULL != strchr(k, b[p])) ) p++; -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_pdf_extract(const char * filename, const char * data, size_t size, @@ -270,7 +270,7 @@ libextractor_pdf_extract(const char * filename, return prev; if (0 != memcmp(data, PDF_HEADER, strlen(PDF_HEADER))) return prev; - if (0 != memcmp(&data[size - strlen(PDF_EOF)], PDF_EOF, strlen(PDF_EOF))) + if (0 != memcmp(&data[size - strlen(PDF_EOF)], PDF_EOF, strlen(PDF_EOF))) return prev; /* PDF format is pretty much sure by now */ memcpy(buf, @@ -286,20 +286,20 @@ libextractor_pdf_extract(const char * filename, prev); - + pos = size - strlen(PDF_EOF) - strlen(PDF_SXR); steps = 0; while ( (steps++ < MAX_STEPS) && (pos > 0) && - (0 != memcmp(&data[pos], PDF_SXR, strlen(PDF_SXR))) ) + (0 != memcmp(&data[pos], PDF_SXR, strlen(PDF_SXR))) ) pos--; if (0 != memcmp(&data[pos], PDF_SXR, strlen(PDF_SXR))) { /* cross reference streams not yet supported! */ - return prev; + return prev; } memcpy(buf, &data[pos + strlen(PDF_SXR)], steps); buf[steps] = '\0'; - if (1 != sscanf(buf, "%llu", &startxref)) + if (1 != sscanf(buf, "%llu", &startxref)) return prev; if (startxref >= size - strlen(PDF_XREF)) return prev; @@ -313,13 +313,13 @@ libextractor_pdf_extract(const char * filename, pos++; memcpy(buf, &data[pos], MIN(MAX_STEPS, size - pos)); buf[MIN(MAX_STEPS,size-pos)] = '\0'; - if (2 != sscanf(buf, "%u %u", &xstart, &xcount)) + if (2 != sscanf(buf, "%u %u", &xstart, &xcount)) break; while ( (pos < size) && (! IS_NL(data[pos])) ) pos++; if ( (pos < size) && IS_NL(data[pos])) pos++; - xrefpos = 20 * xcount + pos; + xrefpos = 20 * xcount + pos; if ( (xrefpos >= size) || (xrefpos < pos) ) return prev; /* invalid xref size */ haveValidXref = 1; @@ -330,7 +330,7 @@ libextractor_pdf_extract(const char * filename, return prev; if (0 != memcmp(&data[pos], PDF_TRAILER, - strlen(PDF_TRAILER))) + strlen(PDF_TRAILER))) return prev; pos += strlen(PDF_TRAILER); @@ -344,8 +344,8 @@ libextractor_pdf_extract(const char * filename, (! IS_NL(data[pos]) ) ) { if ( (data[pos] == '>') && (pos + 1 < size) && - (data[pos+1] == '>') ) - return prev; /* no info */ + (data[pos+1] == '>') ) + return prev; /* no info */ pos++; } while ( (pos < size) && @@ -355,7 +355,7 @@ libextractor_pdf_extract(const char * filename, (pos + strlen(PDF_INFO) < size) && (0 == memcmp(&data[pos], PDF_INFO, - strlen(PDF_INFO))) ) ) + strlen(PDF_INFO))) ) ) return prev; pos += strlen(PDF_INFO); @@ -368,10 +368,10 @@ libextractor_pdf_extract(const char * filename, buf[i] = '\0'; break; } - if (1 != sscanf(buf, "%u", &xinfo)) + if (1 != sscanf(buf, "%u", &xinfo)) return prev; - haveValidXref = 0; + haveValidXref = 0; /* now go find xinfo in xref table */ xrefpos = startxref + strlen(PDF_XREF); while (1) { @@ -380,7 +380,7 @@ libextractor_pdf_extract(const char * filename, pos++; memcpy(buf, &data[pos], MIN(MAX_STEPS, size - pos)); buf[MIN(MAX_STEPS,size-pos)] = '\0'; - if (2 != sscanf(buf, "%u %u", &xstart, &xcount)) + if (2 != sscanf(buf, "%u %u", &xstart, &xcount)) break; while ( (pos < size) && (! IS_NL(data[pos])) ) pos++; @@ -392,17 +392,17 @@ libextractor_pdf_extract(const char * filename, pos += 20 * xinfo - xstart; memcpy(buf, &data[pos], 20); buf[20] = '\0'; - sscanf(buf, "%10llu %*5u %*c", &info_offset); + sscanf(buf, "%10llu %*5u %*c", &info_offset); break; } - xrefpos = 20 * xcount + pos; + xrefpos = 20 * xcount + pos; if ( (xrefpos >= size) || (xrefpos < pos) ) return prev; /* invalid xref size */ } if (! haveValidXref) return prev; pos = info_offset; - + while ( (pos < size - 4) && (! ( (data[pos] == '<') && (data[pos+1] == '<') ) ) ) @@ -412,9 +412,9 @@ libextractor_pdf_extract(const char * filename, return prev; if ( (data[pos] == ' ') || (data[pos] == 10) || - (data[pos] == 13) ) + (data[pos] == 13) ) pos++; - + while ( (pos < size - 2) && ( ! ( (data[pos] == '>') && (data[pos+1] == '>') ) ) ) { diff --git a/src/plugins/printable/bloomfilter.h b/src/plugins/printable/bloomfilter.h @@ -270,7 +270,7 @@ static unsigned char sha1_padding[64] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static void sha1_finish(struct sha1_context *ctx, +static void sha1_finish(struct sha1_context *ctx, unsigned char digest[20] ) { unsigned int last, padn; diff --git a/src/plugins/printable/dictionary-builder.c b/src/plugins/printable/dictionary-builder.c @@ -123,7 +123,7 @@ int main(int argc, memset(&line[0], 0, 2048); fscanf(dictin, "%s", (char*)&line); charset = strdup(line); /* not used (yet) */ - while (1 == fscanf(dictin, "%s", (char*)&line)) { + while (1 == fscanf(dictin, "%s", (char*)&line)) { words[cnt] = strdup(line); cnt++; memset(&line[0], 0, 2048); @@ -160,7 +160,7 @@ int main(int argc, FILE * btfile; snprintf(fn, 64, "%s_%d.c", argv[1], j); - btfile = fopen(fn, "w+"); + btfile = fopen(fn, "w+"); if (btfile == NULL) { fprintf(stderr, _("Error opening file `%s': %s\n"), diff --git a/src/plugins/printable/printableextractor.h b/src/plugins/printable/printableextractor.h @@ -69,8 +69,8 @@ static void testBitCallback(Bloomfilter * bf, int * arg = cls; if (! testBit(bf->sbitArray, bf->bitArraySize, - bit)) - *arg = 0; + bit)) + *arg = 0; } /** * Test if an element is in the filter. @@ -127,7 +127,7 @@ static int wordTest(char * word, HashCode160 hc; char * lower; - if (strlen(word) <= (int) (*strlenthreshold)) + if (strlen(word) <= (int) (*strlenthreshold)) return 0; for (i=strlen(word)-1;i>=0;i--) if (isdigit(word[i])) @@ -448,7 +448,7 @@ static char * blacklist[] = { what we are doing here. EXTRACT_FUNC_NAME is set by Makefile.am to reflect the library that this code module is getting compiled into. */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * EXTRACT_NAME (const char * filename, const char * data, size_t size, diff --git a/src/plugins/qtextractor.c b/src/plugins/qtextractor.c @@ -116,8 +116,8 @@ static unsigned int getAtomHeaderSize(const char * buf) { const Atom * atom; atom = (const Atom*) buf; - if (ntohl(atom->size) == 1) - return sizeof(const LongAtom); + if (ntohl(atom->size) == 1) + return sizeof(const LongAtom); return sizeof(Atom); } @@ -172,7 +172,7 @@ static int moovHandler(const char * input, size_t pos, struct EXTRACTOR_Keywords ** list) { unsigned int hdr = getAtomHeaderSize(&input[pos]); - return processAllAtoms(&input[pos+hdr], + return processAllAtoms(&input[pos+hdr], getAtomSize(&input[pos]) - hdr, list); } @@ -184,7 +184,7 @@ typedef struct { /* minor version */ unsigned int version; /* compatible brands */ - char compatibility[4]; + char compatibility[4]; } FileType; typedef struct { @@ -225,10 +225,10 @@ static int ftypHandler(const char * input, while ( (ftMap[i].ext != NULL) && (0 != memcmp(ft->type, ftMap[i].ext, 4)) ) i++; - if (ftMap[i].ext != NULL) + if (ftMap[i].ext != NULL) addKeyword(EXTRACTOR_MIMETYPE, ftMap[i].mime, - list); + list); return 1; } @@ -247,7 +247,7 @@ typedef struct { scale units. */ unsigned int duration; unsigned int preferredRate; - /* A 16-bit fixed-point number that specifies how loud to + /* A 16-bit fixed-point number that specifies how loud to play. 1.0 indicates full volume */ unsigned short preferredVolume; unsigned char reserved[10]; @@ -292,7 +292,7 @@ static int cmovHandler(const char * input, const CompressedMovieHeaderAtom * c; unsigned int s; char * buf; - int ret; + int ret; z_stream z_state; int z_ret_code; @@ -313,7 +313,7 @@ static int cmovHandler(const char * input, buf = malloc(s); if (buf == NULL) return 1; /* out of memory, handle gracefully */ - + z_state.next_in = (unsigned char*) &c[1]; z_state.avail_in = ntohl(c->cmvdAtom.size); z_state.avail_out = s; @@ -384,10 +384,10 @@ static int tkhdHandler(const char * input, m = (const TrackAtom* ) &input[pos]; if (ntohs(m->track_width.integer) != 0) { /* if actually a/the video track */ - snprintf(dimensions, - 40, - "%dx%d", - ntohs(m->track_width.integer), + snprintf(dimensions, + 40, + "%dx%d", + ntohs(m->track_width.integer), ntohs(m->track_height.integer)); addKeyword(EXTRACTOR_FORMAT, dimensions, @@ -401,7 +401,7 @@ static int trakHandler(const char * input, size_t pos, struct EXTRACTOR_Keywords ** list) { unsigned int hdr = getAtomHeaderSize(&input[pos]); - return processAllAtoms(&input[pos+hdr], + return processAllAtoms(&input[pos+hdr], getAtomSize(&input[pos]) - hdr, list); } @@ -413,7 +413,7 @@ static int metaHandler(const char * input, unsigned int hdr = getAtomHeaderSize(&input[pos]); if (getAtomSize(&input[pos]) < hdr + 4) return 0; - return processAllAtoms(&input[pos+hdr+4], + return processAllAtoms(&input[pos+hdr+4], getAtomSize(&input[pos]) - hdr - 4, list); } @@ -563,7 +563,7 @@ static int processTextTag(const char * input, addKeyword(EXTRACTOR_LANGUAGE, languages[lang], list); - /* TODO: what is the character set encoding here? + /* TODO: what is the character set encoding here? For now, let's assume it is Utf-8 (cannot find anything in the public documentation) */ meta = malloc(len + 1); @@ -597,7 +597,7 @@ static CHE cHm[] = { { "des", EXTRACTOR_DESCRIPTION, }, { "dis", EXTRACTOR_DISCLAIMER, }, { "dir", EXTRACTOR_MOVIE_DIRECTOR, }, - { "src", EXTRACTOR_CONTRIBUTOR, }, + { "src", EXTRACTOR_CONTRIBUTOR, }, { "prf", EXTRACTOR_ARTIST, }, /* performer */ { "req", EXTRACTOR_CREATED_FOR, }, /* hardware requirements */ { "fmt", EXTRACTOR_FORMAT, }, @@ -614,8 +614,8 @@ static CHE cHm[] = { { "ed6", EXTRACTOR_REVISION_HISTORY, }, { "ed7", EXTRACTOR_REVISION_HISTORY, }, { "ed8", EXTRACTOR_REVISION_HISTORY, }, - { "ed9", EXTRACTOR_REVISION_HISTORY, }, - { "chp", EXTRACTOR_CHAPTER, }, + { "ed9", EXTRACTOR_REVISION_HISTORY, }, + { "chp", EXTRACTOR_CHAPTER, }, { NULL, EXTRACTOR_UNKNOWN }, }; @@ -643,7 +643,7 @@ static int udtaHandler(const char * input, size_t pos, struct EXTRACTOR_Keywords ** list) { unsigned int hdr = getAtomHeaderSize(&input[pos]); - return processAllAtoms(&input[pos+hdr], + return processAllAtoms(&input[pos+hdr], getAtomSize(&input[pos]) - hdr, list); } @@ -723,11 +723,11 @@ static int handleAtom(const char * input, #endif return -1; } - i = handlers[i].handler(input, size, pos, list); + i = handlers[i].handler(input, size, pos, list); #if DEBUG printf("Running handler for `%4s' at %u completed with result %d\n", &input[pos + 4], - pos, + pos, i); #endif return i; @@ -738,7 +738,7 @@ static int handleAtom(const char * input, video/x-quicktime: mov,qt: Quicktime animation; application/x-quicktimeplayer: qtl: Quicktime list; */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_qt_extract(const char * filename, const char * data, size_t size, diff --git a/src/plugins/sidextractor.c b/src/plugins/sidextractor.c @@ -28,13 +28,13 @@ addkword(EXTRACTOR_KeywordList *oldhead, const char * phrase, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * keyword; - + keyword = malloc(sizeof(EXTRACTOR_KeywordList)); keyword->next = oldhead; keyword->keyword = strdup(phrase); keyword->keywordType = type; return keyword; -} +} /* "extract" keyword from a SID file @@ -116,7 +116,7 @@ libextractor_sid_extract(const char * filename, return prev; } - /* Version 2 specific options follow + /* Version 2 specific options follow * * Note: Had some troubles understanding specification * on the flags in version 2. I hope this is correct. diff --git a/src/plugins/splitextractor.c b/src/plugins/splitextractor.c @@ -72,9 +72,9 @@ static void splitKeywords(const char * keyword, (pos < len) ) pos++; dp[pos++] = '\0'; - if (pos - last > MINIMUM_KEYWORD_LENGTH) - addKeyword(list, - &dp[last]); + if (pos - last > MINIMUM_KEYWORD_LENGTH) + addKeyword(list, + &dp[last]); while ( (1 == token(dp[pos], options)) && (pos < len) ) pos++; @@ -96,7 +96,7 @@ libextractor_split_extract(const char * filename, options = TOKENIZERS; pos = prev; while (pos != NULL) { - splitKeywords(pos->keyword, + splitKeywords(pos->keyword, &prev, options); pos = pos->next; diff --git a/src/plugins/tarextractor.c b/src/plugins/tarextractor.c @@ -154,7 +154,7 @@ tar_isnonzero(const char *data, return 1; total++; } - + return 0; } @@ -366,7 +366,7 @@ libextractor_tar_extract(const char * filename, && (checksum_stored != (unsigned long long) checksum_computed_500s) && (checksum_stored != (unsigned long long) checksum_computed_500u) ) break; - + tar = (const TarHeader*) &data[pos]; typeFlag = tar->link; pos += TAR_HEADER_SIZE; @@ -454,7 +454,7 @@ libextractor_tar_extract(const char * filename, /* * Locate the file names. */ - if ( (0 != (format_member & TAR_POSIX2001_FORMAT)) + if ( (0 != (format_member & TAR_POSIX2001_FORMAT)) && (('x' == typeFlag) || ('X' == typeFlag)) ) { if(size <= pos) @@ -490,15 +490,15 @@ libextractor_tar_extract(const char * filename, if( (keylength > (valptr - keyptr) + 4 + 2) && (0 == memcmp(valptr, "GNU.", 4)) ) - format_archive |= TAR_GNU2004_FORMAT; + format_archive |= TAR_GNU2004_FORMAT; else if( (keylength > (valptr - keyptr) + 7 + 2) && (0 == memcmp(valptr, "SCHILY.", 7)) ) - format_archive |= TAR_SCHILLING2001_FORMAT; + format_archive |= TAR_SCHILLING2001_FORMAT; else if( (keylength > (valptr - keyptr) + 4 + 2) && (0 == memcmp(valptr, "SUN.", 4)) ) - format_archive |= TAR_SOLARIS2001_FORMAT; + format_archive |= TAR_SOLARIS2001_FORMAT; } keyptr += keylength; @@ -507,7 +507,7 @@ libextractor_tar_extract(const char * filename, break; } } - + if ( (NULL != nameptr) && (0 != *nameptr) && ((size - (nameptr - data)) >= namelength) && (1 < namelength) ) { if (NULL != fname) @@ -577,7 +577,7 @@ libextractor_tar_extract(const char * filename, */ size_t diffpos = 0; fsize += TAR_HEADER_SIZE; - + while ( (pos + diffpos + TAR_HEADER_SIZE < size) && (0 != *(data + pos + diffpos + 504)) ) { diffpos += TAR_HEADER_SIZE; diff --git a/src/plugins/thumbnailextractorqt.cc b/src/plugins/thumbnailextractorqt.cc @@ -48,7 +48,7 @@ char *argv; void __attribute__ ((constructor)) thumnailextractorqt_init(void) { int argc = 0; - + argv = strdup(""); app = qApp ? NULL : new QApplication(argc, &argv); } @@ -157,13 +157,13 @@ struct EXTRACTOR_Keywords * libextractor_thumbnailqt_extract(const char * filena /* Render SVG image */ QSvgRenderer svg; QSize size; - + if (! svg.load(QByteArray((const char *) data))) return prev; size = svg.defaultSize(); img = new QImage(size, QImage::Format_ARGB32); - + QPainter painter(img); painter.setViewport(0, 0, size.width(), size.height()); painter.eraseRect(0, 0, size.width(), size.height()); @@ -177,7 +177,7 @@ struct EXTRACTOR_Keywords * libextractor_thumbnailqt_extract(const char * filena img = new QImage(); img->loadFromData(data, size); } - + height = img->height(); width = img->width(); format = (char *) malloc(64); @@ -194,7 +194,7 @@ struct EXTRACTOR_Keywords * libextractor_thumbnailqt_extract(const char * filena if (width == 0) width = 1; - /* Change color depth */ + /* Change color depth */ QImage thumb = img->convertToFormat(colors); delete img; @@ -212,14 +212,14 @@ struct EXTRACTOR_Keywords * libextractor_thumbnailqt_extract(const char * filena height /= 2; if (height < THUMBSIZE) height = THUMBSIZE; - + thumb = thumb.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); - + if (width == THUMBSIZE && height == THUMBSIZE) break; } - + buffer.setBuffer(&bytes); buffer.open(QIODevice::WriteOnly); thumb.save(&buffer, "PNG");