libextractor

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

commit 1c28cb2260c09ddefde567313b8f54161bd3b969
parent 20d2e51022f79e021a0ad27b97ac41d9543337ea
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 20 Mar 2005 23:56:28 +0000

removing tailing whitespace

Diffstat:
Mdoc/demux_asf.c | 68++++++++++++++++++++++++++++++++++----------------------------------
Mdoc/demux_nsf.c | 6+++---
Mdoc/demux_qt.c | 128++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mdoc/demux_wc3movie.c | 30+++++++++++++++---------------
Mdoc/lj/addkeyword.c | 2+-
Mdoc/lj/minimal.c | 8++++----
Mdoc/lj/signature.c | 2+-
Mlibltdl/ltdl.c | 46+++++++++++++++++++++++-----------------------
Msrc/include/extractor.h | 24++++++++++++------------
Msrc/include/gettext.h | 4++--
Msrc/include/platform.h | 2+-
Msrc/include/winproc.h | 4++--
Msrc/main/extract.c | 36++++++++++++++++++------------------
Msrc/main/extractor.c | 102++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/main/iconv.c | 6+++---
Msrc/main/libextractor_python.c | 12++++++------
Msrc/main/winproc.c | 172++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/asfextractor.c | 48++++++++++++++++++++++++------------------------
Msrc/plugins/convert.c | 4++--
Msrc/plugins/debextractor.c | 36++++++++++++++++++------------------
Msrc/plugins/dviextractor.c | 16++++++++--------
Msrc/plugins/elfextractor.c | 76++++++++++++++++++++++++++++++++++++++--------------------------------------
Msrc/plugins/filenameextractor.c | 4++--
Msrc/plugins/gifextractor.c | 22+++++++++++-----------
Msrc/plugins/hash/md5extractor.c | 12++++++------
Msrc/plugins/hash/rmd160extractor.c | 8++++----
Msrc/plugins/hash/sha1extractor.c | 12++++++------
Msrc/plugins/htmlextractor.c | 360++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/id3v23extractor.c | 12++++++------
Msrc/plugins/id3v24extractor.c | 12++++++------
Msrc/plugins/id3v2extractor.c | 8++++----
Msrc/plugins/jpegextractor.c | 30+++++++++++++++---------------
Msrc/plugins/lowerextractor.c | 2+-
Msrc/plugins/manextractor.c | 28++++++++++++++--------------
Msrc/plugins/mimeextractor.c | 28++++++++++++++--------------
Msrc/plugins/mp3extractor.c | 188++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/mpegextractor.c | 24++++++++++++------------
Msrc/plugins/oggextractor.c | 28++++++++++++++--------------
Msrc/plugins/ole2/gsf-impl-utils.h | 2+-
Msrc/plugins/ole2/gsf-infile-impl.h | 2+-
Msrc/plugins/ole2/gsf-infile-msole.c | 10+++++-----
Msrc/plugins/ole2/gsf-infile-msole.h | 2+-
Msrc/plugins/ole2/gsf-infile.h | 2+-
Msrc/plugins/ole2/gsf-input-memory.c | 2+-
Msrc/plugins/ole2/gsf-input.c | 10+++++-----
Msrc/plugins/ole2/gsf-msole-impl.h | 2+-
Msrc/plugins/ole2/gsf-shared-memory.c | 2+-
Msrc/plugins/ole2/gsf-utils.c | 2+-
Msrc/plugins/ole2/gsf-utils.h | 2+-
Msrc/plugins/ole2/gsf.h | 4++--
Msrc/plugins/ole2/ole2extractor.c | 214++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/oo/ooextractor.c | 22+++++++++++-----------
Msrc/plugins/pack.c | 84++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/pack.h | 8++++----
Msrc/plugins/pdf/Decrypt.cc | 4++--
Msrc/plugins/pdf/FontEncoding.cc | 2+-
Msrc/plugins/pdf/Stream.cc | 6+++---
Msrc/plugins/pdf/gfile.cc | 2+-
Msrc/plugins/pdf/pdfextractor.cc | 66+++++++++++++++++++++++++++++++++---------------------------------
Msrc/plugins/pngextractor.c | 32++++++++++++++++----------------
Msrc/plugins/printable/bloomfilter.c | 26+++++++++++++-------------
Msrc/plugins/printable/bloomfilter.h | 4++--
Msrc/plugins/printable/dictionary-builder.c | 26+++++++++++++-------------
Msrc/plugins/printable/printableextractor.c | 36++++++++++++++++++------------------
Msrc/plugins/printable/sha1.c | 6+++---
Msrc/plugins/psextractor.c | 38+++++++++++++++++++-------------------
Msrc/plugins/qtextractor.c | 100++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/realextractor.c | 98++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/riffextractor.c | 30+++++++++++++++---------------
Msrc/plugins/rpm/rpmextractor.c | 82++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/plugins/splitextractor.c | 2+-
Msrc/plugins/tarextractor.c | 16++++++++--------
Msrc/plugins/templateextractor.c | 2+-
Msrc/plugins/thumbnail/thumbnailextractor.c | 34+++++++++++++++++-----------------
Msrc/plugins/tiffextractor.c | 22+++++++++++-----------
Msrc/plugins/wavextractor.c | 38+++++++++++++++++++-------------------
Msrc/test/keywordlisttest.c | 4++--
Msrc/test/multiload.c | 2+-
Msrc/test/plugintest.c | 8++++----
Msrc/test/trivialtest.c | 2+-
80 files changed, 1334 insertions(+), 1334 deletions(-)

