Mercurial > audlegacy
changeset 700:99382cddf771 trunk
[svn] Fixes for all warnings (except 3 spurious GCC 4.0 ones, upgrade to 4.1 if you see them) and a performance increase. By external contributor Diego "FlameEyes" Petteno (Gentoo).
author | chainsaw |
---|---|
date | Sun, 26 Feb 2006 10:21:49 -0800 |
parents | 63ce2be16d4f |
children | d539e5c5f730 |
files | Plugins/General/scrobbler/configure.c Plugins/General/scrobbler/queue.c Plugins/General/scrobbler/scrobbler.c Plugins/General/scrobbler/tags/Makefile.in Plugins/General/scrobbler/tags/ape.c Plugins/General/scrobbler/tags/cdaudio.c Plugins/General/scrobbler/tags/id3v1.c Plugins/General/scrobbler/tags/id3v2.c Plugins/General/scrobbler/tags/itunes.c Plugins/General/scrobbler/tags/tags.c Plugins/General/scrobbler/tags/unicode.c Plugins/General/scrobbler/tags/vorbis.c Plugins/General/scrobbler/tags/wma.c Plugins/General/scrobbler/xmms_scrobbler.c |
diffstat | 14 files changed, 163 insertions(+), 164 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/General/scrobbler/configure.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/configure.c Sun Feb 26 10:21:49 2006 -0800 @@ -47,7 +47,7 @@ return buf; } -static void saveconfig(GtkWidget *wid, gpointer data) +static void saveconfig(GtkWidget *wid __attribute__((unused)), gpointer data) { ConfigDb *cfgfile; @@ -67,7 +67,7 @@ md5_append(&md5state, (unsigned const char *)pwd, strlen(pwd)); md5_finish(&md5state, md5pword); bmp_cfg_db_set_string(cfgfile, "audioscrobbler", "password", - (char *)hexify(md5pword, sizeof(md5pword))); + hexify((char*)md5pword, sizeof(md5pword))); } bmp_cfg_db_close(cfgfile); } @@ -75,7 +75,7 @@ gtk_widget_destroy(GTK_WIDGET(data)); } -static void closewin(GtkWidget *wid, gpointer data) +static void closewin(GtkWidget *wid __attribute__((unused)), gpointer data) { gtk_widget_destroy(GTK_WIDGET(data)); }
--- a/Plugins/General/scrobbler/queue.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/queue.c Sun Feb 26 10:21:49 2006 -0800 @@ -27,18 +27,18 @@ item_t *item; item = malloc(sizeof(item_t)); - item->artist = fmt_escape(meta->artist); - item->title = fmt_escape(meta->title); + item->artist = fmt_escape((char*)meta->artist); + item->title = fmt_escape((char*)meta->title); item->utctime = fmt_escape(fmt_timestr(time(NULL), 1)); snprintf(item->len, sizeof(item->len), "%d", len); if(meta->mb == NULL) item->mb = fmt_escape(""); else - item->mb = fmt_escape(meta->mb); + item->mb = fmt_escape((char*)meta->mb); if(meta->album == NULL) item->album = fmt_escape(""); else - item->album = fmt_escape(meta->album); + item->album = fmt_escape((char*)meta->album); q_nitems++;
--- a/Plugins/General/scrobbler/scrobbler.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/scrobbler.c Sun Feb 26 10:21:49 2006 -0800 @@ -78,7 +78,7 @@ static size_t sc_store_res(void *ptr, size_t size, size_t nmemb, - void *stream) + void *stream __attribute__((unused))) { int len = size * nmemb; @@ -274,7 +274,7 @@ md5_append(&md5state, (unsigned const char *)sc_challenge_hash, strlen(sc_challenge_hash)); md5_finish(&md5state, md5pword); - hexify(md5pword, sizeof(md5pword)); + hexify((char*)md5pword, sizeof(md5pword)); /*pdebug(fmt_vastr("Response Hash: %s", sc_response_hash), DEBUG);*/ }
--- a/Plugins/General/scrobbler/tags/Makefile.in Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/Makefile.in Sun Feb 26 10:21:49 2006 -0800 @@ -8,6 +8,6 @@ SOURCES = ape.c cdaudio.c id3genres.c id3v1.c id3v2.c itunes.c tags.c \ unicode.c vorbis.c wma.c -CFLAGS += -fPIC -DPIC $(GTK_CFLAGS) $(MUSICBRAINZ_CFLAGS) -I../../../../intl -I../../../.. +CFLAGS += -Wno-unused -fPIC -DPIC $(GTK_CFLAGS) $(MUSICBRAINZ_CFLAGS) -I../../../../intl -I../../../.. OBJECTS = ${SOURCES:.c=.o}
--- a/Plugins/General/scrobbler/tags/ape.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/ape.c Sun Feb 26 10:21:49 2006 -0800 @@ -33,7 +33,8 @@ { ape_t *ape = calloc(sizeof(ape_t), 1); unsigned char *tag_buffer = NULL, *bp, cToInt[4]; - int size, start, i; + int size, start; + unsigned int i; ape->version = version; @@ -63,16 +64,15 @@ ape->items = realloc(ape->items, (ape->numitems) * sizeof(apefielddata_t *)); - for(i = 0; i < ape->numitems && strncmp(bp, "APETAGEX", 8) != 0; i++) + for(i = 0; i < ape->numitems && strncmp((char*)bp, "APETAGEX", 8) != 0; i++) { apefielddata_t *field = calloc(sizeof(apefielddata_t), 1); memcpy(cToInt, bp, 4); bp += 8; field->len = le2int(cToInt); - field->name = malloc(strlen(bp) + 1); - strcpy(field->name, bp); - bp += strlen(bp) + 1; + field->name = (unsigned char*)strdup((char*)bp); + bp += strlen((char*)bp) + 1; field->data = malloc(field->len + 1); memcpy(field->data, bp, field->len); *(field->data + field->len) = '\0'; @@ -80,7 +80,7 @@ ape->items[i] = field; } - if(i < ape->numitems && strncmp(bp, "APETAGEX", 8) == 0) + if(i < ape->numitems && strncmp((char*)bp, "APETAGEX", 8) == 0) { ape->numitems = i; ape->items = realloc(ape->items, @@ -107,7 +107,7 @@ for(i = 0; i < BUFFER_SIZE - 8 && status == 0; i++) { bp++; - if(!strncmp(bp, "APETAGEX", 8)) + if(!strncmp((char*)bp, "APETAGEX", 8)) status = 1; } if(status == 1 || feof(fp)) @@ -171,7 +171,7 @@ void freeAPE(ape_t *ape) { - int i; + unsigned int i; for(i = 0; i < ape->numitems; i++) {
--- a/Plugins/General/scrobbler/tags/cdaudio.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/cdaudio.c Sun Feb 26 10:21:49 2006 -0800 @@ -98,8 +98,7 @@ } else { - musicbrainz->album = malloc(strlen(tmp) + 1); - strcpy(musicbrainz->album, tmp); + musicbrainz->album = (unsigned char*)strdup(tmp); } memset(tmp, '\0', BUFFER_SIZE / 4 + 1); retVal = mb_GetResultData1(mb, MBE_AlbumGetArtistName, tmp, BUFFER_SIZE / 4, track); @@ -110,8 +109,7 @@ } else { - musicbrainz->artist = malloc(strlen(tmp) + 1); - strcpy(musicbrainz->artist, tmp); + musicbrainz->artist = (unsigned char*)strdup(tmp); } memset(tmp, '\0', BUFFER_SIZE / 4 + 1); retVal = mb_GetResultData1(mb, MBE_AlbumGetTrackName, tmp, BUFFER_SIZE / 4, track); @@ -122,8 +120,7 @@ } else { - musicbrainz->title = malloc(strlen(tmp) + 1); - strcpy(musicbrainz->title, tmp); + musicbrainz->title = (unsigned char*)strdup(tmp); } memset(tmp, '\0', BUFFER_SIZE / 4 + 1); retVal = mb_GetResultData1(mb, MBE_AlbumGetTrackId, tmp, BUFFER_SIZE / 4, track); @@ -135,7 +132,7 @@ else { musicbrainz->mbid = malloc(64); - mb_GetIDFromURL(mb, tmp, musicbrainz->mbid, 64); + mb_GetIDFromURL(mb, tmp, (char*)musicbrainz->mbid, 64); } mb_Delete(mb); free(tmp);
--- a/Plugins/General/scrobbler/tags/id3v1.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/id3v1.c Sun Feb 26 10:21:49 2006 -0800 @@ -21,7 +21,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "include/bmp_vfs.h" +#include <libaudacious/vfs.h> #include "include/id3v1.h" #include "include/endian.h" #include "../fmt.h" @@ -90,28 +90,28 @@ vfs_fread(data, 1, 30, fp); cleanID3v1(data, 30); // id3v1->title = realloc(id3v1->title, 31); - if(strcmp(data, "")) - iso88591_to_utf8(data, strlen(data), &id3v1->title); + if(data && *data) + iso88591_to_utf8(data, strlen((char*)data), &id3v1->title); else id3v1->title = NULL; vfs_fread(data, 1, 30, fp); cleanID3v1(data, 30); - if(strcmp(data, "")) - iso88591_to_utf8(data, strlen(data), &id3v1->artist); + if(data && *data) + iso88591_to_utf8(data, strlen((char*)data), &id3v1->artist); else id3v1->artist = NULL; vfs_fread(data, 1, 30, fp); cleanID3v1(data, 30); - if(strcmp(data, "")) - iso88591_to_utf8(data, strlen(data), &id3v1->album); + if(data && *data) + iso88591_to_utf8(data, strlen((char*)data), &id3v1->album); else id3v1->album = NULL; data = realloc(data, 5); *(data + 4) = '\0'; vfs_fread(data, 1, 4, fp); cleanID3v1(data, 4); - if(strcmp(data, "")) - iso88591_to_utf8(data, strlen(data), &id3v1->year); + if(data && *data) + iso88591_to_utf8(data, strlen((char*)data), &id3v1->year); else id3v1->year = NULL; data = realloc(data, 31);
--- a/Plugins/General/scrobbler/tags/id3v2.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/id3v2.c Sun Feb 26 10:21:49 2006 -0800 @@ -136,11 +136,11 @@ sync = malloc(sizeof(resync_t)); - sync->check = syncCheck; + sync->check = (unsigned char*)syncCheck; sync->count = 0; if(size == 0) - size = strlen(sync->check); + size = strlen((char*)sync->check); for(i = 0; i < size; i++) { @@ -273,11 +273,11 @@ frameid[3] = 0; memcpy(frameid, *bp, 3); *bp += 3; - frameidcode = id3_lookupframe(frameid, ID3v22); + frameidcode = id3_lookupframe((char*)frameid, ID3v22); memcpy(cToInt, *bp, 3); cToInt[3] = 0; if(id3_data->unsync) - unsync(cToInt, *bp); + unsync((char*)cToInt, *bp); framesize = be24int(cToInt); *bp += 3; break; @@ -287,10 +287,10 @@ frameid[4] = 0; memcpy(frameid, *bp, 4); *bp += 4; - frameidcode = id3_lookupframe(frameid, ID3v23); + frameidcode = id3_lookupframe((char*)frameid, ID3v23); memcpy(cToInt, *bp, 4); if(id3_data->unsync) - unsync(cToInt, *bp); + unsync((char*)cToInt, *bp); framesize = be2int(cToInt); *bp += 4; @@ -303,7 +303,7 @@ frameid[4] = 0; memcpy(frameid, *bp, 4); *bp += 4; - frameidcode = id3_lookupframe(frameid, ID3v24); + frameidcode = id3_lookupframe((char*)frameid, ID3v24); memcpy(cToInt, *bp, 4); framesize = synchsafe2int(cToInt); *bp += 4; @@ -383,8 +383,8 @@ *bp += framesize; /* Parse text appropriately to UTF-8. */ - if(frameid[0] == 'T' && strcmp(frameid, "TXXX") && - strcmp(frameid, "TXX")) + if(frameid[0] == 'T' && strcmp((char*)frameid, "TXXX") && + strcmp((char*)frameid, "TXX")) { unsigned char *ptr, *data = NULL, *utf = NULL; int encoding; @@ -394,7 +394,7 @@ if(framedata->len == 0) { framedata->data = realloc(framedata->data, 1); - strcpy(framedata->data, "\0"); + framedata->data[0] = '\0'; return framedata; } @@ -404,7 +404,7 @@ memcpy(data, ptr, framedata->len - 1); if((framedata->flags[1] & 0x02) == 0x02) { - resync_t *unsync = checkunsync(data, framedata->len); + resync_t *unsync = checkunsync((char*)data, framedata->len); framedata->len -= unsync->count; free(unsync); } @@ -429,11 +429,11 @@ else if(encoding == 0x03) { utf = realloc(utf, framedata->len); - strcpy(utf, data); + strcpy((char*)utf, (char*)data); } - framedata->len = strlen(utf) + 1; + framedata->len = strlen((char*)utf) + 1; framedata->data = realloc(framedata->data, framedata->len); - strcpy(framedata->data, utf); + strcpy((char*)framedata->data, (char*)utf); framedata->data[framedata->len - 1] = '\0'; free(utf); free(data); @@ -450,7 +450,7 @@ memcpy(data, ptr, framedata->len); if((framedata->flags[1] & 0x02) == 0x02) { - resync_t *unsync = checkunsync(data, framedata->len); + resync_t *unsync = checkunsync((char*)data, framedata->len); framedata->len -= unsync->count; free(unsync); } @@ -558,8 +558,8 @@ { if(search == -1) { - if((strncmp(bp, "ID3", 3) == 0 || - strncmp(bp, "3DI", 3) == 0)) + if((strncmp((char*)bp, "ID3", 3) == 0 || + strncmp((char*)bp, "3DI", 3) == 0)) status = 1; else { @@ -574,8 +574,8 @@ { bp = tag_buffer; pos = vfs_ftell(fp); - if((strncmp(bp, "ID3", 3) == 0 || - strncmp(bp, "3DI", 3) == 0)) status = 1; + if((strncmp((char*)bp, "ID3", 3) == 0 || + strncmp((char*)bp, "3DI", 3) == 0)) status = 1; search = 1; } if(status != 1) @@ -590,8 +590,8 @@ i++) { bp++; - if((strncmp(bp, "ID3", 3) == 0 || - strncmp(bp, "3DI", 3) == 0)) + if((strncmp((char*)bp, "ID3", 3) == 0 || + strncmp((char*)bp, "3DI", 3) == 0)) status = 1; } if(status == 1)
--- a/Plugins/General/scrobbler/tags/itunes.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/itunes.c Sun Feb 26 10:21:49 2006 -0800 @@ -91,7 +91,7 @@ bp += 16; *tag_data = realloc(*tag_data, meta_size + 1); *(*tag_data + meta_size) = '\0'; - strncpy(*tag_data, bp, meta_size); + strncpy((char*)*tag_data, (char*)bp, meta_size); bp += meta_size; } /* @@ -172,7 +172,7 @@ atom_size = be2int(cToInt) - 4; tag_buffer = malloc(8); vfs_fread(tag_buffer, 1, 8, fp); - if(strncmp(tag_buffer, "ftypM4A ", 8)) + if(strncmp((char*)tag_buffer, "ftypM4A ", 8)) { free(tag_buffer); return -1; @@ -188,7 +188,7 @@ tag_buffer = realloc(tag_buffer, atom_size); pos = ftell(fp); vfs_fread(tag_buffer, 1, atom_size, fp); - if(!strncmp(tag_buffer, "moov", 4)) + if(!strncmp((char*)tag_buffer, "moov", 4)) break; } if(feof(fp)) @@ -204,11 +204,11 @@ memcpy(cToInt, bp, 4); atom_size = be2int(cToInt) - 4; bp += 4; - if(!strncmp(bp, "udta", 4)) + if(!strncmp((char*)bp, "udta", 4)) break; bp += atom_size; } - if(strncmp(bp, "udta", 4)) + if(strncmp((char*)bp, "udta", 4)) { free(tag_buffer); return -1; @@ -222,11 +222,11 @@ memcpy(cToInt, bp, 4); atom_size = be2int(cToInt) - 4; bp += 4; - if(!strncmp(bp, "meta", 4)) + if(!strncmp((char*)bp, "meta", 4)) break; bp += atom_size; } - if(strncmp(bp, "meta", 4)) + if(strncmp((char*)bp, "meta", 4)) { free(tag_buffer); return -1; @@ -240,11 +240,11 @@ memcpy(cToInt, bp, 4); atom_size = be2int(cToInt) - 4; bp += 4; - if(!strncmp(bp, "ilst", 4)) + if(!strncmp((char*)bp, "ilst", 4)) break; bp += atom_size; } - if(strncmp(bp, "ilst", 4)) + if(strncmp((char*)bp, "ilst", 4)) { free(tag_buffer); return -1;
--- a/Plugins/General/scrobbler/tags/tags.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/tags.c Sun Feb 26 10:21:49 2006 -0800 @@ -159,14 +159,14 @@ pdebug("Reading metadata into structs...", META_DEBUG); meta->artist = meta->cdaudio->artist; meta->title = meta->cdaudio->title; - meta->mb = realloc(meta->mb, strlen(meta->cdaudio->mbid) + 1); - strcpy(meta->mb, meta->cdaudio->mbid); + meta->mb = realloc(meta->mb, strlen((char*)meta->cdaudio->mbid) + 1); + strcpy((char*)meta->mb, (char*)meta->cdaudio->mbid); meta->album = meta->cdaudio->album; meta->year = NULL; meta->genre = NULL; /* Special track handling... Yay! */ meta->track = realloc(meta->track, 4); - tmp = snprintf(meta->track, 3, "%d", track); + tmp = snprintf((char*)meta->track, 3, "%d", track); *(meta->track + tmp) = '\0'; return; @@ -184,77 +184,79 @@ void metaAPE(metatag_t *meta) { - int i, t = 0; + unsigned int i; + int t = 0; + size_t s; ape_t *ape = meta->ape; for(i = 0; i < ape->numitems; i++) { apefielddata_t *item = ape->items[i]; - if(!strcmp(item->name, "Title")) + if(!strcmp((char*)item->name, "Title")) { pdebug("Found Title!", META_DEBUG); meta->title = item->data; } - else if(!strcmp(item->name, "Artist")) + else if(!strcmp((char*)item->name, "Artist")) { pdebug("Found Artist!", META_DEBUG); meta->artist = item->data; } - else if(strcmp(item->name, "Album") == 0) + else if(strcmp((char*)item->name, "Album") == 0) { pdebug("Found Album!", META_DEBUG); meta->album = item->data; } - else if(strcmp(item->name, "Year") == 0) + else if(strcmp((char*)item->name, "Year") == 0) { pdebug("Found Year!", META_DEBUG); meta->year = item->data; } - else if(strcmp(item->name, "Genre") == 0) + else if(strcmp((char*)item->name, "Genre") == 0) { pdebug("Found Genre!", META_DEBUG); - meta->genre = realloc(meta->genre, strlen(item->data) - + 1); - strcpy(meta->genre, item->data); + s = strlen((char*)item->data) + 1; + meta->genre = realloc(meta->genre, s); + memcpy(meta->genre, item->data, s); } - else if(strcmp(item->name, "Track") == 0) + else if(strcmp((char*)item->name, "Track") == 0) { pdebug("Found Track!", META_DEBUG); - meta->track = realloc(meta->track, strlen(item->data) - + 1); - strcpy(meta->track, item->data); + s = strlen((char*)item->data) + 1; + meta->track = realloc(meta->genre, s); + memcpy(meta->track, item->data, s); } - else if(strcmp(item->name, "Comment") == 0) + else if(strcmp((char*)item->name, "Comment") == 0) { unsigned char *comment_value = NULL, *eq_pos, *sep_pos, *subvalue; subvalue = item->data; - sep_pos = strchr(subvalue, '|'); + sep_pos = (unsigned char*)strchr((char*)subvalue, '|'); while(sep_pos != NULL || t == 0) { t = 1; if(sep_pos != NULL) *sep_pos = '\0'; - comment_value = realloc(comment_value, - strlen(subvalue) + 1); - strcpy(comment_value, subvalue); + s = strlen((char*)subvalue) + 1; + comment_value = realloc(comment_value, s); + memcpy(comment_value, subvalue, s); if(sep_pos != NULL) sep_pos++; - eq_pos = strchr(comment_value, '='); + eq_pos = (unsigned char*)strchr((char*)comment_value, '='); if(eq_pos != NULL) { *eq_pos = '\0'; eq_pos++; - if(!strcmp(comment_value, + if(!strcmp((char*)comment_value, "musicbrainz_trackid")) { /* ??? */ pdebug("Found MusicBrainz Track ID!", META_DEBUG); - meta->mb = realloc(meta->mb, - strlen(eq_pos) + 1); - strcpy(meta->mb, eq_pos); + s = strlen((char*)eq_pos) + 1; + meta->mb = realloc(meta->mb, s); + memcpy(meta->mb, eq_pos, s); break; } } @@ -262,7 +264,7 @@ { t = 0; subvalue = sep_pos; - sep_pos = strchr(subvalue, '|'); + sep_pos = (unsigned char*)strchr((char*)subvalue, '|'); } } t = 0; @@ -305,8 +307,9 @@ void metaVorbis(metatag_t *meta) { - int i; + unsigned int i; vorbis_t *comments = NULL; + size_t s; /* I'm not expecting more than one vorbis tag */ if(meta->has_vorbis) @@ -323,56 +326,54 @@ for(i = 0; i < comments->numitems; i++) { vorbisfielddata_t *field = comments->items[i]; - if(!fmt_strcasecmp(field->name, "TITLE")) + if(!fmt_strcasecmp((char*)field->name, "TITLE")) { pdebug("Found Title!", META_DEBUG); meta->title = field->data; } /* Prefer PERFORMER to ARTIST */ - else if(!fmt_strcasecmp(field->name, "PERFORMER")) + else if(!fmt_strcasecmp((char*)field->name, "PERFORMER")) { pdebug("Found Artist!", META_DEBUG); meta->artist = field->data; } - else if(!fmt_strcasecmp(field->name, "ARTIST") && meta->artist == NULL) + else if(!fmt_strcasecmp((char*)field->name, "ARTIST") && meta->artist == NULL) { pdebug("Found Artist!", META_DEBUG); meta->artist = field->data; } - else if(!fmt_strcasecmp(field->name, "ALBUM")) + else if(!fmt_strcasecmp((char*)field->name, "ALBUM")) { pdebug("Found Album!", META_DEBUG); meta->album = field->data; } - else if(!fmt_strcasecmp(field->name, "MUSICBRAINZ_TRACKID")) + else if(!fmt_strcasecmp((char*)field->name, "MUSICBRAINZ_TRACKID")) { pdebug("Found MusicBrainz Track ID!", META_DEBUG); - - meta->mb = realloc(meta->mb, strlen(field->data) + 1); - memset(meta->mb, '\0', strlen(field->data) + 1); - memcpy(meta->mb, field->data, strlen(field->data)); + + s = strlen((char*)field->data) + 1; + meta->mb = realloc(meta->mb, s); + memcpy(meta->mb, field->data, s); } - else if(!fmt_strcasecmp(field->name, "GENRE")) + else if(!fmt_strcasecmp((char*)field->name, "GENRE")) { pdebug("Found Genre!", META_DEBUG); - - meta->genre = realloc(meta->genre, strlen(field->data) - + 1); - memset(meta->genre, '\0', strlen(field->data) + 1); - memcpy(meta->genre, field->data, strlen(field->data)); + + s = strlen((char*)field->data) + 1; + meta->genre = realloc(meta->genre, s); + memcpy(meta->genre, field->data, s); } - else if(!fmt_strcasecmp(field->name, "TRACKNUMBER")) + else if(!fmt_strcasecmp((char*)field->name, "TRACKNUMBER")) { pdebug("Found Track!", META_DEBUG); - meta->track = realloc(meta->track, strlen(field->data) - + 1); - memset(meta->track, '\0', strlen(field->data) + 1); - memcpy(meta->track, field->data, strlen(field->data)); + s = strlen((char*)field->data) + 1; + meta->track = realloc(meta->track, s); + memcpy(meta->track, field->data, s); } } @@ -459,7 +460,7 @@ { data = frame->data; - if(!strcmp(data, "http://musicbrainz.org")) + if(!strcmp((char*)data, "http://musicbrainz.org")) { pdebug("Found MusicBrainz Track ID!", META_DEBUG); @@ -512,7 +513,7 @@ pdebug("Found Track!", META_DEBUG); meta->track = realloc(meta->track, 4); - tmp = snprintf(meta->track, 3, "%d", itunes->track); + tmp = snprintf((char*)meta->track, 3, "%d", itunes->track); *(meta->track + tmp) = '\0'; } if(itunes->year != NULL) @@ -536,50 +537,51 @@ void metaWMA(metatag_t *meta) { wma_t *wma = meta->wma; - int i, tmp; + unsigned int i; + int tmp; for(i = 0; i < wma->numitems; i++) { attribute_t *attribute = wma->items[i]; - if(!strcmp(attribute->name, "Title")) + if(!strcmp((char*)attribute->name, "Title")) { pdebug("Found Title!", META_DEBUG); meta->title = attribute->data; } - else if(!strcmp(attribute->name, "Author")) + else if(!strcmp((char*)attribute->name, "Author")) { pdebug("Found Artist!", META_DEBUG); meta->artist = attribute->data; } - else if(!strcmp(attribute->name, "WM/AlbumTitle")) + else if(!strcmp((char*)attribute->name, "WM/AlbumTitle")) { pdebug("Found Album!", META_DEBUG); meta->album = attribute->data; } - else if(!strcmp(attribute->name, "WM/Year")) + else if(!strcmp((char*)attribute->name, "WM/Year")) { pdebug("Found Year!", META_DEBUG); meta->year = attribute->data; } - else if(!strcmp(attribute->name, "WM/Genre")) + else if(!strcmp((char*)attribute->name, "WM/Genre")) { pdebug("Found Genre!", META_DEBUG); - meta->genre = realloc(meta->genre, - strlen(attribute->data) + 1); - strcpy(meta->genre, attribute->data); + size_t s = strlen((char*)attribute->data) + 1; + meta->genre = realloc(meta->genre, s); + memcpy(meta->genre, attribute->data, s); } - else if(!strcmp(attribute->name, "WM/TrackNumber")) + else if(!strcmp((char*)attribute->name, "WM/TrackNumber")) { pdebug("Found Track!", META_DEBUG); meta->track = realloc(meta->track, 4); - tmp = snprintf(meta->track, 3, "%d", + tmp = snprintf((char*)meta->track, 3, "%d", le2int(attribute->data)); *(meta->track + tmp) = '\0'; } @@ -630,7 +632,7 @@ pdebug("Found Track!", META_DEBUG); meta->track = realloc(meta->track, 4); - tmp = snprintf(meta->track, 3, "%d", id3v1->track); + tmp = snprintf((char*)meta->track, 3, "%d", id3v1->track); *(meta->track + tmp) = '\0'; } /* I assume unassigned genre's are 255 */ @@ -638,10 +640,10 @@ / sizeof(char *)) { pdebug("Found Genre!", META_DEBUG); - - meta->genre = realloc(meta->genre, - strlen(genre_list[id3v1->genre]) + 1); - strcpy(meta->genre, genre_list[id3v1->genre]); + + size_t s = strlen(genre_list[id3v1->genre]) + 1; + meta->genre = realloc(meta->genre, s); + memcpy(meta->genre, genre_list[id3v1->genre], s); } /* * This next one is unofficial, but maybe someone will use it. @@ -662,12 +664,12 @@ * "MBID: \156%g\203J\139@\150\177\005\218\218k\149\160\139" * in ASCII (with three digit decimal escape characters) */ - if(!strncmp((id3v1->comment) + 1, "MBTRACKID=", 10)) + if(!strncmp((char*)((id3v1->comment) + 1), "MBTRACKID=", 10)) { pdebug("Found MusicBrainz Track ID!", META_DEBUG); meta->mb = realloc(meta->mb, 37); - tmp = sprintf(meta->mb, + tmp = sprintf((char*)meta->mb, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", id3v1->comment[11], id3v1->comment[12],
--- a/Plugins/General/scrobbler/tags/unicode.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/unicode.c Sun Feb 26 10:21:49 2006 -0800 @@ -26,7 +26,8 @@ wchar_t *utf8_to_wchar(unsigned char *utf, size_t memsize) { - int i, j = 0; + size_t i; + int j = 0; wchar_t *mem; mem = calloc(sizeof(wchar_t) * (memsize + 1), 1); @@ -84,7 +85,7 @@ unsigned char *wchar_to_utf8(wchar_t *wchar, size_t memsize) { - int i; + size_t i; unsigned char *mem, *ptr; mem = calloc(memsize * 6 + 1, 1); @@ -122,7 +123,7 @@ *ptr++ = 0x80 | ((wchar[i] >> 6) & 0x3F); *ptr++ = 0x80 | (wchar[i] & 0x3F); } - else if(wchar[i] < 0x80000000) + else if((unsigned long)wchar[i] < 0x80000000) { *ptr++ = 0xFC | ((wchar[i] >> 30) & 0x01); *ptr++ = 0x80 | ((wchar[i] >> 24) & 0x3F); @@ -141,7 +142,7 @@ void iso88591_to_utf8(unsigned char *iso, size_t memsize, unsigned char **utf) { - int i; + size_t i; wchar_t *wchar; wchar = calloc(sizeof(wchar_t) * (memsize + 1), 1); @@ -155,7 +156,8 @@ { wchar_t *wchar; unsigned char utf16char[2]; - int endian = 0, i; + int endian = 0; + size_t i; wchar = calloc(sizeof(wchar_t) * memsize / 2 - 1, 1); for(i = 0; i < memsize; i += 2) @@ -182,7 +184,7 @@ { wchar_t *wchar; unsigned char utf16char[2]; - int i; + size_t i; wchar = calloc(sizeof(wchar_t) * (memsize / 2), 1); for(i = 0; i < memsize; i += 2) @@ -200,7 +202,7 @@ { wchar_t *wchar; unsigned char utf16char[2]; - int i; + size_t i; wchar = calloc(sizeof(wchar_t) * (memsize / 2), 1); for(i = 0; i < memsize; i += 2)
--- a/Plugins/General/scrobbler/tags/vorbis.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/vorbis.c Sun Feb 26 10:21:49 2006 -0800 @@ -46,6 +46,7 @@ for(i = 0; i < lines; i++) { unsigned char *data, *dp; + size_t datalen; vorbisfielddata_t *fielddata = calloc(sizeof(vorbisfielddata_t), 1); @@ -53,7 +54,7 @@ fielddata->len = le2int(cToInt); data = malloc(fielddata->len); vfs_fread(data, 1, fielddata->len, fp); - dp = strchr(data, '='); + dp = (unsigned char*)strchr((char*)data, '='); if(dp == NULL) { pdebug("No '=' in comment!", META_DEBUG); @@ -63,11 +64,12 @@ } *dp = '\0'; dp++; - fielddata->name = malloc(strlen(data) + 1); - fielddata->data = malloc(fielddata->len - strlen(data)); - *(fielddata->data + fielddata->len - strlen(data) - 1) = '\0'; - strcpy(fielddata->name, data); - strncpy(fielddata->data, dp, fielddata->len - strlen(data) - 1); + datalen = strlen((char*)data); + fielddata->name = malloc(datalen + 1); + fielddata->data = malloc(fielddata->len - datalen); + *(fielddata->data + fielddata->len - datalen - 1) = '\0'; + strcpy((char*)fielddata->name, (char*)data); + strncpy((char*)fielddata->data, (char*)dp, fielddata->len - datalen - 1); comments->items[j++] = fielddata; @@ -104,7 +106,7 @@ bp = tag_buffer; for(i = 0; i < segments && status == 0;) { - if(strncmp(bp + 1, "vorbis", 6) == 0) + if(strncmp((char*)(bp + 1), "vorbis", 6) == 0) { vorbis_type = *bp; if(vorbis_type == 0x03) @@ -141,7 +143,7 @@ int pos; vfs_fread(tag_id, 1, 4, fp); - if(strcmp(tag_id, "fLaC")) + if(strcmp((char*)tag_id, "fLaC")) return 0; while(1) { @@ -173,7 +175,7 @@ tag_buffer = malloc(28); vfs_fread(tag_buffer, 1, 28, fp); bp = tag_buffer + 24; - if(strncmp(bp, "fLaC", 4)) + if(strncmp((char*)bp, "fLaC", 4)) { free(tag_buffer); return -1; @@ -248,7 +250,7 @@ tag_buffer = realloc(tag_buffer, pagelen); vfs_fread(tag_buffer, 1, pagelen, fp); bp = tag_buffer; - if(strncmp(bp, "Speex ", 8)) + if(strncmp((char*)bp, "Speex ", 8)) { free(lacing); free(tag_buffer); @@ -396,7 +398,7 @@ void freeVorbis(vorbis_t *comments) { - int i; + unsigned int i; for(i = 0; i < comments->numitems; i++) {
--- a/Plugins/General/scrobbler/tags/wma.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/tags/wma.c Sun Feb 26 10:21:49 2006 -0800 @@ -53,7 +53,8 @@ attribute_t *attribute; unsigned char *tag_buffer = NULL, *bp, cToInt[8], *data = NULL; int title_size, author_size, copyright_size, desc_size, rating_size, - size, primary_items, i; + size, primary_items; + unsigned int i; vfs_fseek(fp, pos, SEEK_SET); vfs_fread(cToInt, 1, 8, fp); @@ -77,8 +78,7 @@ attribute = calloc(sizeof(attribute_t), 1); wma->items = realloc(wma->items, (wma->numitems + 1) * sizeof(attribute_t *)); - attribute->name = malloc(6); - strcpy(attribute->name, "Title"); + attribute->name = (unsigned char*)strdup("Title"); data = malloc(title_size); memcpy(data, bp, title_size); bp += title_size; @@ -92,8 +92,7 @@ attribute = calloc(sizeof(attribute_t), 1); wma->items = realloc(wma->items, (wma->numitems + 1) * sizeof(attribute_t *)); - attribute->name = malloc(7); - strcpy(attribute->name, "Author"); + attribute->name = (unsigned char*)strdup("Author"); data = malloc(author_size); memcpy(data, bp, author_size); bp += author_size; @@ -107,8 +106,7 @@ attribute = calloc(sizeof(attribute_t), 1); wma->items = realloc(wma->items, (wma->numitems + 1) * sizeof(attribute_t *)); - attribute->name = malloc(10); - strcpy(attribute->name, "Copyright"); + attribute->name = (unsigned char*)strdup("Copyright"); data = malloc(copyright_size); memcpy(data, bp, copyright_size); bp += copyright_size; @@ -122,8 +120,7 @@ attribute = calloc(sizeof(attribute_t), 1); wma->items = realloc(wma->items, (wma->numitems + 1) * sizeof(attribute_t *)); - attribute->name = malloc(12); - strcpy(attribute->name, "Description"); + attribute->name = (unsigned char*)strdup("Description"); data = malloc(desc_size); memcpy(data, bp, desc_size); bp += desc_size; @@ -137,8 +134,7 @@ attribute = calloc(sizeof(attribute_t), 1); wma->items = realloc(wma->items, (wma->numitems + 1) * sizeof(attribute_t *)); - attribute->name = malloc(7); - strcpy(attribute->name, "Rating"); + attribute->name = (unsigned char*)strdup("Rating"); data = malloc(rating_size); memcpy(data, bp, rating_size); bp += rating_size; @@ -289,7 +285,7 @@ void freeWMA(wma_t *wma) { - int i; + unsigned int i; for(i = 0; i < wma->numitems; i++) {
--- a/Plugins/General/scrobbler/xmms_scrobbler.c Sun Feb 26 01:09:12 2006 -0800 +++ b/Plugins/General/scrobbler/xmms_scrobbler.c Sun Feb 26 10:21:49 2006 -0800 @@ -341,7 +341,7 @@ return dosubmit; } -static void *xs_thread(void *data) +static void *xs_thread(void *data __attribute__((unused))) { int run = 1, i; char *charpos, *dirname; @@ -457,7 +457,7 @@ return NULL; } -static void *hs_thread(void *data) +static void *hs_thread(void *data __attribute__((unused))) { int run = 1;