From e2d835fbcebd1df3011c8107690a6a936c639779 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Mon, 30 May 2005 03:41:31 +0000 Subject: [PATCH] -Wall cleanups for gcc4 --- src/db-generic.c | 15 ++++----- src/db-generic.h | 12 ++++---- src/dbs-sqlite.c | 4 +-- src/dispatch.c | 77 +++++++++++++++++++++++------------------------ src/dynamic-art.c | 12 ++++---- src/mp3-scanner.c | 37 ++++++++++++----------- src/mp3-scanner.h | 10 +++--- src/scan-flac.c | 4 +-- src/scan-wma.c | 46 ++++++++++++++++------------ src/uici.c | 2 +- src/webserver.c | 4 +-- 11 files changed, 116 insertions(+), 107 deletions(-) diff --git a/src/db-generic.c b/src/db-generic.c index 1840790c..671ab474 100644 --- a/src/db-generic.c +++ b/src/db-generic.c @@ -723,7 +723,7 @@ int db_get_playlist_count() { * \tag what four byte tag * \value what character value */ -int db_dmap_add_char(char *where, char *tag, char value) { +int db_dmap_add_char(unsigned char *where, char *tag, char value) { /* tag */ memcpy(where,tag,4); @@ -743,7 +743,7 @@ int db_dmap_add_char(char *where, char *tag, char value) { * \tag what four byte tag * \value what character value */ -int db_dmap_add_short(char *where, char *tag, short value) { +int db_dmap_add_short(unsigned char *where, char *tag, short value) { /* tag */ memcpy(where,tag,4); @@ -766,7 +766,7 @@ int db_dmap_add_short(char *where, char *tag, short value) { * \value what character value */ -int db_dmap_add_int(char *where, char *tag, int value) { +int db_dmap_add_int(unsigned char *where, char *tag, int value) { /* tag */ memcpy(where,tag,4); /* len */ @@ -790,7 +790,7 @@ int db_dmap_add_int(char *where, char *tag, int value) { * \value what character value */ -int db_dmap_add_string(char *where, char *tag, char *value) { +int db_dmap_add_string(unsigned char *where, char *tag, char *value) { int len=strlen(value); /* tag */ @@ -802,7 +802,7 @@ int db_dmap_add_string(char *where, char *tag, char *value) { where[6]=(len >> 8) & 0xFF; where[7]=len & 0xFF; - strncpy(where+8,value,strlen(value)); + strncpy((char*)where+8,value,strlen(value)); return 8 + strlen(value); } @@ -814,7 +814,8 @@ int db_dmap_add_string(char *where, char *tag, char *value) { * \param value what to put there * \param size how much data to cram in there */ -int db_dmap_add_literal(char *where, char *tag, char *value, int size) { +int db_dmap_add_literal(unsigned char *where, char *tag, + char *value, int size) { /* tag */ memcpy(where,tag,4); @@ -837,7 +838,7 @@ int db_dmap_add_literal(char *where, char *tag, char *value, int size) { * \value what character value */ -int db_dmap_add_container(char *where, char *tag, int size) { +int db_dmap_add_container(unsigned char *where, char *tag, int size) { int len=size; /* tag */ diff --git a/src/db-generic.h b/src/db-generic.h index a675d876..db88114c 100644 --- a/src/db-generic.h +++ b/src/db-generic.h @@ -171,12 +171,12 @@ extern MetaField_t db_encode_meta(char *meta); extern int db_wantsmeta(MetaField_t meta, MetaFieldName_t fieldNo); /* dmap helper functions */ -extern int db_dmap_add_char(char *where, char *tag, char value); -extern int db_dmap_add_short(char *where, char *tag, short value); -extern int db_dmap_add_int(char *where, char *tag, int value); -extern int db_dmap_add_string(char *where, char *tag, char *value); -extern int db_dmap_add_literal(char *where, char *tag, char *value, int size); -extern int db_dmap_add_container(char *where, char *tag, int size); +extern int db_dmap_add_char(unsigned char *where, char *tag, char value); +extern int db_dmap_add_short(unsigned char *where, char *tag, short value); +extern int db_dmap_add_int(unsigned char *where, char *tag, int value); +extern int db_dmap_add_string(unsigned char *where, char *tag, char *value); +extern int db_dmap_add_literal(unsigned char *where, char *tag, char *value, int size); +extern int db_dmap_add_container(unsigned char *where, char *tag, int size); /* Holdover functions from old db interface... * should these be removed? Refactored? diff --git a/src/dbs-sqlite.c b/src/dbs-sqlite.c index 0bc95540..7c216c46 100644 --- a/src/dbs-sqlite.c +++ b/src/dbs-sqlite.c @@ -53,7 +53,7 @@ static char db_path[PATH_MAX + 1]; /* Forwards */ int db_sqlite_get_size(DBQUERYINFO *pinfo, char **valarray); -int db_sqlite_build_dmap(DBQUERYINFO *pinfo, char **valarray, char *presult, int len); +int db_sqlite_build_dmap(DBQUERYINFO *pinfo, char **valarray, unsigned char *presult, int len); void db_sqlite_build_mp3file(char **valarray, MP3FILE *pmp3); int db_sqlite_exec(int fatal, char *fmt, ...); int db_sqlite_get_table(int fatal, char ***resarray, int *rows, int *cols, char *fmt, ...); @@ -1163,7 +1163,7 @@ int db_sqlite_get_size(DBQUERYINFO *pinfo, char **valarray) { return 0; } -int db_sqlite_build_dmap(DBQUERYINFO *pinfo, char **valarray, char *presult, int len) { +int db_sqlite_build_dmap(DBQUERYINFO *pinfo, char **valarray, unsigned char *presult, int len) { unsigned char *current = presult; int transcode; int samplerate=0; diff --git a/src/dispatch.c b/src/dispatch.c index 1edb2b55..51ad53d2 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -61,12 +61,12 @@ static void dispatch_items(WS_CONNINFO *pwsc, DBQUERYINFO *pqi); static void dispatch_logout(WS_CONNINFO *pwsc, DBQUERYINFO *pqi); static int dispatch_output_start(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, int content_length); -static int dispatch_output_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, char *block, int len); +static int dispatch_output_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, unsigned char *block, int len); static int dispatch_output_end(WS_CONNINFO *pwsc, DBQUERYINFO *pqi); static DAAP_ITEMS *dispatch_xml_lookup_tag(char *tag); static char *dispatch_xml_encode(char *original, int len); -static int dispatch_output_xml_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, char *block, int len); +static int dispatch_output_xml_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, unsigned char *block, int len); /** @@ -300,7 +300,7 @@ int dispatch_output_start(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, int content_lengt * \param pblock block of data to write * \param len length of block to write */ -int dispatch_output_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, char *block, int len) { +int dispatch_output_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, unsigned char *block, int len) { OUTPUT_INFO *poi=(pqi->output_info); int result; @@ -324,9 +324,9 @@ int dispatch_output_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, char *block, int * \param pblock block of data to write * \param len length of block to write */ -int dispatch_output_xml_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, char *block, int len) { +int dispatch_output_xml_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, unsigned char *block, int len) { OUTPUT_INFO *poi = pqi->output_info; - char *current=block; + unsigned char *current=block; char block_tag[5]; int block_len; int len_left; @@ -414,7 +414,7 @@ int dispatch_output_xml_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, char *block, r_fdprintf(pwsc->fd,"%ll",ivalue); break; case 0x09: /* string */ - encoded_string=dispatch_xml_encode(data,block_len); + encoded_string=dispatch_xml_encode((char*)data,block_len); r_fdprintf(pwsc->fd,"%s",encoded_string); free(encoded_string); break; @@ -429,7 +429,7 @@ int dispatch_output_xml_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, char *block, case 0x0C: if((poi->browse_response)&&(strcmp(block_tag,"mlit") ==0)) { - encoded_string=dispatch_xml_encode(data,block_len); + encoded_string=dispatch_xml_encode((char*)data,block_len); r_fdprintf(pwsc->fd,"%s",encoded_string); free(encoded_string); } else { @@ -798,8 +798,8 @@ void dispatch_stream(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { * add songs to an existing playlist */ void dispatch_addplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char playlist_response[20]; - char *current; + unsigned char playlist_response[20]; + unsigned char *current; char *tempstring; char *token; @@ -810,9 +810,9 @@ void dispatch_addplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } tempstring=strdup(ws_getvar(pwsc,"dmap.itemid")); - current=tempstring; + current=(unsigned char*)tempstring; - while((token=strsep(¤t,","))) { + while((token=strsep((char**)¤t,","))) { if(token) { db_add_playlist_item(pqi->playlist_id,atoi(token)); } @@ -838,8 +838,8 @@ void dispatch_addplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { * delete a playlist */ void dispatch_deleteplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char playlist_response[20]; - char *current; + unsigned char playlist_response[20]; + unsigned char *current; if(!ws_getvar(pwsc,"dmap.itemid")) { DPRINTF(E_LOG,L_DAAP,"attempt to delete playlist with no dmap.itemid\n"); @@ -867,8 +867,8 @@ void dispatch_deleteplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { * delete a playlist item */ void dispatch_deleteplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char playlist_response[20]; - char *current; + unsigned char playlist_response[20]; + unsigned char *current; char *tempstring; char *token; @@ -879,9 +879,9 @@ void dispatch_deleteplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } tempstring=strdup(ws_getvar(pwsc,"dmap.itemid")); - current=tempstring; + current=(unsigned char *)tempstring; - while((token=strsep(¤t,","))) { + while((token=strsep((char**)¤t,","))) { if(token) { db_delete_playlist_item(pqi->playlist_id,atoi(token)); } @@ -907,8 +907,8 @@ void dispatch_deleteplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { * add a playlist */ void dispatch_addplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char playlist_response[32]; - char *current=playlist_response; + unsigned char playlist_response[32]; + unsigned char *current=playlist_response; char *name, *query; int type; int retval, playlistid; @@ -949,8 +949,8 @@ void dispatch_addplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { * enumerate and return playlistitems */ void dispatch_playlistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char items_response[61]; - char *current=items_response; + unsigned char items_response[61]; + unsigned char *current=items_response; int song_count; int list_length; unsigned char *block; @@ -1002,8 +1002,8 @@ void dispatch_playlistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } void dispatch_browse(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char browse_response[52]; - char *current=browse_response; + unsigned char browse_response[52]; + unsigned char *current=browse_response; int item_count; int list_length; unsigned char *block; @@ -1068,8 +1068,8 @@ void dispatch_browse(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } void dispatch_playlists(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char playlist_response[61]; - char *current=playlist_response; + unsigned char playlist_response[61]; + unsigned char *current=playlist_response; int pl_count; int list_length; unsigned char *block; @@ -1122,8 +1122,8 @@ void dispatch_playlists(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } void dispatch_items(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char items_response[61]; - char *current=items_response; + unsigned char items_response[61]; + unsigned char *current=items_response; int song_count; int list_length; unsigned char *block; @@ -1171,12 +1171,12 @@ void dispatch_items(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } void dispatch_update(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char update_response[32]; + unsigned char update_response[32]; + unsigned char *current=update_response; int clientver=1; fd_set rset; struct timeval tv; int result; - char *current=update_response; DPRINTF(E_DBG,L_DAAP,"Preparing to send update response\n"); @@ -1213,8 +1213,8 @@ void dispatch_update(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } void dispatch_dbinfo(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char dbinfo_response[255]; /* FIXME */ - char *current = dbinfo_response; + unsigned char dbinfo_response[255]; /* FIXME */ + unsigned char *current = dbinfo_response; int namelen; namelen=strlen(config.servername); @@ -1246,8 +1246,8 @@ void dispatch_logout(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_login(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char login_response[32]; - char *current = login_response; + unsigned char login_response[32]; + unsigned char *current = login_response; int session; session = config_get_next_session(); @@ -1263,13 +1263,12 @@ void dispatch_login(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } void dispatch_content_codes(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char content_codes[20]; - char mdcl[256]; /* FIXME: Don't make this static */ + unsigned char content_codes[20]; + unsigned char *current=content_codes; + unsigned char mdcl[256]; /* FIXME: Don't make this static */ int len; DAAP_ITEMS *dicurrent; - char *current=content_codes; - dicurrent=taglist; len=0; while(dicurrent->type) { @@ -1300,8 +1299,8 @@ void dispatch_content_codes(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { } void dispatch_server_info(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { - char server_info[256]; /* FIXME: Don't make this static */ - char *current = server_info; + unsigned char server_info[256]; /* FIXME: Don't make this static */ + unsigned char *current = server_info; char *client_version; int mpro = 2 << 16; int apro = 3 << 16; diff --git a/src/dynamic-art.c b/src/dynamic-art.c index 71cf4b97..48e8e9c2 100644 --- a/src/dynamic-art.c +++ b/src/dynamic-art.c @@ -82,10 +82,10 @@ int fcopyblock(FILE *fromfp, int tofd, size_t size); * Get a file descriptor for a piece of cover art. */ int da_get_image_fd(char *filename) { - unsigned char buffer[255]; + char buffer[PATH_MAX]; char *path_end; int fd; - strncpy(buffer,filename,255); + strncpy(buffer,filename,sizeof(buffer)); path_end = strrchr(buffer,'/'); strcpy(path_end+1,config.artfilename); fd = open(buffer,O_RDONLY); @@ -109,7 +109,7 @@ int *da_get_current_tag_info(int file_fd) { tag_info = (int *) calloc(2,sizeof(int)); r_read(file_fd,buffer,10); - if ( strncmp(buffer,"ID3", 3) == 0 ) { + if (strncmp((char*)buffer,"ID3", 3) == 0 ) { tag_info[0] = buffer[3]; tag_info[1] = ( buffer[6] << 21 ) + ( buffer[7] << 14 ) + ( buffer[8] << 7 ) + buffer[9]; return tag_info; @@ -211,7 +211,7 @@ off_t da_aac_rewrite_stco_atom(off_t extra_size, int out_fd, FILE *aac_fp, unsigned char buffer[4]; off_t file_size; int atom_offset; - int atom_length; + unsigned int atom_length; off_t cur_pos; off_t old_pos; int i; @@ -277,7 +277,7 @@ off_t da_aac_insert_covr_atom(off_t extra_size, int out_fd, FILE *aac_fp, off_t old_pos; unsigned char buffer[4]; int atom_offset; - int atom_length; + unsigned int atom_length; off_t cur_pos; char *cp; unsigned char img_type_flag = 0; @@ -438,7 +438,7 @@ off_t da_aac_insert_covr_atom(off_t extra_size, int out_fd, FILE *aac_fp, off_t da_aac_attach_image(int img_fd, int out_fd, int aac_fd, int offset) { off_t img_size; - int atom_length; + unsigned int atom_length; unsigned int extra_size; off_t file_size; unsigned char buffer[4]; diff --git a/src/mp3-scanner.c b/src/mp3-scanner.c index 05a8a3da..5f703092 100644 --- a/src/mp3-scanner.c +++ b/src/mp3-scanner.c @@ -283,11 +283,9 @@ typedef struct { static int scan_path(char *path); static int scan_gettags(char *file, MP3FILE *pmp3); static int scan_get_mp3tags(char *file, MP3FILE *pmp3); -static int scan_get_aactags(char *file, MP3FILE *pmp3); static int scan_get_nultags(char *file, MP3FILE *pmp3) { return 0; }; static int scan_get_fileinfo(char *file, MP3FILE *pmp3); static int scan_get_mp3fileinfo(char *file, MP3FILE *pmp3); -static int scan_get_aacfileinfo(char *file, MP3FILE *pmp3); static int scan_get_wavfileinfo(char *file, MP3FILE *pmp3); //static int scan_get_nulfileinfo(char *file, MP3FILE *pmp3) { return 0; }; static int scan_get_urlfileinfo(char *file, MP3FILE *pmp3); @@ -790,7 +788,7 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) { int err; int index; int used; - unsigned char *utf8_text; + char *utf8_text; int genre=WINAMP_GENRE_UNKNOWN; int have_utf8; int have_text; @@ -835,11 +833,16 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) { native_text=id3_field_getstrings(&pid3frame->fields[1],0); if(native_text) { + /* FIXME: I didn't understand what was happening here. + * this should really be a switch to evaluate latin1 + * tags as native codepage. Not only is this hackish, + * it's just plain wrong. + */ have_utf8=1; if(config.latin1_tags) { - utf8_text=id3_ucs4_latin1duplicate(native_text); + utf8_text=(char *)id3_ucs4_latin1duplicate(native_text); } else { - utf8_text=id3_ucs4_utf8duplicate(native_text); + utf8_text=(char *)id3_ucs4_utf8duplicate(native_text); } MEMNOTIFY(utf8_text); @@ -900,20 +903,20 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) { pmp3->comment = utf8_text; DPRINTF(E_DBG,L_SCAN," Comment: %s\n",pmp3->comment); } else if(!strcmp(pid3frame->id,"TPOS")) { - tmp=(char*)utf8_text; + tmp=utf8_text; strsep(&tmp,"/"); if(tmp) { pmp3->total_discs=atoi(tmp); } - pmp3->disc=atoi((char*)utf8_text); + pmp3->disc=atoi(utf8_text); DPRINTF(E_DBG,L_SCAN," Disc %d of %d\n",pmp3->disc,pmp3->total_discs); } else if(!strcmp(pid3frame->id,"TRCK")) { - tmp=(char*)utf8_text; + tmp=utf8_text; strsep(&tmp,"/"); if(tmp) { pmp3->total_tracks=atoi(tmp); } - pmp3->track=atoi((char*)utf8_text); + pmp3->track=atoi(utf8_text); DPRINTF(E_DBG,L_SCAN," Track %d of %d\n",pmp3->track,pmp3->total_tracks); } else if(!strcmp(pid3frame->id,"TDRC")) { pmp3->year = atoi(utf8_text); @@ -948,7 +951,7 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) { */ native_text=id3_field_getstring(&pid3frame->fields[2]); if(native_text) { - utf8_text=id3_ucs4_utf8duplicate(native_text); + utf8_text=(char*)id3_ucs4_utf8duplicate(native_text); if((utf8_text) && (strncasecmp(utf8_text,"iTun",4) != 0)) { /* it's a real comment */ if(utf8_text) @@ -958,7 +961,7 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) { if(native_text) { if(pmp3->comment) free(pmp3->comment); - utf8_text=id3_ucs4_utf8duplicate(native_text); + utf8_text=(char*)id3_ucs4_utf8duplicate(native_text); if(utf8_text) { pmp3->comment=utf8_text; MEMNOTIFY(pmp3->comment); @@ -1136,10 +1139,10 @@ int scan_get_wavfileinfo(char *file, MP3FILE *pmp3) { return -1; } - if (strncmp(hdr + 0, "RIFF", 4) || - strncmp(hdr + 8, "WAVE", 4) || - strncmp(hdr + 12, "fmt ", 4) || - strncmp(hdr + 36, "data", 4)) { + if (strncmp((char*)hdr + 0, "RIFF", 4) || + strncmp((char*)hdr + 8, "WAVE", 4) || + strncmp((char*)hdr + 12, "fmt ", 4) || + strncmp((char*)hdr + 36, "data", 4)) { DPRINTF(E_WARN,L_SCAN,"Invalid wav header in %s\n",file); return -1; } @@ -1502,7 +1505,7 @@ int scan_get_mp3fileinfo(char *file, MP3FILE *pmp3) { found=0; fp_size=0; - if(strncmp(pid3->id,"ID3",3)==0) { + if(strncmp((char*)pid3->id,"ID3",3)==0) { /* found an ID3 header... */ DPRINTF(E_DBG,L_SCAN,"Found ID3 header\n"); size = (pid3->size[0] << 21 | pid3->size[1] << 14 | @@ -1558,7 +1561,7 @@ int scan_get_mp3fileinfo(char *file, MP3FILE *pmp3) { DPRINTF(E_DBG,L_SCAN,"Checking at %04x\n",(int)fp_size+index+fi.frame_length); fseek(infile,fp_size + index + fi.frame_length,SEEK_SET); if(fread(frame_buffer,1,sizeof(frame_buffer),infile) == sizeof(frame_buffer)) { - if(!scan_decode_mp3_frame(frame_buffer,&fi)) { + if(!scan_decode_mp3_frame((u_char*)frame_buffer,&fi)) { found=1; fp_size += index; } diff --git a/src/mp3-scanner.h b/src/mp3-scanner.h index 05d69680..e2e02cfd 100644 --- a/src/mp3-scanner.h +++ b/src/mp3-scanner.h @@ -63,8 +63,8 @@ typedef struct tag_mp3file { int got_id3; unsigned int id; - char *description; /* long file type */ - char *codectype; /* song.codectype */ + char *description; /* long file type */ + char *codectype; /* song.codectype */ int item_kind; /* song or movie */ int data_kind; /* dmap.datakind (asdk) */ int force_update; @@ -74,12 +74,12 @@ typedef struct tag_mp3file { typedef struct tag_m3ufile { int id; /**< integer id (miid) */ - char *title; /**< playlist name as displayed in iTunes (minm) */ + char *title; /**< playlist name as displayed in iTunes (minm) */ int type; /**< 0=static webmanaged, 1=smart, 2=static m3u (aeSP/MPTY) */ int items; /**< number of items (mimc) */ - char *query; /**< where clause if type 1 (MSPS) */ + char *query; /**< where clause if type 1 (MSPS) */ int db_timestamp; /**< time last updated */ - char *path; /**< path of underlying playlist (if type 2) */ + char *path; /**< path of underlying playlist (if type 2) */ int index; /**< index of playlist for paths with multiple playlists */ } M3UFILE; diff --git a/src/scan-flac.c b/src/scan-flac.c index 25d28a7c..3ca40485 100644 --- a/src/scan-flac.c +++ b/src/scan-flac.c @@ -49,8 +49,8 @@ #include -#define GET_VORBIS_COMMENT(comment, name, len) \ - (((strncasecmp(name, (comment).entry, strlen(name)) == 0) && \ +#define GET_VORBIS_COMMENT(comment, name, len) (char*) \ + (((strncasecmp(name, (char*)(comment).entry, strlen(name)) == 0) && \ ((comment).entry[strlen(name)] == '=')) ? \ ((*(len) = (comment).length - (strlen(name) + 1)), \ (&((comment).entry[strlen(name) + 1]))) : \ diff --git a/src/scan-wma.c b/src/scan-wma.c index 50281f4c..4f40c266 100644 --- a/src/scan-wma.c +++ b/src/scan-wma.c @@ -241,11 +241,11 @@ typedef struct tag_wma_subheader { /* * Forwards */ -WMA_GUID *wma_find_guid(char *guid); +WMA_GUID *wma_find_guid(unsigned char *guid); unsigned short int wma_convert_short(unsigned char *src); unsigned int wma_convert_int(unsigned char *src); unsigned long long wma_convert_ll(unsigned char *src); -unsigned char *wma_utf16toutf8(char *utf16, int len); +char *wma_utf16toutf8(unsigned char *utf16, int len); int wma_parse_content_description(int fd,int size, MP3FILE *pmp3); int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3); int wma_parse_file_properteis(int fd,int size, MP3FILE *pmp3); @@ -290,7 +290,7 @@ int wma_file_read_ll(int fd, unsigned long long *pll) { /** * read a utf-16le string as a utf8 */ -int wma_file_read_utf16(int fd, int len, unsigned char **utf8) { +int wma_file_read_utf16(int fd, int len, char **utf8) { char *out; unsigned char *utf16; @@ -309,7 +309,7 @@ int wma_file_read_utf16(int fd, int len, unsigned char **utf8) { } int wma_file_read_bytes(int fd,int len, unsigned char **data) { - *data = (char *)malloc(len); + *data = (unsigned char *)malloc(len); if(!*data) return 0; @@ -331,11 +331,11 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3) { unsigned short descriptor_count; int index; unsigned short descriptor_name_len; - unsigned char *descriptor_name; + char *descriptor_name; unsigned short descriptor_value_type; unsigned short descriptor_value_len; - unsigned char *descriptor_byte_value=NULL; + char *descriptor_byte_value=NULL; unsigned int descriptor_int_value; /* bool and dword */ unsigned long long descriptor_ll_value; unsigned short int descriptor_short_value; @@ -363,11 +363,17 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3) { /* see what kind it is */ switch(descriptor_value_type) { case 0x0000: /* string */ - if(!wma_file_read_utf16(fd,descriptor_value_len,&descriptor_byte_value)) fail=1; + if(!wma_file_read_utf16(fd,descriptor_value_len, + &descriptor_byte_value)) { + fail=1; + } DPRINTF(E_DBG,L_SCAN,"Type: string, value: %s\n",descriptor_byte_value); break; case 0x0001: /* byte array */ - if(!wma_file_read_bytes(fd,descriptor_value_len,&descriptor_byte_value)) fail=1; + if(!wma_file_read_bytes(fd,descriptor_value_len, + (unsigned char **)&descriptor_byte_value)){ + fail=1; + } DPRINTF(E_DBG,L_SCAN,"Type: bytes\n"); break; case 0x0002: /* bool - dropthru */ @@ -447,7 +453,7 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3) { int wma_parse_content_description(int fd,int size, MP3FILE *pmp3) { unsigned short sizes[5]; int index; - unsigned char *utf8; + char *utf8; if(size < 10) /* must be at least enough room for the size block */ return -1; @@ -505,11 +511,11 @@ int wma_parse_content_description(int fd,int size, MP3FILE *pmp3) { * \param pmp3 the mp3 struct we are filling with gleaned data */ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) { - long long play_duration; - long long send_duration; - long long preroll; + unsigned long long play_duration; + unsigned long long send_duration; + unsigned long long preroll; - int max_bitrate; + unsigned int max_bitrate; /* skip guid (16 bytes), filesize (8), creation time (8), * data packets (8) @@ -559,9 +565,9 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) { * \param utf16 utf-16 to convert * \param len length of utf-16 string */ -unsigned char *wma_utf16toutf8(char *utf16, int len) { +char *wma_utf16toutf8(unsigned char *utf16, int len) { char *utf8; - char *src=utf16; + unsigned char *src=utf16; char *dst; unsigned int w1, w2; int bytes; @@ -569,7 +575,7 @@ unsigned char *wma_utf16toutf8(char *utf16, int len) { if(!len) return NULL; - utf8=(unsigned char *)malloc(len*2 + 1); + utf8=(char *)malloc(len*2 + 1); if(!utf8) return NULL; @@ -630,7 +636,7 @@ unsigned char *wma_utf16toutf8(char *utf16, int len) { * * \param guid 16 byte guid to look up */ -WMA_GUID *wma_find_guid(char *guid) { +WMA_GUID *wma_find_guid(unsigned char *guid) { WMA_GUID *pguid = wma_guidlist; while((pguid->name) && (memcmp(guid,pguid->value,16) != 0)) { @@ -728,8 +734,8 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) { return -1; } - hdr.objects=wma_convert_int((char *)&hdr.objects); - hdr.size=wma_convert_ll((char *)&hdr.size); + hdr.objects=wma_convert_int((unsigned char *)&hdr.objects); + hdr.size=wma_convert_ll((unsigned char *)&hdr.size); DPRINTF(E_DBG,L_SCAN,"Found WMA header: %s\n",pguid->name); DPRINTF(E_DBG,L_SCAN,"Header size: %lld\n",hdr.size); @@ -756,7 +762,7 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) { return -1; } - subhdr.size=wma_convert_ll((char *)&subhdr.size); + subhdr.size=wma_convert_ll((unsigned char *)&subhdr.size); pguid = wma_find_guid(subhdr.objectid); if(pguid) { diff --git a/src/uici.c b/src/uici.c index d1b233fd..4fa48a35 100644 --- a/src/uici.c +++ b/src/uici.c @@ -135,7 +135,7 @@ int u_open(u_port_t port) { * If hostn is NULL or hostnsize <= 0, no hostname is copied. */ int u_accept(int fd, char *hostn, int hostnsize) { - int len = sizeof(struct sockaddr); + socklen_t len = sizeof(struct sockaddr); struct sockaddr_in netclient; int retval; diff --git a/src/webserver.c b/src/webserver.c index 901a4f63..b176fa2f 100644 --- a/src/webserver.c +++ b/src/webserver.c @@ -1418,7 +1418,7 @@ int ws_decodepassword(char *header, char **username, char **password) { memset(decodebuffer,0,strlen(header)); len=0; pout=decodebuffer; - pin=header; + pin=(unsigned char *)header; /* this is more than a little sloppy */ while(pin[rack]) { @@ -1465,7 +1465,7 @@ int ws_decodepassword(char *header, char **username, char **password) { /* we now have the decoded string */ DPRINTF(E_DBG,L_WS,"Decoded %s\n",decodebuffer); - *username = decodebuffer; + *username = (char*)decodebuffer; *password = *username; strsep(password,":");