diff --git a/doc/demux_asf.c b/doc/demux_asf.c @@ -93,7 +93,7 @@ typedef struct demux_asf_s { uint32_t packet_size; uint8_t packet_flags; uint32_t data_size; - + asf_stream_t streams[MAX_NUM_STREAMS]; uint32_t bitrates[MAX_NUM_STREAMS]; int num_streams; @@ -144,7 +144,7 @@ typedef struct demux_asf_s { off_t header_size; int buf_flag_seek; - + /* first packet position */ int64_t first_packet_pos; @@ -172,7 +172,7 @@ static uint8_t get_byte (demux_asf_t *this) { /* printf ("%02x ", buf); */ if (i != 1) { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: end of data\n"); this->status = DEMUX_FINISHED; } @@ -190,7 +190,7 @@ static uint16_t get_le16 (demux_asf_t *this) { /* printf (" [%02x %02x] ", buf[0], buf[1]); */ if (i != 2) { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: end of data\n"); this->status = DEMUX_FINISHED; } @@ -208,7 +208,7 @@ static uint32_t get_le32 (demux_asf_t *this) { /* printf ("%02x %02x %02x %02x ", buf[0], buf[1], buf[2], buf[3]); */ if (i != 4) { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: end of data\n"); this->status = DEMUX_FINISHED; } @@ -224,12 +224,12 @@ static uint64_t get_le64 (demux_asf_t *this) { i = this->input->read (this->input, buf, 8); if (i != 8) { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: end of data\n"); this->status = DEMUX_FINISHED; } - return (uint64_t) buf[0] + return (uint64_t) buf[0] | ((uint64_t) buf[1] << 8) | ((uint64_t) buf[2] << 16) | ((uint64_t) buf[3] << 24) @@ -249,7 +249,7 @@ static int get_guid (demux_asf_t *this) { for(i = 0; i < 8; i++) { g.v4[i] = get_byte(this); } - + for (i = 1; i < GUID_END; i++) { if (!memcmp(&g, &guids[i].guid, sizeof(GUID))) { #ifdef LOG @@ -258,8 +258,8 @@ static int get_guid (demux_asf_t *this) { return i; } } - - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: unknown GUID: 0x%x, 0x%x, 0x%x, " "{ 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx }\n", g.v1, g.v2, g.v3, @@ -339,7 +339,7 @@ static int asf_read_header (demux_asf_t *this) { guid = get_guid(this); if (guid != GUID_ASF_HEADER) { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: file doesn't start with an asf header\n"); return 0; } @@ -440,7 +440,7 @@ static int asf_read_header (demux_asf_t *this) { this->reorder_w = (buffer[2]<<8)|buffer[1]; this->reorder_b = (buffer[4]<<8)|buffer[3]; this->reorder_w /= this->reorder_b; - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: audio conceal interleave detected (%d x %d x %d)\n", this->reorder_w, this->reorder_h, this->reorder_b ); } else { @@ -763,13 +763,13 @@ static void check_newpts (demux_asf_t *this, int64_t pts, int video, int frame_e #endif } } - + this->last_frame_pts = pts; } } -static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, +static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, int frag_offset, int seq, int64_t timestamp, int frag_len, int payload_size) { @@ -782,7 +782,7 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, /* new packet */ stream->seq = seq; } else { - if (seq == stream->seq && + if (seq == stream->seq && frag_offset == stream->frag_offset) { /* continuing packet */ } else { @@ -799,19 +799,19 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, } } - + while( frag_len ) { if ( frag_len < stream->fifo->buffer_pool_buf_size ) bufsize = frag_len; else bufsize = stream->fifo->buffer_pool_buf_size; - + buf = stream->fifo->buffer_pool_alloc (stream->fifo); this->input->read (this->input, buf->content, bufsize); buf->extra_info->input_pos = this->input->get_current_pos (this->input); if (this->rate) - buf->extra_info->input_time = (int)((int64_t)buf->extra_info->input_pos + buf->extra_info->input_time = (int)((int64_t)buf->extra_info->input_pos * 1000 / this->rate); else buf->extra_info->input_time = 0; @@ -827,13 +827,13 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, buf->type = stream->buf_type; buf->size = bufsize; timestamp = 0; - + stream->frag_offset += bufsize; frag_len -= bufsize; package_done = (stream->frag_offset == payload_size); - if ((buf->type & BUF_MAJOR_MASK) == BUF_VIDEO_BASE) + if ((buf->type & BUF_MAJOR_MASK) == BUF_VIDEO_BASE) check_newpts (this, buf->pts, PTS_VIDEO, package_done); else check_newpts (this, buf->pts, PTS_AUDIO, package_done); @@ -1000,7 +1000,7 @@ static void asf_read_packet(demux_asf_t *this) { this->input->seek (this->input, this->packet_size_left, SEEK_CUR); if (!asf_get_packet(this)) { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: get_packet failed\n"); this->status = DEMUX_FINISHED; return ; @@ -1008,7 +1008,7 @@ static void asf_read_packet(demux_asf_t *this) { if (this->packet_padsize > this->packet_size) { /* skip packet */ - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: invalid padsize: %d\n", this->packet_padsize); this->frame = this->nb_frames - 1; return; @@ -1066,7 +1066,7 @@ static void asf_read_packet(demux_asf_t *this) { case 3: seq = get_le32(this); s_hdr_size += 4; break; default: - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: seq=0\n"); seq = 0; } @@ -1079,7 +1079,7 @@ static void asf_read_packet(demux_asf_t *this) { case 3: frag_offset = get_le32(this); s_hdr_size += 4; break; default: - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: frag_offset=0\n"); frag_offset = 0; } @@ -1101,7 +1101,7 @@ static void asf_read_packet(demux_asf_t *this) { if (rlen > this->packet_size_left) { /* skip packet */ - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: invalid rlen %d\n", rlen); this->frame = this->nb_frames - 1; return; @@ -1148,7 +1148,7 @@ static void asf_read_packet(demux_asf_t *this) { if (data_length > this->packet_size_left) { /* skip packet */ - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: invalid data_length\n"); this->frame = this->nb_frames - 1; return; @@ -1196,7 +1196,7 @@ static void asf_read_packet(demux_asf_t *this) { this->input->seek (this->input, rlen - 8, SEEK_CUR); s_hdr_size += rlen - 8; } else { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: strange rlen %d\n", rlen); timestamp = 0; payload_size = 0; @@ -1232,7 +1232,7 @@ static void asf_read_packet(demux_asf_t *this) { if (frag_len > this->packet_size_left) { /* skip packet */ - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: invalid frag_len %d\n", frag_len); this->frame = this->nb_frames - 1; return; @@ -1313,7 +1313,7 @@ static int demux_asf_parse_http_references( demux_asf_t *this) { if (!strncmp(href, "http", 4)) { memcpy(href, "mmsh", 4); } - if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG) printf("demux_asf: http ref: %s\n", href); uevent.type = XINE_EVENT_MRL_REFERENCE; uevent.stream = this->stream; @@ -1376,7 +1376,7 @@ static int demux_asf_parse_asf_references( demux_asf_t *this) { } } - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf("demux_asf: asf ref: %s\n", ptr); uevent.type = XINE_EVENT_MRL_REFERENCE; uevent.stream = this->stream; @@ -1601,7 +1601,7 @@ static void demux_asf_send_headers (demux_plugin_t *this_gen) { if (!asf_read_header (this)) { - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf ("demux_asf: asf_read_header failed.\n"); this->status = DEMUX_FINISHED; @@ -1634,7 +1634,7 @@ static void demux_asf_send_headers (demux_plugin_t *this_gen) { stream_id = this->streams[i].stream_id; bitrate = this->bitrates[stream_id]; - if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_LOG) printf("demux_asf: stream: %d, bitrate %d bps\n", stream_id, bitrate); if ((buf_type == BUF_VIDEO_BASE) && (bitrate > max_vrate || this->video_stream_id == 0)) { @@ -1659,7 +1659,7 @@ static void demux_asf_send_headers (demux_plugin_t *this_gen) { this->stream->stream_info[XINE_STREAM_INFO_BITRATE] = bitrate; - if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf("demux_asf: video stream_id: %d, audio stream_id: %d\n", this->video_stream_id, this->audio_stream_id); @@ -1821,7 +1821,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, break; default: - printf ("demux_asf: warning, unkown method %d\n", + printf ("demux_asf: warning, unkown method %d\n", stream->content_detection_method); return NULL; } diff --git a/doc/demux_nsf.c b/doc/demux_nsf.c @@ -20,7 +20,7 @@ * NSF File "Demuxer" by Mike Melanson (melanson@pcisys.net) * This is really just a loader for NES Music File Format (extension NSF) * which loads an entire NSF file and passes it over to the NSF audio - * decoder. + * decoder. * * After the file is sent over, the demuxer controls the playback by * sending empty buffers with incrementing pts values. @@ -175,7 +175,7 @@ static int demux_nsf_send_chunk(demux_plugin_t *this_gen) { buf->decoder_info[1] = this->current_song; this->new_song = 0; - sprintf(title, "%s, song %d/%d", + sprintf(title, "%s, song %d/%d", this->title, this->current_song, this->total_songs); if (this->stream->meta_info[XINE_META_INFO_TITLE]) free (this->stream->meta_info[XINE_META_INFO_TITLE]); @@ -316,7 +316,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str demux_nsf_t *this; if (! (input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) { - if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) printf(_("demux_nsf.c: input not seekable, can not handle!\n")); return NULL; } diff --git a/doc/demux_qt.c b/doc/demux_qt.c @@ -221,7 +221,7 @@ typedef struct { /* flags that indicate how a trak is supposed to be used */ unsigned int flags; - + /* decoder data pass information to the AAC decoder */ void *decoder_config; int decoder_config_len; @@ -267,7 +267,7 @@ typedef struct { unsigned int modification_time; unsigned int timescale; /* base clock frequency is Hz */ unsigned int duration; - + int64_t moov_first_offset; int trak_count; @@ -335,7 +335,7 @@ typedef struct { * lazyqt special debugging functions **********************************************************************/ -/* define DEBUG_ATOM_LOAD as 1 to get a verbose parsing of the relevant +/* define DEBUG_ATOM_LOAD as 1 to get a verbose parsing of the relevant * atoms */ #define DEBUG_ATOM_LOAD 0 @@ -357,7 +357,7 @@ typedef struct { /* Define DEBUG_DUMP_MOOV as 1 to dump the raw moov atom to disk. This is * particularly useful in debugging a file with a compressed moov (cmov) - * atom. The atom will be dumped to the filename specified as + * atom. The atom will be dumped to the filename specified as * RAW_MOOV_FILENAME. */ #define DEBUG_DUMP_MOOV 0 #define RAW_MOOV_FILENAME "moovatom.raw" @@ -637,7 +637,7 @@ static int is_qt_file(input_plugin_t *qt_file) { return 0; } else { /* check that the next atom in the chunk contains alphanumeric - * characters in the atom type field; if not, disqualify the file + * characters in the atom type field; if not, disqualify the file * as a QT file */ qt_file->seek(qt_file, moov_atom_offset + ATOM_PREAMBLE_SIZE, SEEK_SET); if (qt_file->read(qt_file, atom_preamble, ATOM_PREAMBLE_SIZE) != @@ -665,7 +665,7 @@ static void parse_mvhd_atom(qt_info *info, unsigned char *mvhd_atom) { static int mp4_read_descr_len(unsigned char *s, uint32_t *length) { uint8_t b; uint8_t numBytes = 0; - + *length = 0; do { @@ -741,7 +741,7 @@ static qt_error parse_trak_atom (qt_trak *trak, break; } } - + debug_atom_load(" qt: parsing %s trak atom\n", (trak->type == MEDIA_VIDEO) ? "video" : (trak->type == MEDIA_AUDIO) ? "audio" : "other"); @@ -762,7 +762,7 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->properties.video.width = BE_16(&trak_atom[i + 0x50]); trak->properties.video.height = - BE_16(&trak_atom[i + 0x54]); + BE_16(&trak_atom[i + 0x54]); } } } else if (current_atom == ELST_ATOM) { @@ -837,7 +837,7 @@ static qt_error parse_trak_atom (qt_trak *trak, * fix at the end of the stsd parser */ i += hack_adjust; } - + if (trak->type == MEDIA_VIDEO) { /* initialize to sane values */ @@ -849,7 +849,7 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->properties.video.palette_count = 0; /* fetch video parameters */ - if( BE_16(&trak_atom[i + 0x2C]) && + if( BE_16(&trak_atom[i + 0x2C]) && BE_16(&trak_atom[i + 0x2E]) ) { trak->properties.video.width = BE_16(&trak_atom[i + 0x2C]); @@ -877,9 +877,9 @@ static qt_error parse_trak_atom (qt_trak *trak, /* compute the greyscale palette */ color_index = 255; - color_dec = 256 / + color_dec = 256 / (trak->properties.video.palette_count - 1); - for (j = 0; + for (j = 0; j < trak->properties.video.palette_count; j++) { @@ -904,7 +904,7 @@ static qt_error parse_trak_atom (qt_trak *trak, else color_table = qt_default_palette_256; - for (j = 0; + for (j = 0; j < trak->properties.video.palette_count; j++) { @@ -931,7 +931,7 @@ static qt_error parse_trak_atom (qt_trak *trak, color_index = BE_16(&trak_atom[i + 0x6A + j * 8]); if (color_count & 0x8000) color_index = j; - if (color_index < + if (color_index < trak->properties.video.palette_count) { trak->properties.video.palette[color_index].r = trak_atom[i + 0x6A + j * 8 + 2]; @@ -982,12 +982,12 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->properties.audio.bits / 8; trak->properties.audio.samples_per_frame = trak->properties.audio.channels; - trak->properties.audio.bytes_per_frame = - trak->properties.audio.bytes_per_sample * + trak->properties.audio.bytes_per_frame = + trak->properties.audio.bytes_per_sample * trak->properties.audio.samples_per_frame; - trak->properties.audio.samples_per_packet = + trak->properties.audio.samples_per_packet = trak->properties.audio.samples_per_frame; - trak->properties.audio.bytes_per_packet = + trak->properties.audio.bytes_per_packet = trak->properties.audio.bytes_per_sample; /* special case time: some ima4-encoded files don't have the @@ -995,7 +995,7 @@ static qt_error parse_trak_atom (qt_trak *trak, if (BE_32(&trak_atom[i + 0x10]) == IMA4_FOURCC) { trak->properties.audio.samples_per_packet = 64; trak->properties.audio.bytes_per_packet = 34; - trak->properties.audio.bytes_per_frame = 34 * + trak->properties.audio.bytes_per_frame = 34 * trak->properties.audio.channels; trak->properties.audio.bytes_per_sample = 2; trak->properties.audio.samples_per_frame = 64 * @@ -1009,19 +1009,19 @@ static qt_error parse_trak_atom (qt_trak *trak, if (BE_32(&trak_atom[i + 0x0C]) > 0x24) { if (BE_32(&trak_atom[i + 0x30])) - trak->properties.audio.samples_per_packet = + trak->properties.audio.samples_per_packet = BE_32(&trak_atom[i + 0x30]); if (BE_32(&trak_atom[i + 0x34])) - trak->properties.audio.bytes_per_packet = + trak->properties.audio.bytes_per_packet = BE_32(&trak_atom[i + 0x34]); if (BE_32(&trak_atom[i + 0x38])) - trak->properties.audio.bytes_per_frame = + trak->properties.audio.bytes_per_frame = BE_32(&trak_atom[i + 0x38]); if (BE_32(&trak_atom[i + 0x3C])) - trak->properties.audio.bytes_per_sample = + trak->properties.audio.bytes_per_sample = BE_32(&trak_atom[i + 0x3C]); trak->properties.audio.samples_per_frame = - (trak->properties.audio.bytes_per_frame / + (trak->properties.audio.bytes_per_frame / trak->properties.audio.bytes_per_packet) * trak->properties.audio.samples_per_packet; @@ -1038,10 +1038,10 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->properties.audio.vbr = 1; /* check for a MS-style WAVE format header */ - if ((current_atom_size >= 0x48) && + if ((current_atom_size >= 0x48) && (BE_32(&trak_atom[i + 0x44]) == WAVE_ATOM)) { trak->properties.audio.wave_present = 1; - memcpy(&trak->properties.audio.wave, + memcpy(&trak->properties.audio.wave, &trak_atom[i + 0x5C], sizeof(trak->properties.audio.wave)); xine_waveformatex_le2me(&trak->properties.audio.wave); @@ -1079,12 +1079,12 @@ static qt_error parse_trak_atom (qt_trak *trak, } else if (current_atom == ESDS_ATOM) { uint32_t len; - + debug_atom_load(" qt/mpeg-4 esds atom\n"); - if ((trak->type == MEDIA_VIDEO) || + if ((trak->type == MEDIA_VIDEO) || (trak->type == MEDIA_AUDIO)) { - + j = i + 8; if( trak_atom[j++] == 0x03 ) { j += mp4_read_descr_len( &trak_atom[j], &len ); @@ -1386,9 +1386,9 @@ static qt_error parse_reference_atom (reference_t *ref, /* This is a little support function used to process the edit list when * building a frame table. */ #define MAX_DURATION 0x7FFFFFFFFFFFFFFF -static void get_next_edit_list_entry(qt_trak *trak, +static void get_next_edit_list_entry(qt_trak *trak, int *edit_list_index, - unsigned int *edit_list_media_time, + unsigned int *edit_list_media_time, int64_t *edit_list_duration, unsigned int global_timescale) { @@ -1405,9 +1405,9 @@ static void get_next_edit_list_entry(qt_trak *trak, /* otherwise, find an edit list entries whose media time != -1 */ if (trak->edit_list_table[*edit_list_index].media_time != -1) { - *edit_list_media_time = + *edit_list_media_time = trak->edit_list_table[*edit_list_index].media_time; - *edit_list_duration = + *edit_list_duration = trak->edit_list_table[*edit_list_index].track_duration; /* duration is in global timescale units; convert to trak timescale */ @@ -1421,8 +1421,8 @@ static void get_next_edit_list_entry(qt_trak *trak, *edit_list_index = *edit_list_index + 1; } - /* on the way out, check if this is the last edit list entry; if so, - * don't let the duration expire (so set it to an absurdly large value) + /* on the way out, check if this is the last edit list entry; if so, + * don't let the duration expire (so set it to an absurdly large value) */ if (*edit_list_index == trak->edit_list_count) *edit_list_duration = MAX_DURATION; @@ -1449,7 +1449,7 @@ static qt_error build_frame_table(qt_trak *trak, /* AUDIO and OTHER frame types follow the same rules; VIDEO and vbr audio * frame types follow a different set */ - if ((trak->type == MEDIA_VIDEO) || + if ((trak->type == MEDIA_VIDEO) || (trak->properties.audio.vbr)) { /* in this case, the total number of frames is equal to the number of @@ -1544,11 +1544,11 @@ static qt_error build_frame_table(qt_trak *trak, debug_edit_list(" %d: (before) pts = %lld...", i, trak->frames[i].pts); - if (trak->frames[i].pts < edit_list_media_time) + if (trak->frames[i].pts < edit_list_media_time) trak->frames[i].pts = edit_list_pts_counter; else { if (i < trak->frame_count - 1) - frame_duration = + frame_duration = (trak->frames[i + 1].pts - trak->frames[i].pts); debug_edit_list("duration = %lld...", frame_duration); @@ -1617,7 +1617,7 @@ static qt_error build_frame_table(qt_trak *trak, /* compute the actual chunk size */ trak->frames[j].size = - (trak->frames[j].size * + (trak->frames[j].size * trak->properties.audio.channels) / trak->properties.audio.samples_per_frame * trak->properties.audio.bytes_per_frame; @@ -1671,7 +1671,7 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, /* create a new trak structure */ info->trak_count++; - info->traks = (qt_trak *)realloc(info->traks, + info->traks = (qt_trak *)realloc(info->traks, info->trak_count * sizeof(qt_trak)); parse_trak_atom (&info->traks[info->trak_count - 1], &moov_atom[i - 4]); @@ -1758,11 +1758,11 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom, /* iterate through 1..n-1 reference entries and decide on the right one */ for (i = 1; i < info->reference_count; i++) { - if (info->references[i].qtim_version > + if (info->references[i].qtim_version > info->references[info->chosen_reference].qtim_version) info->chosen_reference = i; else if ((info->references[i].data_rate <= bandwidth) && - (info->references[i].data_rate > + (info->references[i].data_rate > info->references[info->chosen_reference].data_rate)) info->chosen_reference = i; } @@ -1832,7 +1832,7 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input, info->last_error = QT_FILE_READ_ERROR; return info->last_error; } - if (input->read(input, moov_atom, moov_atom_size) != + if (input->read(input, moov_atom, moov_atom_size) != moov_atom_size) { free(moov_atom); info->last_error = QT_FILE_READ_ERROR; @@ -1933,7 +1933,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { uevent.type = XINE_EVENT_MRL_REFERENCE; uevent.stream = this->stream; - uevent.data_length = + uevent.data_length = strlen(this->qt->references[this->qt->chosen_reference].url) + sizeof(xine_mrl_reference_data_t); data = malloc(uevent.data_length); @@ -1966,12 +1966,12 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { /* if audio is present, send pts of current audio frame, otherwise * send current video frame pts */ if (audio_trak) - xine_demux_control_newpts(this->stream, - audio_trak->frames[audio_trak->current_frame].pts, + xine_demux_control_newpts(this->stream, + audio_trak->frames[audio_trak->current_frame].pts, BUF_FLAG_SEEK); else - xine_demux_control_newpts(this->stream, - video_trak->frames[video_trak->current_frame].pts, + xine_demux_control_newpts(this->stream, + video_trak->frames[video_trak->current_frame].pts, BUF_FLAG_SEEK); } @@ -2072,7 +2072,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { frame_duration; debug_video_demux(" qt: sending off video frame %d from offset 0x%llX, %d bytes, %lld pts\n", - i, + i, video_trak->frames[i].offset, video_trak->frames[i].size, video_trak->frames[i].pts); @@ -2122,7 +2122,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { SEEK_SET); debug_audio_demux(" qt: sending off audio frame %d from offset 0x%llX, %d bytes, %lld pts\n", - i, + i, audio_trak->frames[i].offset, audio_trak->frames[i].size, audio_trak->frames[i].pts); @@ -2139,8 +2139,8 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { * turns around and sends out audio buffers as soon as they are * received. If 2 or more consecutive audio buffers are dispatched to * the audio out unit, the engine will compensate with pops. */ - if ((buf->type == BUF_AUDIO_LPCM_BE) || - (buf->type == BUF_AUDIO_LPCM_LE)) { + if ((buf->type == BUF_AUDIO_LPCM_BE) || + (buf->type == BUF_AUDIO_LPCM_LE)) { if (first_buf) { buf->extra_info->input_time = audio_trak->frames[i].pts / 90; buf->pts = audio_trak->frames[i].pts; @@ -2169,7 +2169,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { /* Special case alert: If this is signed, 8-bit data, transform * the data to unsigned. */ - if ((audio_trak->properties.audio.bits == 8) && + if ((audio_trak->properties.audio.bits == 8) && ((audio_trak->properties.audio.codec_fourcc == TWOS_FOURCC) || (audio_trak->properties.audio.codec_fourcc == SOWT_FOURCC))) for (j = 0; j < buf->size; j++) @@ -2237,7 +2237,7 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { this->bih.biBitCount = video_trak->properties.video.depth; this->bih.biCompression = video_trak->properties.video.codec_fourcc; - video_trak->properties.video.codec_buftype = + video_trak->properties.video.codec_buftype = fourcc_to_buf_video(this->bih.biCompression); /* hack: workaround a fourcc clash! 'mpg4' is used by MS and Sorenson @@ -2245,17 +2245,17 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { */ if( video_trak->properties.video.codec_buftype == BUF_VIDEO_MSMPEG4_V1 ) video_trak->properties.video.codec_buftype = BUF_VIDEO_MPEG4; - - if( !video_trak->properties.video.codec_buftype && + + if( !video_trak->properties.video.codec_buftype && video_trak->properties.video.codec_fourcc ) video_trak->properties.video.codec_buftype = BUF_VIDEO_UNKNOWN; this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1; this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->bih.biWidth; - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = + this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->bih.biHeight; - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_FOURCC] = + this->stream->stream_info[XINE_STREAM_INFO_VIDEO_FOURCC] = video_trak->properties.video.codec_fourcc; } else { @@ -2271,7 +2271,7 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { if (this->qt->audio_trak != -1) { - audio_trak->properties.audio.codec_buftype = + audio_trak->properties.audio.codec_buftype = formattag_to_buf_audio(audio_trak->properties.audio.codec_fourcc); if( !audio_trak->properties.audio.codec_buftype && @@ -2285,7 +2285,7 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { audio_trak->properties.audio.sample_rate; this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS] = audio_trak->properties.audio.bits; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_FOURCC] = + this->stream->stream_info[XINE_STREAM_INFO_AUDIO_FOURCC] = audio_trak->properties.audio.codec_fourcc; } else { @@ -2325,13 +2325,13 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { buf->size = sizeof(this->bih); buf->type = video_trak->properties.video.codec_buftype; this->video_fifo->put (this->video_fifo, buf); - + /* send header info to decoder. some mpeg4 streams need this */ if( video_trak->decoder_config ) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->type = video_trak->properties.video.codec_buftype; buf->size = video_trak->decoder_config_len; - buf->content = video_trak->decoder_config; + buf->content = video_trak->decoder_config; this->video_fifo->put (this->video_fifo, buf); } @@ -2372,7 +2372,7 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { buf->content = (void *)&audio_trak->properties.audio.wave; buf->size = sizeof(audio_trak->properties.audio.wave); this->audio_fifo->put (this->audio_fifo, buf); - + if( audio_trak->decoder_config ) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = audio_trak->properties.audio.codec_buftype; @@ -2710,7 +2710,7 @@ static void *init_plugin (xine_t *xine, void *data) { */ plugin_info_t xine_plugin_info[] = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 20, "quicktime", XINE_VERSION_CODE, NULL, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/doc/demux_wc3movie.c b/doc/demux_wc3movie.c @@ -192,7 +192,7 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { } else { /* record the offset of the SHOT chunk */ - this->shot_offsets[this->current_shot] = + this->shot_offsets[this->current_shot] = this->input->get_current_pos(this->input) - PREAMBLE_SIZE; } @@ -227,7 +227,7 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { if( this->audio_fifo ) { audio_pts = this->video_pts - WC3_PTS_INC; - + while (chunk_size) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_LPCM_LE; @@ -235,23 +235,23 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) { buf->extra_info->input_length = this->data_size; buf->extra_info->input_time = audio_pts / 90; buf->pts = audio_pts; - + if (chunk_size > buf->max_size) buf->size = buf->max_size; else buf->size = chunk_size; chunk_size -= buf->size; - + if (this->input->read(this->input, buf->content, buf->size) != buf->size) { buf->free_buffer(buf); this->status = DEMUX_FINISHED; break; } - + if (!chunk_size) buf->decoder_flags |= BUF_FLAG_FRAME_END; - + this->audio_fifo->put (this->audio_fifo, buf); } }else{ @@ -321,7 +321,7 @@ static void demux_mve_send_headers(demux_plugin_t *this_gen) { /* load stream information */ this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1; - /* this is not strictly correct-- some WC3 MVE files do not contain + /* this is not strictly correct-- some WC3 MVE files do not contain * audio, but I'm too lazy to check if that is the case */ this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = 1; this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->video_width; @@ -392,7 +392,7 @@ static int open_mve_file(demux_mve_t *this) { if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) { this->input->seek(this->input, 0, SEEK_SET); - if (this->input->read(this->input, header, WC3_HEADER_SIZE) != + if (this->input->read(this->input, header, WC3_HEADER_SIZE) != WC3_HEADER_SIZE) return 0; } else { @@ -443,7 +443,7 @@ static int open_mve_file(demux_mve_t *this) { return 0; } - if ((BE_32(&preamble[0]) != PALT_TAG) || + if ((BE_32(&preamble[0]) != PALT_TAG) || (BE_32(&preamble[4]) != PALETTE_CHUNK_SIZE)) { xine_log(this->stream->xine, XINE_LOG_MSG, _("demux_wc3movie: There was a problem while loading palette chunks\n")); @@ -585,7 +585,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, this->seek_flag = 1; /* if input is non-seekable, do not proceed with the rest of this - * seek function */ + * seek function */ if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) return this->status; @@ -605,7 +605,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, chunk_size = (BE_32(&preamble[4]) + 1) & (~1); if (chunk_tag == SHOT_TAG) { - this->shot_offsets[0] = + this->shot_offsets[0] = this->input->get_current_pos(this->input) - PREAMBLE_SIZE; /* skip the four SHOT data bytes (palette index) */ this->input->seek(this->input, 4, SEEK_CUR); @@ -620,7 +620,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, start_pos += this->data_start; for (i = 0; i < this->number_of_shots - 1; i++) { - /* if the next shot offset has not been recorded, traverse through the + /* if the next shot offset has not been recorded, traverse through the * file until it is found */ if (this->shot_offsets[i + 1] == 0) { @@ -637,7 +637,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, chunk_size = (BE_32(&preamble[4]) + 1) & (~1); if (chunk_tag == SHOT_TAG) { - this->shot_offsets[i + 1] = + this->shot_offsets[i + 1] = this->input->get_current_pos(this->input) - PREAMBLE_SIZE; /* skip the four SHOT data bytes (palette index) */ this->input->seek(this->input, 4, SEEK_CUR); @@ -650,7 +650,7 @@ static int demux_mve_seek (demux_plugin_t *this_gen, /* check if the seek-to offset falls in between this shot offset and * the next one */ - if ((start_pos >= this->shot_offsets[i]) && + if ((start_pos >= this->shot_offsets[i]) && (start_pos < this->shot_offsets[i + 1])) { new_shot = i; @@ -817,7 +817,7 @@ void *demux_wc3movie_init_plugin (xine_t *xine, void *data) { #if 0 plugin_info_t xine_plugin_info[] = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 20, "wc3movie", XINE_VERSION_CODE, NULL, demux_wc3movie_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/doc/lj/addkeyword.c b/doc/lj/addkeyword.c @@ -1,7 +1,7 @@ static void addKeyword (struct EXTRACTOR_Keywords ** list, char * keyword, - EXTRACTOR_KeywordType type) + EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); diff --git a/doc/lj/minimal.c b/doc/lj/minimal.c @@ -1,11 +1,11 @@ -#include <extractor.h> +#include <extractor.h> int main(int argc, char * argv[]) { EXTRACTOR_ExtractorList * plugins; EXTRACTOR_KeywordList * md_list; - plugins = EXTRACTOR_loadDefaultLibraries(); + plugins = EXTRACTOR_loadDefaultLibraries(); md_list = EXTRACTOR_getKeywords(plugins, argv[1]); - EXTRACTOR_printKeywords(stdout, md_list); - EXTRACTOR_freeKeywords(md_list); + EXTRACTOR_printKeywords(stdout, md_list); + EXTRACTOR_freeKeywords(md_list); EXTRACTOR_removeAll(plugins); /* unload plugins */ } diff --git a/doc/lj/signature.c b/doc/lj/signature.c @@ -1,4 +1,4 @@ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_XXX_extract (char * filename, char * data, diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c @@ -1606,14 +1606,14 @@ static enum DYLD_BOOL (*ltdl_NSIsSymbolNameDefinedInImage)(const struct mach_hea static enum DYLD_BOOL (*ltdl_NSMakePrivateModulePublic)(NSModule module) = 0; #ifndef NSADDIMAGE_OPTION_NONE -#define NSADDIMAGE_OPTION_NONE 0x0 +#define NSADDIMAGE_OPTION_NONE 0x0 #endif #ifndef NSADDIMAGE_OPTION_RETURN_ON_ERROR #define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1 -#endif +#endif #ifndef NSADDIMAGE_OPTION_WITH_SEARCHING #define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2 -#endif +#endif #ifndef NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED #define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4 #endif @@ -1622,7 +1622,7 @@ static enum DYLD_BOOL (*ltdl_NSMakePrivateModulePublic)(NSModule module) = 0; #endif #ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND #define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0 -#endif +#endif #ifndef NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW #define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1 #endif @@ -1647,7 +1647,7 @@ lt_int_dyld_error(othererror) if (!errstr || !strlen(errstr)) errstr = othererror; return errstr; } - + static const struct mach_header * lt_int_dyld_get_mach_header_from_nsmodule(module) NSModule module; @@ -1687,7 +1687,7 @@ static const char* lt_int_dyld_lib_install_name(mh) lc = (struct load_command*)(((unsigned long)mh) + offset); if (LC_ID_DYLIB == lc->cmd) { - retStr=(char*)(((struct dylib_command*)lc)->dylib.name.offset + + retStr=(char*)(((struct dylib_command*)lc)->dylib.name.offset + (unsigned long)lc); } offset += lc->cmdsize; @@ -1732,14 +1732,14 @@ lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh) lc = (struct load_command*)(((unsigned long)mh) + offset); if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == lc->cmd)) { - mh1=lt_int_dyld_match_loaded_lib_by_install_name((char*)(((struct dylib_command*)lc)->dylib.name.offset + + mh1=lt_int_dyld_match_loaded_lib_by_install_name((char*)(((struct dylib_command*)lc)->dylib.name.offset + (unsigned long)lc)); if (!mh1) { /* Maybe NSAddImage can find it */ - mh1=ltdl_NSAddImage((char*)(((struct dylib_command*)lc)->dylib.name.offset + + mh1=ltdl_NSAddImage((char*)(((struct dylib_command*)lc)->dylib.name.offset + (unsigned long)lc), - NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED + + NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED + NSADDIMAGE_OPTION_WITH_SEARCHING + NSADDIMAGE_OPTION_RETURN_ON_ERROR ); } @@ -1747,7 +1747,7 @@ lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh) { retSym = ltdl_NSLookupSymbolInImage(mh1, symbol, - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR ); if (retSym) break; @@ -1764,7 +1764,7 @@ sys_dyld_init() { int retCode = 0; int err = 0; - if (!_dyld_present()) { + if (!_dyld_present()) { retCode=1; } else { @@ -1785,7 +1785,7 @@ sys_dyld_open (loader_data, filename) NSObjectFileImage ofi = 0; NSObjectFileImageReturnCode ofirc; - if (!filename) + if (!filename) return (lt_module)-1; ofirc = NSCreateObjectFileImageFromFile(filename, &ofi); switch (ofirc) @@ -1826,7 +1826,7 @@ sys_dyld_close (loader_data, module) if (((struct mach_header *)module)->magic == MH_MAGIC) #else if (((struct mach_header *)module)->magic == MH_CIGAM) -#endif +#endif { LT_DLMUTEX_SETERROR("Can not close a dylib"); retCode = 1; @@ -1837,13 +1837,13 @@ sys_dyld_close (loader_data, module) /* Currently, if a module contains c++ static destructors and it is unloaded, we get a segfault in atexit(), due to compiler and dynamic loader differences of opinion, this works around that. -*/ - if ((const struct section *)NULL != +*/ + if ((const struct section *)NULL != getsectbynamefromheader(lt_int_dyld_get_mach_header_from_nsmodule(module), "__DATA","__mod_term_func")) { flags += NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED; - } + } #endif #ifdef __ppc__ flags += NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES; @@ -1877,31 +1877,31 @@ sys_dyld_sym (loader_data, module, symbol) if (((struct mach_header *)module)->magic == MH_MAGIC) #else if (((struct mach_header *)module)->magic == MH_CIGAM) -#endif +#endif { if (ltdl_NSIsSymbolNameDefinedInImage && ltdl_NSLookupSymbolInImage) { mh=module; - if (ltdl_NSIsSymbolNameDefinedInImage((struct mach_header*)module,symbol)) + if (ltdl_NSIsSymbolNameDefinedInImage((struct mach_header*)module,symbol)) { nssym = ltdl_NSLookupSymbolInImage((struct mach_header*)module, symbol, - NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR ); } } - - } + + } else { nssym = NSLookupSymbolInModule(module, symbol); } - if (!nssym) + if (!nssym) { if (!mh) mh=lt_int_dyld_get_mach_header_from_nsmodule(module); nssym = lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh); } - if (!nssym) + if (!nssym) { LT_DLMUTEX_SETERROR (lt_int_dyld_error(LT_DLSTRERROR(SYMBOL_NOT_FOUND))); return NULL; diff --git a/src/include/extractor.h b/src/include/extractor.h @@ -36,7 +36,7 @@ extern "C" { /* ignore the 'type' of the keyword when eliminating duplicates */ #define EXTRACTOR_DUPLICATES_TYPELESS 1 /* remove type 'UNKNOWN' if there is a duplicate keyword of - known type, even if usually different types should be + known type, even if usually different types should be preserved */ #define EXTRACTOR_DUPLICATES_REMOVE_UNKNOWN 2 @@ -49,7 +49,7 @@ const char * EXTRACTOR_getDefaultLibraries(); * See also * http://dublincore.org/documents/1998/09/dces/ */ -typedef enum { +typedef enum { EXTRACTOR_UNKNOWN = 0, EXTRACTOR_FILENAME = 1, EXTRACTOR_MIMETYPE = 2, @@ -75,7 +75,7 @@ typedef enum { EXTRACTOR_RESOURCE_IDENTIFIER = 22, EXTRACTOR_SOURCE = 23, EXTRACTOR_RELATION = 24, - EXTRACTOR_COVERAGE = 25, + EXTRACTOR_COVERAGE = 25, EXTRACTOR_SOFTWARE = 26, EXTRACTOR_DISCLAIMER = 27, EXTRACTOR_WARNING = 28, @@ -196,17 +196,17 @@ EXTRACTOR_KeywordType EXTRACTOR_getHighestKeywordTypeNumber(); * @return the new list of libraries, equal to prev iff an error occured * or if config was empty (or NULL). */ -EXTRACTOR_ExtractorList * +EXTRACTOR_ExtractorList * EXTRACTOR_loadConfigLibraries(EXTRACTOR_ExtractorList * prev, const char * config); /** - * Add a library for keyword extraction. + * Add a library for keyword extraction. * @param prev the previous list of libraries, may be NULL * @param library the name of the library * @return the new list of libraries, equal to prev iff an error occured */ -EXTRACTOR_ExtractorList * +EXTRACTOR_ExtractorList * EXTRACTOR_addLibrary(EXTRACTOR_ExtractorList * prev, const char * library); @@ -217,7 +217,7 @@ EXTRACTOR_addLibrary(EXTRACTOR_ExtractorList * prev, * @return the new list of libraries, always equal to prev * except if prev was NULL and no error occurs */ -EXTRACTOR_ExtractorList * +EXTRACTOR_ExtractorList * EXTRACTOR_addLibraryLast(EXTRACTOR_ExtractorList * prev, const char * library); @@ -227,7 +227,7 @@ EXTRACTOR_addLibraryLast(EXTRACTOR_ExtractorList * prev, * @param library the name of the library to remove * @return the reduced list, unchanged if the library was not loaded */ -EXTRACTOR_ExtractorList * +EXTRACTOR_ExtractorList * EXTRACTOR_removeLibrary(EXTRACTOR_ExtractorList * prev, const char * library); @@ -244,7 +244,7 @@ void EXTRACTOR_removeAll(EXTRACTOR_ExtractorList * libraries); * @return the list of keywords found in the file, NULL if none * were found (or other errors) */ -EXTRACTOR_KeywordList * +EXTRACTOR_KeywordList * EXTRACTOR_getKeywords(EXTRACTOR_ExtractorList * extractor, const char * filename); @@ -254,8 +254,8 @@ EXTRACTOR_getKeywords(EXTRACTOR_ExtractorList * extractor, * @param list the original keyword list (destroyed in the process!) * @param options a set of options (DUPLICATES_XXXX) * @return a list of keywords without duplicates - */ -EXTRACTOR_KeywordList * + */ +EXTRACTOR_KeywordList * EXTRACTOR_removeDuplicateKeywords(EXTRACTOR_KeywordList * list, const unsigned int options); @@ -293,7 +293,7 @@ void EXTRACTOR_freeKeywords(EXTRACTOR_KeywordList * keywords); * not be freed or manipulated by the client. It will become * invalid once the keyword list is freed. */ -const char * EXTRACTOR_extractLast(const EXTRACTOR_KeywordType type, +const char * EXTRACTOR_extractLast(const EXTRACTOR_KeywordType type, EXTRACTOR_KeywordList * keywords); /** diff --git a/src/include/gettext.h b/src/include/gettext.h @@ -53,8 +53,8 @@ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) /* slight modification here to avoid warnings: generate NO code, not even the cast... */ -# define textdomain(Domainname) -# define bindtextdomain(Domainname, Dirname) +# define textdomain(Domainname) +# define bindtextdomain(Domainname, Dirname) # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) #endif diff --git a/src/include/platform.h b/src/include/platform.h @@ -62,7 +62,7 @@ #ifndef MINGW #define DIR_SEPARATOR '/' - + #define CREAT(p, m) creat(p, m) #undef FOPEN #define FOPEN(f, m) fopen(f, m) diff --git a/src/include/winproc.h b/src/include/winproc.h @@ -196,7 +196,7 @@ extern "C" { #define NO_RECOVERY 3 #undef NO_ADDRESS #define NO_ADDRESS 4 - + #define PROT_READ 0x1 #define PROT_WRITE 0x2 #define MAP_SHARED 0x1 @@ -277,7 +277,7 @@ typedef struct BOOL bBlocking; } Winsock; extern Winsock *pSocks; -extern unsigned int uiSockCount; +extern unsigned int uiSockCount; #define SHUT_RDWR SD_BOTH diff --git a/src/main/extract.c b/src/main/extract.c @@ -45,7 +45,7 @@ static void formatHelp(const char * general, int p; char * scp; const char * trans; - + printf(_("Usage: %s\n%s\n\n"), gettext(general), gettext(description)); @@ -65,7 +65,7 @@ static void formatHelp(const char * general, printf("=%s", opt[i].mandatoryArg); slen += 1+strlen(opt[i].mandatoryArg); - } + } if (slen > BORDER) { printf("\n%*s", BORDER, ""); slen = BORDER; @@ -123,7 +123,7 @@ printHelp () { static Help help[] = { { 'a', "all", NULL, - gettext_noop("do not remove any duplicates") }, + gettext_noop("do not remove any duplicates") }, { 'b', "bibtex", NULL, gettext_noop("print output in bibtex format") }, { 'B', "binary", "LANG", @@ -137,7 +137,7 @@ printHelp () { 'H', "hash", "ALGORITHM", gettext_noop("compute hash using the given ALGORITHM (currently sha1 or md5)") }, { 'l', "library", "LIBRARY", - gettext_noop("load an extractor plugin named LIBRARY") }, + gettext_noop("load an extractor plugin named LIBRARY") }, { 'L', "list", NULL, gettext_noop("list all keyword types") }, { 'n', "nodefault", NULL, @@ -159,7 +159,7 @@ printHelp () formatHelp(_("extract [OPTIONS] [FILENAME]*"), _("Extract metadata from files."), help); - + } #include "iconv.c" @@ -175,7 +175,7 @@ printHelp () static void printSelectedKeywords(FILE * handle, EXTRACTOR_KeywordList * keywords, - const int * print, + const int * print, const int verbose) { char * keyword; @@ -188,7 +188,7 @@ printSelectedKeywords(FILE * handle, while (keywords != NULL) { buf = NULL; if (cd != (iconv_t) -1) - keyword = iconvHelper(cd, + keyword = iconvHelper(cd, keywords->keyword); else keyword = strdup(keywords->keyword); @@ -200,7 +200,7 @@ printSelectedKeywords(FILE * handle, } else { if (NULL == EXTRACTOR_getKeywordTypeAsString(keywords->keywordType)) { if (verbose == YES) { - fprintf(handle, + fprintf(handle, _("INVALID TYPE - %s\n"), keyword); } @@ -221,8 +221,8 @@ printSelectedKeywords(FILE * handle, * Take title, auth, year and return a string */ static char * -splice(const char * title, - const char * auth, +splice(const char * title, + const char * auth, const char * year) { char * temp = (char*)malloc(sizeof(char)*16); @@ -248,7 +248,7 @@ splice(const char * title, static void printSelectedKeywordsBibtex (FILE * handle, EXTRACTOR_KeywordList * keywords, - const int * print, + const int * print, const char * filename) { const char * last = NULL; @@ -334,7 +334,7 @@ printSelectedKeywordsBibtex (FILE * handle, fprintf(handle, "@misc{ %s,\n",splice(title, author, year)); if ( title ) - fprintf(handle, " title = \"%s\"%s\n", title, + fprintf(handle, " title = \"%s\"%s\n", title, (last == title)?"":","); if ( author ) fprintf(handle, " author = \"%s\"%s\n", author, @@ -408,7 +408,7 @@ main (int argc, char *argv[]) {"duplicates", 0, 0, 'd'}, {"filename", 0, 0, 'f'}, {"help", 0, 0, 'h'}, - {"hash", 1, 0, 'H'}, + {"hash", 1, 0, 'H'}, {"list", 0, 0, 'L'}, {"library", 1, 0, 'l'}, {"nodefault", 0, 0, 'n'}, @@ -422,8 +422,8 @@ main (int argc, char *argv[]) }; option_index = 0; c = getopt_long (argc, - argv, "vhbl:nsH:fp:x:LVdraB:", - long_options, + argv, "vhbl:nsH:fp:x:LVdraB:", + long_options, &option_index); if (c == -1) @@ -562,7 +562,7 @@ main (int argc, char *argv[]) free(name); } if (hash != NULL) { - char * name; + char * name; name = malloc(strlen(hash) + strlen("libextractor_hash_") + 1); strcpy(name, "libextractor_hash_"); strcat(name, hash); @@ -570,7 +570,7 @@ main (int argc, char *argv[]) name); free(name); } - + if (splitKeywords == YES) extractors = EXTRACTOR_addLibraryLast(extractors, "libextractor_split"); @@ -582,7 +582,7 @@ main (int argc, char *argv[]) } /* extract keywords */ if ( bibtex == YES ) - fprintf(stdout, + fprintf(stdout, _("%% BiBTeX file\n")); for (i = optind; i < argc; i++) { diff --git a/src/main/extractor.c b/src/main/extractor.c @@ -77,7 +77,7 @@ static const char *keywordTypes[] = { gettext_noop("magnification"), gettext_noop("release"), gettext_noop("group"), - gettext_noop("size"), + gettext_noop("size"), gettext_noop("summary"), gettext_noop("packager"), gettext_noop("vendor"), @@ -218,7 +218,7 @@ void __attribute__ ((destructor)) le_ltdl_fini(void) { free(old_dlsearchpath); #ifdef MINGW ShutdownWinEnv(); -#endif +#endif lt_dlexit (); } @@ -226,7 +226,7 @@ void __attribute__ ((destructor)) le_ltdl_fini(void) { /** * Open a file */ -static int OPEN(const char *filename, +static int OPEN(const char *filename, int oflag, ...) { int mode; char *fn; @@ -234,36 +234,36 @@ static int OPEN(const char *filename, #ifdef MINGW char szFile[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(filename, szFile)) != ERROR_SUCCESS) { errno = ENOENT; SetLastError(lRet); - + return -1; } fn = szFile; #else fn = (char *) filename; #endif - + if (oflag & O_CREAT) { va_list arg; va_start(arg, oflag); mode = va_arg(arg, int); - va_end(arg); + va_end(arg); } else { mode = 0; } - + #ifdef MINGW /* Set binary mode */ mode |= O_BINARY; #endif - + return open(fn, oflag, mode); } @@ -271,7 +271,7 @@ static int OPEN(const char *filename, /** * Load the default set of libraries. The default set of - * libraries consists of the libraries that are part of + * libraries consists of the libraries that are part of * the libextractor distribution (except split and filename * extractor) plus the extractors that are specified * in the environment variable "LIBEXTRACTOR_LIBRARIES". @@ -404,7 +404,7 @@ static void *getSymbolWithPrefix(void *lib_handle, */ static int loadLibrary (const char *name, - void **libHandle, + void **libHandle, ExtractMethod * method) { *libHandle = lt_dlopenext (name); @@ -412,8 +412,8 @@ loadLibrary (const char *name, { #if DEBUG fprintf (stderr, - _("Loading '%s' plugin failed: %s\n"), - name, + _("Loading '%s' plugin failed: %s\n"), + name, lt_dlerror ()); #endif return -1; @@ -434,7 +434,7 @@ loadLibrary (const char *name, * @return the new list of libraries, equal to prev iff an error occured */ EXTRACTOR_ExtractorList * -EXTRACTOR_addLibrary (EXTRACTOR_ExtractorList * prev, +EXTRACTOR_addLibrary (EXTRACTOR_ExtractorList * prev, const char *library) { EXTRACTOR_ExtractorList *result; @@ -459,7 +459,7 @@ EXTRACTOR_addLibrary (EXTRACTOR_ExtractorList * prev, * except if prev was NULL and no error occurs */ EXTRACTOR_ExtractorList * -EXTRACTOR_addLibraryLast(EXTRACTOR_ExtractorList * prev, +EXTRACTOR_addLibraryLast(EXTRACTOR_ExtractorList * prev, const char *library) { EXTRACTOR_ExtractorList *result; @@ -490,7 +490,7 @@ EXTRACTOR_addLibraryLast(EXTRACTOR_ExtractorList * prev, * @return the reduced list, unchanged if the library was not loaded */ EXTRACTOR_ExtractorList * -EXTRACTOR_removeLibrary(EXTRACTOR_ExtractorList * prev, +EXTRACTOR_removeLibrary(EXTRACTOR_ExtractorList * prev, const char *library) { EXTRACTOR_ExtractorList *pos; @@ -516,8 +516,8 @@ EXTRACTOR_removeLibrary(EXTRACTOR_ExtractorList * prev, } #if DEBUG else - fprintf(stderr, - _("Unloading plugin '%s' failed!\n"), + fprintf(stderr, + _("Unloading plugin '%s' failed!\n"), library); #endif return first; @@ -589,7 +589,7 @@ static void removeKeyword (const char *keyword, const EXTRACTOR_KeywordType type, const unsigned int options, - EXTRACTOR_KeywordList ** list, + EXTRACTOR_KeywordList ** list, EXTRACTOR_KeywordList * current) { EXTRACTOR_KeywordList *first; @@ -676,7 +676,7 @@ EXTRACTOR_removeEmptyKeywords (EXTRACTOR_KeywordList * list) for (i=strlen(pos->keyword)-1;i>=0;i--) if (! isspace(pos->keyword[i])) allWhite = 0; - if (allWhite) + if (allWhite) { EXTRACTOR_KeywordList * next; next = pos->next; @@ -688,7 +688,7 @@ EXTRACTOR_removeEmptyKeywords (EXTRACTOR_KeywordList * list) free(pos); pos = next; } - else + else { last = pos; pos = pos->next; @@ -706,7 +706,7 @@ EXTRACTOR_removeEmptyKeywords (EXTRACTOR_KeywordList * list) * @param keywords the list of keywords to print, may be NULL */ void -EXTRACTOR_printKeywords(FILE * handle, +EXTRACTOR_printKeywords(FILE * handle, EXTRACTOR_KeywordList * keywords) { iconv_t cd; @@ -726,9 +726,9 @@ EXTRACTOR_printKeywords(FILE * handle, fprintf(handle, _("%s - (binary)\n"), gettext(keywordTypes[keywords->keywordType])); - } else { + } else { if (keywords->keywordType >= HIGHEST_TYPE_NUMBER) - fprintf(handle, + fprintf(handle, _("INVALID TYPE - %s\n"), buf); else @@ -798,7 +798,7 @@ EXTRACTOR_extractLast (const EXTRACTOR_KeywordType type, * @return the last matching keyword, or NULL if none matches */ const char * -EXTRACTOR_extractLastByString (const char * type, +EXTRACTOR_extractLastByString (const char * type, EXTRACTOR_KeywordList * keywords) { char * result = NULL; @@ -865,7 +865,7 @@ JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_loadDefaultInternal * Method: unloadInternal * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ovmj_libextractor_Extractor_unloadInternal(JNIEnv * env, +JNIEXPORT void JNICALL Java_org_ovmj_libextractor_Extractor_unloadInternal(JNIEnv * env, jclass c, jlong arg) { EXTRACTOR_removeAll((EXTRACTOR_ExtractorList*) (long) arg); @@ -876,9 +876,9 @@ JNIEXPORT void JNICALL Java_org_ovmj_libextractor_Extractor_unloadInternal(JNIEn * Method: extractInternal * Signature: (JLjava/lang/String;)J */ -JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_extractInternal(JNIEnv * env, +JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_extractInternal(JNIEnv * env, jclass c, - jlong arg, + jlong arg, jstring f) { const char * fname; jboolean bo; @@ -897,8 +897,8 @@ JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_extractInternal(JNI * Method: freeInternal * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ovmj_libextractor_Extractor_freeInternal(JNIEnv * env, - jclass c, +JNIEXPORT void JNICALL Java_org_ovmj_libextractor_Extractor_freeInternal(JNIEnv * env, + jclass c, jlong list) { EXTRACTOR_freeKeywords( (EXTRACTOR_KeywordList*) (long) list); } @@ -908,8 +908,8 @@ JNIEXPORT void JNICALL Java_org_ovmj_libextractor_Extractor_freeInternal(JNIEnv * Method: typeInternal * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_typeInternal(JNIEnv * env, - jclass c, +JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_typeInternal(JNIEnv * env, + jclass c, jlong list) { if (list == 0) return -1; /* error! */ @@ -921,8 +921,8 @@ JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_typeInternal(JNIEnv * Method: keywordInternal * Signature: (J)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_ovmj_libextractor_Extractor_keywordInternal(JNIEnv * env, - jclass c, +JNIEXPORT jstring JNICALL Java_org_ovmj_libextractor_Extractor_keywordInternal(JNIEnv * env, + jclass c, jlong list) { char * str; if (list == 0) @@ -936,8 +936,8 @@ JNIEXPORT jstring JNICALL Java_org_ovmj_libextractor_Extractor_keywordInternal(J * Method: nextInternal * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_nextInternal(JNIEnv * env, - jclass j, +JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_nextInternal(JNIEnv * env, + jclass j, jlong list) { if (list == 0) return 0; /* error! */ @@ -949,16 +949,16 @@ JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_nextInternal(JNIEnv * Method: getTypeAsStringInternal * Signature: (I)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_ovmj_libextractor_Extractor_getTypeAsStringInternal(JNIEnv * env, - jclass c, +JNIEXPORT jstring JNICALL Java_org_ovmj_libextractor_Extractor_getTypeAsStringInternal(JNIEnv * env, + jclass c, jint type) { const char * str; if ( (type < 0) || (type > HIGHEST_TYPE_NUMBER) ) - return NULL; /* error! */ + return NULL; /* error! */ str = gettext(keywordTypes[type]); if (str == NULL) return NULL; - return (*env)->NewStringUTF(env, + return (*env)->NewStringUTF(env, str); } @@ -968,7 +968,7 @@ JNIEXPORT jstring JNICALL Java_org_ovmj_libextractor_Extractor_getTypeAsStringIn * Method: getVersionInternal * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_getVersionInternal(JNIEnv * env, +JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_getVersionInternal(JNIEnv * env, jclass c) { return EXTRACTOR_VERSION; } @@ -978,7 +978,7 @@ JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_getVersionInternal(J * Method: getMaxTypeInternal * Signature: ()I */ -JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_getMaxTypeInternal(JNIEnv * env, +JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_getMaxTypeInternal(JNIEnv * env, jclass c) { return HIGHEST_TYPE_NUMBER; } @@ -988,9 +988,9 @@ JNIEXPORT jint JNICALL Java_org_ovmj_libextractor_Extractor_getMaxTypeInternal(J * Method: unloadPlugin * Signature: (JLjava/lang/String;)J */ -JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_unloadPlugin(JNIEnv * env, - jclass c, - jlong handle, +JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_unloadPlugin(JNIEnv * env, + jclass c, + jlong handle, jstring name) { const char * lname; jboolean bo; @@ -1001,7 +1001,7 @@ JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_unloadPlugin(JNIEnv ret = (jlong) (long) EXTRACTOR_removeLibrary((EXTRACTOR_ExtractorList*) (long) handle, lname); (*env)->ReleaseStringUTFChars(env, name, lname); - return ret; + return ret; } /* @@ -1009,9 +1009,9 @@ JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_unloadPlugin(JNIEnv * Method: loadPlugin * Signature: (JLjava/lang/String;Z)J */ -JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_loadPlugin(JNIEnv * env, - jclass c, - jlong handle, +JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_loadPlugin(JNIEnv * env, + jclass c, + jlong handle, jstring name, jboolean place) { const char * lname; @@ -1025,10 +1025,10 @@ JNIEXPORT jlong JNICALL Java_org_ovmj_libextractor_Extractor_loadPlugin(JNIEnv * lname); } else { ret = (jlong) (long) EXTRACTOR_addLibrary((EXTRACTOR_ExtractorList*) (long) handle, - lname); + lname); } (*env)->ReleaseStringUTFChars(env, name, lname); - return ret; + return ret; } /* #ifdef HAVE_JNI_H */ diff --git a/src/main/iconv.c b/src/main/iconv.c @@ -22,14 +22,14 @@ static char * iconvHelper(iconv_t cd, buf = malloc(outSize); ibuf = buf; memset(buf, 0, outSize); - if (iconv(cd, + if (iconv(cd, (char**) &in, &inSize, - &ibuf, + &ibuf, &outLeft) == (size_t)-1) { /* conversion failed */ free(buf); - return strdup(i); + return strdup(i); } return buf; } diff --git a/src/main/libextractor_python.c b/src/main/libextractor_python.c @@ -31,7 +31,7 @@ static PyObject * EXTRACTOR_PY_removeAll(PyObject * self, PyObject * py_exts; PyArg_ParseTuple(args, "O", &py_exts); - + EXTRACTOR_removeAll((EXTRACTOR_ExtractorList*) PyCObject_AsVoidPtr(py_exts)); Py_INCREF(Py_None); return Py_None; @@ -41,9 +41,9 @@ static PyObject * EXTRACTOR_PY_getKeywordTypeAsString(PyObject * self, PyObject * args) { unsigned int type; - PyArg_ParseTuple(args, - "i", - &type); + PyArg_ParseTuple(args, + "i", + &type); return Py_BuildValue("s", EXTRACTOR_getKeywordTypeAsString((EXTRACTOR_KeywordType)type)); } @@ -64,7 +64,7 @@ static PyObject * EXTRACTOR_PY_extract(PyObject * self, ret = PyList_New(0); pos = keys; while (pos != NULL) { - PyList_Append(ret, + PyList_Append(ret, Py_BuildValue("(OO)", PyInt_FromLong((long)pos->keywordType), PyString_FromString(pos->keyword))); @@ -86,7 +86,7 @@ static PyMethodDef ExtractorMethods[] = { { NULL, NULL, 0, NULL } }; -PyMODINIT_FUNC +PyMODINIT_FUNC initextractor() { Py_InitModule("extractor", ExtractorMethods); } diff --git a/src/main/winproc.c b/src/main/winproc.c @@ -23,7 +23,7 @@ * @brief Functions for MS Windows * @author Nils Durner */ - + /*** Note: this file differs from GNUnet's winproc.c ***/ #include "platform.h" @@ -286,7 +286,7 @@ long DetermineRootDir() long lDirLen; /* Get the path of the calling module. - It should be located in one of the "bin" directories */ + It should be located in one of the "bin" directories */ GetModuleFileName(NULL, szModule, MAX_PATH); _splitpath(szModule, szDrv, szDir, NULL, NULL); @@ -359,7 +359,7 @@ long DetermineHomeDir() } else { - /* C:\My Documents */ + /* C:\My Documents */ long lRet; lHomeDirLen = _MAX_PATH; @@ -405,7 +405,7 @@ void InitWinEnv() DWORD dwSize = 261; GetUserName(szUser, &dwSize); - + eAction = HOME; lRet = DetermineHomeDir(); } @@ -425,10 +425,10 @@ void InitWinEnv() if(pszMsg2[lRet - 2] == '\r') pszMsg2[lRet - 2] = 0; - fprintf(stderr, - eAction == ROOT - ? _("Cannot determine root directory (%s)\n") - : _("Cannot determine home directory (%s)\n"), + fprintf(stderr, + eAction == ROOT + ? _("Cannot determine root directory (%s)\n") + : _("Cannot determine home directory (%s)\n"), pszMsg2); LocalFree(pszMsg); free(pszMsg2); @@ -443,13 +443,13 @@ void InitWinEnv() /* Open files in binary mode */ _fmode = _O_BINARY; - + /* Get Windows version */ theWinVersion.dwOSVersionInfoSize = sizeof(theWinVersion); GetVersionEx(&theWinVersion); - + hNTDLL = LoadLibrary("ntdll.dll"); - + /* Function to get CPU usage under Win NT */ if (hNTDLL) { @@ -460,7 +460,7 @@ void InitWinEnv() { GNNtQuerySystemInformation = NULL; } - + /* Functions to get information about a network adapter */ hIphlpapi = LoadLibrary("iphlpapi.dll"); if (hIphlpapi) @@ -476,7 +476,7 @@ void InitWinEnv() GNGetIpAddrTable = NULL; GNGetIfTable = NULL; } - + /* Use ANSI codepage for console IO */ SetConsoleCP(CP_ACP); SetConsoleOutputCP(CP_ACP); @@ -489,7 +489,7 @@ void InitWinEnv() void ShutdownWinEnv() { free(pMappings); - CloseHandle(hMappingsLock); + CloseHandle(hMappingsLock); FreeLibrary(hNTDLL); FreeLibrary(hIphlpapi); @@ -569,7 +569,7 @@ int conv_to_win_path(const char *pszUnix, char *pszWindows) pSrc++; } *pDest = 0; - + return ERROR_SUCCESS; } @@ -586,7 +586,7 @@ void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine) case ERROR_SUCCESS: errno = 0; break; - + case ERROR_INVALID_FUNCTION: errno = EBADRQC; break; @@ -906,7 +906,7 @@ void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine) case ERROR_BUFFER_OVERFLOW: errno = ENOMEM; break; - + default: errno = ESTALE; fprintf(stderr, "ERROR: Unknown error %i in SetErrnoFromWinError(). " \ @@ -924,7 +924,7 @@ int flock(int fd, int operation) HANDLE hFile; OVERLAPPED theOvInfo; BOOL bRet; - + hFile = (HANDLE) _get_osfhandle(fd); memset(&theOvInfo, sizeof(OVERLAPPED), 0); @@ -938,13 +938,13 @@ int flock(int fd, int operation) { if (!bRet && ((dwFlags = GetLastError()) != ERROR_NOT_LOCKED)) { - SetErrnoFromWinError(dwFlags); + SetErrnoFromWinError(dwFlags); return -1; } else return 0; } - + if (operation & LOCK_EX) { dwFlags = LOCKFILE_EXCLUSIVE_LOCK; @@ -958,18 +958,18 @@ int flock(int fd, int operation) errno = EINVAL; return -1; } - + if (operation & LOCK_NB) dwFlags |= LOCKFILE_FAIL_IMMEDIATELY; - + if (theWinVersion.dwPlatformId == VER_PLATFORM_WIN32_NT) bRet = LockFileEx(hFile, dwFlags, 0, 1, 0, &theOvInfo); else bRet = LockFile(hFile, 0, 0, 1, 0); - + if (! bRet) { - SetErrnoFromWinError(GetLastError()); + SetErrnoFromWinError(GetLastError()); return -1; } else @@ -1011,13 +1011,13 @@ DIR *_win_opendir(const char *dirname) { char szDir[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(dirname, szDir)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return NULL; - } - + } + return opendir(szDir); } @@ -1028,14 +1028,14 @@ int _win_chdir(const char *path) { char szDir[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(path, szDir)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; - } - - return chdir(szDir); + } + + return chdir(szDir); } /** @@ -1047,7 +1047,7 @@ int _win_fstat(int handle, struct stat *buffer) if (fstat(handle, buffer) == -1) { /* We just check for a valid handle here */ - + /* Handle */ memset(buffer, sizeof(struct stat), 0); GetFileType(handle); @@ -1068,14 +1068,14 @@ int _win_rmdir(const char *path) { char szDir[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(path, szDir)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; - } - - return rmdir(szDir); + } + + return rmdir(szDir); } /** @@ -1086,7 +1086,7 @@ int _win_pipe(int *phandles) if (!CreatePipe((HANDLE *) &phandles[0],(HANDLE *) &phandles[1], NULL, 0)) { SetErrnoFromWinError(GetLastError()); - + return -1; } else @@ -1126,39 +1126,39 @@ void *_win_mmap(void *start, size_t len, int access, int flags, int fd, access_param = FILE_MAP_COPY; break; } - + sec_none.nLength = sizeof(SECURITY_ATTRIBUTES); sec_none.bInheritHandle = TRUE; sec_none.lpSecurityDescriptor = NULL; - + hFile = (HANDLE) _get_osfhandle(fd); - + h = CreateFileMapping(hFile, &sec_none, protect, 0, 0, NULL); - + if (! h) { SetErrnoFromWinError(GetLastError()); return (void *) -1; } - + high = off >> 32; low = off & ULONG_MAX; base = NULL; - + /* If a non-zero start is given, try mapping using the given address first. If it fails and flags is not MAP_FIXED, try again with NULL address. */ if (start) base = MapViewOfFileEx(h, access_param, high, low, len, start); if (!base && !(flags & MAP_FIXED)) base = MapViewOfFileEx(h, access_param, high, low, len, NULL); - + if (!base || ((flags & MAP_FIXED) && base != start)) { if (!base) SetErrnoFromWinError(GetLastError()); else errno = EINVAL; - + CloseHandle(h); return (void *) -1; } @@ -1174,11 +1174,11 @@ void *_win_mmap(void *start, size_t len, int access, int flags, int fd, break; } } - + if (! bFound) { uiIndex = 0; - + while(TRUE) { if (pMappings[uiIndex].pStart == NULL) @@ -1191,14 +1191,14 @@ void *_win_mmap(void *start, size_t len, int access, int flags, int fd, uiMappingsCount++; pMappings = (TMapping *) realloc(pMappings, (uiMappingsCount + 1) * sizeof(TMapping)); pMappings[uiMappingsCount].pStart = NULL; - + break; } uiIndex++; } } ReleaseMutex(hMappingsLock); - + return base; } @@ -1217,7 +1217,7 @@ int _win_munmap(void *start, size_t length) { /* Release mapping handle */ WaitForSingleObject(hMappingsLock, INFINITE); - + for(uiIndex = 0; uiIndex <= uiMappingsCount; uiIndex++) { if (pMappings[uiIndex].pStart == start) @@ -1230,10 +1230,10 @@ int _win_munmap(void *start, size_t length) break; } } - + ReleaseMutex(hMappingsLock); } - + return success ? 0 : -1; } @@ -1244,14 +1244,14 @@ int _win_access( const char *path, int mode ) { char szFile[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(path, szFile)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; - } - - return access(szFile, mode); + } + + return access(szFile, mode); } /** @@ -1261,14 +1261,14 @@ int _win_chmod(const char *filename, int pmode) { char szFile[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(filename, szFile)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; - } - - return access(szFile, pmode); + } + + return access(szFile, pmode); } @@ -1276,14 +1276,14 @@ char *realpath(const char *file_name, char *resolved_name) { char szFile[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(file_name, szFile)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return NULL; - } - - return _fullpath(szFile, resolved_name, MAX_PATH); + } + + return _fullpath(szFile, resolved_name, MAX_PATH); } /** @@ -1293,13 +1293,13 @@ int _win_remove(const char *path) { char szFile[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(path, szFile)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; - } - + } + return remove(szFile); } @@ -1311,19 +1311,19 @@ int _win_rename(const char *oldname, const char *newname) char szOldName[_MAX_PATH + 1]; char szNewName[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(oldname, szOldName)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; - } + } if ((lRet = conv_to_win_path(newname, szNewName)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; - } - + } + return rename(szOldName, szNewName); } @@ -1334,20 +1334,20 @@ int _win_stat(const char *path, struct stat *buffer) { char szFile[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(path, szFile)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; } - + /* Remove trailing slash */ lRet = strlen(szFile) - 1; if (szFile[lRet] == '\\') { szFile[lRet] = 0; } - + return stat(szFile, buffer); } @@ -1358,13 +1358,13 @@ int _win_unlink(const char *filename) { char szFile[_MAX_PATH + 1]; long lRet; - + if ((lRet = conv_to_win_path(filename, szFile)) != ERROR_SUCCESS) { SetErrnoFromWinError(lRet); return -1; - } - + } + return unlink(szFile); } @@ -1424,7 +1424,7 @@ size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream) { SetErrnoFromWinError(iError); } - + return dwWritten; } @@ -1436,7 +1436,7 @@ size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ) DWORD dwRead; int iItemsRead, iError; void *pDest = buffer; - + for(iItemsRead = 0; iItemsRead < count; iItemsRead++) { if (!ReadFile((HANDLE) _get_osfhandle(fileno(stream)), pDest, size, @@ -1444,12 +1444,12 @@ size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ) break; pDest += size; } - + if ((iError = GetLastError()) != ERROR_SUCCESS) { SetErrnoFromWinError(iError); } - + return iItemsRead; } @@ -2062,7 +2062,7 @@ char *_win_strerror(int errnum) break; default: error = _("Unknown error"); - fprintf(stderr, + fprintf(stderr, _("ERROR: Unknown error %i in %s\n"), errnum, __FUNCTION__); @@ -2216,15 +2216,15 @@ size_t strnlen (const char *str, size_t maxlen) char *nl_langinfo(int item) { unsigned int loc; - + loc = GetThreadLocale(); - + switch(item) { case CODESET: { unsigned int cp = GetACP(); - + if (cp) sprintf(__langinfo, "CP%u", cp); else @@ -2373,7 +2373,7 @@ char *nl_langinfo(int item) return __langinfo; case RADIXCHAR: GetLocaleInfo(loc, LOCALE_SDECIMAL, __langinfo, 251); - return __langinfo; + return __langinfo; case THOUSEP: GetLocaleInfo(loc, LOCALE_STHOUSAND, __langinfo, 251); return __langinfo; diff --git a/src/plugins/asfextractor.c b/src/plugins/asfextractor.c @@ -88,7 +88,7 @@ #define GUID_ASF_EXTENDED_CONTENT_DESCRIPTION 14 #define GUID_ASF_ERROR_CORRECTION 15 #define GUID_ASF_PADDING 16 - + /* stream properties object stream type */ #define GUID_ASF_AUDIO_MEDIA 17 #define GUID_ASF_VIDEO_MEDIA 18 @@ -104,7 +104,7 @@ /* header extension */ #define GUID_ASF_RESERVED_1 24 - + /* script command */ #define GUID_ASF_RESERVED_SCRIPT_COMMNAND 25 @@ -228,7 +228,7 @@ static const struct { "mutex bitrate", { 0xd6e22a01, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} }, - { "mutex unknown", + { "mutex unknown", { 0xd6e22a02, 0x35da, 0x11d1, { 0x90, 0x34, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xbe }} }, @@ -289,7 +289,7 @@ typedef struct demux_asf_s { ext_uint32_t packet_size; ext_uint8_t packet_flags; ext_uint32_t data_size; - + ext_uint32_t bitrates[MAX_NUM_STREAMS]; int num_streams; int num_audio_streams; @@ -336,7 +336,7 @@ typedef struct demux_asf_s { off_t header_size; int buf_flag_seek; - + /* first packet position */ int64_t first_packet_pos; @@ -347,12 +347,12 @@ static int readBuf(demux_asf_t * this, void * buf, int len) { int min; - + min = len; if (this->inputLen - this->inputPos < min) min = this->inputLen - this->inputPos; - memcpy(buf, - &this->input[this->inputPos], + memcpy(buf, + &this->input[this->inputPos], min); this->inputPos += min; return min; @@ -363,7 +363,7 @@ static ext_uint8_t get_byte (demux_asf_t *this) { int i; i = readBuf (this, &buf, 1); - if (i != 1) + if (i != 1) this->status = DEMUX_FINISHED; return buf; } @@ -373,7 +373,7 @@ static ext_uint16_t get_le16 (demux_asf_t *this) { int i; i = readBuf (this, buf, 2); - if (i != 2) + if (i != 2) this->status = DEMUX_FINISHED; return buf[0] | (buf[1] << 8); } @@ -383,7 +383,7 @@ static ext_uint32_t get_le32 (demux_asf_t *this) { int i; i = readBuf (this, buf, 4); - if (i != 4) + if (i != 4) this->status = DEMUX_FINISHED; return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); } @@ -393,9 +393,9 @@ static ext_uint64_t get_le64 (demux_asf_t *this) { int i; i = readBuf (this, buf, 8); - if (i != 8) + if (i != 8) this->status = DEMUX_FINISHED; - return (ext_uint64_t) buf[0] + return (ext_uint64_t) buf[0] | ((ext_uint64_t) buf[1] << 8) | ((ext_uint64_t) buf[2] << 16) | ((ext_uint64_t) buf[3] << 24) @@ -412,20 +412,20 @@ static int get_guid (demux_asf_t *this) { g.v1 = get_le32(this); g.v2 = get_le16(this); g.v3 = get_le16(this); - for(i = 0; i < 8; i++) + for(i = 0; i < 8; i++) g.v4[i] = get_byte(this); if (this->status == DEMUX_FINISHED) return GUID_ERROR; - for (i = 1; i < GUID_END; i++) - if (!memcmp(&g, &guids[i].guid, sizeof(LE_GUID))) + for (i = 1; i < GUID_END; i++) + if (!memcmp(&g, &guids[i].guid, sizeof(LE_GUID))) return i; - + return GUID_ERROR; } -static void get_str16_nolen(demux_asf_t *this, +static void get_str16_nolen(demux_asf_t *this, int len, - char *buf, + char *buf, int buf_size) { int c; @@ -446,8 +446,8 @@ static int asf_read_header(demux_asf_t *this) { ext_uint64_t gsize; guid = get_guid(this); - if (guid != GUID_ASF_HEADER) - return 0; + if (guid != GUID_ASF_HEADER) + return 0; get_le64(this); get_le32(this); get_byte(this); @@ -617,7 +617,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = strdup(keyword); result->keywordType = type; return result; @@ -650,7 +650,7 @@ struct EXTRACTOR_Keywords * libextractor_asf_extract(char * filename, free(this); return prev; } - + if (strlen(this->title) > 0) prev = addKeyword(EXTRACTOR_TITLE, this->title, prev); if (strlen(this->author) > 0) @@ -663,7 +663,7 @@ struct EXTRACTOR_Keywords * libextractor_asf_extract(char * filename, /* build a description from author and title */ if (strlen(this->author) * strlen(this->title) > 0) { - EXTRACTOR_KeywordList * keyword = malloc(sizeof(EXTRACTOR_KeywordList)); + EXTRACTOR_KeywordList * keyword = malloc(sizeof(EXTRACTOR_KeywordList)); char * word; int len = 3 + strlen(this->author) + strlen(this->title); diff --git a/src/plugins/convert.c b/src/plugins/convert.c @@ -40,7 +40,7 @@ char * convertToUtf8(const char * input, char * itmp; const char * i; iconv_t cd; - + i = input; cd = iconv_open("UTF-8", charset); if (cd == (iconv_t) -1) @@ -52,7 +52,7 @@ char * convertToUtf8(const char * input, if (iconv(cd, (char**) &input, &len, - &itmp, + &itmp, &finSize) == (size_t)-1) { iconv_close(cd); free(tmp); diff --git a/src/plugins/debextractor.c b/src/plugins/debextractor.c @@ -43,7 +43,7 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -67,7 +67,7 @@ typedef struct { /* see also: "man 5 deb-control" */ static Matches tmap[] = { - { "Package: ", EXTRACTOR_SOFTWARE }, + { "Package: ", EXTRACTOR_SOFTWARE }, { "Version: ", EXTRACTOR_VERSIONNUMBER }, { "Section: ", EXTRACTOR_GENRE }, { "Priority: ", EXTRACTOR_PRIORITY }, @@ -75,7 +75,7 @@ static Matches tmap[] = { { "Depends: ", EXTRACTOR_DEPENDENCY }, { "Recommends: ", EXTRACTOR_RELATION }, { "Suggests: ", EXTRACTOR_RELATION }, - { "Installed-Size: ", EXTRACTOR_SIZE }, + { "Installed-Size: ", EXTRACTOR_SIZE }, { "Maintainer: ", EXTRACTOR_PACKAGER }, { "Description: ", EXTRACTOR_DESCRIPTION }, { "Source: ", EXTRACTOR_SOURCE }, @@ -118,7 +118,7 @@ static struct EXTRACTOR_Keywords * processControl(const char * data, (data[eol] != '\n') || ( (eol+1 < size) && (data[eol+1] == ' ') ) ) - eol++; + eol++; if ( (eol == colon) || (eol > size) ) return prev; key = stndup(&data[pos], colon-pos); @@ -168,7 +168,7 @@ typedef struct { /** * Process the control.tar file. */ -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * processControlTar(const char * data, const size_t size, struct EXTRACTOR_Keywords * prev) { @@ -186,23 +186,23 @@ processControlTar(const char * data, ustar = (USTarHeader*) &data[pos]; if (0 == strncmp("ustar", &ustar->magic[0], - strlen("ustar"))) + strlen("ustar"))) pos += 512; /* sizeof(USTarHeader); */ else pos += 257; /* sizeof(TarHeader); minus gcc alignment... */ } else { pos += 257; /* sizeof(TarHeader); minus gcc alignment... */ } - + memcpy(buf, &tar->filesize[0], 12); - buf[12] = '\0'; + buf[12] = '\0'; if (1 != sscanf(buf, "%12llo", &fsize)) /* octal! Yuck yuck! */ return prev; if ( (pos + fsize > size) || (fsize > size) || (pos + fsize < pos) ) return prev; - + if (0 == strncmp(&tar->name[0], "./control", strlen("./control"))) { @@ -251,7 +251,7 @@ void * writeThread(void * arg) { /** * Process the control.tar.gz file. */ -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * processControlTGZ(const unsigned char * data, size_t size, struct EXTRACTOR_Keywords * prev) { @@ -286,7 +286,7 @@ processControlTGZ(const unsigned char * data, pthread_join(pt, &error); return prev; } - buf = malloc(bufSize); + buf = malloc(bufSize); if (buf == NULL) { gzclose(gzf); close(fdes[1]); @@ -302,11 +302,11 @@ processControlTGZ(const unsigned char * data, } close(fdes[1]); pthread_join(pt, &error); - gzclose(gzf); + gzclose(gzf); prev = processControlTar(buf, bufSize, prev); - free(buf); + free(buf); return prev; } @@ -319,8 +319,8 @@ typedef struct { char filesize[10]; char trailer[2]; } ObjectHeader; - -struct EXTRACTOR_Keywords * + +struct EXTRACTOR_Keywords * libextractor_deb_extract(const char * filename, const char * data, const size_t size, @@ -347,7 +347,7 @@ libextractor_deb_extract(const char * filename, return prev; memcpy(buf, &hdr->filesize[0], 10); - buf[10] = '\0'; + buf[10] = '\0'; if (1 != sscanf(buf, "%10llu", &fsize)) return prev; pos += sizeof(ObjectHeader); @@ -357,7 +357,7 @@ libextractor_deb_extract(const char * filename, return prev; if (0 == strncmp(&hdr->name[0], "control.tar.gz", - strlen("control.tar.gz"))) { + strlen("control.tar.gz"))) { prev = processControlTGZ(&data[pos], fsize, prev); @@ -374,7 +374,7 @@ libextractor_deb_extract(const char * filename, pos += fsize; if (done == 2) break; /* no need to process the rest of the archive */ - } + } return prev; } diff --git a/src/plugins/dviextractor.c b/src/plugins/dviextractor.c @@ -29,7 +29,7 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -88,7 +88,7 @@ static struct EXTRACTOR_Keywords * parseZZZ(unsigned char * data, slen); prev = addKeyword(tmap[i].type, value, - prev); + prev); pos += slen + 1; } } @@ -129,7 +129,7 @@ struct EXTRACTOR_Keywords * libextractor_dvi_extract(const char * filename, return prev; if ( (data[0] != 247) || (data[1] != 2) ) return prev; /* cannot be dvi or unsupported version */ - klen = data[14]; + klen = data[14]; pos = size-1; while ( (data[pos] == 223) && (pos > 0) ) @@ -140,10 +140,10 @@ struct EXTRACTOR_Keywords * libextractor_dvi_extract(const char * filename, pos -= 4; /* assert pos at 'post_post tag' */ if (data[pos] != 249) - return prev; + return prev; opos = pos; pos = ntohl(getIntAt(&data[opos+1])); - if (pos+25 > size) + if (pos+25 > size) return prev; /* assert pos at 'post' command */ if (data[pos] != 248) @@ -168,7 +168,7 @@ struct EXTRACTOR_Keywords * libextractor_dvi_extract(const char * filename, } /* ok, now we believe it's a dvi... */ pages = malloc(16); - snprintf(pages, + snprintf(pages, 16, "%u", pageCount); @@ -176,7 +176,7 @@ struct EXTRACTOR_Keywords * libextractor_dvi_extract(const char * filename, comment[klen] = '\0'; memcpy(comment, &data[15], - klen); + klen); prev = addKeyword(EXTRACTOR_MIMETYPE, strdup("application/x-dvi"), prev); @@ -220,7 +220,7 @@ struct EXTRACTOR_Keywords * libextractor_dvi_extract(const char * filename, len, prev); pos += len+4; - break; + break; case 242: /* zzz4, hurray! */ len = ntohl(getIntAt(&data[pos+1])); if (pos + 1 + len < size) diff --git a/src/plugins/elfextractor.c b/src/plugins/elfextractor.c @@ -26,7 +26,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = *list; + next->next = *list; next->keyword = strdup(keyword); next->keywordType = type; *list = next; @@ -79,16 +79,16 @@ typedef struct { &(p)->e_phnum, \ &(p)->e_shentsize, \ &(p)->e_shnum, \ - &(p)->e_shstrndx + &(p)->e_shstrndx static char * ELF_HEADER_SPECS[] = { - "hhwwwwwhhhhhh", + "hhwwwwwhhhhhh", "HHWWWWWHHHHHH", }; typedef struct { Elf32_Word sh_name; - Elf32_Word sh_type; + Elf32_Word sh_type; Elf32_Word sh_flags; Elf32_Addr sh_addr; /* where loaded */ Elf32_Off sh_offset; /* where in image (! sh_type==SHT_NOBITS) */ @@ -188,7 +188,7 @@ static char * ELF_DYN_SPECS[] = { #define SHT_NOTE 7 #define SHT_NOBITS 8 #define SHT_REL 9 -#define SHT_SHLIB 10 +#define SHT_SHLIB 10 #define SHT_DYNSYM 11 #define SHT_LOPROC 0x70000000 #define SHT_HIPROC 0x7fffffff @@ -253,35 +253,35 @@ static char * ELF_DYN_SPECS[] = { /** * @param ei_data ELFDATA2LSB or ELFDATA2MSB * @return 1 if we need to convert, 0 if not - */ + */ static int getByteorder(char ei_data) { if (ei_data == ELFDATA2LSB) { #if __BYTE_ORDER == __BIG_ENDIAN return 1; #else return 0; -#endif +#endif } else { #if __BYTE_ORDER == __BIG_ENDIAN return 0; #else return 1; -#endif +#endif } } /** - * + * * @return 0 on success, -1 on error */ static int getSectionHdr(char * data, size_t size, - Elf32_Ehdr * ehdr, + Elf32_Ehdr * ehdr, Elf32_Half idx, Elf32_Shdr * ret) { if (ehdr->e_shnum <= idx) return -1; - + cat_unpack(&data[ehdr->e_shoff + ehdr->e_shentsize * idx], ELF_SECTION_SPECS[getByteorder(data[EI_CLASS])], ELF_SECTION_FIELDS(ret)); @@ -289,19 +289,19 @@ static int getSectionHdr(char * data, } /** - * + * * @return 0 on success, -1 on error */ static int getDynTag(char * data, size_t size, - Elf32_Ehdr * ehdr, + Elf32_Ehdr * ehdr, Elf32_Off off, Elf32_Word osize, unsigned int idx, Elf32_Dyn * ret) { if ( (off+osize > size) || ((idx+1) * ELF_DYN_SIZE > osize) ) - return -1; + return -1; cat_unpack(&data[off + idx*ELF_DYN_SIZE], ELF_DYN_SPECS[getByteorder(data[EI_CLASS])], ELF_DYN_FIELDS(ret)); @@ -309,17 +309,17 @@ static int getDynTag(char * data, } /** - * + * * @return 0 on success, -1 on error */ static int getProgramHdr(char * data, size_t size, - Elf32_Ehdr * ehdr, + Elf32_Ehdr * ehdr, Elf32_Half idx, Elf32_Phdr * ret) { if (ehdr->e_phnum <= idx) return -1; - + cat_unpack(&data[ehdr->e_phoff + ehdr->e_phensize * idx], ELF_PHDR_SPECS[getByteorder(data[EI_CLASS])], ELF_PHDR_FIELDS(ret)); @@ -340,7 +340,7 @@ static int getELFHdr(char * data, elfMagic, sizeof(elfMagic))) return -1; /* not an elf */ - + switch (data[EI_CLASS]) { case ELFDATA2LSB: case ELFDATA2MSB: @@ -366,7 +366,7 @@ static int getELFHdr(char * data, */ static const char * readStringTable(char * data, size_t size, - Elf32_Ehdr * ehdr, + Elf32_Ehdr * ehdr, Elf32_Half strTableOffset, Elf32_Word sh_name) { Elf32_Shdr shrd; @@ -389,7 +389,7 @@ static const char * readStringTable(char * data, /* application/x-executable, ELF */ struct EXTRACTOR_Keywords * libextractor_elf_extract(char * filename, char * data, - size_t size, + size_t size, struct EXTRACTOR_Keywords * prev) { Elf32_Ehdr ehdr; Elf32_Half idx; @@ -400,24 +400,24 @@ struct EXTRACTOR_Keywords * libextractor_elf_extract(char * filename, return prev; addKeyword(&prev, "application/x-executable", - EXTRACTOR_MIMETYPE); + EXTRACTOR_MIMETYPE); switch (ehdr.e_type) { - case ET_REL: + case ET_REL: addKeyword(&prev, "Relocatable file", EXTRACTOR_RESOURCE_TYPE); break; - case ET_EXEC: + case ET_EXEC: addKeyword(&prev, "Executable file", EXTRACTOR_RESOURCE_TYPE); break; - case ET_DYN: + case ET_DYN: addKeyword(&prev, "Shared object file", EXTRACTOR_RESOURCE_TYPE); break; - case ET_CORE: + case ET_CORE: addKeyword(&prev, "Core file", EXTRACTOR_RESOURCE_TYPE); @@ -429,37 +429,37 @@ struct EXTRACTOR_Keywords * libextractor_elf_extract(char * filename, case EM_M32: addKeyword(&prev, "M32", - EXTRACTOR_CREATED_FOR); + EXTRACTOR_CREATED_FOR); break; case EM_386: addKeyword(&prev, "i386", - EXTRACTOR_CREATED_FOR); + EXTRACTOR_CREATED_FOR); break; case EM_68K: addKeyword(&prev, "68K", - EXTRACTOR_CREATED_FOR); + EXTRACTOR_CREATED_FOR); break; case EM_88K: addKeyword(&prev, "88K", - EXTRACTOR_CREATED_FOR); + EXTRACTOR_CREATED_FOR); break; case EM_SPARC: addKeyword(&prev, "Sparc", - EXTRACTOR_CREATED_FOR); + EXTRACTOR_CREATED_FOR); break; case EM_860: addKeyword(&prev, "960", - EXTRACTOR_CREATED_FOR); + EXTRACTOR_CREATED_FOR); break; case EM_MIPS: addKeyword(&prev, "MIPS", - EXTRACTOR_CREATED_FOR); + EXTRACTOR_CREATED_FOR); break; default: break; /* oops */ @@ -480,7 +480,7 @@ struct EXTRACTOR_Keywords * libextractor_elf_extract(char * filename, Elf32_Addr stringPtr; Elf32_Half stringIdx; Elf32_Half six; - + stringPtr = 0; for (id=0;id<dc;id++) { @@ -491,7 +491,7 @@ struct EXTRACTOR_Keywords * libextractor_elf_extract(char * filename, phdr.p_offset, phdr.p_filesz, id, - &dyn)) + &dyn)) return prev; if (DT_STRTAB == dyn.d_tag) { stringPtr = dyn.d_un.d_ptr; @@ -523,7 +523,7 @@ struct EXTRACTOR_Keywords * libextractor_elf_extract(char * filename, phdr.p_offset, phdr.p_filesz, id, - &dyn)) + &dyn)) return prev; switch(dyn.d_tag) { case DT_RPATH: { @@ -542,7 +542,7 @@ struct EXTRACTOR_Keywords * libextractor_elf_extract(char * filename, EXTRACTOR_SOURCE); } break; - } + } case DT_NEEDED: { const char * needed; @@ -557,9 +557,9 @@ struct EXTRACTOR_Keywords * libextractor_elf_extract(char * filename, EXTRACTOR_DEPENDENCY); } break; - } } - } + } + } } } diff --git a/src/plugins/filenameextractor.c b/src/plugins/filenameextractor.c @@ -32,13 +32,13 @@ struct EXTRACTOR_Keywords * libextractor_filename_extract(const char * filename, const char * filenameRoot = filename; int res; - for (res=strlen(filename)-1;res>=0;res--) + for (res=strlen(filename)-1;res>=0;res--) if (filename[res] == DIR_SEPARATOR) { filenameRoot = &filename[res+1]; break; } keyword = malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = prev; + keyword->next = prev; keyword->keyword = convertToUtf8(filenameRoot, strlen(filenameRoot), nl_langinfo(CODESET) diff --git a/src/plugins/gifextractor.c b/src/plugins/gifextractor.c @@ -26,7 +26,7 @@ #if DEBUG_GIF #define PRINT(a,b) fprintf(stderr,a,b) #else -#define PRINT(a,b) +#define PRINT(a,b) #endif typedef struct { @@ -90,7 +90,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -127,7 +127,7 @@ static size_t skipGlobalColorMap(const unsigned char * data, const size_t size, const GIF_HEADER * header) { size_t gct_size; - + if ( (header->flags & HEADER_FLAGS__GLOBAL_COLOR_TABLE_FLAG) > 0) gct_size = 3*(1 << ((header->flags & HEADER_FLAGS__SIZE_OF_GLOBAL_COLOR_TABLE)+1)); else @@ -150,7 +150,7 @@ static size_t skipLocalColorMap(const unsigned char * data, lct_size = 3*(1 << ((descriptor->flags & DESCRIPTOR_FLAGS__PIXEL_SIZE)+1)); else lct_size = 0; - return pos + GIF_DESCRIPTOR_SIZE + lct_size; + return pos + GIF_DESCRIPTOR_SIZE + lct_size; } static struct EXTRACTOR_Keywords * parseComment(const unsigned char * data, @@ -170,21 +170,21 @@ static struct EXTRACTOR_Keywords * parseComment(const unsigned char * data, curr = pos; length = 0; while ( (data[curr] != 0) && - (curr < size) ) { + (curr < size) ) { length += data[curr]; - if (length >= size) + if (length >= size) break; memcpy(&keyword[length-data[curr]], &data[curr]+1, data[curr]); keyword[length] = 0; curr += data[curr] + 1; - } + } return addKeyword(EXTRACTOR_COMMENT, keyword, prev); } - + struct EXTRACTOR_Keywords * libextractor_gif_extract(const char * filename, const unsigned char * data, @@ -209,9 +209,9 @@ struct EXTRACTOR_Keywords * libextractor_gif_extract(const char * filename, strdup("image/gif"), result); tmp = malloc(128); - snprintf(tmp, + snprintf(tmp, 128, - "%ux%u", + "%ux%u", header.screen_width, header.screen_height); result = addKeyword(EXTRACTOR_SIZE, @@ -253,6 +253,6 @@ struct EXTRACTOR_Keywords * libextractor_gif_extract(const char * filename, } } PRINT("returning at %d\n",pos); - return result; + return result; } diff --git a/src/plugins/hash/md5extractor.c b/src/plugins/hash/md5extractor.c @@ -23,13 +23,13 @@ #include "md5.h" -static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, const char *phrase, EXTRACTOR_KeywordType type) { - EXTRACTOR_KeywordList * keyword; + EXTRACTOR_KeywordList * keyword; keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = oldhead; + keyword->next = oldhead; keyword->keyword = strdup(phrase); keyword->keywordType = type; return keyword; @@ -40,7 +40,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, #define DIGEST_BITS 128 #define DIGEST_HEX_BYTES (DIGEST_BITS / 4) #define DIGEST_BIN_BYTES (DIGEST_BITS / 8) -#define MAX_DIGEST_BIN_BYTES DIGEST_BIN_BYTES +#define MAX_DIGEST_BIN_BYTES DIGEST_BIN_BYTES struct EXTRACTOR_Keywords * libextractor_hash_md5_extract(const char * filename, char * data, @@ -51,7 +51,7 @@ struct EXTRACTOR_Keywords * libextractor_hash_md5_extract(const char * filename, char buf[16]; int i; - md5_buffer(data, size, bin_buffer); + md5_buffer(data, size, bin_buffer); hash[0] = '\0'; for (i=0;i<DIGEST_HEX_BYTES / 2; i++) { snprintf(buf, @@ -63,6 +63,6 @@ struct EXTRACTOR_Keywords * libextractor_hash_md5_extract(const char * filename, prev = addKeyword(prev, hash, EXTRACTOR_HASH_MD5); - + return prev; } diff --git a/src/plugins/hash/rmd160extractor.c b/src/plugins/hash/rmd160extractor.c @@ -599,13 +599,13 @@ rmd160_sum_bytes ( #undef FUNCTION_NAME -static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, const char *phrase, EXTRACTOR_KeywordType type) { - EXTRACTOR_KeywordList * keyword; + EXTRACTOR_KeywordList * keyword; keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = oldhead; + keyword->next = oldhead; keyword->keyword = strdup(phrase); keyword->keywordType = type; return keyword; @@ -614,7 +614,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, #define DIGEST_BITS 160 #define DIGEST_HEX_BYTES (DIGEST_BITS / 4) #define DIGEST_BIN_BYTES (DIGEST_BITS / 8) -#define MAX_DIGEST_BIN_BYTES DIGEST_BIN_BYTES +#define MAX_DIGEST_BIN_BYTES DIGEST_BIN_BYTES #define rmd160_init(t) rmd160_copy((t),NULL) #define rmd160_new() rmd160_copy(NULL,NULL) diff --git a/src/plugins/hash/sha1extractor.c b/src/plugins/hash/sha1extractor.c @@ -22,13 +22,13 @@ #include "extractor.h" #include "sha1.h" -static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, const char *phrase, EXTRACTOR_KeywordType type) { - EXTRACTOR_KeywordList * keyword; + EXTRACTOR_KeywordList * keyword; keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = oldhead; + keyword->next = oldhead; keyword->keyword = strdup(phrase); keyword->keywordType = type; return keyword; @@ -38,7 +38,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, #define DIGEST_HEX_BYTES (DIGEST_BITS / 4) #define DIGEST_BIN_BYTES (DIGEST_BITS / 8) -#define MAX_DIGEST_BIN_BYTES DIGEST_BIN_BYTES +#define MAX_DIGEST_BIN_BYTES DIGEST_BIN_BYTES struct EXTRACTOR_Keywords * libextractor_hash_sha1_extract(const char * filename, char * data, @@ -50,7 +50,7 @@ struct EXTRACTOR_Keywords * libextractor_hash_sha1_extract(const char * filename int i; sha_buffer(data, size, bin_buffer); - + hash[0] = '\0'; for (i=0;i<DIGEST_HEX_BYTES / 2; i++) { snprintf(buf, @@ -61,6 +61,6 @@ struct EXTRACTOR_Keywords * libextractor_hash_sha1_extract(const char * filename } prev = addKeyword(prev, hash, - EXTRACTOR_HASH_SHA1); + EXTRACTOR_HASH_SHA1); return prev; } diff --git a/src/plugins/htmlextractor.c b/src/plugins/htmlextractor.c @@ -38,18 +38,18 @@ struct ArgvTable { * We now put them all in one big table that is passed * around inside the parser. * - * The CallBacks - * You may call one ore several or even all callbacks. Except of the - * XHTMLCallBack, all CallBacks will work as expected and described - * - * XHTMLCallBack: - * The XHTMLCallBack is a special case, because you can decide, if the - * XHTML specific tags should be handeled as a start- AND endtag, or - * as an XHTML tag. If you call nothing, except start and endtag, the - * behaviour is, that you'll get a start AND an endtag called back. + * The CallBacks + * You may call one ore several or even all callbacks. Except of the + * XHTMLCallBack, all CallBacks will work as expected and described + * + * XHTMLCallBack: + * The XHTMLCallBack is a special case, because you can decide, if the + * XHTML specific tags should be handeled as a start- AND endtag, or + * as an XHTML tag. If you call nothing, except start and endtag, the + * behaviour is, that you'll get a start AND an endtag called back. * If you call XHTMLCallBack, it will only give you the XHTML call back. - * - * If you are in doubt or simply confused now, call XHTMLCallBack() + * + * If you are in doubt or simply confused now, call XHTMLCallBack() */ typedef struct PC_ { /* handle comments and javascript */ @@ -65,7 +65,7 @@ typedef struct PC_ { /* End tag e.g. </html>*/ int (*endCallBack) (char *tag, struct PC_ * pc); - + /* handle plain text */ int (*textCallBack) (char *text, struct PC_ * pc); int (*textStartCallBack) (struct PC_ * pc); @@ -98,13 +98,13 @@ typedef struct PC_ { * 0: ignore, 1: add keyword */ int nextTextAction; - + /** * If nextTextAction == 1, this gives the type of the * keyword. */ EXTRACTOR_KeywordType nextKeywordType; - + /** * Result of the current pass. */ @@ -124,14 +124,14 @@ static struct ArgvTable *addArgToTable(struct ArgvTable *args, char *arg, char * args = (struct ArgvTable*) calloc(1, sizeof(struct ArgvTable)*(pc->numArgs+1)); } else { args = (struct ArgvTable*) realloc(args, sizeof(struct ArgvTable)*(pc->numArgs+1)); - } + } if (args == NULL) { fprintf(stderr, _("Fatal: could not allocate (%s at %s:%d).\n"), strerror(errno), __FILE__, __LINE__); exit(EXIT_FAILURE); - } + } args[pc->numArgs-1].arg = arg; args[pc->numArgs-1].val = val; return args; @@ -141,12 +141,12 @@ static struct ArgvTable *addArgToTable(struct ArgvTable *args, char *arg, char * static void freeArgs (struct ArgvTable *args, struct PC_ * pc) { int i; - + if (args != NULL) { for(i=0; i<pc->numArgs; i++) { free(args[i].arg); free(args[i].val); - } + } free(args); args=NULL; pc->numArgs=0; @@ -161,19 +161,19 @@ static const char *parseText(const char *html, struct PC_ * pc) { char *tmp; const char *tmp2; int ret=0; - + while( (*html != '\0') && isspace((int) *html)) html++; - + if (*html == '<') return html; - + tmp2 = html; while ( (*html != '\0') && (*html != '<') ) html++; - + tmp = (char *)calloc(1, (size_t)(html-tmp2+1)); if (!tmp) return ""; - + memcpy(tmp, tmp2, (size_t)(html-tmp2)); - + if (strlen(tmp) > 0) { if (pc->textStartCallBack) { ret = pc->textStartCallBack(pc); @@ -181,8 +181,8 @@ static const char *parseText(const char *html, struct PC_ * pc) { free(tmp); return ""; } - } - if (pc->textCallBack) { + } + if (pc->textCallBack) { if (pc->entityCallBack){ /* that is textCallBack(text) with entityCallBack(entity) as an extrabonus */ /*printf("entity is here\n");*/ @@ -194,7 +194,7 @@ static const char *parseText(const char *html, struct PC_ * pc) { return ""; } } - } + } if (pc->textEndCallBack) { ret = pc->textEndCallBack(pc); if (ret != 0) { @@ -202,8 +202,8 @@ static const char *parseText(const char *html, struct PC_ * pc) { return ""; } } - } - free(tmp); + } + free(tmp); if (*html != '\0') if (*(html+1) == '>') html += 2; return html; @@ -213,19 +213,19 @@ static const char *parseComment (const char *html, struct PC_ * pc) { char *tmp; const char *tmp2; int ret=0; - + while ( (*html == '-') || isspace((int)*html))html++; - + tmp2 = html; while ( (*html != '\0') && !(*html == '-' && *(html+1) == '-' && *(html+2) == '>')) html++; - + tmp = (char *)calloc(1, (size_t)(html-tmp2+1)); if (!tmp) return ""; - + memcpy(tmp, tmp2, (size_t)(html-tmp2)); - + if (*(html+3) != '\0') html += 3; - + if (pc->commentStartCallBack) { ret = pc->commentStartCallBack(pc); if (ret != 0) { @@ -239,7 +239,7 @@ static const char *parseComment (const char *html, struct PC_ * pc) { free(tmp); return ""; } - } + } if (pc->commentEndCallBack) { ret = pc->commentEndCallBack(pc); if (ret != 0) { @@ -255,27 +255,27 @@ static const char *parseEndTag(const char *html, struct PC_ * pc) { char *tmp; const char *tmp2; int ret=0; - + if (*html == '\0') return html; - html++; + html++; tmp2 = html; while(*html != '\0' && *html != '>') html++; - + tmp =(char *) calloc(1, (size_t)(html-tmp2+1)); if (!tmp) return ""; - + memcpy(tmp, tmp2, (size_t)(html-tmp2)); - + if (pc->endCallBack) { ret = pc->endCallBack(tmp,pc); if (ret != 0) { free(tmp); return ""; } - } - if (*html == '>') html++; + } + if (*html == '>') html++; free(tmp); return html; } @@ -284,28 +284,28 @@ static const char *parsePHP(const char *html, struct PC_ * pc) { const char *tmp; char *tmp2; int ret=0; - + html += 4; while(*html != '\0' && isspace((int)*html)) html++; - + tmp = html; - + while(*html != '\0' && !(*html == '?' && *(html+1) == '>')) html++; tmp2 = (char *)calloc(1, (size_t)(html-tmp+1)); if (!tmp2) return ""; - + memcpy(tmp2, tmp, (size_t)(html-tmp)); - + if (pc->phpCallBack) { ret = pc->phpCallBack(tmp2, pc); if (ret != 0) { free(tmp2); return ""; } - } + } free(tmp2); html += 2; - return html; + return html; } /* parse the XML tag itself */ @@ -314,18 +314,18 @@ static const char *parseXMLtag(const char *html, struct PC_ * pc) { const char *tmp; int ret; struct ArgvTable *tmp2 = NULL; - + pc->numArgs = 0; tmp = html; while(*html != '\0' && !isspace((int)*html) && *html != '>') html++; - + /* you may want to upper/lower tags, so I leave the tag itself untouched */ tag = (char *)calloc(1, (size_t)(html-tmp+1)); if (!tag) { return ""; - } + } memcpy(tag, tmp, (size_t)(html-tmp)); - + if (*html == '>') { if (pc->xmlCallBack != NULL) { ret = pc->xmlCallBack(tag, NULL, 0, pc); @@ -333,13 +333,13 @@ static const char *parseXMLtag(const char *html, struct PC_ * pc) { if (*html == '>') html++; return((ret != 0) ? (char *) "" : html); } - } + } while(*html != '\0' && isspace((int)*html)) html++; - + while(*html != '\0' && *html != '>' ) { while(isspace((int)*html)) html++; if (*html == '>') break; - + tmp = html; while(*html != '\0' && !isspace((int)*html) && *html != '=' && *html != '>') html++; name = (char *)calloc(1, (size_t)(html-tmp+1)); @@ -347,18 +347,18 @@ static const char *parseXMLtag(const char *html, struct PC_ * pc) { free(tag); tag = NULL; return ""; - } - memcpy(name, tmp, (size_t)(html-tmp)); + } + memcpy(name, tmp, (size_t)(html-tmp)); if (isspace((int)*html)) { tmp2 = addArgToTable(tmp2, name, NULL, pc); while(*html != '\0' && isspace((int)*html) && *html != '>') html++; - } + } if (*html == '>') { - tmp2 = addArgToTable(tmp2, name, NULL, pc); + tmp2 = addArgToTable(tmp2, name, NULL, pc); html++; break; - } - if (*html == '=') html++; + } + if (*html == '=') html++; if (*html != '"' && *html != '\'') { tmp = html; while(*html != '\0' && *html != '>' && !isspace((int)*html)) html++; @@ -374,7 +374,7 @@ static const char *parseXMLtag(const char *html, struct PC_ * pc) { tmp2 = NULL; } return ""; - } + } memcpy(value, tmp, (size_t)(html-tmp)); tmp2 = addArgToTable(tmp2, name, value, pc); } else if (*html == '"') { @@ -393,7 +393,7 @@ static const char *parseXMLtag(const char *html, struct PC_ * pc) { tmp2 = NULL; } return ""; - } + } memcpy(value, tmp, (size_t)(html-tmp)); if (*html != '\0') html++; @@ -402,7 +402,7 @@ static const char *parseXMLtag(const char *html, struct PC_ * pc) { html++; tmp = html; while(*html != '\0' && !(*html == '\'' && *(html-1) != '\\')) html++; - + value = (char *)calloc(1, (size_t)(html-tmp+1)); if (!value) { free(name); @@ -414,25 +414,25 @@ static const char *parseXMLtag(const char *html, struct PC_ * pc) { tmp2 = NULL; } return ""; - } + } memcpy(value, tmp, (size_t)(html-tmp)); if (*html != '\0') html++; tmp2 = addArgToTable(tmp2, name, value, pc); - } + } tmp = NULL; value = NULL; name = NULL; - } - if (*html != '\0') html++; - ret = pc->xmlCallBack(tag, tmp2, pc->numArgs, pc); + } + if (*html != '\0') html++; + ret = pc->xmlCallBack(tag, tmp2, pc->numArgs, pc); if (tmp2 != NULL) { freeArgs(tmp2, pc); tmp2 = NULL; - } + } free(tag); tag = NULL; - pc->numArgsStatus=0; + pc->numArgsStatus=0; return (ret != 0 ? "" : html); } @@ -442,7 +442,7 @@ static const char *eatUp(const char *html){ (*html != '\0') ) { html++; } - if (*html != '\0') + if (*html != '\0') html++; return html; } @@ -450,7 +450,7 @@ static const char *eatUp(const char *html){ /* cannibalistic function, munches the actuall text */ static const char *eatUpText(const char *html){ while(*html != '\0' && *html != '<') - html++; + html++; return html; } @@ -459,10 +459,10 @@ static const char *eatUpText(const char *html){ otherwise it gormandizes them up. *burps* */ static const char *parseXML(const char *html, struct PC_ * pc) { /* conditional expressions inside a conditional expression - don't try _this_ at home kids! ;-) */ + don't try _this_ at home kids! ;-) */ html=(((tolower((int)(*(html+1))))==(int)('p')) ? ( (pc->phpCallBack) ? parsePHP (html, pc) : eatUp(html) ) : - ( (pc->xmlCallBack) ? parseXMLtag(html, pc) : eatUp(html) ) ); + ( (pc->xmlCallBack) ? parseXMLtag(html, pc) : eatUp(html) ) ); return html; } @@ -472,31 +472,31 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { const char * start = html; int ret = 0; struct ArgvTable *tmp2 = NULL; - + pc->numArgs = 0; tmp = html; - while(*html != '\0' && !isspace((int)*html) && + while(*html != '\0' && !isspace((int)*html) && *html != '>' && *html != '/') html++; - + tag = (char *)calloc(1, (size_t)(html-tmp+1)); if (!tag) { return ""; - } + } memcpy(tag, tmp, (size_t)(html-tmp)); - + if (strncasecmp("script", tag, 6) == 0) { pc->lhtml_script_passthru = 1; } else if (strncasecmp("pre", tag, 3) == 0) { pc->lhtml_script_passthru = 2; } - + if (*html == '>') { if (pc->startCallBack) { ret = pc->startCallBack(tag, NULL, 0, pc); free(tag); tag = NULL; - + /* this check is redundant */ /* if (*html == '>') */ html++; return((ret != 0) ? "" : html); @@ -518,26 +518,26 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { if(pc->XHTMLCallBack){ ret = pc->XHTMLCallBack(tag, NULL, 0, pc); } - + free(tag); tag = NULL; - + html += 2; return((ret != 0) ? "" : html); } - + while(*html != '\0' && isspace((int)*html)) html++; - + while(*html != '\0' && *html != '>' ) { while(isspace((int)*html)) html++; if (*html == '>') break; - + if (*html == '/' && *(html+1) == '>') { html++; break; } - + tmp = html; - while(*html != '\0' && !isspace((int)*html) && + while(*html != '\0' && !isspace((int)*html) && *html != '=' && *html != '>') html++; name = (char *)calloc(1, (size_t)(html-tmp+1)); if (!name) { @@ -545,9 +545,9 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { tag = NULL; return ""; } - + memcpy(name, tmp, (size_t)(html-tmp)); - + if (isspace((int)*html)) { const char *x = html; while(*x != '\0' && *x != '>' && *x != '=') x++; @@ -556,35 +556,35 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { goto namevalue; } tmp2 = addArgToTable(tmp2, name, NULL, pc); - while(*html != '\0' && isspace((int)*html) && - *html != '>' && - !(*html == '/' && *(html+1) == '>')) + while(*html != '\0' && isspace((int)*html) && + *html != '>' && + !(*html == '/' && *(html+1) == '>')) html++; } else { - + if (*html == '/') { html++; break; } - + /* html++ is repeated after the while loop * and may cause deletion of important info */ if (*html == '>') { tmp2 = addArgToTable(tmp2, name, NULL, pc); /*html++;*/ - break; + break; } - + namevalue: if (*html == '=') html++; - + while(isspace(*html)) html++; - + if (*html != '"' && *html != '\'') { tmp = html; - while(*html != '\0' && *html != '>' && - !isspace((int)*html) && - !(*html == '/' && *(html+1) == '>')) + while(*html != '\0' && *html != '>' && + !isspace((int)*html) && + !(*html == '/' && *(html+1) == '>')) html++; value = (char *)calloc(1, (size_t)(html-tmp+1)); if (value == NULL) { @@ -592,7 +592,7 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { name = NULL; free(tag); tag = NULL; - + freeArgs(tmp2, pc); return ""; } @@ -601,8 +601,8 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { } else if (*html == '"') { html++; tmp = html; - while (*html != '\0' && - !(*html == '"' && *(html-1) != '\\')) + while (*html != '\0' && + !(*html == '"' && *(html-1) != '\\')) html++; value = (char *) calloc(1, (size_t)(html-tmp+1)); if (value == NULL) { @@ -610,7 +610,7 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { name = NULL; free(tag); tag = NULL; - + freeArgs(tmp2, pc); return ""; } @@ -622,7 +622,7 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { } else if (*html == '\'') { html++; tmp = html; - while(*html != '\0' && !(*html == '\'' && + while(*html != '\0' && !(*html == '\'' && *(html-1) != '\\')) html++; value = (char *)calloc(1, (size_t)(html-tmp+1)); @@ -631,7 +631,7 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { name = NULL; free(tag); tag = NULL; - + freeArgs(tmp2, pc); return ""; } @@ -645,12 +645,12 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { } } if (*html != '\0') html++; - + if (html - start > 2) { if (pc->startCallBack != NULL && (*(html-2)!='/')) { ret = pc->startCallBack(tag, tmp2, pc->numArgs, pc); } - if (pc->endCallBack != NULL && ret==0 && *(html-2)=='/' + if (pc->endCallBack != NULL && ret==0 && *(html-2)=='/' && !(pc->XHTMLCallBack)) { ret = pc->endCallBack(tag, pc); } @@ -664,9 +664,9 @@ static const char *parseStartTag (const char *html, struct PC_ * pc) { } free(tag); tag = NULL; - + pc->numArgsStatus=0; - + /* this is a bad hack, feel free to write a better one (maybe a more readable one? ;-)*/ return (pc->XHTMLCallBack != NULL) ? @@ -679,90 +679,90 @@ static const char *parseDecl(const char *html, struct PC_ * pc) { const char *tmp; int ret=0; struct ArgvTable *tmp2 = NULL; - + pc->numArgs = 0; tmp = html; while(*html != '\0' && !isspace((int)*html) && *html != '>') html++; - + tag = (char *)calloc(1, (size_t)(html-tmp+1)); if (!tag) { return ""; } - + memcpy(tag, tmp, (size_t)(html-tmp)); - + if (*html == '>') { if (pc->declCallBack) { ret = pc->declCallBack(tag, NULL, 0, pc); free(tag); tag = NULL; - + if (*html == '>') html++; return((ret != 0) ? "" : html); } } - + while(*html != '\0' && isspace((int)*html)) html++; - + while(*html != '\0' && *html != '>') { while(isspace((int)*html)) html++; - if (*html == '>') break; - tmp = html; - switch(*tmp) { - case '\'' : + if (*html == '>') break; + tmp = html; + switch(*tmp) { + case '\'' : html++; tmp = html; - while(*html != '\0' && !(*html == '\'' && *html != '\\')) + while(*html != '\0' && !(*html == '\'' && *html != '\\')) html++; break; case '"' : html++; tmp = html; - while(*html != '\0' && !(*html == '"' && *html != '\\')) + while(*html != '\0' && !(*html == '"' && *html != '\\')) html++; break; default : - while(*html != '\0' && !isspace((int)*html) && *html != '=' && *html != '>') + while(*html != '\0' && !isspace((int)*html) && *html != '=' && *html != '>') html++; break; } - + name = (char *) calloc(1, (size_t)(html-tmp+1)); if (!name) { free(tag); tag = NULL; return ""; } - + memcpy(name, tmp, (size_t)(html-tmp)); - + if (isspace((int)*html)) { tmp2 = addArgToTable(tmp2, name, NULL, pc); - while(*html != '\0' && isspace((int)*html) && *html != '>') + while(*html != '\0' && isspace((int)*html) && *html != '>') html++; continue; } - + if (*html == '>') { tmp2 = addArgToTable(tmp2, name, NULL, pc); html++; break; } - + if (*(html+1) == '>') { tmp2 = addArgToTable(tmp2, name, NULL, pc); html += 2; break; } - - if (*html == '=') html++; - switch(*html){ - case '\'' : + + if (*html == '=') html++; + switch(*html){ + case '\'' : html++; tmp = html; - while(*html != '\0' && !(*html == '\'' && *(html-1) != '\\')) + while(*html != '\0' && !(*html == '\'' && *(html-1) != '\\')) html++; - + value = (char *) calloc(1, (size_t)(html-tmp+1)); if (!value) { free(name); @@ -773,13 +773,13 @@ static const char *parseDecl(const char *html, struct PC_ * pc) { freeArgs(tmp2, pc); return ""; } - + memcpy(value, tmp, (size_t)(html-tmp)); if (*html != '\0') html++; tmp2 = addArgToTable(tmp2, name, value, pc); break; - case '"' : + case '"' : html++; tmp = html; while (*html != '\0' && !(*html == '"' && *(html-1) != '\\')) @@ -794,16 +794,16 @@ static const char *parseDecl(const char *html, struct PC_ * pc) { freeArgs(tmp2, pc); return ""; } - + memcpy(value, tmp, (size_t)(html-tmp)); - if (*html != '\0') + if (*html != '\0') html++; tmp2 = addArgToTable(tmp2, name, value, pc); break; - default : + default : html++; tmp = html; - while(*html != '\0' && *html != '>' && !isspace((int)*html)) + while(*html != '\0' && *html != '>' && !isspace((int)*html)) html++; value = (char *) calloc(1, (size_t)(html-tmp+1)); if (!value) { @@ -815,26 +815,26 @@ static const char *parseDecl(const char *html, struct PC_ * pc) { freeArgs(tmp2, pc); return ""; } - + memcpy(value, tmp, (size_t)(html-tmp)); tmp2 = addArgToTable(tmp2, name, value, pc); break; } tmp = NULL; } - + if (*html != '\0') html++; - + if (pc->declCallBack) { ret = pc->declCallBack(tag, tmp2, pc->numArgs, pc); freeArgs(tmp2, pc); free(tag); - tag = NULL; + tag = NULL; return((ret != 0) ? "" : html); - } + } freeArgs(tmp2, pc); pc->numArgsStatus=0; - + return html; } @@ -845,12 +845,12 @@ static const char *parseForEntities (const char *tmp, struct PC_ * pc){ while(*tmp != '\0'){ tmp1 = tmp; while(*tmp != '\0' && *tmp != '&')tmp++; - + text = (char *)calloc(1, (size_t)(tmp-tmp1+1)); if (text == NULL) { return ""; } - + memcpy(text, tmp1, (size_t)(tmp-tmp1)); /* the chunk of text before the first entity will not be called, if it starts with an entity*/ @@ -859,9 +859,9 @@ static const char *parseForEntities (const char *tmp, struct PC_ * pc){ ret = pc->textCallBack(text, pc); } free(text); - text = NULL; + text = NULL; tmp1 = ""; - } + } if(*tmp == '&'){ tmp++; tmp2=tmp; @@ -893,11 +893,11 @@ static void parse (const char *html, struct PC_ * pc) { while(*html != '\0') { /* while(isspace(*html)){html++;} there may be leading blanks in some autogenerated files add this or not, that is the question ;-)) */ - + if (pc->lhtml_script_passthru != 0) { const char *text; char *tmp; - + text = html; if (pc->lhtml_script_passthru == 1 ){ while(*text != '\0') { @@ -924,12 +924,12 @@ static void parse (const char *html, struct PC_ * pc) { } tmp = (char *) malloc((size_t)(text-html+1)); if (tmp == NULL) { - fprintf(stderr, + fprintf(stderr, _("Fatal: could not allocate (%s at %s:%d).\n"), strerror(errno), __FILE__, __LINE__); return; } - + strncpy(tmp, html, (size_t)(text-html)); tmp[text-html] = '\0'; /* strncpy does not zero-terminate! */ if (pc->textCallBack != NULL) { @@ -937,21 +937,21 @@ static void parse (const char *html, struct PC_ * pc) { if (ret != 0) { free(tmp); tmp = NULL; - + return; } } - + free(tmp); tmp = NULL; - + pc->lhtml_script_passthru = 0; html = text; } - + if(*html == '<'){ html++; - + switch (*html){ case '!' : html++; @@ -1005,7 +1005,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = (EXTRACTOR_KeywordList*)malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = strdup(keyword); result->keywordType = type; return result; @@ -1043,7 +1043,7 @@ static char * getTag(char * arg, struct ArgvTable * args, int numargs) { int i; - for (i=0;i<numargs;i++) + for (i=0;i<numargs;i++) if (0 == strcasecmp(args[i].arg, arg)) return args[i].val; return NULL; @@ -1053,10 +1053,10 @@ static struct { char * name; EXTRACTOR_KeywordType type; } tagmap[] = { - { "author" , EXTRACTOR_AUTHOR}, + { "author" , EXTRACTOR_AUTHOR}, { "description" , EXTRACTOR_DESCRIPTION}, { "language", EXTRACTOR_LANGUAGE}, - { "rights", EXTRACTOR_COPYRIGHT}, + { "rights", EXTRACTOR_COPYRIGHT}, { "publisher", EXTRACTOR_PUBLISHER}, { "date", EXTRACTOR_DATE}, { "keywords", EXTRACTOR_KEYWORDS}, @@ -1065,8 +1065,8 @@ static struct { -static int starttag(char *tag, - struct ArgvTable *args, +static int starttag(char *tag, + struct ArgvTable *args, int numargs, struct PC_ * pc) { int i; @@ -1075,11 +1075,11 @@ static int starttag(char *tag, pc->nextTextAction = 1; pc->nextKeywordType = EXTRACTOR_TITLE; return 0; - } + } if (0 == strcasecmp(tag,"meta")) { i = 0; while (tagmap[i].name != NULL) { - if (hasTag("name",tagmap[i].name,args, numargs)) + if (hasTag("name",tagmap[i].name,args, numargs)) pc->result = addKeyword(tagmap[i].type, getTag("content", args, numargs), @@ -1094,8 +1094,8 @@ static int starttag(char *tag, "text/html", pc->result); return 0; - } -#endif + } +#endif if ( (tag != NULL) && ( (0 == strcasecmp(tag, "body")) || (0 == strcasecmp(tag, "/body")) ) ) @@ -1174,7 +1174,7 @@ struct EXTRACTOR_Keywords * libextractor_html_extract(const char * filename, return prev; j++; } - } + } memset(&pc, 0, @@ -1186,14 +1186,14 @@ struct EXTRACTOR_Keywords * libextractor_html_extract(const char * filename, if (size > 1024 * 32) xsize = 1024 * 32; else - xsize = size; + xsize = size; /* the parser requires 0-termination. We just overwrite the last character in data and restore it later, assuming that it can - hardly be a keyword in a valid HTML text... + hardly be a keyword in a valid HTML text... */ backup = data[xsize-1]; - data[xsize-1] = '\0'; + data[xsize-1] = '\0'; parse(data, &pc); data[xsize-1] = backup; return pc.result; diff --git a/src/plugins/id3v23extractor.c b/src/plugins/id3v23extractor.c @@ -36,13 +36,13 @@ #include "convert.h" -static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, char *phrase, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * keyword; - + keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = oldhead; + keyword->next = oldhead; keyword->keyword = phrase; keyword->keywordType = type; return keyword; @@ -90,7 +90,7 @@ static Matches tmap[] = { /* mimetype = audio/mpeg */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_id3v23_extract(const char * filename, const unsigned char * data, const size_t size, @@ -125,12 +125,12 @@ libextractor_id3v23_extract(const char * filename, ehdrSize = ( ( (data[10]) << 24 ) | ( (data[11]) << 16 ) | ( (data[12]) << 8 ) | - ( (data[12]) << 0 ) ); + ( (data[12]) << 0 ) ); padding = ( ( (data[15]) << 24 ) | ( (data[16]) << 16 ) | ( (data[17]) << 8 ) | - ( (data[18]) << 0 ) ); + ( (data[18]) << 0 ) ); pos += 4 + ehdrSize; if (padding < tsize) tsize -= padding; diff --git a/src/plugins/id3v24extractor.c b/src/plugins/id3v24extractor.c @@ -36,13 +36,13 @@ #include "convert.h" -static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, char *phrase, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * keyword; - + keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = oldhead; + keyword->next = oldhead; keyword->keyword = phrase; keyword->keywordType = type; return keyword; @@ -89,7 +89,7 @@ static Matches tmap[] = { /* mimetype = audio/mpeg */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_id3v24_extract(const char * filename, const unsigned char * data, const size_t size, @@ -143,7 +143,7 @@ libextractor_id3v24_extract(const char * filename, ( (data[pos+5] & 0x7F) << 14 ) | ( (data[pos+6] & 0x7F) << 7 ) | ( (data[pos+7] & 0x7F) << 0 ) ); - + if ( (pos + 10 + csize > tsize) || (csize > tsize) || (csize == 0) ) @@ -186,7 +186,7 @@ libextractor_id3v24_extract(const char * filename, "UTF-16BE"); break; case 0x03 : - word = malloc(csize+1); + word = malloc(csize+1); memcpy(word, &data[pos+11], csize); diff --git a/src/plugins/id3v2extractor.c b/src/plugins/id3v2extractor.c @@ -29,13 +29,13 @@ #define DEBUG_EXTRACT_ID3v2 0 -static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, char *phrase, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * keyword; - + keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = oldhead; + keyword->next = oldhead; keyword->keyword = phrase; keyword->keywordType = type; return keyword; @@ -104,7 +104,7 @@ struct EXTRACTOR_Keywords * libextractor_id3v2_extract(char * filename, ( (data[7] & 0x7F) << 14 ) | ( (data[8] & 0x7F) << 07 ) | ( (data[9] & 0x7F) << 00 ) ); - + if (tsize + 10 > size) return prev; pos = 10; diff --git a/src/plugins/jpegextractor.c b/src/plugins/jpegextractor.c @@ -37,7 +37,7 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -56,14 +56,14 @@ unsigned int NEXTC(unsigned char ** data, char * end) { char result = **data; (*data)++; return result; - } else + } else return -1; } */ /** * Read length, convert to unsigned int. - * All 2-byte quantities in JPEG markers are MSB first + * All 2-byte quantities in JPEG markers are MSB first * @return -1 on error */ static int readLength(unsigned char ** data, @@ -83,19 +83,19 @@ static int readLength(unsigned char ** data, /** * @return the next marker or -1 on error. */ -static int next_marker(unsigned char ** data, +static int next_marker(unsigned char ** data, unsigned char * end) { int c; c = NEXTC(data, end); - while ( (c != 0xFF) && (c != -1) ) - c = NEXTC(data, end); + while ( (c != 0xFF) && (c != -1) ) + c = NEXTC(data, end); do { c = NEXTC(data, end); } while ( (c == 0xFF) && (c != -1) ); return c; } -static void skip_variable(unsigned char ** data, +static void skip_variable(unsigned char ** data, unsigned char * end) { int length; @@ -108,7 +108,7 @@ static void skip_variable(unsigned char ** data, (*data) += length; } -static char * process_COM(unsigned char ** data, +static char * process_COM(unsigned char ** data, unsigned char * end) { unsigned int length; int ch; @@ -117,7 +117,7 @@ static char * process_COM(unsigned char ** data, length = readLength(data, end); if (length <= 0) - return NULL; + return NULL; comment = malloc(length+1); pos = 0; while (length > 0) { @@ -125,8 +125,8 @@ static char * process_COM(unsigned char ** data, if ( (ch == '\r') || (ch == '\n') ) comment[pos++] = '\n'; - else if (isprint(ch)) - comment[pos++] = ch; + else if (isprint(ch)) + comment[pos++] = ch; length--; } comment[pos] = '\0'; @@ -160,12 +160,12 @@ struct EXTRACTOR_Keywords * libextractor_jpeg_extract(const char * filename, case -1: /* end of file */ case M_SOS: case M_EOI: - goto RETURN; /* this used to be "return result", but this + goto RETURN; /* this used to be "return result", but this makes certain compilers unhappy...*/ case M_APP0: { int len = readLength(&data, end); if (len < 0x8) - goto RETURN; + goto RETURN; if (0 == strncmp(data, "JFIF", 4)) { @@ -213,7 +213,7 @@ struct EXTRACTOR_Keywords * libextractor_jpeg_extract(const char * filename, char * val; int len = readLength(&data, end); if (len < 0x9) - goto RETURN; + goto RETURN; val = malloc(128); snprintf(val, 128, "%ux%u", @@ -222,7 +222,7 @@ struct EXTRACTOR_Keywords * libextractor_jpeg_extract(const char * filename, result = addKeyword(EXTRACTOR_SIZE, val, result); - data = &data[len]; + data = &data[len]; break; } case M_COM: diff --git a/src/plugins/lowerextractor.c b/src/plugins/lowerextractor.c @@ -26,7 +26,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = *list; + next->next = *list; next->keyword = strdup(keyword); next->keywordType = type; *list = next; diff --git a/src/plugins/manextractor.c b/src/plugins/manextractor.c @@ -65,14 +65,14 @@ static void NEXT(size_t * end, const char * buf, const size_t size) { int quot; - + quot = 0; while ( (*end < size) && - ( ((quot & 1) != 0) || + ( ((quot & 1) != 0) || ( (buf[*end] != ' ') ) ) ) { if (buf[*end] == '\"') quot++; - (*end)++; + (*end)++; } if ((quot & 1) == 1) (*end) = size+1; @@ -84,7 +84,7 @@ static struct EXTRACTOR_Keywords * tryParse(const char * buf, int pos; size_t xsize; const size_t xlen = strlen(".TH "); - + pos = 0; if (size < xlen) return prev; @@ -100,12 +100,12 @@ static struct EXTRACTOR_Keywords * tryParse(const char * buf, (buf[xsize] != '\n') ) xsize++; size = xsize; - + if (0 == strncmp(".TH ", &buf[pos], xlen)) { int end; - + pos += xlen; end = pos; NEXT(&end, buf, size); if (end > size) return prev; @@ -113,19 +113,19 @@ static struct EXTRACTOR_Keywords * tryParse(const char * buf, prev = addKeyword(EXTRACTOR_TITLE, stndup(&buf[pos], end - pos), - prev); + prev); pos = end + 1; } if (pos >= size) return prev; end = pos; - NEXT(&end, buf, size); if (end > size) return prev; + NEXT(&end, buf, size); if (end > size) return prev; if (buf[pos] == '\"') pos++; if ( (end-pos >= 1) && (end - pos <= 4) ) { switch (buf[pos]) { case '1': prev = addKeyword(EXTRACTOR_CATEGORY, - strdup(_("Commands")), + strdup(_("Commands")), prev); break; case '2': @@ -177,7 +177,7 @@ static struct EXTRACTOR_Keywords * tryParse(const char * buf, prev = addKeyword(EXTRACTOR_DATE, stndup(&buf[pos], end - pos), - prev); + prev); pos = end + 1; } end = pos; @@ -186,7 +186,7 @@ static struct EXTRACTOR_Keywords * tryParse(const char * buf, prev = addKeyword(EXTRACTOR_SOURCE, stndup(&buf[pos], end - pos), - prev); + prev); pos = end + 1; } end = pos; @@ -195,9 +195,9 @@ static struct EXTRACTOR_Keywords * tryParse(const char * buf, prev = addKeyword(EXTRACTOR_BOOKTITLE, stndup(&buf[pos], end - pos), - prev); + prev); pos = end + 1; - } + } } return prev; @@ -216,7 +216,7 @@ struct EXTRACTOR_Keywords * libextractor_man_extract(const char * filename, gzFile gz; char * buf; int len; - + gz = gzopen(filename, "rb"); buf = malloc(MAX_READ); len = gzread(gz, buf, MAX_READ); diff --git a/src/plugins/mimeextractor.c b/src/plugins/mimeextractor.c @@ -30,7 +30,7 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -53,7 +53,7 @@ typedef int (*Detector)(char * data, * @param len the length of the file * @return always 1 **/ -static int defaultDetector(char * data, +static int defaultDetector(char * data, size_t len, void * arg) { return 1; @@ -65,7 +65,7 @@ static int defaultDetector(char * data, * @param len the length of the file * @return always 0 **/ -static int disableDetector(char * data, +static int disableDetector(char * data, size_t len, void * arg) { return 0; @@ -101,7 +101,7 @@ static ExtraPattern xpatterns[] = { { 0, 0, NULL }, #define ACON_XPATTERN 12 { 8, 4, "ACON"}, - { 0, 0, NULL}, + { 0, 0, NULL}, }; /** @@ -110,7 +110,7 @@ static ExtraPattern xpatterns[] = { * entries in the main table, so this "AND" (all match) semantics are * the only reasonable answer. **/ -static int xPatternMatcher(char * data, +static int xPatternMatcher(char * data, size_t len, ExtraPattern * arg) { while (arg->pattern != NULL) { @@ -152,8 +152,8 @@ typedef struct Pattern { static Pattern patterns[] = { { "\xFF\xD8", 2, "image/jpeg", DEFAULT}, - { "\211PNG\r\n\032\n", 8, "image/png", DEFAULT}, - { "/* XPM */", 9, "image/x-xpm", DEFAULT}, + { "\211PNG\r\n\032\n", 8, "image/png", DEFAULT}, + { "/* XPM */", 9, "image/x-xpm", DEFAULT}, { "GIF8", 4, "image/gif", DEFAULT}, { "P1", 2, "image/x-portable-bitmap", DEFAULT}, { "P2", 2, "image/x-portable-graymap", DEFAULT}, @@ -168,9 +168,9 @@ static Pattern patterns[] = { { "hsi1", 4, "image/x-jpeg-proprietary", DEFAULT}, { "\x2E\x52\x4d\x46", 4, "video/real", DEFAULT}, { "\x2e\x72\x61\xfd", 4, "audio/real", DEFAULT}, - { "\177ELF", 4, "application/elf", DEFAULT}, + { "\177ELF", 4, "application/elf", DEFAULT}, /* FIXME: correct MIME-type for an ELF!? */ - { "\xca\xfe\xba\xbe", 4, "application/java", DEFAULT}, + { "\xca\xfe\xba\xbe", 4, "application/java", DEFAULT}, /* FIXME: correct MIME for a class-file? */ { "gimp xcf", 8, "image/xcf", DEFAULT}, { "IIN1", 4, "image/tiff", DEFAULT}, @@ -183,13 +183,13 @@ static Pattern patterns[] = { { "RIFF", 4, "audio/x-wav", XPATTERN(WAVE_XPATTERN)}, { "RIFX", 4, "video/avi", XPATTERN(AVI_XPATTERN)}, { "RIFX", 4, "audio/x-wav", XPATTERN(WAVE_XPATTERN)}, - { "RIFF", 4, "audio/midi", XPATTERN(RMID_XPATTERN)}, - { "RIFX", 4, "audio/midi", XPATTERN(RMID_XPATTERN)}, - { "RIFF", 4, "image/x-animated-cursor", XPATTERN(ACON_XPATTERN)}, - { "RIFX", 4, "image/x-animated-cursor", XPATTERN(ACON_XPATTERN)}, + { "RIFF", 4, "audio/midi", XPATTERN(RMID_XPATTERN)}, + { "RIFX", 4, "audio/midi", XPATTERN(RMID_XPATTERN)}, + { "RIFF", 4, "image/x-animated-cursor", XPATTERN(ACON_XPATTERN)}, + { "RIFX", 4, "image/x-animated-cursor", XPATTERN(ACON_XPATTERN)}, { "\211GND\r\n\032\n", 8, "application/gnunet-directory", DEFAULT}, { "{\\rtf", 5, "application/rtf", DEFAULT}, - { "\xf7\x02", 2, "application/x-dvi", DEFAULT}, + { "\xf7\x02", 2, "application/x-dvi", DEFAULT}, { "\x1F\x8B\x08\x00", 4, "application/x-gzip", DEFAULT}, { "BZh91AY&SY", 10, "application/bz2", DEFAULT}, { "\xED\xAB\xEE\xDB", 4, "application/x-rpm", DEFAULT}, /* binary */ diff --git a/src/plugins/mp3extractor.c b/src/plugins/mp3extractor.c @@ -18,7 +18,7 @@ Boston, MA 02111-1307, USA. - Some of this code is based on AVInfo 1.0 alpha 11 + Some of this code is based on AVInfo 1.0 alpha 11 (c) George Shuklin, gs]AT[shounen.ru, 2002-2004 http://shounen.ru/soft/avinfo/ @@ -47,19 +47,19 @@ typedef struct { static const char *const genre_names[] = { gettext_noop("Blues"), - gettext_noop("Classic Rock"), - gettext_noop("Country"), - gettext_noop("Dance"), - gettext_noop("Disco"), - gettext_noop("Funk"), + gettext_noop("Classic Rock"), + gettext_noop("Country"), + gettext_noop("Dance"), + gettext_noop("Disco"), + gettext_noop("Funk"), gettext_noop("Grunge"), gettext_noop("Hip-Hop"), - gettext_noop("Jazz"), - gettext_noop("Metal"), + gettext_noop("Jazz"), + gettext_noop("Metal"), gettext_noop("New Age"), gettext_noop("Oldies"), - gettext_noop("Other"), - gettext_noop("Pop"), + gettext_noop("Other"), + gettext_noop("Pop"), gettext_noop("R&B"), gettext_noop("Rap"), gettext_noop("Reggae"), @@ -68,57 +68,57 @@ static const char *const genre_names[] = { gettext_noop("Industrial"), gettext_noop("Alternative"), gettext_noop("Ska"), - gettext_noop("Death Metal"), + gettext_noop("Death Metal"), gettext_noop("Pranks"), - gettext_noop("Soundtrack"), + gettext_noop("Soundtrack"), gettext_noop("Euro-Techno"), - gettext_noop("Ambient"), + gettext_noop("Ambient"), gettext_noop("Trip-Hop"), gettext_noop("Vocal"), gettext_noop("Jazz+Funk"), - gettext_noop("Fusion"), - gettext_noop("Trance"), - gettext_noop("Classical"), + gettext_noop("Fusion"), + gettext_noop("Trance"), + gettext_noop("Classical"), gettext_noop("Instrumental"), gettext_noop("Acid"), gettext_noop("House"), gettext_noop("Game"), - gettext_noop("Sound Clip"), + gettext_noop("Sound Clip"), gettext_noop("Gospel"), - gettext_noop("Noise"), + gettext_noop("Noise"), gettext_noop("Alt. Rock"), - gettext_noop("Bass"), - gettext_noop("Soul"), + gettext_noop("Bass"), + gettext_noop("Soul"), gettext_noop("Punk"), gettext_noop("Space"), gettext_noop("Meditative"), gettext_noop("Instrumental Pop"), - gettext_noop("Instrumental Rock"), - gettext_noop("Ethnic"), + gettext_noop("Instrumental Rock"), + gettext_noop("Ethnic"), gettext_noop("Gothic"), - gettext_noop("Darkwave"), + gettext_noop("Darkwave"), gettext_noop("Techno-Industrial"), gettext_noop("Electronic"), gettext_noop("Pop-Folk"), - gettext_noop("Eurodance"), - gettext_noop("Dream"), + gettext_noop("Eurodance"), + gettext_noop("Dream"), gettext_noop("Southern Rock"), gettext_noop("Comedy"), - gettext_noop("Cult"), - gettext_noop("Gangsta Rap"), - gettext_noop("Top 40"), + gettext_noop("Cult"), + gettext_noop("Gangsta Rap"), + gettext_noop("Top 40"), gettext_noop("Christian Rap"), gettext_noop("Pop/Funk"), gettext_noop("Jungle"), gettext_noop("Native American"), - gettext_noop("Cabaret"), + gettext_noop("Cabaret"), gettext_noop("New Wave"), gettext_noop("Psychedelic"), gettext_noop("Rave"), - gettext_noop("Showtunes"), + gettext_noop("Showtunes"), gettext_noop("Trailer"), - gettext_noop("Lo-Fi"), - gettext_noop("Tribal"), + gettext_noop("Lo-Fi"), + gettext_noop("Tribal"), gettext_noop("Acid Punk"), gettext_noop("Acid Jazz"), gettext_noop("Polka"), @@ -130,53 +130,53 @@ static const char *const genre_names[] = { gettext_noop("Folk/Rock"), gettext_noop("National Folk"), gettext_noop("Swing"), - gettext_noop("Fast-Fusion"), + gettext_noop("Fast-Fusion"), gettext_noop("Bebob"), gettext_noop("Latin"), gettext_noop("Revival"), gettext_noop("Celtic"), gettext_noop("Bluegrass"), - gettext_noop("Avantgarde"), + gettext_noop("Avantgarde"), gettext_noop("Gothic Rock"), - gettext_noop("Progressive Rock"), + gettext_noop("Progressive Rock"), gettext_noop("Psychedelic Rock"), - gettext_noop("Symphonic Rock"), + gettext_noop("Symphonic Rock"), gettext_noop("Slow Rock"), - gettext_noop("Big Band"), + gettext_noop("Big Band"), gettext_noop("Chorus"), gettext_noop("Easy Listening"), - gettext_noop("Acoustic"), + gettext_noop("Acoustic"), gettext_noop("Humour"), gettext_noop("Speech"), gettext_noop("Chanson"), - gettext_noop("Opera"), + gettext_noop("Opera"), gettext_noop("Chamber Music"), gettext_noop("Sonata"), - gettext_noop("Symphony"), + gettext_noop("Symphony"), gettext_noop("Booty Bass"), - gettext_noop("Primus"), + gettext_noop("Primus"), gettext_noop("Porn Groove"), gettext_noop("Satire"), - gettext_noop("Slow Jam"), - gettext_noop("Club"), - gettext_noop("Tango"), + gettext_noop("Slow Jam"), + gettext_noop("Club"), + gettext_noop("Tango"), gettext_noop("Samba"), - gettext_noop("Folklore"), - gettext_noop("Ballad"), - gettext_noop("Power Ballad"), + gettext_noop("Folklore"), + gettext_noop("Ballad"), + gettext_noop("Power Ballad"), gettext_noop("Rhythmic Soul"), - gettext_noop("Freestyle"), + gettext_noop("Freestyle"), gettext_noop("Duet"), gettext_noop("Punk Rock"), - gettext_noop("Drum Solo"), - gettext_noop("A Cappella"), + gettext_noop("Drum Solo"), + gettext_noop("A Cappella"), gettext_noop("Euro-House"), gettext_noop("Dance Hall"), gettext_noop("Goa"), gettext_noop("Drum & Bass"), gettext_noop("Club-House"), - gettext_noop("Hardcore"), - gettext_noop("Terror"), + gettext_noop("Hardcore"), + gettext_noop("Terror"), gettext_noop("Indie"), gettext_noop("BritPop"), gettext_noop("Negerpunk"), @@ -187,7 +187,7 @@ static const char *const genre_names[] = { gettext_noop("Black Metal"), gettext_noop("Crossover"), gettext_noop("Contemporary Christian"), - gettext_noop("Christian Rock"), + gettext_noop("Christian Rock"), gettext_noop("Merengue"), gettext_noop("Salsa"), gettext_noop("Thrash Metal"), @@ -244,11 +244,11 @@ int freq_table[4][3]={ #define INVALID_ID3 2 /** - * Remove trailing whitespace from the end of a string + * Remove trailing whitespace from the end of a string */ static char * unpad(char * string) { char * end = &string[strlen(string) - 1]; - while ( (end >= string) && + while ( (end >= string) && (' ' == end[0]) ) (end--)[0]='\0'; return string; @@ -264,7 +264,7 @@ static int get_id3(unsigned char * data, pos = &data[size - 128]; if (0 != strncmp((const char *)"TAG",(const char *)pos, 3)) - return INVALID_ID3; + return INVALID_ID3; pos += 3; id3->title = convertToUtf8(pos, @@ -288,15 +288,15 @@ static int get_id3(unsigned char * data, return OK; } -static struct EXTRACTOR_Keywords * -addkword(EXTRACTOR_KeywordList *oldhead, +static struct EXTRACTOR_Keywords * +addkword(EXTRACTOR_KeywordList *oldhead, char *phrase, EXTRACTOR_KeywordType type) { - + EXTRACTOR_KeywordList * keyword; - + keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = oldhead; + keyword->next = oldhead; keyword->keyword = strdup(phrase); keyword->keywordType = type; return keyword; @@ -304,7 +304,7 @@ addkword(EXTRACTOR_KeywordList *oldhead, -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * mp3parse(char * data, size_t size, struct EXTRACTOR_Keywords * prev) { @@ -333,7 +333,7 @@ mp3parse(char * data, memcpy(&header, &data[pos], sizeof(header)); - if ((header&sync_mask)==sync_mask) + if ((header&sync_mask)==sync_mask) break;/*found header sync*/ pos++; counter++; /*next try*/ @@ -343,36 +343,36 @@ mp3parse(char * data, };/*give up to find mp3 header*/ prev = addkword(prev, - "audio/mpeg", - EXTRACTOR_MIMETYPE); + "audio/mpeg", + EXTRACTOR_MIMETYPE); do { /*ok, now we found a mp3 frame header*/ frames++; switch (header & mpeg_ver_mask){ - case 0x1000: + case 0x1000: mpeg_ver = MPEG_ERR; /*error*/ break; - case 0x800: + case 0x800: prev = addkword(prev, - "MPEG V2", - EXTRACTOR_RESOURCE_TYPE); + "MPEG V2", + EXTRACTOR_RESOURCE_TYPE); mpeg_ver = MPEG_V2; break; case 0x1800: prev = addkword(prev, - "MPEG V1", - EXTRACTOR_RESOURCE_TYPE); + "MPEG V1", + EXTRACTOR_RESOURCE_TYPE); mpeg_ver = MPEG_V1; break; case 0: prev = addkword(prev, - "MPEG V25", - EXTRACTOR_RESOURCE_TYPE); + "MPEG V25", + EXTRACTOR_RESOURCE_TYPE); mpeg_ver = MPEG_V25; break; } switch(header&mpeg_layer_mask){ - case 0x400: + case 0x400: layer_ver=LAYER_2; break; case 0x200: @@ -386,9 +386,9 @@ mp3parse(char * data, } if (!layer_ver||!mpeg_ver) return prev; /*unknown mpeg type*/ - if (mpeg_ver<3) - idx_num=(mpeg_ver-1)*3+layer_ver-1; - else + if (mpeg_ver<3) + idx_num=(mpeg_ver-1)*3+layer_ver-1; + else idx_num=2+layer_ver; bitrate = 1000*bitrate_table[(header&bitrate_mask)>>20][idx_num]; if (bitrate<0) { @@ -400,15 +400,15 @@ mp3parse(char * data, frames--; break; } /*error in header*/ - if ((header&ch_mask)==ch_mask) + if ((header&ch_mask)==ch_mask) ch=1; - else + else ch=2; /*stereo non stereo select*/ frame_size = 144*bitrate/(sample_rate?sample_rate:1)+((header&pad_mask)>>17); avg_bps += bitrate/1000; pos += frame_size-4; - if (frames > max_frames_scan) + if (frames > max_frames_scan) break; /*optimization*/ if (avg_bps/frames!=bitrate/1000) vbr_flag=1; @@ -419,7 +419,7 @@ mp3parse(char * data, sizeof(header)); } while ((header&sync_mask)==sync_mask); - if (!frames) + if (!frames) return prev; /*no valid frames*/ avg_bps = avg_bps/frames; if (max_frames_scan){ /*if not all frames scaned*/ @@ -427,7 +427,7 @@ mp3parse(char * data, } else{ length=1152*frames/(sample_rate?sample_rate:0xFFFFFFFF); } - + format = malloc(512); snprintf(format, 512, @@ -439,14 +439,14 @@ mp3parse(char * data, vbr_flag ? _("(variable bps)"):""); prev = addkword(prev, format, - EXTRACTOR_FORMAT); + EXTRACTOR_FORMAT); free(format); return prev; } /* mimetype = audio/mpeg */ -struct EXTRACTOR_Keywords * +struct EXTRACTOR_Keywords * libextractor_mp3_extract(char * filename, char * data, size_t size, @@ -454,29 +454,29 @@ libextractor_mp3_extract(char * filename, id3tag info; char * word; - if (0 != get_id3(data, size, &info)) + if (0 != get_id3(data, size, &info)) return klist; - if (strlen(info.title) > 0) - klist = addkword(klist, info.title, EXTRACTOR_TITLE); + if (strlen(info.title) > 0) + klist = addkword(klist, info.title, EXTRACTOR_TITLE); if (strlen(info.artist) > 0) klist = addkword(klist, info.artist, EXTRACTOR_ARTIST); - if (strlen(info.album) > 0) + if (strlen(info.album) > 0) klist = addkword(klist, info.album, EXTRACTOR_ALBUM); - if (strlen(info.year) > 0) + if (strlen(info.year) > 0) klist = addkword(klist, info.year, EXTRACTOR_DATE); - if (strlen(info.genre) > 0) + if (strlen(info.genre) > 0) klist = addkword(klist, info.genre, EXTRACTOR_GENRE); - if (strlen(info.genre) > 0) + if (strlen(info.genre) > 0) klist = addkword(klist, info.comment, EXTRACTOR_COMMENT); /* A keyword that has all of the information together) */ word = (char*) malloc(strlen(info.artist) + strlen(info.title) + strlen(info.album) + 6); - sprintf(word, + sprintf(word, "%s: %s (%s)", - info.artist, - info.title, + info.artist, + info.title, info.album); klist = addkword(klist, word, EXTRACTOR_DESCRIPTION); free(word); diff --git a/src/plugins/mpegextractor.c b/src/plugins/mpegextractor.c @@ -18,7 +18,7 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - This code was based on AVInfo 1.0 alpha 11 + This code was based on AVInfo 1.0 alpha 11 (c) George Shuklin, gs]AT[shounen.ru, 2002-2004 http://shounen.ru/soft/avinfo/ @@ -36,7 +36,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = *list; + next->next = *list; next->keyword = keyword; next->keywordType = type; *list = next; @@ -54,9 +54,9 @@ static double round_double(double num) { static unsigned int fread_be(unsigned char * data) { int x; unsigned int result = 0; - + for (x=3;x>=0;x--) - result |= data[4-x] << (x*8); + result |= data[4-x] << (x*8); return result; } @@ -79,7 +79,7 @@ struct EXTRACTOR_Keywords * libextractor_mpeg_extract(char * filename, return prev; if ( ! ( (xdata[0]==0x00) && - (xdata[1]==0x00) && + (xdata[1]==0x00) && (xdata[2]==0x01) && ( (xdata[3]==0xB3) || (xdata[3]==0xBA) ) ) ) return prev; @@ -94,7 +94,7 @@ struct EXTRACTOR_Keywords * libextractor_mpeg_extract(char * filename, version = 2; else return prev; /* unsupported mpeg version */ - + if (version == 1) { bitrate = round_double((double)((fread_be(&xdata[8]) & 0x7FFFFE) >> 1) * 0.4); pos = 12; @@ -113,7 +113,7 @@ struct EXTRACTOR_Keywords * libextractor_mpeg_extract(char * filename, if (pos + 4 >= xsize) return prev; temp = fread_be(&xdata[pos]); - } + } } else { if (pos + 4 >= xsize) return prev; @@ -124,8 +124,8 @@ struct EXTRACTOR_Keywords * libextractor_mpeg_extract(char * filename, temp = fread_be(&xdata[pos]); } } - pos += 4; - + pos += 4; + if (pos + 4 >= xsize) return prev; /* Now read byte by byte until we find the 0x000001B3 instead of actually @@ -140,14 +140,14 @@ struct EXTRACTOR_Keywords * libextractor_mpeg_extract(char * filename, return prev; temp |= xdata[pos++]; } - } else + } else pos = 4; /* video only */ - + if (pos + 16 >= xsize) return prev; width = (xdata[pos] << 4) + (xdata[pos+1] & 0xF); height = ((xdata[pos+1] & 0xF0) << 4) + xdata[pos+2]; - + addKeyword(&prev, strdup("video/mpeg"), EXTRACTOR_MIMETYPE); diff --git a/src/plugins/oggextractor.c b/src/plugins/oggextractor.c @@ -46,7 +46,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = strdup(keyword); result->keywordType = type; return result; @@ -86,9 +86,9 @@ struct EXTRACTOR_Keywords * libextractor_ogg_extract(char * filename, return prev; } if (OGG_HEADER != ntohl(*(int*)data)) { - return prev; + return prev; } - + callbacks.read_func = &readError; callbacks.seek_func = &seekError; callbacks.close_func = &closeOk; @@ -101,7 +101,7 @@ struct EXTRACTOR_Keywords * libextractor_ogg_extract(char * filename, return prev; } comments = ov_comment(&vf, -1); - + if (NULL == comments) { #if DEBUG_EXTRACT_OGG fprintf(stderr, @@ -125,17 +125,17 @@ struct EXTRACTOR_Keywords * libextractor_ogg_extract(char * filename, prev = addKeyword(EXTRACTOR_LOCATION,get_comment(comments, "location"), prev); prev = addKeyword(EXTRACTOR_DESCRIPTION, get_comment(comments, "description"), prev); prev = addKeyword(EXTRACTOR_VERSIONNUMBER, get_comment(comments, "version"), prev); - prev = addKeyword(EXTRACTOR_RESOURCE_IDENTIFIER, get_comment(comments, "isrc"), prev); + prev = addKeyword(EXTRACTOR_RESOURCE_IDENTIFIER, get_comment(comments, "isrc"), prev); prev = addKeyword(EXTRACTOR_ORGANIZATION, get_comment(comments, "organization"), prev); prev = addKeyword(EXTRACTOR_COPYRIGHT, get_comment(comments, "copyright"), prev); - /* we have determined for sure that this is an + /* we have determined for sure that this is an ogg-vorbis stream, we should add this as a keyword, too */ - prev = addKeyword(EXTRACTOR_MIMETYPE, - "application/ogg", + prev = addKeyword(EXTRACTOR_MIMETYPE, + "application/ogg", prev); /* build a description from artist, title and album */ { - EXTRACTOR_KeywordList * keyword = malloc(sizeof(EXTRACTOR_KeywordList)); + EXTRACTOR_KeywordList * keyword = malloc(sizeof(EXTRACTOR_KeywordList)); char * word; int len = 1+2+2+1; if (get_comment(comments, "artist") != NULL) @@ -144,7 +144,7 @@ struct EXTRACTOR_Keywords * libextractor_ogg_extract(char * filename, len += strlen(get_comment(comments, "title")); if (get_comment(comments, "album") != NULL) len += strlen(get_comment(comments, "album")); - + word = malloc(len); word[0] = 0; if (get_comment(comments, "artist") != NULL) { @@ -152,9 +152,9 @@ struct EXTRACTOR_Keywords * libextractor_ogg_extract(char * filename, } if (get_comment(comments, "title") != NULL) { strcat(word,": "); - strcat(word, get_comment(comments, "title")); + strcat(word, get_comment(comments, "title")); } - if (get_comment(comments, "album") != NULL) { + if (get_comment(comments, "album") != NULL) { strcat(word," ("); strcat(word, get_comment(comments, "album")); strcat(word, ")"); @@ -162,8 +162,8 @@ struct EXTRACTOR_Keywords * libextractor_ogg_extract(char * filename, keyword->next = prev; keyword->keyword = word; keyword->keywordType = EXTRACTOR_DESCRIPTION; - prev = keyword; - + prev = keyword; + } ov_clear(&vf); diff --git a/src/plugins/ole2/gsf-impl-utils.h b/src/plugins/ole2/gsf-impl-utils.h @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-impl-utils.h: + * gsf-impl-utils.h: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * diff --git a/src/plugins/ole2/gsf-infile-impl.h b/src/plugins/ole2/gsf-infile-impl.h @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-infile-impl.h: + * gsf-infile-impl.h: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * diff --git a/src/plugins/ole2/gsf-infile-msole.c b/src/plugins/ole2/gsf-infile-msole.c @@ -362,11 +362,11 @@ ole_dirent_new (GsfInfileMSOle *ole, guint32 entry, MSOleDirent *parent) if (prev == entry) { g_warning ("Invalid OLE file with a cycle in its directory tree"); } else - ole_dirent_new (ole, prev, parent); + ole_dirent_new (ole, prev, parent); if (next == entry) { g_warning ("Invalid OLE file with a cycle in its directory tree"); } else - ole_dirent_new (ole, next, parent); + ole_dirent_new (ole, next, parent); if (dirent->is_directory) ole_dirent_new (ole, child, dirent); @@ -713,7 +713,7 @@ gsf_infile_msole_seek (GsfInput *input, gsf_off_t offset, GSeekType whence) { GsfInfileMSOle *ole = GSF_INFILE_MSOLE (input); - (void) offset; + (void) offset; (void) whence; ole->cur_block = BAT_MAGIC_UNUSED; @@ -776,7 +776,7 @@ gsf_infile_msole_new_child (GsfInfileMSOle *parent, if (gsf_input_seek (GSF_INPUT (sb_file), (gsf_off_t)(child->bat.block [i] << info->sb.shift), G_SEEK_SET) < 0 || (data = gsf_input_read (GSF_INPUT (sb_file), - info->sb.size, + info->sb.size, child->stream.buf + (i << info->sb.shift))) == NULL) { g_warning ("failure reading block %d", i); @@ -851,7 +851,7 @@ gsf_infile_msole_init (GObject *obj) ole->bat.num_blocks = 0; ole->cur_block = BAT_MAGIC_UNUSED; ole->stream.buf = NULL; - ole->stream.buf_size = 0; + ole->stream.buf_size = 0; } static void diff --git a/src/plugins/ole2/gsf-infile-msole.h b/src/plugins/ole2/gsf-infile-msole.h @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-infile-msole.h: + * gsf-infile-msole.h: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * diff --git a/src/plugins/ole2/gsf-infile.h b/src/plugins/ole2/gsf-infile.h @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-infile.h: + * gsf-infile.h: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * diff --git a/src/plugins/ole2/gsf-input-memory.c b/src/plugins/ole2/gsf-input-memory.c @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-input-memory.c: + * gsf-input-memory.c: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * diff --git a/src/plugins/ole2/gsf-input.c b/src/plugins/ole2/gsf-input.c @@ -160,7 +160,7 @@ GSF_CLASS_ABSTRACT (GsfInput, gsf_input, /** * gsf_input_name : - * @input : + * @input : * * Returns @input's name in utf8 form, DO NOT FREE THIS STRING **/ @@ -173,7 +173,7 @@ gsf_input_name (GsfInput *input) /** * gsf_input_container : - * @input : + * @input : * * Returns, but does not add a reference to @input's container. * Potentially NULL @@ -429,7 +429,7 @@ gsf_input_seek_emulate (GsfInput *input, gsf_off_t pos) * * Returns : A utility quark to flag a GError as being an input problem. */ -GQuark +GQuark gsf_input_error (void) { static GQuark quark; @@ -479,7 +479,7 @@ gsf_input_uncompress (GsfInput *src) if (res) { g_object_unref (G_OBJECT (src)); return gsf_input_uncompress (res); - } + } } } #endif @@ -536,7 +536,7 @@ gsf_input_new_for_uri (char const * uri, GError ** err) if (len > 7 && !strncmp (uri, "file:/", 6)) { /* dumb attempt to translate this into a local path */ input = gsf_input_stdio_new (uri+7, err); - } + } /* else: unknown or unhandled protocol - bail */ #endif } diff --git a/src/plugins/ole2/gsf-msole-impl.h b/src/plugins/ole2/gsf-msole-impl.h @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-msole-impl.h: + * gsf-msole-impl.h: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * diff --git a/src/plugins/ole2/gsf-shared-memory.c b/src/plugins/ole2/gsf-shared-memory.c @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-shared-memory.c: + * gsf-shared-memory.c: * * Copyright (C) 2002-2004 Morten Welinder (terra@diku.dk) * diff --git a/src/plugins/ole2/gsf-utils.c b/src/plugins/ole2/gsf-utils.c @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-utils.c: + * gsf-utils.c: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * diff --git a/src/plugins/ole2/gsf-utils.h b/src/plugins/ole2/gsf-utils.h @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf-utils.h: + * gsf-utils.h: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * diff --git a/src/plugins/ole2/gsf.h b/src/plugins/ole2/gsf.h @@ -1,6 +1,6 @@ /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * gsf.h: + * gsf.h: * * Copyright (C) 2002-2004 Jody Goldberg (jody@gnome.org) * @@ -39,7 +39,7 @@ typedef struct _GsfTimestamp GsfTimestamp; /* FIXME: * gsf_off_t is really supposed to be the widest type off_t can be configured * to on the platform - */ + */ typedef gint64 gsf_off_t; #define GSF_OFF_T_FORMAT G_GINT64_FORMAT diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c @@ -44,11 +44,11 @@ void __attribute__ ((constructor)) ole_gobject_init(void) { g_type_init(); /* really needed??? */ } -static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, const char *phrase, EXTRACTOR_KeywordType type) { - EXTRACTOR_KeywordList * keyword; + EXTRACTOR_KeywordList * keyword; if (strlen(phrase) == 0) return oldhead; if (0 == strcmp(phrase, "\"\"")) @@ -58,7 +58,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordList *oldhead, if (0 == strcmp(phrase, " ")) return oldhead; keyword = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - keyword->next = oldhead; + keyword->next = oldhead; keyword->keyword = strdup(phrase); keyword->keywordType = type; return keyword; @@ -229,21 +229,21 @@ msole_prop_id_to_gsf (GsfMSOleMetaDataSection *section, guint32 id) char const *res = NULL; GsfMSOleMetaDataPropMap const *map = NULL; unsigned i = 0; - + if (section->dict != NULL) { if (id & 0x1000000) { id &= ~0x1000000; d (printf ("LINKED ");); } - + res = g_hash_table_lookup (section->dict, GINT_TO_POINTER (id)); - + if (res != NULL) { d (printf (res);); return res; } } - + if (section->type == GSF_MSOLE_META_DATA_COMPONENT) { map = component_props; i = G_N_ELEMENTS (component_props); @@ -256,7 +256,7 @@ msole_prop_id_to_gsf (GsfMSOleMetaDataSection *section, guint32 id) d (printf (map[i].name);); return map[i].name; } - + map = common_props; i = G_N_ELEMENTS (common_props); while (i-- > 0) @@ -264,16 +264,16 @@ msole_prop_id_to_gsf (GsfMSOleMetaDataSection *section, guint32 id) d (printf (map[i].name);); return map[i].name; } - + d (printf ("_UNKNOWN_(0x%x %d)", id, id);); - + return NULL; } static GValue * msole_prop_parse(GsfMSOleMetaDataSection *section, - guint32 type, - guint8 const **data, + guint32 type, + guint8 const **data, guint8 const *data_end) { GValue *res; @@ -281,19 +281,19 @@ msole_prop_parse(GsfMSOleMetaDataSection *section, guint32 len; gsize gslen; gboolean const is_vector = type & LE_VT_VECTOR; - + g_return_val_if_fail (!(type & (unsigned)(~0x1fff)), NULL); /* not valid in a prop set */ - + type &= 0xfff; - + if (is_vector) { unsigned i, n; - + g_return_val_if_fail (*data + 4 <= data_end, NULL); - + n = GSF_LE_GET_GUINT32 (*data); *data += 4; - + d (printf (" array with %d elem\n", n); gsf_mem_dump (*data, (unsigned)(data_end - *data));); for (i = 0 ; i < n ; i++) { @@ -309,152 +309,152 @@ msole_prop_parse(GsfMSOleMetaDataSection *section, } return NULL; } - + res = g_new0 (GValue, 1); switch (type) { case LE_VT_EMPTY : d (puts ("VT_EMPTY");); /* value::unset == empty */ break; - + case LE_VT_NULL : d (puts ("VT_NULL");); /* value::unset == null too :-) do we need to distinguish ? */ break; - + case LE_VT_I2 : d (puts ("VT_I2");); g_return_val_if_fail (*data + 2 <= data_end, NULL); g_value_init (res, G_TYPE_INT); g_value_set_int (res, GSF_LE_GET_GINT16 (*data)); *data += 2; break; - + case LE_VT_I4 : d (puts ("VT_I4");); g_return_val_if_fail (*data + 4 <= data_end, NULL); g_value_init (res, G_TYPE_INT); g_value_set_int (res, GSF_LE_GET_GINT32 (*data)); *data += 4; break; - + case LE_VT_R4 : d (puts ("VT_R4");); g_return_val_if_fail (*data + 4 <= data_end, NULL); g_value_init (res, G_TYPE_FLOAT); g_value_set_float (res, GSF_LE_GET_FLOAT (*data)); *data += 4; break; - + case LE_VT_R8 : d (puts ("VT_R8");); g_return_val_if_fail (*data + 8 <= data_end, NULL); g_value_init (res, G_TYPE_DOUBLE); g_value_set_double (res, GSF_LE_GET_DOUBLE (*data)); *data += 8; break; - + case LE_VT_CY : d (puts ("VT_CY");); break; - + case LE_VT_DATE : d (puts ("VT_DATE");); break; - + case LE_VT_BSTR : d (puts ("VT_BSTR");); break; - + case LE_VT_DISPATCH : d (puts ("VT_DISPATCH");); break; - + case LE_VT_BOOL : d (puts ("VT_BOOL");); g_return_val_if_fail (*data + 1 <= data_end, NULL); g_value_init (res, G_TYPE_BOOLEAN); g_value_set_boolean (res, **data ? TRUE : FALSE); *data += 1; break; - + case LE_VT_VARIANT : d (printf ("VT_VARIANT containing a ");); g_free (res); type = GSF_LE_GET_GUINT32 (*data); *data += 4; return msole_prop_parse (section, type, data, data_end); - + case LE_VT_UI1 : d (puts ("VT_UI1");); g_return_val_if_fail (*data + 1 <= data_end, NULL); g_value_init (res, G_TYPE_UCHAR); g_value_set_uchar (res, (guchar)(**data)); *data += 1; break; - + case LE_VT_UI2 : d (puts ("VT_UI2");); g_return_val_if_fail (*data + 2 <= data_end, NULL); g_value_init (res, G_TYPE_UINT); g_value_set_uint (res, GSF_LE_GET_GUINT16 (*data)); *data += 2; break; - + case LE_VT_UI4 : d (puts ("VT_UI4");); g_return_val_if_fail (*data + 4 <= data_end, NULL); g_value_init (res, G_TYPE_UINT); *data += 4; d (printf ("%u\n", GSF_LE_GET_GUINT32 (*data));); break; - + case LE_VT_I8 : d (puts ("VT_I8");); g_return_val_if_fail (*data + 8 <= data_end, NULL); g_value_init (res, G_TYPE_INT64); *data += 8; break; - + case LE_VT_UI8 : d (puts ("VT_UI8");); g_return_val_if_fail (*data + 8 <= data_end, NULL); g_value_init (res, G_TYPE_UINT64); *data += 8; break; - + case LE_VT_LPSTR : d (puts ("VT_LPSTR");); /* be anal and safe */ g_return_val_if_fail (*data + 4 <= data_end, NULL); - + len = GSF_LE_GET_GUINT32 (*data); - + g_return_val_if_fail (len < 0x10000, NULL); g_return_val_if_fail (*data + 4 + len*section->char_size <= data_end, NULL); - + gslen = 0; str = g_convert_with_iconv (*data + 4, len * section->char_size, section->iconv_handle, &gslen, NULL, NULL); len = (guint32)gslen; - + g_value_init (res, G_TYPE_STRING); g_value_set_string (res, str); g_free (str); *data += 4 + len; break; - + case LE_VT_LPWSTR : d (puts ("VT_LPWSTR");); /* be anal and safe */ g_return_val_if_fail (*data + 4 <= data_end, NULL); - + len = GSF_LE_GET_GUINT32 (*data); - + g_return_val_if_fail (len < 0x10000, NULL); g_return_val_if_fail (*data + 4 + len <= data_end, NULL); - + str = g_convert (*data + 4, len*2, "UTF-8", "UTF-16LE", &gslen, NULL, NULL); len = (guint32)gslen; - + g_value_init (res, G_TYPE_STRING); g_value_set_string (res, str); g_free (str); *data += 4 + len; break; - + case LE_VT_FILETIME : d (puts ("VT_FILETIME");); g_return_val_if_fail (*data + 8 <= data_end, NULL); - + g_value_init (res, G_TYPE_STRING); { /* ft * 100ns since Jan 1 1601 */ guint64 ft = GSF_LE_GET_GUINT64 (*data); - + ft /= 10000000; /* convert to seconds */ #ifdef _MSC_VER ft -= 11644473600i64; /* move to Jan 1 1970 */ @@ -463,7 +463,7 @@ msole_prop_parse(GsfMSOleMetaDataSection *section, #endif str = g_strdup(ctime((time_t*)&ft)); - + g_value_set_string (res, str); *data += 8; @@ -486,7 +486,7 @@ msole_prop_parse(GsfMSOleMetaDataSection *section, case LE_VT_CLSID : d (puts ("VT_CLSID");); *data += 16; break; - + case LE_VT_ERROR : case LE_VT_UNKNOWN : case LE_VT_DECIMAL : @@ -504,13 +504,13 @@ msole_prop_parse(GsfMSOleMetaDataSection *section, g_free (res); res = NULL; break; - + default : warning ("Unknown property type %d (0x%x)", type, type); g_free (res); res = NULL; }; - + d ( if (res != NULL && G_IS_VALUE (res)) { char *val = g_strdup_value_contents (res); d(printf ("%s\n", val);); @@ -533,52 +533,52 @@ msole_prop_read (GsfInput *in, gsf_off_t size = ((i+1) >= section->num_props) ? section->size-4 : props[i+1].offset; char const *prop_name; - + g_return_val_if_fail (i < section->num_props, NULL); g_return_val_if_fail (size >= props[i].offset + 4, NULL); - + size -= props[i].offset; /* includes the type id */ if (gsf_input_seek (in, section->offset+props[i].offset, G_SEEK_SET) || NULL == (data = gsf_input_read (in, size, NULL))) { warning ("failed to read prop #%d", i); return NULL; } - + type = GSF_LE_GET_GUINT32 (data); data += 4; - + /* dictionary is magic */ if (props[i].id == 0) { guint32 len, id, i, n; gsize gslen; char *name; guint8 const *start = data; - + g_return_val_if_fail (section->dict == NULL, NULL); - + section->dict = g_hash_table_new_full ( g_direct_hash, g_direct_equal, NULL, g_free); - + d (gsf_mem_dump (data-4, size);); n = type; for (i = 0 ; i < n ; i++) { id = GSF_LE_GET_GUINT32 (data); len = GSF_LE_GET_GUINT32 (data + 4); - + g_return_val_if_fail (len < 0x10000, NULL); - + gslen = 0; name = g_convert_with_iconv (data + 8, len * section->char_size, section->iconv_handle, &gslen, NULL, NULL); len = (guint32)gslen; data += 8 + len; - + d (printf ("\t%u == %s\n", id, name);); g_hash_table_replace (section->dict, GINT_TO_POINTER (id), name); - + /* MS documentation blows goats ! * The docs claim there are padding bytes in the dictionary. * Their examples show padding bytes. @@ -587,13 +587,13 @@ msole_prop_read (GsfInput *in, if (section->char_size != 1 && (data - start) % 4) data += 4 - ((data - start) % 4); } - + return NULL; } - + d (printf ("%u) ", i);); prop_name = msole_prop_id_to_gsf (section, props[i].id); - + d (printf (" @ %x %x = ", (unsigned)props[i].offset, (unsigned)size);); return msole_prop_parse (section, type, &data, data + size); } @@ -614,12 +614,12 @@ msole_prop_cmp (gconstpointer a, gconstpointer b) * Returns an iconv converter for @codepage -> utf8. **/ static GIConv -gsf_msole_iconv_open_codepage_for_import(char const *to, +gsf_msole_iconv_open_codepage_for_import(char const *to, int codepage) { GIConv iconv_handle; g_return_val_if_fail (to != NULL, (GIConv)(-1)); - + /* sometimes it is stored as signed short */ if (codepage == 65001 || codepage == -535) { iconv_handle = g_iconv_open (to, "UTF-8"); @@ -637,20 +637,20 @@ gsf_msole_iconv_open_codepage_for_import(char const *to, if (iconv_handle != (GIConv)(-1)) return iconv_handle; } - + /* Try aliases. */ if (codepage == 10000) { /* gnu iconv. */ iconv_handle = g_iconv_open (to, "MACROMAN"); if (iconv_handle != (GIConv)(-1)) return iconv_handle; - + /* glibc. */ iconv_handle = g_iconv_open (to, "MACINTOSH"); if (iconv_handle != (GIConv)(-1)) return iconv_handle; } - + warning ("Unable to open an iconv handle from codepage %d -> %s", codepage, to); return (GIConv)(-1); @@ -683,18 +683,18 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, GsfMSOleMetaDataSection *sections; GsfMSOleMetaDataProp *props; - if (NULL == data) - return prev; - + if (NULL == data) + return prev; + /* NOTE : high word is the os, low word is the os version * 0 = win16 * 1 = mac * 2 = win32 */ os = GSF_LE_GET_GUINT16 (data + 6); - + version = GSF_LE_GET_GUINT16 (data + 2); - + num_sections = GSF_LE_GET_GUINT32 (data + 24); if (GSF_LE_GET_GUINT16 (data + 0) != 0xfffe || (version != 0 && version != 1) @@ -702,7 +702,7 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, || num_sections > 100) { /* arbitrary sanity check */ return prev; } - + /* extract the section info */ sections = (GsfMSOleMetaDataSection *)g_alloca (sizeof (GsfMSOleMetaDataSection)* num_sections); for (i = 0 ; i < num_sections ; i++) { @@ -721,7 +721,7 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, warning ("Unknown property section type, treating it as USER"); d(gsf_mem_dump (data, 16);); } - + sections [i].offset = GSF_LE_GET_GUINT32 (data + 16); #ifndef NO_DEBUG_OLE_PROPS d(printf ("0x%x\n", (guint32)sections [i].offset);); @@ -732,7 +732,7 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, NULL == (data = gsf_input_read (in, 8, NULL))) { return prev; } - + sections[i].iconv_handle = (GIConv)-1; sections[i].char_size = 1; sections[i].dict = NULL; @@ -746,16 +746,16 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, g_free (props); return prev; } - + props [j].id = GSF_LE_GET_GUINT32 (data); props [j].offset = GSF_LE_GET_GUINT32 (data + 4); } - + /* order prop info by offset to facilitate bounds checking */ qsort (props, sections[i].num_props, sizeof (GsfMSOleMetaDataProp), msole_prop_cmp); - + sections[i].iconv_handle = (GIConv)-1; sections[i].char_size = 1; for (j = 0; j < sections[i].num_props; j++) /* first codepage */ @@ -776,7 +776,7 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, } if (sections[i].iconv_handle == (GIConv)-1) sections[i].iconv_handle = gsf_msole_iconv_open_for_import (1252); - + for (j = 0; j < sections[i].num_props; j++) /* then dictionary */ if (props[j].id == 0) { GValue *v = msole_prop_read (in, sections+i, props, j); @@ -784,8 +784,8 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, if (G_VALUE_TYPE(v) == G_TYPE_STRING) { gchar * contents = g_strdup_value_contents(v); free(contents); - } else { - + } else { + /* FIXME: do something with non-strings... */ } if (G_IS_VALUE (v)) @@ -800,13 +800,13 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, gchar * contents = NULL; int pc; int ipc; - + if (G_VALUE_TYPE(v) == G_TYPE_STRING) { contents = g_strdup_value_contents(v); } else { /* convert other formats? */ contents = g_strdup_value_contents(v); - } + } pc = 0; if (contents != NULL) { for (ipc=strlen(contents)-1;ipc>=0;ipc--) @@ -819,7 +819,7 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, } if (pc > 0) { int pos = 0; - const char * prop + const char * prop = msole_prop_id_to_gsf(sections+i, props[j].id); if (prop != NULL) { while (tmap[pos].text != NULL) { @@ -833,7 +833,7 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, contents, tmap[pos].type); } - } + } if (contents != NULL) free(contents); } @@ -843,7 +843,7 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, g_free (v); } } - + gsf_iconv_close (sections[i].iconv_handle); g_free (props); if (sections[i].dict != NULL) @@ -865,7 +865,7 @@ static struct EXTRACTOR_Keywords * process(GsfInput * in, "Win32", EXTRACTOR_OS); break; - } + } return prev; } @@ -876,12 +876,12 @@ static struct EXTRACTOR_Keywords * processSO(GsfInput * src, size = gsf_input_size(src); if (size < 0x374) /* == 0x375?? */ - return prev; + return prev; buf = malloc(size); - gsf_input_read(src, size, buf); + gsf_input_read(src, size, buf); if ( (buf[0] != 0x0F) || (buf[1] != 0x0) || - (0 != strncmp(&buf[2], + (0 != strncmp(&buf[2], "SfxDocumentInfo", strlen("SfxDocumentInfo"))) || (buf[0x11] != 0x0B) || @@ -905,7 +905,7 @@ static struct EXTRACTOR_Keywords * processSO(GsfInput * src, prev = addKeyword(prev, &buf[0x117], EXTRACTOR_COMMENT); - buf[0x296] = '\0'; + buf[0x296] = '\0'; if (buf[0x216] + buf[0x217] > 0) prev = addKeyword(prev, &buf[0x218], @@ -926,17 +926,17 @@ struct EXTRACTOR_Keywords * libextractor_ole2_extract(const char * filename, guint8 const *data; size_t len; int i; - - input = gsf_input_memory_new((guint8 const *) date, - (gsf_off_t) size, + + input = gsf_input_memory_new((guint8 const *) date, + (gsf_off_t) size, FALSE); - if (input == NULL) - return prev; - + if (input == NULL) + return prev; + infile = gsf_infile_msole_new(input, NULL); g_object_unref(G_OBJECT(input)); - - if (infile == NULL) + + if (infile == NULL) return prev; if (GSF_IS_INFILE(infile) && @@ -944,16 +944,16 @@ struct EXTRACTOR_Keywords * libextractor_ole2_extract(const char * filename, GsfInfile * in = GSF_INFILE (infile); GsfInput * src; const char * name; - + for (i=0;i<gsf_infile_num_children(in);i++) { src = gsf_infile_child_by_index (in, i); name = gsf_infile_name_by_index (in, i); - if ( (0 == strcmp(name, "\005SummaryInformation")) - || (0 == strcmp(name, "\005DocumentSummaryInformation")) ) { + if ( (0 == strcmp(name, "\005SummaryInformation")) + || (0 == strcmp(name, "\005DocumentSummaryInformation")) ) { prev = process(src, prev); - } + } if (0 == strcmp(name, "SfxDocumentInfo")) { prev = processSO(src, prev); diff --git a/src/plugins/oo/ooextractor.c b/src/plugins/oo/ooextractor.c @@ -38,7 +38,7 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -51,7 +51,7 @@ typedef struct { } Matches; static Matches tmap[] = { - { "meta:generator", EXTRACTOR_SOFTWARE }, + { "meta:generator", EXTRACTOR_SOFTWARE }, { "meta:page-count", EXTRACTOR_PAGE_COUNT }, { "meta:creation-date", EXTRACTOR_CREATION_DATE }, { "dc:date", EXTRACTOR_DATE }, @@ -59,7 +59,7 @@ static Matches tmap[] = { { "dc:language", EXTRACTOR_LANGUAGE }, { "dc:title", EXTRACTOR_TITLE }, { "dc:description", EXTRACTOR_DESCRIPTION }, - { "dc:subject", EXTRACTOR_SUBJECT }, + { "dc:subject", EXTRACTOR_SUBJECT }, { "meta:keyword", EXTRACTOR_KEYWORDS }, { "meta:user-defined meta:name=\"Info 1\"", EXTRACTOR_UNKNOWN }, { "meta:user-defined meta:name=\"Info 2\"", EXTRACTOR_UNKNOWN }, @@ -105,7 +105,7 @@ struct EXTRACTOR_Keywords * libextractor_oo_extract(const char * filename, unzClose(uf); return prev; /* problems... */ } - + if (UNZ_OK != unzOpenCurrentFilePassword(uf,NULL)) { unzClose(uf); return prev; /* problems... */ @@ -123,7 +123,7 @@ struct EXTRACTOR_Keywords * libextractor_oo_extract(const char * filename, unzClose(uf); return prev; /* out of memory */ } - + if (buf_size != unzReadCurrentFile(uf,buf,buf_size)) { free(buf); unzCloseCurrentFile(uf); @@ -150,10 +150,10 @@ struct EXTRACTOR_Keywords * libextractor_oo_extract(const char * filename, pbuf = buf; - while (1) { + while (1) { strcpy(needle, "<"); strcat(needle, tmap[i].text); - strcat(needle, ">"); + strcat(needle, ">"); spos = strstr(pbuf, needle); if (NULL == spos) { strcpy(needle, tmap[i].text); @@ -165,7 +165,7 @@ struct EXTRACTOR_Keywords * libextractor_oo_extract(const char * filename, epos = spos; while ( (epos[0] != '\0') && (epos[0] != '"') ) - epos++; + epos++; } else { oc = 0; spos += strlen(needle); @@ -191,13 +191,13 @@ struct EXTRACTOR_Keywords * libextractor_oo_extract(const char * filename, key[epos-spos] = '\0'; prev = addKeyword(tmap[i].type, key, - prev); + prev); pbuf = epos; } else break; - } + } } - } + } free(buf); unzClose(uf); return prev; diff --git a/src/plugins/pack.c b/src/plugins/pack.c @@ -2,7 +2,7 @@ Catlib Copyright Notice The author of this software is Christopher Adam Telfer -Copyright (c) 1998, 1999, 2000, 2001, 2002 +Copyright (c) 1998, 1999, 2000, 2001, 2002 by Christopher Adam Telfer. All Rights Reserved. Permission to use, copy, modify, and distribute this software for any @@ -23,10 +23,10 @@ OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ - + #include "platform.h" #include "pack.h" - + typedef unsigned char byte; typedef unsigned short half; typedef unsigned long word; @@ -35,7 +35,7 @@ typedef signed short shalf; typedef signed long sword; -/* +/* "bhwAcslPBHWCSL" Small letters: do not convert (not implemented for arrays and P) @@ -45,7 +45,7 @@ typedef signed long sword; h - half-word w - word a - array (32-byte unsigned long + that many bytes) - c - signed 8 bit value + c - signed 8 bit value s - signed 16 bit value l - signed 32 bit value p - (unpack only) value is a pointer to a pointer. Generate the buffer @@ -55,7 +55,7 @@ typedef signed long sword; of the arguments specified by the letter */ -int cat_pack(void * buf, +int cat_pack(void * buf, const char *fmt, ...) { va_list ap; @@ -68,15 +68,15 @@ int cat_pack(void * buf, void * arr; struct cat_bvec *cbvp; char *cp; - + va_start(ap, fmt); - + npacked = 0; bp = (byte *)buf; while( *fmt ) { nreps = 0; - + if ( isdigit(*fmt) ) { /* We use cp instead of fmt to keep the 'const' qualifier of fmt */ nreps = strtoul(fmt, &cp, 0); @@ -98,7 +98,7 @@ int cat_pack(void * buf, npacked += 1; } } - break; + break; case 'h': case 's': @@ -116,8 +116,8 @@ int cat_pack(void * buf, npacked += 2; } } - break; - + break; + case 'H': case 'S': if ( ! nreps ) { @@ -134,8 +134,8 @@ int cat_pack(void * buf, npacked += 2; } } - break; - + break; + case 'l': case 'w': if ( ! nreps ) { @@ -157,7 +157,7 @@ int cat_pack(void * buf, } } break; - + case 'L': case 'W': if ( ! nreps ) { @@ -179,7 +179,7 @@ int cat_pack(void * buf, } } break; - + case 'A': if ( ! nreps ) { blen = va_arg(ap, word); @@ -206,14 +206,14 @@ int cat_pack(void * buf, } } break; - + default: va_end(ap); return -1; } ++fmt; } - + va_end(ap); return npacked; } @@ -235,7 +235,7 @@ int cat_unpack(const void * buf, unsigned int nreps, i, isnonprefixed = 1; /* used for 'a' types only */ struct cat_bvec *cbvp; char *cp; - + bp = (byte *)buf; npacked = 0; @@ -243,15 +243,15 @@ int cat_unpack(const void * buf, while ( *fmt ) { nreps = 1; - + if ( isdigit(*fmt) ) { /* We use cp instead of format to keep the 'const' qualifier of fmt */ - nreps = strtoul(fmt, &cp, 0); + nreps = strtoul(fmt, &cp, 0); fmt = cp; if ( *fmt == 'a' ) isnonprefixed = 0; } - + switch (*fmt) { case 'B': case 'b': @@ -262,9 +262,9 @@ int cat_unpack(const void * buf, npacked += 1; } break; - - - + + + case 'h': halfp = va_arg(ap, half*); for ( i = 0 ; i < nreps ; ++i ) { @@ -274,7 +274,7 @@ int cat_unpack(const void * buf, npacked += 2; } break; - + case 'H': halfp = va_arg(ap, half*); for ( i = 0 ; i < nreps ; ++i ) { @@ -284,8 +284,8 @@ int cat_unpack(const void * buf, npacked += 2; } break; - - + + case 'w': wordp = va_arg(ap, word*); for ( i = 0 ; i < nreps ; ++i ) { @@ -297,7 +297,7 @@ int cat_unpack(const void * buf, npacked += 4; } break; - + case 'W': wordp = va_arg(ap, word*); for ( i = 0 ; i < nreps ; ++i ) { @@ -309,9 +309,9 @@ int cat_unpack(const void * buf, npacked += 4; } break; - + case 'A': - if ( isnonprefixed ) { + if ( isnonprefixed ) { maxlen = va_arg(ap, word); arr = va_arg(ap, void *); @@ -332,26 +332,26 @@ int cat_unpack(const void * buf, for ( i = 0 ; i < nreps ; ++i ) { maxlen = cbvp->len; arr = cbvp->data; - + len = *bp++ << 24; len |= *bp++ << 16; len |= *bp++ << 8; len |= *bp++; - + if ( len > maxlen ) return -1; - + memmove(arr, bp, len); cbvp->len = len; bp += len; - + ++cbvp; npacked += len; } isnonprefixed = 1; } break; - + case 'C': case 'c': sbytep = va_arg(ap, sbyte*); @@ -365,8 +365,8 @@ int cat_unpack(const void * buf, npacked += 1; } break; - - + + case 's': shalfp = va_arg(ap, shalf*); for ( i = 0 ; i < nreps ; ++i ) { @@ -380,7 +380,7 @@ int cat_unpack(const void * buf, npacked += 2; } break; - + case 'S': shalfp = va_arg(ap, shalf*); for ( i = 0 ; i < nreps ; ++i ) { @@ -394,7 +394,7 @@ int cat_unpack(const void * buf, npacked += 2; } break; - + case 'l': swordp = va_arg(ap, sword*); for ( i = 0 ; i < nreps ; ++i ) { @@ -426,7 +426,7 @@ int cat_unpack(const void * buf, npacked += 4; } break; - + case 'P': cbvp = va_arg(ap, struct cat_bvec *); for ( i = 0 ; i < nreps ; ++i ) { @@ -452,7 +452,7 @@ int cat_unpack(const void * buf, npacked += len; } break; - + default: va_end(ap); return -1; diff --git a/src/plugins/pack.h b/src/plugins/pack.h @@ -2,7 +2,7 @@ Catlib Copyright Notice The author of this software is Christopher Adam Telfer -Copyright (c) 1998, 1999, 2000, 2001, 2002 +Copyright (c) 1998, 1999, 2000, 2001, 2002 by Christopher Adam Telfer. All Rights Reserved. Permission to use, copy, modify, and distribute this software for any @@ -28,7 +28,7 @@ MODIFICATIONS. #ifndef __CAT_PACK_H #define __CAT_PACK_H -/* +/* "bhwAcslPBHWCSL" Small letters: do not convert (not implemented for arrays and P) @@ -38,14 +38,14 @@ MODIFICATIONS. h - half-word w - word a - array (32-byte unsigned long + that many bytes) - c - signed 8 bit value + c - signed 8 bit value s - signed 16 bit value l - signed 32 bit value p - (unpack only) value is a pointer to a pointer. Generate the buffer to hold the data. */ -int cat_pack(void * buf, const char *fmt, ... ); +int cat_pack(void * buf, const char *fmt, ... ); int cat_unpack(const void * buf, const char *fmt, ... ); diff --git a/src/plugins/pdf/Decrypt.cc b/src/plugins/pdf/Decrypt.cc @@ -21,8 +21,8 @@ static void md5(Guchar *msg, int msgLen, Guchar *digest); static Guchar passwordPad[32] = { 0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, - 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, - 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, + 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, + 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a }; diff --git a/src/plugins/pdf/FontEncoding.cc b/src/plugins/pdf/FontEncoding.cc @@ -97,7 +97,7 @@ void FontEncoding::addChar1(int code, char *name) { int h, i, code2; // insert name in hash table - h = hash(name); + h = hash(name); for (i = 0; i < fontEncHashSize; ++i) { code2 = hashTab[h]; if (code2 < 0) { diff --git a/src/plugins/pdf/Stream.cc b/src/plugins/pdf/Stream.cc @@ -250,7 +250,7 @@ Stream *Stream::makeFilter(char *name, Stream *str, Object *params) { obj.free(); } str = new FlateStream(str, pred, columns, colors, bits); - } + } #if 0 else if (!strcmp(name, "JBIG2Decode")) { if (params->isDict()) { @@ -260,7 +260,7 @@ else if (!strcmp(name, "JBIG2Decode")) { globals.free(); } else if (!strcmp(name, "JPXDecode")) { str = new JPXStream(str); - } + } #endif else { error(getPos(), "Unknown filter '%s'", name); @@ -1532,7 +1532,7 @@ int CCITTFaxStream::lookChar() { eatBits(1); code1 = lookBits(13); } while ((code1 >> 1) != 0x001); - eatBits(12); + eatBits(12); if (encoding > 0) { eatBits(1); nextLine2D = !(code1 & 1); diff --git a/src/plugins/pdf/gfile.cc b/src/plugins/pdf/gfile.cc @@ -14,7 +14,7 @@ #endif #ifndef WIN32 #include <pwd.h> -#endif +#endif #include "GString.h" #include "gfile.h" #include <sys/types.h> diff --git a/src/plugins/pdf/pdfextractor.cc b/src/plugins/pdf/pdfextractor.cc @@ -48,25 +48,25 @@ extern "C" { char * keyword, struct EXTRACTOR_Keywords * next) { EXTRACTOR_KeywordList * result; - + if (keyword == NULL) return next; result = (EXTRACTOR_KeywordList*) malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; } - - - static struct EXTRACTOR_Keywords * printInfoString(Dict *infoDict, - char *key, + + + static struct EXTRACTOR_Keywords * printInfoString(Dict *infoDict, + char *key, EXTRACTOR_KeywordType type, struct EXTRACTOR_Keywords * next) { Object obj; GString *s1; char * s; - + if (infoDict->lookup(key, &obj)->isString()) { s1 = obj.getString(); s = s1->getCString(); @@ -87,13 +87,13 @@ extern "C" { con = (char*) convertToUtf8((const char*) u, 2, "UNICODE"); strcat(result, con); free(con); - } + } next = addKeyword(type, strdup(result), next); free(result); } else { - next = addKeyword(type, + next = addKeyword(type, convertToUtf8(s, strlen(s), "ISO-8859-1"), @@ -103,9 +103,9 @@ extern "C" { obj.free(); return next; } - - static struct EXTRACTOR_Keywords * printInfoDate(Dict *infoDict, - char *key, + + static struct EXTRACTOR_Keywords * printInfoDate(Dict *infoDict, + char *key, EXTRACTOR_KeywordType type, struct EXTRACTOR_Keywords * next) { Object obj; @@ -134,7 +134,7 @@ extern "C" { con = (char*) convertToUtf8((const char*) u, 2, "UNICODE"); strcat(result, con); free(con); - } + } next = addKeyword(type, strdup(result), next); @@ -151,7 +151,7 @@ extern "C" { return next; } - + /* which mime-types should not be subjected to the PDF extractor? (no use trying!) */ static char * blacklist[] = { @@ -178,8 +178,8 @@ extern "C" { "video/asf", "video/quicktime", NULL, - }; - + }; + static const char * extractLast (const EXTRACTOR_KeywordType type, @@ -204,7 +204,7 @@ extern "C" { Object info; struct EXTRACTOR_Keywords * result; const char * mime; - + /* if the mime-type of the file is blacklisted, don't run the printable extactor! */ mime = extractLast(EXTRACTOR_MIMETYPE, @@ -218,7 +218,7 @@ extern "C" { j++; } - } + } fileName = new GString(filename); /* errorInit(); -- keep commented out, otherwise errors are printed to stderr for non-pdf files! */ @@ -229,34 +229,34 @@ extern "C" { freeParams(); return prev; } - + result = addKeyword(EXTRACTOR_MIMETYPE, strdup("application/pdf"), prev); doc->getDocInfo(&info); if (info.isDict()) { - result = printInfoString(info.getDict(), - "Title", + result = printInfoString(info.getDict(), + "Title", EXTRACTOR_TITLE, result); - result = printInfoString(info.getDict(), - "Subject", + result = printInfoString(info.getDict(), + "Subject", EXTRACTOR_SUBJECT, result); - result = printInfoString(info.getDict(), + result = printInfoString(info.getDict(), "Keywords", EXTRACTOR_KEYWORDS, result); - result = printInfoString(info.getDict(), + result = printInfoString(info.getDict(), "Author", EXTRACTOR_AUTHOR, result); - result = printInfoString(info.getDict(), + result = printInfoString(info.getDict(), "Creator", EXTRACTOR_CREATOR, result); - result = printInfoString(info.getDict(), - "Producer", + result = printInfoString(info.getDict(), + "Producer", EXTRACTOR_PRODUCER, result); { @@ -273,11 +273,11 @@ extern "C" { strdup(pcnt), result); } - result = printInfoDate(info.getDict(), - "CreationDate", + result = printInfoDate(info.getDict(), + "CreationDate", EXTRACTOR_CREATION_DATE, result); - result = printInfoDate(info.getDict(), + result = printInfoDate(info.getDict(), "ModDate", EXTRACTOR_MODIFICATION_DATE, result); @@ -286,7 +286,7 @@ extern "C" { info.free(); delete doc; freeParams(); - - return result; + + return result; } } diff --git a/src/plugins/pngextractor.c b/src/plugins/pngextractor.c @@ -40,7 +40,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -58,17 +58,17 @@ static struct { char * name; EXTRACTOR_KeywordType type; } tagmap[] = { - { "Author" , EXTRACTOR_AUTHOR}, + { "Author" , EXTRACTOR_AUTHOR}, { "Description" , EXTRACTOR_DESCRIPTION}, { "Comment", EXTRACTOR_COMMENT}, - { "Copyright", EXTRACTOR_COPYRIGHT}, + { "Copyright", EXTRACTOR_COPYRIGHT}, { "Source", EXTRACTOR_SOURCE}, { "Creation Time", EXTRACTOR_DATE}, { "Title", EXTRACTOR_TITLE}, { "Software", EXTRACTOR_SOFTWARE}, { "Disclaimer", EXTRACTOR_DISCLAIMER}, { "Warning", EXTRACTOR_WARNING}, - { "Signature", EXTRACTOR_RESOURCE_IDENTIFIER}, + { "Signature", EXTRACTOR_RESOURCE_IDENTIFIER}, { NULL, EXTRACTOR_UNKNOWN}, }; @@ -83,7 +83,7 @@ static struct EXTRACTOR_Keywords * processtEXt(const unsigned char * data, off = strnlen(data, length) + 1; if (off >= length) return prev; /* failed to find '\0' */ - keyword = convertToUtf8(&data[off], + keyword = convertToUtf8(&data[off], length-off, "ISO-8859-1"); i = 0; @@ -111,7 +111,7 @@ static struct EXTRACTOR_Keywords * processiTXt(const unsigned char * data, int compressed; char * buf; uLongf bufLen; - int ret; + int ret; pos = strnlen(data, length)+1; if (pos+3 >= length) @@ -135,7 +135,7 @@ static struct EXTRACTOR_Keywords * processiTXt(const unsigned char * data, pos += strnlen(translated, length-pos)+1; if (pos >= length) return prev; - + if (compressed) { bufLen = 1024 + 2 * (length - pos); while (1) { @@ -167,10 +167,10 @@ static struct EXTRACTOR_Keywords * processiTXt(const unsigned char * data, free(buf); } else { keyword = stndup(&data[pos], length - pos); - } + } i = 0; while (tagmap[i].name != NULL) { - if (0 == strcmp(tagmap[i].name, + if (0 == strcmp(tagmap[i].name, data)) return addKeyword(tagmap[i].type, keyword, /* already in utf-8 */ @@ -195,7 +195,7 @@ static struct EXTRACTOR_Keywords * processIHDR(const unsigned char * data, 128, "%ux%u", htonl(getIntAt(&data[4])), - htonl(getIntAt(&data[8]))); + htonl(getIntAt(&data[8]))); return addKeyword(EXTRACTOR_SIZE, tmp, prev); @@ -293,19 +293,19 @@ struct EXTRACTOR_Keywords * libextractor_png_extract(char * filename, length = htonl(getIntAt(pos)); pos+=4; /* printf("Length: %u, pos %u\n", length, pos - data); */ if ( (pos+4+length+4 > end) || - (pos+4+length+4 < pos + 4 + length) ) + (pos+4+length+4 < pos + 4 + length) ) break; - + if (0 == strncmp(pos, "IHDR", 4)) result = processIHDR(pos, length, result); - if (0 == strncmp(pos, "iTXt", 4)) + if (0 == strncmp(pos, "iTXt", 4)) result = processiTXt(pos, length, result); - if (0 == strncmp(pos, "tEXt", 4)) + if (0 == strncmp(pos, "tEXt", 4)) result = processtEXt(pos, length, result); - if (0 == strncmp(pos, "zTXt", 4)) + if (0 == strncmp(pos, "zTXt", 4)) result = processzTXt(pos, length, result); pos += 4+length+4; /* Chunk type, data, crc */ } - return result; + return result; } diff --git a/src/plugins/printable/bloomfilter.c b/src/plugins/printable/bloomfilter.c @@ -28,7 +28,7 @@ * * A property of the bloom filter is that sometimes we will have * a match even if the element is not on the disk (then we do - * an unnecessary disk access), but what's most important is that + * an unnecessary disk access), but what's most important is that * we never get a single "false negative". * * @author Igor Wronsky @@ -42,17 +42,17 @@ /** * Sets a bit active in the bitArray. Increment bit-specific * usage counter on disk only if below 4bit max (==15). - * + * * @param bitArray memory area to set the bit in * @param bitIdx which bit to set */ -static void setBit(unsigned char * bitArray, +static void setBit(unsigned char * bitArray, unsigned int bitIdx) { unsigned int arraySlot; unsigned int targetBit; arraySlot = bitIdx / 8; - targetBit = (1L << (bitIdx % 8)); + targetBit = (1L << (bitIdx % 8)); bitArray[arraySlot] |= targetBit; } @@ -63,13 +63,13 @@ static void setBit(unsigned char * bitArray, * @param bitIdx which bit to test * @return 1 if the bit is set, 0 if not. */ -static int testBit(unsigned char * bitArray, +static int testBit(unsigned char * bitArray, unsigned int bitIdx) { unsigned int slot; unsigned int targetBit; slot = bitIdx / 8; - targetBit = (1L << (bitIdx % 8)); + targetBit = (1L << (bitIdx % 8)); return (bitArray[slot] & targetBit) != 0; } @@ -87,7 +87,7 @@ static int testBit(unsigned char * bitArray, typedef void (*BitIterator)(Bloomfilter * bf, unsigned int bit, void * arg); - + /** * Call an iterator for each bit that the bloomfilter * must test or set for this element. @@ -114,8 +114,8 @@ static void iterateBits(Bloomfilter * bf, while (bitCount > 0) { while (slot < (sizeof(HashCode160)/ sizeof(unsigned int))) { - callback(bf, - (((unsigned int*)&tmp[round&1])[slot]) % (bf->bitArraySize*8), + callback(bf, + (((unsigned int*)&tmp[round&1])[slot]) % (bf->bitArraySize*8), arg); slot++; bitCount--; @@ -149,7 +149,7 @@ static void setBitCallback(Bloomfilter * bf, /** * Callback: test if all bits are set * - * @param bf the filter + * @param bf the filter * @param bit the bit to test * @param arg pointer set to NO if bit is not set */ @@ -174,10 +174,10 @@ int testBloomfilter(Bloomfilter * bf, HashCode160 * e) { int res; - if (NULL == bf) + if (NULL == bf) return 1; res = 1; - iterateBits(bf, + iterateBits(bf, (BitIterator)&testBitCallback, &res, e); @@ -193,7 +193,7 @@ int testBloomfilter(Bloomfilter * bf, void addToBloomfilter(Bloomfilter * bf, HashCode160 * e) { - if (NULL == bf) + if (NULL == bf) return; iterateBits(bf, &setBitCallback, diff --git a/src/plugins/printable/bloomfilter.h b/src/plugins/printable/bloomfilter.h @@ -28,7 +28,7 @@ #include "sha1.h" typedef struct { - /** How many bits we set for each stored element */ + /** How many bits we set for each stored element */ unsigned int addressesPerElement; /** The actual bloomfilter bit array */ unsigned char * bitArray; @@ -53,4 +53,4 @@ int testBloomfilter(Bloomfilter * bf, void addToBloomfilter(Bloomfilter * bf, HashCode160 * e); -#endif +#endif diff --git a/src/plugins/printable/dictionary-builder.c b/src/plugins/printable/dictionary-builder.c @@ -6,7 +6,7 @@ #include "bloomfilter.h" #include "sha1.c" -#include "bloomfilter.c" +#include "bloomfilter.c" #define ADDR_PER_ELEMENT 46 @@ -23,30 +23,30 @@ int main(int argc, FILE *dictin; char * bn; #define ALLOCSIZE 1024*1024 - + if (argc<2) { - fprintf(stderr, + fprintf(stderr, _("Please provide the name of the language you are building\n" "a dictionary for. For example:\n")); fprintf(stderr, "$ ./dictionary-builder en > en.c\n"); exit(-1); } - + fn = malloc(strlen(argv[1]) + 6); strcpy(fn, argv[1]); strcat(fn, ".txt"); dictin=fopen(fn,"r"); free(fn); if (dictin==NULL) { - fprintf(stderr, + fprintf(stderr, _("Error opening file '%s': %s\n"), argv[1],strerror(errno)); exit(-1); } - + words = malloc(sizeof(char*) * ALLOCSIZE); /* don't we LOVE constant size buffers? */ if (words == NULL) { - fprintf(stderr, + fprintf(stderr, _("Error allocating: %s\n."), strerror(errno)); exit(-1); @@ -54,18 +54,18 @@ int main(int argc, cnt = 0; memset(&line[0], 0, 2048); while (1 == fscanf(dictin, "%s", (char*)&line)) { - words[cnt] = strdup(line); + words[cnt] = strdup(line); cnt++; memset(&line[0], 0, 2048); if (cnt > ALLOCSIZE) { - fprintf(stderr, + fprintf(stderr, _("Increase ALLOCSIZE (in %s).\n"), __FILE__); exit(-1); } - + } - + bf.addressesPerElement = ADDR_PER_ELEMENT; bf.bitArraySize = cnt*4; bf.bitArray = malloc(bf.bitArraySize); @@ -82,7 +82,7 @@ int main(int argc, "#include \"bloomfilter.h\"\n"); /* use int[] instead of char[] since it cuts the memory use of - gcc down to a quarter; don't use long long since various + gcc down to a quarter; don't use long long since various gcc versions then output tons of warnings about "decimal constant is so large that it is unsigned" (even for unsigned long long[] that warning is generated and dramatically increases compile times). */ @@ -90,7 +90,7 @@ int main(int argc, "static int bits[] = { "); for (i=0;i<bf.bitArraySize/sizeof(int);i++) fprintf(stdout, - "%dL,", + "%dL,", (((int*)bf.bitArray)[i])); fprintf(stdout, "};\n"); diff --git a/src/plugins/printable/printableextractor.c b/src/plugins/printable/printableextractor.c @@ -47,7 +47,7 @@ static struct EXTRACTOR_Keywords * addKeyword(struct EXTRACTOR_Keywords * list, char * keyword) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = list; + next->next = list; next->keyword = keyword; next->keywordType = EXTRACTOR_UNKNOWN; return next; @@ -55,7 +55,7 @@ static struct EXTRACTOR_Keywords * addKeyword(struct EXTRACTOR_Keywords * list, /** - * + * * @param word (alphabetic characters without spaces) * @return 0 if it is no word, 1 if it is **/ @@ -83,8 +83,8 @@ static int wordTest(char * word, if (isupper(word[i])) count++; } - if ( ((count==1) && (isupper(word[0]))) || - (count == strlen(word)) ){ + if ( ((count==1) && (isupper(word[0]))) || + (count == strlen(word)) ){ lower = strdup(word); for (i=strlen(lower)-1;i>=0;i--) lower[i] = tolower(lower[i]); @@ -94,12 +94,12 @@ static int wordTest(char * word, i = testBloomfilter(&FILTER_NAME, &hc); free(lower); - } else + } else i=0; } if (i) { switch(strlen(word)) { - case 1: + case 1: *strlenthreshold = 6 * (*strlenthreshold); break; case 2: @@ -129,7 +129,7 @@ static int wordTest(char * word, if (*strlenthreshold < 0.25) *strlenthreshold = 0.25; } - + return i; } @@ -140,7 +140,7 @@ static void addKeywordToList(char * keyword, if (*tail != NULL) { (*tail)->next = addKeyword(NULL, keyword); *tail = (*tail)->next; - } else { + } else { *tail = addKeyword(NULL, keyword); *head = *tail; } @@ -180,7 +180,7 @@ static int process(char * keyword, free(keyword); if (isprint(sxdup[0])) { i=0; - while ( (! isprint(sxdup[i+1])) + while ( (! isprint(sxdup[i+1])) && (i<len-1) ) i++; free(sxdup); @@ -191,7 +191,7 @@ static int process(char * keyword, } } addKeywordToList(xstrndup(keyword, max), - head, + head, tail); free(keyword); p=0; @@ -230,7 +230,7 @@ static void testKeyword(size_t start, if (wordTest(keyword, thresh)) { addKeywordToList(keyword, head, - tail); + tail); return; } i = 0; @@ -238,7 +238,7 @@ static void testKeyword(size_t start, i += process(xstrndup(&keyword[i], MAXBLEN), thresh, head, - tail); + tail); } process(strdup(&keyword[i]), thresh, @@ -299,7 +299,7 @@ static void processSentences(struct EXTRACTOR_Keywords ** head, numWords = 0; continue; } - } + } /* found sentence! build & advance start! */ if (start == NULL) @@ -344,7 +344,7 @@ static void processSentences(struct EXTRACTOR_Keywords ** head, pos = last->next; numSentences++; numWords = 0; - continue; + continue; } *tail = last; } @@ -396,7 +396,7 @@ struct EXTRACTOR_Keywords * EXTRACT_NAME (char * filename, struct EXTRACTOR_Keywords * head = NULL; struct EXTRACTOR_Keywords * tail = NULL; double thresh = 2.0; - + /* if the mime-type of the file is blacklisted, don't run the printable extactor! */ mime = EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE, @@ -409,8 +409,8 @@ struct EXTRACTOR_Keywords * EXTRACT_NAME (char * filename, return prev; j++; } - } - + } + last = 0; pos = 0; while (last < size) { @@ -450,7 +450,7 @@ struct EXTRACTOR_Keywords * EXTRACT_NAME (char * filename, &head, &tail); while ( (last < size) && - (isspace(data[last])) ) + (isspace(data[last])) ) last++; } processSentences(&head, &tail); diff --git a/src/plugins/printable/sha1.c b/src/plugins/printable/sha1.c @@ -269,11 +269,11 @@ void hash(void * data, struct sha1_context ctx; sha1_starts( &ctx ); - sha1_update( &ctx, + sha1_update( &ctx, data, size); - sha1_finish( &ctx, hc->data ); + sha1_finish( &ctx, hc->data ); } #ifdef TEST @@ -285,7 +285,7 @@ void hash(void * data, * those are the standard FIPS 180-1 test vectors */ -static char *msg[] = +static char *msg[] = { "abc", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", diff --git a/src/plugins/psextractor.c b/src/plugins/psextractor.c @@ -29,7 +29,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = strdup(keyword); result->keywordType = type; return result; @@ -42,10 +42,10 @@ static char * readline(char * data, char * res; while ( ( pos < size) && - ( (data[pos] == (char)0x0d) || - (data[pos] == (char)0x0a) ) ) + ( (data[pos] == (char)0x0d) || + (data[pos] == (char)0x0a) ) ) pos++; - + if (pos >= size) return NULL; /* end of file */ end = pos; @@ -58,7 +58,7 @@ static char * readline(char * data, &data[pos], end-pos); res[end-pos] = '\0'; - + return res; } @@ -79,7 +79,7 @@ static struct EXTRACTOR_Keywords * testmeta(char * line, } prev = addKeyword(type, key, - prev); + prev); } return prev; } @@ -103,9 +103,9 @@ static Matches tests[] = { { "%%Magnification: ", EXTRACTOR_UNKNOWN }, /* Also widely used but not supported since they - probably make no sense: + probably make no sense: "%%BoundingBox: ", - "%%DocumentNeededResources: ", + "%%DocumentNeededResources: ", "%%DocumentSuppliedResources: ", "%%DocumentProcSets: ", "%%DocumentData: ", */ @@ -152,7 +152,7 @@ struct EXTRACTOR_Keywords * libextractor_ps_extract(char * filename, int i; int lastLine; const char * mime; - + /* if the mime-type of the file is blacklisted, don't run the printable extactor! */ mime = EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE, @@ -165,7 +165,7 @@ struct EXTRACTOR_Keywords * libextractor_ps_extract(char * filename, return prev; j++; } - } + } pos = 0; @@ -176,15 +176,15 @@ struct EXTRACTOR_Keywords * libextractor_ps_extract(char * filename, if (pos != strlen(psheader)) { return prev; /* no ps */ } - + prev = addKeyword(EXTRACTOR_MIMETYPE, "application/postscript", prev); /* skip rest of first line */ - while ( (pos<size) && (data[pos] != '\n') ) - pos++; - + while ( (pos<size) && (data[pos] != '\n') ) + pos++; + lastLine = -1; line = strdup(psheader); @@ -192,22 +192,22 @@ struct EXTRACTOR_Keywords * libextractor_ps_extract(char * filename, "%%EndComments", this should allow us to not read through most of the file for all the sane applications... For Windows-generated PS files, we will bail out at the end of the file. */ - while (0 != strncmp("%%EndComments", + while (0 != strncmp("%%EndComments", line, - strlen("%%EndComments"))) { + strlen("%%EndComments"))) { free(line); line = readline(data, size, pos); if (line == NULL) break; i=0; while (tests[i].prefix != NULL) { - prev = testmeta(line, + prev = testmeta(line, tests[i].prefix, tests[i].type, prev); i++; } - + /* %%+ continues previous meta-data type... */ if ( (lastLine != -1) && (0 == strncmp(line, "%%+ ", strlen("%%+ "))) ) { @@ -225,7 +225,7 @@ struct EXTRACTOR_Keywords * libextractor_ps_extract(char * filename, pos += strlen(line)+1; /* skip newline, too; guarantee progress! */ } free(line); - + return prev; } diff --git a/src/plugins/qtextractor.c b/src/plugins/qtextractor.c @@ -256,7 +256,7 @@ typedef struct { /* flags that indicate how a trak is supposed to be used */ unsigned int flags; - + /* decoder data pass information to the AAC decoder */ void *decoder_config; int decoder_config_len; @@ -307,7 +307,7 @@ typedef struct { unsigned int modification_time; unsigned int timescale; /* base clock frequency is Hz */ unsigned int duration; - + int64_t moov_first_offset; int trak_count; @@ -335,15 +335,15 @@ static int readBuf(qt_info * this, void * buf, int len) { int min; - + min = len; if ( (this->inputLen < this->inputPos) || (this->inputPos < 0) ) return -1; /* invalid pos/len */ if (this->inputLen - this->inputPos < min) min = this->inputLen - this->inputPos; - memcpy(buf, - &this->input[this->inputPos], + memcpy(buf, + &this->input[this->inputPos], min); this->inputPos += min; return min; @@ -353,7 +353,7 @@ static int readBuf(qt_info * this, * lazyqt special debugging functions **********************************************************************/ -/* define DEBUG_ATOM_LOAD as 1 to get a verbose parsing of the relevant +/* define DEBUG_ATOM_LOAD as 1 to get a verbose parsing of the relevant * atoms */ #define DEBUG_ATOM_LOAD 0 @@ -375,7 +375,7 @@ static int readBuf(qt_info * this, /* Define DEBUG_DUMP_MOOV as 1 to dump the raw moov atom to disk. This is * particularly useful in debugging a file with a compressed moov (cmov) - * atom. The atom will be dumped to the filename specified as + * atom. The atom will be dumped to the filename specified as * RAW_MOOV_FILENAME. */ #define DEBUG_DUMP_MOOV 0 #define RAW_MOOV_FILENAME "moovatom.raw" @@ -511,7 +511,7 @@ static void find_moov_atom(qt_info *input, off_t *moov_offset, ATOM_PREAMBLE_SIZE) break; - atom_size = BE_32(&atom_preamble[0]); + atom_size = BE_32(&atom_preamble[0]); atom_size <<= 16; /* <<= 32 causes compiler warning if we */ atom_size <<= 16; /* are not running on 64 bit. */ atom_size |= BE_32(&atom_preamble[4]); @@ -616,7 +616,7 @@ static void parse_mvhd_atom(qt_info *info, unsigned char *mvhd_atom) { static int mp4_read_descr_len(unsigned char *s, ext_uint32_t *length) { ext_uint8_t b; ext_uint8_t numBytes = 0; - + *length = 0; do { @@ -691,7 +691,7 @@ static qt_error parse_trak_atom (qt_trak *trak, break; } } - + debug_atom_load(" qt: parsing %s trak atom\n", (trak->type == MEDIA_VIDEO) ? "video" : (trak->type == MEDIA_AUDIO) ? "audio" : "other"); @@ -712,7 +712,7 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->properties.video.width = BE_16(&trak_atom[i + 0x50]); trak->properties.video.height = - BE_16(&trak_atom[i + 0x54]); + BE_16(&trak_atom[i + 0x54]); } } } else if (current_atom == ELST_ATOM) { @@ -784,7 +784,7 @@ static qt_error parse_trak_atom (qt_trak *trak, * fix at the end of the stsd parser */ i += hack_adjust; } - + if (trak->type == MEDIA_VIDEO) { /* initialize to sane values */ @@ -796,7 +796,7 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->properties.video.palette_count = 0; /* fetch video parameters */ - if( BE_16(&trak_atom[i + 0x2C]) && + if( BE_16(&trak_atom[i + 0x2C]) && BE_16(&trak_atom[i + 0x2E]) ) { trak->properties.video.width = BE_16(&trak_atom[i + 0x2C]); @@ -824,9 +824,9 @@ static qt_error parse_trak_atom (qt_trak *trak, /* compute the greyscale palette */ color_index = 255; - color_dec = 256 / + color_dec = 256 / (trak->properties.video.palette_count - 1); - for (j = 0; + for (j = 0; j < trak->properties.video.palette_count; j++) { @@ -890,12 +890,12 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->properties.audio.bits / 8; trak->properties.audio.samples_per_frame = trak->properties.audio.channels; - trak->properties.audio.bytes_per_frame = - trak->properties.audio.bytes_per_sample * + trak->properties.audio.bytes_per_frame = + trak->properties.audio.bytes_per_sample * trak->properties.audio.samples_per_frame; - trak->properties.audio.samples_per_packet = + trak->properties.audio.samples_per_packet = trak->properties.audio.samples_per_frame; - trak->properties.audio.bytes_per_packet = + trak->properties.audio.bytes_per_packet = trak->properties.audio.bytes_per_sample; /* special case time: some ima4-encoded files don't have the @@ -903,7 +903,7 @@ static qt_error parse_trak_atom (qt_trak *trak, if (BE_32(&trak_atom[i + 0x10]) == IMA4_FOURCC) { trak->properties.audio.samples_per_packet = 64; trak->properties.audio.bytes_per_packet = 34; - trak->properties.audio.bytes_per_frame = 34 * + trak->properties.audio.bytes_per_frame = 34 * trak->properties.audio.channels; trak->properties.audio.bytes_per_sample = 2; trak->properties.audio.samples_per_frame = 64 * @@ -917,19 +917,19 @@ static qt_error parse_trak_atom (qt_trak *trak, if (BE_32(&trak_atom[i + 0x0C]) > 0x24) { if (BE_32(&trak_atom[i + 0x30])) - trak->properties.audio.samples_per_packet = + trak->properties.audio.samples_per_packet = BE_32(&trak_atom[i + 0x30]); if (BE_32(&trak_atom[i + 0x34])) - trak->properties.audio.bytes_per_packet = + trak->properties.audio.bytes_per_packet = BE_32(&trak_atom[i + 0x34]); if (BE_32(&trak_atom[i + 0x38])) - trak->properties.audio.bytes_per_frame = + trak->properties.audio.bytes_per_frame = BE_32(&trak_atom[i + 0x38]); if (BE_32(&trak_atom[i + 0x3C])) - trak->properties.audio.bytes_per_sample = + trak->properties.audio.bytes_per_sample = BE_32(&trak_atom[i + 0x3C]); trak->properties.audio.samples_per_frame = - (trak->properties.audio.bytes_per_frame / + (trak->properties.audio.bytes_per_frame / trak->properties.audio.bytes_per_packet) * trak->properties.audio.samples_per_packet; @@ -946,7 +946,7 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->properties.audio.vbr = 1; /* check for a MS-style WAVE format header */ - if ((current_atom_size >= 0x48) && + if ((current_atom_size >= 0x48) && (BE_32(&trak_atom[i + 0x44]) == WAVE_ATOM)) { trak->properties.audio.wave_present = 1; } else { @@ -983,12 +983,12 @@ static qt_error parse_trak_atom (qt_trak *trak, } else if (current_atom == ESDS_ATOM) { ext_uint32_t len; - + debug_atom_load(" qt/mpeg-4 esds atom\n"); - if ((trak->type == MEDIA_VIDEO) || + if ((trak->type == MEDIA_VIDEO) || (trak->type == MEDIA_AUDIO)) { - + j = i + 8; if( trak_atom[j++] == 0x03 ) { j += mp4_read_descr_len( &trak_atom[j], &len ); @@ -1290,9 +1290,9 @@ static qt_error parse_reference_atom (reference_t *ref, /* This is a little support function used to process the edit list when * building a frame table. */ #define MAX_DURATION 0x7FFFFFFF -static void get_next_edit_list_entry(qt_trak *trak, +static void get_next_edit_list_entry(qt_trak *trak, int *edit_list_index, - unsigned int *edit_list_media_time, + unsigned int *edit_list_media_time, int64_t *edit_list_duration, unsigned int global_timescale) { @@ -1309,9 +1309,9 @@ static void get_next_edit_list_entry(qt_trak *trak, /* otherwise, find an edit list entries whose media time != -1 */ if (trak->edit_list_table[*edit_list_index].media_time != -1) { - *edit_list_media_time = + *edit_list_media_time = trak->edit_list_table[*edit_list_index].media_time; - *edit_list_duration = + *edit_list_duration = trak->edit_list_table[*edit_list_index].track_duration; /* duration is in global timescale units; convert to trak timescale */ @@ -1325,8 +1325,8 @@ static void get_next_edit_list_entry(qt_trak *trak, *edit_list_index = *edit_list_index + 1; } - /* on the way out, check if this is the last edit list entry; if so, - * don't let the duration expire (so set it to an absurdly large value) + /* on the way out, check if this is the last edit list entry; if so, + * don't let the duration expire (so set it to an absurdly large value) */ if (*edit_list_index == trak->edit_list_count) *edit_list_duration = MAX_DURATION; @@ -1353,7 +1353,7 @@ static qt_error build_frame_table(qt_trak *trak, /* AUDIO and OTHER frame types follow the same rules; VIDEO and vbr audio * frame types follow a different set */ - if ((trak->type == MEDIA_VIDEO) || + if ((trak->type == MEDIA_VIDEO) || (trak->properties.audio.vbr)) { /* in this case, the total number of frames is equal to the number of @@ -1448,11 +1448,11 @@ static qt_error build_frame_table(qt_trak *trak, debug_edit_list(" %d: (before) pts = %lld...", i, trak->frames[i].pts); - if (trak->frames[i].pts < edit_list_media_time) + if (trak->frames[i].pts < edit_list_media_time) trak->frames[i].pts = edit_list_pts_counter; else { if (i < trak->frame_count - 1) - frame_duration = + frame_duration = (trak->frames[i + 1].pts - trak->frames[i].pts); debug_edit_list("duration = %lld...", frame_duration); @@ -1521,7 +1521,7 @@ static qt_error build_frame_table(qt_trak *trak, /* compute the actual chunk size */ trak->frames[j].size = - (trak->frames[j].size * + (trak->frames[j].size * trak->properties.audio.channels) / trak->properties.audio.samples_per_frame * trak->properties.audio.bytes_per_frame; @@ -1574,7 +1574,7 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom) { /* create a new trak structure */ info->trak_count++; - info->traks = (qt_trak *)realloc(info->traks, + info->traks = (qt_trak *)realloc(info->traks, info->trak_count * sizeof(qt_trak)); parse_trak_atom (&info->traks[info->trak_count - 1], &moov_atom[i - 4]); @@ -1668,10 +1668,10 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom) { /* iterate through 1..n-1 reference entries and decide on the right one */ for (i = 1; i < info->reference_count; i++) { - if (info->references[i].qtim_version > + if (info->references[i].qtim_version > info->references[info->chosen_reference].qtim_version) info->chosen_reference = i; - else if ((info->references[i].data_rate > + else if ((info->references[i].data_rate > info->references[info->chosen_reference].data_rate)) info->chosen_reference = i; } @@ -1711,7 +1711,7 @@ static qt_error open_qt_file(qt_info *info) { /* seek to the start of moov atom */ info->inputPos = info->moov_first_offset; - if (readBuf(info, moov_atom, moov_atom_size) != + if (readBuf(info, moov_atom, moov_atom_size) != moov_atom_size) { free(moov_atom); info->last_error = QT_FILE_READ_ERROR; @@ -1896,29 +1896,29 @@ void parse_quicktime(FILE *file, Data *data) fseek(file, blockStart + blockLen, SEEK_SET); continue; } - + subBlockStart = ftell(file); subBlockLen = fread_be(file, 4); /* tkhd length */ fread(fourcc, sizeof(char), 4, file); if(memcmp(fourcc, "tkhd", 4)!=0) return; - + /* Now in the track header */ /* 84: width (2 bytes) */ fseek(file, subBlockStart + 84, SEEK_SET); width = fread_be(file, 2); - + /* 88: height (2 bytes) */ fseek(file, subBlockStart + 88, SEEK_SET); height = fread_be(file, 2); - + /* Note on above: Apple's docs say that width/height are 4-byte integers, * but all files I've seen have the data stored in the high-order two * bytes, with the low-order two being 0x0000. Interpreting it the * "official" way would make width/height be thousands of pixels each. */ - + /* Skip rest of tkhd */ fseek(file, subBlockStart + subBlockLen, SEEK_SET); @@ -1987,7 +1987,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = strdup(keyword); result->keywordType = type; return result; @@ -1996,7 +1996,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, /* mimetypes: video/quicktime: mov,qt: Quicktime animation; video/x-quicktime: mov,qt: Quicktime animation; - application/x-quicktimeplayer: qtl: Quicktime list; + application/x-quicktimeplayer: qtl: Quicktime list; */ struct EXTRACTOR_Keywords * libextractor_qt_extract(char * filename, char * data, diff --git a/src/plugins/realextractor.c b/src/plugins/realextractor.c @@ -62,7 +62,7 @@ typedef struct { UINT8[copyright_len] copyright; UINT16 comment_len; UINT8[comment_len] comment; - */ + */ } Content_Description; /* author, copyright and comment are supposed to be ASCII */ @@ -72,7 +72,7 @@ typedef struct { #define RAFF4_HEADER 0x2E7261FD -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, char * keyword, struct EXTRACTOR_Keywords * next) { @@ -81,7 +81,7 @@ addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -90,38 +90,38 @@ addKeyword(EXTRACTOR_KeywordType type, static struct EXTRACTOR_Keywords * processMediaProperties(const Media_Properties * prop, struct EXTRACTOR_Keywords * prev) { - + UINT8 mime_type_size; UINT32 prop_size; char * data; prop_size = ntohl(prop->size); if (prop_size <= sizeof(Media_Properties)) - return prev; + return prev; if (0 != prop->object_version) return prev; if (prop_size <= prop->stream_name_size + sizeof(UINT8) + sizeof(Media_Properties)) - return prev; - + return prev; + mime_type_size = prop->data[prop->stream_name_size]; if (prop_size <= prop->stream_name_size + sizeof(UINT8) + + mime_type_size + sizeof(Media_Properties)) - return prev; - + return prev; + data = malloc(mime_type_size+1); memcpy(data,&prop->data[prop->stream_name_size+1],mime_type_size); data[mime_type_size]='\0'; - + return addKeyword(EXTRACTOR_MIMETYPE, data, prev); } -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * processContentDescription(const Content_Description * prop, struct EXTRACTOR_Keywords * prev) { - + UINT16 author_len; UINT16 copyright_len; @@ -135,7 +135,7 @@ processContentDescription(const Content_Description * prop, prop_size = ntohl(prop->size); if (prop_size <= sizeof(Content_Description)) - return prev; + return prev; if (0 != prop->object_version) return prev; title_len = ntohs(prop->title_len); @@ -145,33 +145,33 @@ processContentDescription(const Content_Description * prop, author_len = ntohs( *(UINT16*)&prop->data[title_len]); - - if (prop_size <= title_len + sizeof(UINT16) + + if (prop_size <= title_len + sizeof(UINT16) + author_len + sizeof(Content_Description)) return prev; copyright_len =ntohs( *(UINT16*)&prop->data[title_len+ author_len+ sizeof(UINT16)]); - - if (prop_size <= title_len + 2*sizeof(UINT16) + + if (prop_size <= title_len + 2*sizeof(UINT16) + author_len + copyright_len + sizeof(Content_Description)) return prev; - + comment_len = ntohs( *(UINT16*)&prop->data[title_len+ author_len+ copyright_len+ 2*sizeof(UINT16)]); - - if (prop_size < title_len + 3*sizeof(UINT16) - + author_len + copyright_len + comment_len + + if (prop_size < title_len + 3*sizeof(UINT16) + + author_len + copyright_len + comment_len + sizeof(Content_Description)) return prev; - + title = malloc(title_len+1); memcpy(title,&prop->data[0],title_len); title[title_len]='\0'; - + prev = addKeyword(EXTRACTOR_TITLE, title, prev); @@ -209,34 +209,34 @@ processContentDescription(const Content_Description * prop, return prev; } -typedef struct RAFF4_header { - unsigned short version; - unsigned short revision; - unsigned short header_length; +typedef struct RAFF4_header { + unsigned short version; + unsigned short revision; + unsigned short header_length; unsigned short compression_type; - unsigned int granularity; - unsigned int total_bytes; + unsigned int granularity; + unsigned int total_bytes; unsigned int bytes_per_minute; unsigned int bytes_per_minute2; - unsigned short interleave_factor; + unsigned short interleave_factor; unsigned short interleave_block_size; - unsigned int user_data; - float sample_rate; + unsigned int user_data; + float sample_rate; unsigned short sample_size; - unsigned short channels; - unsigned char interleave_code[5]; + unsigned short channels; + unsigned char interleave_code[5]; unsigned char compression_code[5]; unsigned char is_interleaved; - unsigned char copy_byte; - unsigned char stream_type; + unsigned char copy_byte; + unsigned char stream_type; /* unsigned char tlen; unsigned char title[tlen]; - unsigned char alen; + unsigned char alen; unsigned char author[alen]; - unsigned char clen; + unsigned char clen; unsigned char copyright[clen]; - unsigned char aplen; + unsigned char aplen; unsigned char app[aplen]; */ } RAFF4_header; @@ -259,20 +259,20 @@ struct EXTRACTOR_Keywords * libextractor_real_extract(unsigned char * filename, const unsigned char * pos; const unsigned char * end; struct EXTRACTOR_Keywords * result; - unsigned int length; + unsigned int length; const RAFF4_header * hdr; unsigned char tlen; unsigned char alen; unsigned char clen; unsigned char aplen; - if (size <= 2*sizeof(int)) - return prev; - - if (RAFF4_HEADER == ntohl(*(int*)data)) { + if (size <= 2*sizeof(int)) + return prev; + + if (RAFF4_HEADER == ntohl(*(int*)data)) { /* HELIX */ if (size <= RAFF4_HDR_SIZE + 16 + 4) - return prev; + return prev; prev = addKeyword(EXTRACTOR_MIMETYPE, strdup("audio/vnd.rn-realaudio"), prev); @@ -287,7 +287,7 @@ struct EXTRACTOR_Keywords * libextractor_real_extract(unsigned char * filename, return prev; clen = data[18 + tlen + alen + RAFF4_HDR_SIZE]; if (tlen + alen + clen + RAFF4_HDR_SIZE + 20 > size) - return prev; + return prev; aplen = data[19 + tlen + clen + alen + RAFF4_HDR_SIZE]; if (tlen + alen + clen + aplen + RAFF4_HDR_SIZE + 20 > size) return prev; @@ -313,7 +313,7 @@ struct EXTRACTOR_Keywords * libextractor_real_extract(unsigned char * filename, aplen), prev); return prev; - + } if (REAL_HEADER == ntohl(*(int*)data)) { /* old real */ @@ -347,8 +347,8 @@ struct EXTRACTOR_Keywords * libextractor_real_extract(unsigned char * filename, break; } } - return result; - } + return result; + } return prev; } diff --git a/src/plugins/riffextractor.c b/src/plugins/riffextractor.c @@ -17,7 +17,7 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - This code was based on AVInfo 1.0 alpha 11 + This code was based on AVInfo 1.0 alpha 11 (c) George Shuklin, gs]AT[shounen.ru, 2002-2004 http://shounen.ru/soft/avinfo/ @@ -35,7 +35,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = *list; + next->next = *list; next->keyword = keyword; next->keywordType = type; *list = next; @@ -62,7 +62,7 @@ static struct EXTRACTOR_Keywords * riffparse_INFO(char * buffer, word[c-8] = '\0'; addKeyword(&prev, strdup(buffer+c), - EXTRACTOR_UNKNOWN); /* eh, what exactly is it */ + EXTRACTOR_UNKNOWN); /* eh, what exactly is it */ } return prev; } @@ -71,12 +71,12 @@ static struct EXTRACTOR_Keywords * riffparse_INFO(char * buffer, /** * Read the specified number of bytes as a little-endian (least - * significant byte first) integer. + * significant byte first) integer. */ static unsigned int fread_le(char * data) { int x; unsigned int result = 0; - + for(x=0;x<4; x++) result |= ((unsigned char)data[x]) << (x*8); return result; @@ -103,17 +103,17 @@ struct EXTRACTOR_Keywords * libextractor_riff_extract(char * filename, unsigned int height; char codec[5]; char * format; - + if (xsize < 32) return prev; - if ( (memcmp(&xdata[0], + if ( (memcmp(&xdata[0], "RIFF", 4) !=0) || - (memcmp(&xdata[8], - "AVI ", + (memcmp(&xdata[8], + "AVI ", 4) !=0) ) return prev; - + if (memcmp(&xdata[12], "LIST", 4) != 0) @@ -132,11 +132,11 @@ struct EXTRACTOR_Keywords * libextractor_riff_extract(char * filename, * 1000 / fps); width = fread_le(&xdata[64]); height = fread_le(&xdata[68]); - + /* pos: begin of video stream header */ pos = blockLen + 32; - + if ( (pos < blockLen) || (pos + 32 > xsize) || (pos > xsize) ) @@ -160,8 +160,8 @@ struct EXTRACTOR_Keywords * libextractor_riff_extract(char * filename, &xdata[pos+24], 4); codec[4] = '\0'; - - format = malloc(256); + + format = malloc(256); snprintf(format, 256, _("codec: %s, %u fps, %u ms"), @@ -171,7 +171,7 @@ struct EXTRACTOR_Keywords * libextractor_riff_extract(char * filename, addKeyword(&prev, format, EXTRACTOR_FORMAT); - format = malloc(256); + format = malloc(256); snprintf(format, 256, "%ux%u", diff --git a/src/plugins/rpm/rpmextractor.c b/src/plugins/rpm/rpmextractor.c @@ -48,9 +48,9 @@ static int timedRead(FD_t f, if (f->len - f->pos >= n) min = n; - else + else min = f->len - f->pos; - memcpy(dst, + memcpy(dst, &f->data[f->pos], min); f->pos += min; @@ -405,7 +405,7 @@ struct rpmlead { * Alignment needs (and sizeof scalars types) for internal rpm data types. */ /*@observer@*/ /*@unchecked@*/ -static int typeSizes[] = { +static int typeSizes[] = { 0, /*!< RPM_NULL_TYPE */ 1, /*!< RPM_CHAR_TYPE */ 1, /*!< RPM_INT8_TYPE */ @@ -655,7 +655,7 @@ int (*HDRhdrwrite) (FD_t fd, /*@null@*/ Header h, enum hMagic magicp) */ typedef int (*HDRisentry) (/*@null@*/Header h, int_32 tag) - /*@*/; + /*@*/; /** \ingroup header * Free data allocated when retrieved from header. @@ -1327,7 +1327,7 @@ indexEntry findEntry(/*@null@*/ Header h, int_32 tag, int_32 type) key.info.tag = tag; - entry2 = entry = + entry2 = entry = bsearch(&key, h->index, h->indexUsed, sizeof(*h->index), indexCmp); if (entry == NULL) return NULL; @@ -1377,7 +1377,7 @@ static int copyEntry(const indexEntry entry, { int_32 count = entry->info.count; int rc = 1; /* XXX 1 on success. */ - + if (p) switch (entry->info.type) { case RPM_BIN_TYPE: @@ -1443,7 +1443,7 @@ static int copyEntry(const indexEntry entry, /*@=sizeoftype@*/ char * t; int i; - + /*@-mods@*/ if (minMem) { *p = malloc(tableSize); @@ -1548,7 +1548,7 @@ int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type, /** * Does locale match entry in header i18n table? - * + * * \verbatim * The range [l,le) contains the next locale to match: * ll[_CC][.EEEEE][@dddd] @@ -1649,7 +1649,7 @@ headerFindI18NString(Header h, indexEntry entry) (lang = getenv("LC_MESSAGES")) == NULL && (lang = getenv("LANG")) == NULL) return entry->data; - + /*@-mods@*/ if ((table = findEntry(h, HEADER_I18NTABLE, RPM_STRING_ARRAY_TYPE)) == NULL) return entry->data; @@ -1916,7 +1916,7 @@ int headerNextIterator(HeaderIterator hi, *tag = entry->info.tag; rc = copyEntry(entry, type, p, c, do_copy); - + /* XXX 1 on success */ return ((rc == 1) ? 1 : 0); } @@ -1975,13 +1975,13 @@ Header headerFree(/*@killref@*/ /*@null@*/ Header h) /** * Sanity check on no. of tags. * This check imposes a limit of 65K tags, more than enough. - */ + */ #define hdrchkTags(_ntags) ((_ntags) & 0xffff0000) /** * Sanity check on data size and/or offset. * This check imposes a limit of 16Mb, more than enough. - */ + */ #define hdrchkData(_nbytes) ((_nbytes) & 0xff000000) @@ -2130,7 +2130,7 @@ Header headerLoad(/*@kept@*/ void * uh) Header h = NULL; entryInfo pe; char * dataStart; - indexEntry entry; + indexEntry entry; int rdlen; int i; @@ -2330,7 +2330,7 @@ Header headerRead(FD_t fd, enum hMagic magicp) goto exit; reserved = block[i++]; } - + il = ntohl(block[i]); i++; dl = ntohl(block[i]); i++; @@ -2351,7 +2351,7 @@ Header headerRead(FD_t fd, enum hMagic magicp) if (timedRead(fd, (char *)&ei[2], len) != len) goto exit; /*@=type@*/ - + h = headerLoad(ei); exit: @@ -2546,7 +2546,7 @@ int headerRemoveEntry(Header h, int_32 tag) if (!entry) return 1; /* Make sure entry points to the first occurence of this tag. */ - while (entry > h->index && (entry - 1)->info.tag == tag) + while (entry > h->index && (entry - 1)->info.tag == tag) entry--; /* Free data for tags being removed. */ @@ -2784,7 +2784,7 @@ static Header rpmFreeSignature(Header h); * @return rpmRC return code */ static rpmRC readPackageHeaders(FD_t fd, - /*@null@*/ /*@out@*/ struct rpmlead * leadPtr, + /*@null@*/ /*@out@*/ struct rpmlead * leadPtr, /*@null@*/ /*@out@*/ Header * sigs, /*@null@*/ /*@out@*/ Header * hdrPtr) /*@modifies fd, *leadPtr, *sigs, *hdrPtr @*/ @@ -2837,7 +2837,7 @@ static rpmRC readPackageHeaders(FD_t fd, /* * We switched the way we do relocateable packages. We fix some of - * it up here, though the install code still has to be a bit + * it up here, though the install code still has to be a bit * careful. This fixup makes queries give the new values though, * which is quite handy. */ @@ -2847,7 +2847,7 @@ static rpmRC readPackageHeaders(FD_t fd, defaultPrefix = stripTrailingChar(alloca_strdup(defaultPrefix), '/'); (void) headerAddEntry(*hdr, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE, - &defaultPrefix, 1); + &defaultPrefix, 1); } /* @@ -2874,11 +2874,11 @@ static rpmRC readPackageHeaders(FD_t fd, default: return RPMRC_FAIL; /*@notreached@*/ break; - } + } if (hdrPtr == NULL) *hdr = headerFree(*hdr); - + return RPMRC_OK; } @@ -2956,13 +2956,13 @@ static rpmRC rpmReadPackageHeader(FD_t fd, Header * hdrp, int * isSource, int * headerMergeLegacySigs(*hdrp, sig); sig = rpmFreeSignature(sig); } - + if (isSource) *isSource = lead.type == RPMLEAD_SOURCE; /*@-mods@*/ if (major) *major = lead.major; if (minor) *minor = lead.minor; /*@=mods@*/ - + exit: return rc; } @@ -2978,7 +2978,7 @@ static struct EXTRACTOR_Keywords * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = strdup(keyword); result->keywordType = type; return result; @@ -3028,13 +3028,13 @@ struct EXTRACTOR_Keywords * libextractor_rpm_extract(char * filename, int minor; int i; char verb[40]; - + handle.data = data; handle.pos = 0; handle.len = size; if (0 != rpmReadPackageHeader(&handle, &hdr, - &isSource, + &isSource, &major, &minor)) { return prev; @@ -3051,7 +3051,7 @@ struct EXTRACTOR_Keywords * libextractor_rpm_extract(char * filename, else sprintf(verb, _("Binary RPM %d.%d"), - major, + major, minor); prev = addKeyword(EXTRACTOR_UNKNOWN, verb, @@ -3064,15 +3064,15 @@ struct EXTRACTOR_Keywords * libextractor_rpm_extract(char * filename, &c, 0)) { i=0; - while (tests[i].rtype != 0) { + while (tests[i].rtype != 0) { if (tests[i].rtype == tag) { switch (type) { - case RPM_STRING_ARRAY_TYPE: { + case RPM_STRING_ARRAY_TYPE: { char * tmp; const char * p2; int c2; int size; - + c2 = c; p2 = p; size = 0; @@ -3081,7 +3081,7 @@ struct EXTRACTOR_Keywords * libextractor_rpm_extract(char * filename, p2 = strchr(p2, 0); p2++; } - + tmp = malloc(size+1); tmp[0] = '\0'; while (c--) { @@ -3091,11 +3091,11 @@ struct EXTRACTOR_Keywords * libextractor_rpm_extract(char * filename, } prev = addKeyword(tests[i].type, tmp, - prev); + prev); free(tmp); break; } - case RPM_I18NSTRING_TYPE: { + case RPM_I18NSTRING_TYPE: { char * tmp; const char * p2; int c2; @@ -3110,7 +3110,7 @@ struct EXTRACTOR_Keywords * libextractor_rpm_extract(char * filename, p2 = strchr(p2, 0); p2++; } - + tmp = malloc(size+1); tmp[0] = '\0'; p2 = p; @@ -3122,7 +3122,7 @@ struct EXTRACTOR_Keywords * libextractor_rpm_extract(char * filename, } prev = addKeyword(tests[i].type, tmp, - prev); + prev); free(tmp); break; } @@ -3139,27 +3139,27 @@ struct EXTRACTOR_Keywords * libextractor_rpm_extract(char * filename, tmp[strlen(tmp)-1] = '\0'; /* eat linefeed */ prev = addKeyword(tests[i].type, tmp, - prev); + prev); } else { char tmp[14]; - + sprintf(tmp, "%d", *(int*)p); prev = addKeyword(tests[i].type, tmp, - prev); + prev); } break; } } - } + } i++; } if ( ( (type == RPM_BIN_TYPE) || (type == RPM_I18NSTRING_TYPE) || (type == RPM_STRING_ARRAY_TYPE) ) && (p != NULL) ) { - free((void*)p); - } + free((void*)p); + } } headerFreeIterator(hi); headerFree(hdr); diff --git a/src/plugins/splitextractor.c b/src/plugins/splitextractor.c @@ -29,7 +29,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = *list; + next->next = *list; next->keyword = strdup(keyword); next->keywordType = type; *list = next; diff --git a/src/plugins/tarextractor.c b/src/plugins/tarextractor.c @@ -42,7 +42,7 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, return next; } result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -81,19 +81,19 @@ typedef struct { } USTarHeader; -static struct EXTRACTOR_Keywords * +static struct EXTRACTOR_Keywords * tar_extract(const char * data, size_t size, struct EXTRACTOR_Keywords * prev) { TarHeader * tar; USTarHeader * ustar; - size_t pos; + size_t pos; if (0 != (size % 512) ) return prev; /* cannot be tar! */ if (size < 1024) return prev; - size -= 1024; /* last 2 blocks are all zeros */ + size -= 1024; /* last 2 blocks are all zeros */ /* fixme: we may want to check that the last 1024 bytes are all zeros here... */ @@ -108,13 +108,13 @@ tar_extract(const char * data, ustar = (USTarHeader*) &data[pos]; if (0 == strncmp("ustar", &ustar->magic[0], - strlen("ustar"))) + strlen("ustar"))) pos += 512; /* sizeof(USTarHeader); */ else pos += 257; /* sizeof(TarHeader); minus gcc alignment... */ } else { pos += 257; /* sizeof(TarHeader); minus gcc alignment... */ - } + } memcpy(buf, &tar->filesize[0], 12); buf[12] = '\0'; if (1 != sscanf(buf, "%12llo", &fsize)) /* octal! Yuck yuck! */ @@ -188,11 +188,11 @@ struct EXTRACTOR_Keywords * libextractor_tar_extract(const char * filename, } gzclose(gzf); prev = tar_extract(buf, bufSize, prev); - free(buf); + free(buf); return prev; } else { /* try for uncompressed tar */ return tar_extract(data, size, prev); - } + } } diff --git a/src/plugins/templateextractor.c b/src/plugins/templateextractor.c @@ -29,7 +29,7 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; diff --git a/src/plugins/thumbnail/thumbnailextractor.c b/src/plugins/thumbnail/thumbnailextractor.c @@ -41,7 +41,7 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, if (keyword == NULL) return next; result = malloc(sizeof(EXTRACTOR_KeywordList)); - result->next = next; + result->next = next; result->keyword = keyword; result->keywordType = type; return result; @@ -49,9 +49,9 @@ static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, /* which mime-types maybe subjected to - the thumbnail extractor (ImageMagick + the thumbnail extractor (ImageMagick crashes and/or prints errors for bad - formats, so we need to be rather + formats, so we need to be rather conservative here) */ static char * whitelist[] = { "image/jpeg", @@ -87,12 +87,12 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename unsigned char marker; const char * mime; int j; - + /* if the mime-type of the file is not whitelisted do not run the thumbnail extactor! */ mime = EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE, prev); - if (mime == NULL) + if (mime == NULL) return prev; j = 0; while (whitelist[j] != NULL) { @@ -103,7 +103,7 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename if (whitelist[j] == NULL) return prev; - magick_wand = NewMagickWand(); + magick_wand = NewMagickWand(); status = MagickReadImageBlob(magick_wand, data, size); if (status == MagickFalse) { DestroyMagickWand(magick_wand); @@ -124,7 +124,7 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename DestroyMagickWand(magick_wand); return prev; } - + if (height > THUMBSIZE) { width = width * THUMBSIZE / height; @@ -140,7 +140,7 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename MagickSetImageChannelDepth(magick_wand, RedChannel, 2); - MagickCommentImage(magick_wand, ""); + MagickCommentImage(magick_wand, ""); MagickSetImageChannelDepth(magick_wand, GreenChannel, 2); @@ -159,10 +159,10 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename } thumb = MagickGetImageBlob(magick_wand, &length); DestroyMagickWand(magick_wand); - if (thumb == NULL) + if (thumb == NULL) return prev; - - + + /* encode! */ binary = malloc(2 + length + (length+256) / 254); if (binary == NULL) @@ -179,8 +179,8 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename if (end > length) end = length; memset(markers, 0, sizeof(markers)); - for (i=pos;i<end;i++) - markers[thumb[i]&7] |= 1 << (thumb[i] >> 3); + for (i=pos;i<end;i++) + markers[thumb[i]&7] |= 1 << (thumb[i] >> 3); marker = 1; while (markers[marker&7] & (1 << (marker >> 3))) { marker++; @@ -208,7 +208,7 @@ struct EXTRACTOR_Keywords * libextractor_thumbnail_extract(const char * filename /** * This function can be used to decode the binary data - * stream produced by the thumbnailextractor. + * stream produced by the thumbnailextractor. * * @param in 0-terminated string from the meta-data * @return 1 on error, 0 on success @@ -223,7 +223,7 @@ int decodeThumbnail(const unsigned char * in, size_t i; size_t end; size_t inSize; - + inSize = strlen(in); if (inSize == 0) { *out = NULL; @@ -233,7 +233,7 @@ int decodeThumbnail(const unsigned char * in, buf = malloc(inSize); /* slightly more than needed ;-) */ *out = buf; - + pos = 0; wpos = 0; while (pos < inSize) { @@ -241,7 +241,7 @@ int decodeThumbnail(const unsigned char * in, if (end > inSize) end = inSize; marker = in[pos++]; - for (i=pos;i<end;i++) + for (i=pos;i<end;i++) buf[wpos++] = (in[i] == marker) ? 0 : in[i]; pos = end; } diff --git a/src/plugins/tiffextractor.c b/src/plugins/tiffextractor.c @@ -29,7 +29,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = *list; + next->next = *list; next->keyword = keyword; next->keywordType = type; *list = next; @@ -64,7 +64,7 @@ typedef struct { &(p)->value_or_offset static char * DIRECTORY_ENTRY_SPECS[] = { "hhww", - "HHWW" + "HHWW" }; #define TAG_LENGTH 0x101 @@ -115,7 +115,7 @@ struct EXTRACTOR_Keywords * libextractor_tiff_extract(char * filename, int current_ifd; long long length = -1; long long width = -1; - + if (size < TIFF_HEADER_SIZE) return prev; /* can not be tiff */ if ( (data[0] == 0x49) && @@ -128,7 +128,7 @@ struct EXTRACTOR_Keywords * libextractor_tiff_extract(char * filename, return prev; /* can not be tiff */ #if __BYTE_ORDER == __BIG_ENDIAN byteOrder = 1-byteOrder; -#endif +#endif cat_unpack(data, TIFF_HEADER_SPECS[byteOrder], TIFF_HEADER_FIELDS(&hdr)); @@ -159,7 +159,7 @@ struct EXTRACTOR_Keywords * libextractor_tiff_extract(char * filename, for (i=0;i<len;i++) { DIRECTORY_ENTRY entry; off = current_ifd + 2 + DIRECTORY_ENTRY_SIZE*i; - + cat_unpack(&data[off], DIRECTORY_ENTRY_SPECS[byteOrder], DIRECTORY_ENTRY_FIELDS(&entry)); @@ -174,7 +174,7 @@ struct EXTRACTOR_Keywords * libextractor_tiff_extract(char * filename, if (width != -1) { char * tmp; tmp = malloc(128); - sprintf(tmp, "%ux%u", + sprintf(tmp, "%ux%u", (unsigned int) width, (unsigned int) length); addKeyword(&prev, @@ -182,17 +182,17 @@ struct EXTRACTOR_Keywords * libextractor_tiff_extract(char * filename, EXTRACTOR_SIZE); free(tmp); } - break; + break; case TAG_WIDTH: if ( (entry.type == TYPE_SHORT) && - (byteOrder == 1) ) + (byteOrder == 1) ) width = entry.value_or_offset >> 16; else width = entry.value_or_offset; if (length != -1) { char * tmp; tmp = malloc(128); - sprintf(tmp, "%ux%u", + sprintf(tmp, "%ux%u", (unsigned int) width, (unsigned int) length); addKeyword(&prev, @@ -251,13 +251,13 @@ struct EXTRACTOR_Keywords * libextractor_tiff_extract(char * filename, break; } } - + off = current_ifd + 2 + DIRECTORY_ENTRY_SIZE * len; if (byteOrder == 0) current_ifd = data[off+3]<<24|data[off+2]<<16|data[off+1]<<8|data[off]; else current_ifd = data[off]<<24|data[off+1]<<16|data[off+2]<<8|data[off+3]; - } + } return prev; } diff --git a/src/plugins/wavextractor.c b/src/plugins/wavextractor.c @@ -21,8 +21,8 @@ (PD) 2004 The Bitzi Corporation http://bitzi.com/ (PD) 2001 The Bitzi Corporation - Please see file COPYING or http://bitzi.com/publicdomain - for more info. + Please see file COPYING or http://bitzi.com/publicdomain + for more info. */ @@ -35,7 +35,7 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, EXTRACTOR_KeywordType type) { EXTRACTOR_KeywordList * next; next = malloc(sizeof(EXTRACTOR_KeywordList)); - next->next = *list; + next->next = *list; next->keyword = keyword; next->keywordType = type; *list = next; @@ -44,14 +44,14 @@ static void addKeyword(struct EXTRACTOR_Keywords ** list, #if BIG_ENDIAN_HOST static short toLittleEndian16(short in) { char *ptr = (char *)&in; - - return ((ptr[1] & 0xFF) << 8) | (ptr[0] & 0xFF); + + return ((ptr[1] & 0xFF) << 8) | (ptr[0] & 0xFF); } static unsigned int toLittleEndian32(unsigned int in) { char *ptr = (char *)&in; - - return ((ptr[3] & 0xFF) << 24) | ((ptr[2] & 0xFF) << 16) | ((ptr[1] & 0xFF) << 8) | (ptr[0] & 0xFF); + + return ((ptr[3] & 0xFF) << 24) | ((ptr[2] & 0xFF) << 16) | ((ptr[1] & 0xFF) << 8) | (ptr[0] & 0xFF); } #endif @@ -74,20 +74,20 @@ struct EXTRACTOR_Keywords * libextractor_wav_extract(char * filename, int bytesProcessed; char * scratch; - + if ( (bufLen < 44) || - (buf[0] != 'R' || buf[1] != 'I' || + (buf[0] != 'R' || buf[1] != 'I' || buf[2] != 'F' || buf[3] != 'F' || - buf[8] != 'W' || buf[9] != 'A' || + buf[8] != 'W' || buf[9] != 'A' || buf[10] != 'V' || buf[11] != 'E' || - buf[12] != 'f' || buf[13] != 'm' || + buf[12] != 'f' || buf[13] != 'm' || buf[14] != 't' || buf[15] != ' ') ) return prev; /* not a WAV file */ - - channels = *((unsigned short *)&buf[22]); - sampleRate = *((unsigned int *)&buf[24]); - sampleSize = *((unsigned short *)&buf[34]); - dataLen = *((unsigned int *)&buf[40]); + + channels = *((unsigned short *)&buf[22]); + sampleRate = *((unsigned int *)&buf[24]); + sampleSize = *((unsigned short *)&buf[34]); + dataLen = *((unsigned int *)&buf[40]); #if BIG_ENDIAN_HOST channels = toLittleEndian16(channels); @@ -96,17 +96,17 @@ struct EXTRACTOR_Keywords * libextractor_wav_extract(char * filename, dataLen = toLittleEndian32(dataLen); #endif - if (sampleSize != 8 && sampleSize != 16) + if (sampleSize != 8 && sampleSize != 16) return prev; /* invalid sample size found in wav file */ if (channels == 0) return prev; /* invalid channels value -- avoid division by 0! */ samples = dataLen / (channels * (sampleSize >> 3)); - + scratch = malloc(256); snprintf(scratch, 256, "%u ms, %d Hz, %s", - (samples < sampleRate) + (samples < sampleRate) ? (samples * 1000 / sampleRate) : (samples / sampleRate) * 1000, sampleRate, diff --git a/src/test/keywordlisttest.c b/src/test/keywordlisttest.c @@ -1,4 +1,4 @@ -/** +/** * @file test/keywordlisttest.c * @brief testcase for libextractor keyword list manipulation * @author Christian Grothoff @@ -27,7 +27,7 @@ int main(int argc, char * argv[]){ }; EXTRACTOR_KeywordList * head; EXTRACTOR_KeywordList * pos; - + head = NULL; i = 0; while (keywords[i] != NULL) { diff --git a/src/test/multiload.c b/src/test/multiload.c @@ -1,4 +1,4 @@ -/** +/** * @file test/multiload.c * @brief testcase for libextractor plugin loading that loads the same * plugins multiple times! diff --git a/src/test/plugintest.c b/src/test/plugintest.c @@ -1,4 +1,4 @@ -/** +/** * @file test/plugintest.c * @brief testcase for dynamic loading and unloading of plugins */ @@ -68,9 +68,9 @@ int main(int argc, char * argv[]){ while (list1 != NULL) { if ( (strcmp(list1->keyword, "resolv") == 0) || (strcmp(list1->keyword, "conf") == 0) || - (strcmp(list1->keyword, "resolv.conf") == 0) ) + (strcmp(list1->keyword, "resolv.conf") == 0) ) i++; - list1 = list1->next; + list1 = list1->next; } if (i != 3) { printf("Wrong keyword extracted.\n"); @@ -78,7 +78,7 @@ int main(int argc, char * argv[]){ list); return -1; } - + EXTRACTOR_removeAll(arg); EXTRACTOR_freeKeywords(list); diff --git a/src/test/trivialtest.c b/src/test/trivialtest.c @@ -1,4 +1,4 @@ -/** +/** * @file test/trivialtest.c * @brief trivial testcase for libextractor plugin loading * @author Christian Grothoff