-Wall cleanups for gcc4

This commit is contained in:
Ron Pedde 2005-05-30 03:41:31 +00:00
parent 5cb2784e2e
commit e2d835fbce
11 changed files with 116 additions and 107 deletions

View File

@ -723,7 +723,7 @@ int db_get_playlist_count() {
* \tag what four byte tag * \tag what four byte tag
* \value what character value * \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 */ /* tag */
memcpy(where,tag,4); memcpy(where,tag,4);
@ -743,7 +743,7 @@ int db_dmap_add_char(char *where, char *tag, char value) {
* \tag what four byte tag * \tag what four byte tag
* \value what character value * \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 */ /* tag */
memcpy(where,tag,4); memcpy(where,tag,4);
@ -766,7 +766,7 @@ int db_dmap_add_short(char *where, char *tag, short value) {
* \value what character 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 */ /* tag */
memcpy(where,tag,4); memcpy(where,tag,4);
/* len */ /* len */
@ -790,7 +790,7 @@ int db_dmap_add_int(char *where, char *tag, int value) {
* \value what character 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); int len=strlen(value);
/* tag */ /* tag */
@ -802,7 +802,7 @@ int db_dmap_add_string(char *where, char *tag, char *value) {
where[6]=(len >> 8) & 0xFF; where[6]=(len >> 8) & 0xFF;
where[7]=len & 0xFF; where[7]=len & 0xFF;
strncpy(where+8,value,strlen(value)); strncpy((char*)where+8,value,strlen(value));
return 8 + 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 value what to put there
* \param size how much data to cram in 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 */ /* tag */
memcpy(where,tag,4); 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 * \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; int len=size;
/* tag */ /* tag */

View File

@ -171,12 +171,12 @@ extern MetaField_t db_encode_meta(char *meta);
extern int db_wantsmeta(MetaField_t meta, MetaFieldName_t fieldNo); extern int db_wantsmeta(MetaField_t meta, MetaFieldName_t fieldNo);
/* dmap helper functions */ /* dmap helper functions */
extern int db_dmap_add_char(char *where, char *tag, char value); extern int db_dmap_add_char(unsigned char *where, char *tag, char value);
extern int db_dmap_add_short(char *where, char *tag, short value); extern int db_dmap_add_short(unsigned char *where, char *tag, short value);
extern int db_dmap_add_int(char *where, char *tag, int value); extern int db_dmap_add_int(unsigned char *where, char *tag, int value);
extern int db_dmap_add_string(char *where, char *tag, char *value); extern int db_dmap_add_string(unsigned 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_literal(unsigned 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_container(unsigned char *where, char *tag, int size);
/* Holdover functions from old db interface... /* Holdover functions from old db interface...
* should these be removed? Refactored? * should these be removed? Refactored?

View File

@ -53,7 +53,7 @@ static char db_path[PATH_MAX + 1];
/* Forwards */ /* Forwards */
int db_sqlite_get_size(DBQUERYINFO *pinfo, char **valarray); 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); void db_sqlite_build_mp3file(char **valarray, MP3FILE *pmp3);
int db_sqlite_exec(int fatal, char *fmt, ...); int db_sqlite_exec(int fatal, char *fmt, ...);
int db_sqlite_get_table(int fatal, char ***resarray, int *rows, int *cols, 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; 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; unsigned char *current = presult;
int transcode; int transcode;
int samplerate=0; int samplerate=0;

View File

@ -61,12 +61,12 @@ static void dispatch_items(WS_CONNINFO *pwsc, DBQUERYINFO *pqi);
static void dispatch_logout(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_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 int dispatch_output_end(WS_CONNINFO *pwsc, DBQUERYINFO *pqi);
static DAAP_ITEMS *dispatch_xml_lookup_tag(char *tag); static DAAP_ITEMS *dispatch_xml_lookup_tag(char *tag);
static char *dispatch_xml_encode(char *original, int len); 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 pblock block of data to write
* \param len length of block 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); OUTPUT_INFO *poi=(pqi->output_info);
int result; 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 pblock block of data to write
* \param len length of block 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; OUTPUT_INFO *poi = pqi->output_info;
char *current=block; unsigned char *current=block;
char block_tag[5]; char block_tag[5];
int block_len; int block_len;
int len_left; 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); r_fdprintf(pwsc->fd,"%ll",ivalue);
break; break;
case 0x09: /* string */ 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); r_fdprintf(pwsc->fd,"%s",encoded_string);
free(encoded_string); free(encoded_string);
break; break;
@ -429,7 +429,7 @@ int dispatch_output_xml_write(WS_CONNINFO *pwsc, DBQUERYINFO *pqi, char *block,
case 0x0C: case 0x0C:
if((poi->browse_response)&&(strcmp(block_tag,"mlit") ==0)) { 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); r_fdprintf(pwsc->fd,"%s",encoded_string);
free(encoded_string); free(encoded_string);
} else { } else {
@ -798,8 +798,8 @@ void dispatch_stream(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
* add songs to an existing playlist * add songs to an existing playlist
*/ */
void dispatch_addplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_addplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char playlist_response[20]; unsigned char playlist_response[20];
char *current; unsigned char *current;
char *tempstring; char *tempstring;
char *token; char *token;
@ -810,9 +810,9 @@ void dispatch_addplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
} }
tempstring=strdup(ws_getvar(pwsc,"dmap.itemid")); tempstring=strdup(ws_getvar(pwsc,"dmap.itemid"));
current=tempstring; current=(unsigned char*)tempstring;
while((token=strsep(&current,","))) { while((token=strsep((char**)&current,","))) {
if(token) { if(token) {
db_add_playlist_item(pqi->playlist_id,atoi(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 * delete a playlist
*/ */
void dispatch_deleteplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_deleteplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char playlist_response[20]; unsigned char playlist_response[20];
char *current; unsigned char *current;
if(!ws_getvar(pwsc,"dmap.itemid")) { if(!ws_getvar(pwsc,"dmap.itemid")) {
DPRINTF(E_LOG,L_DAAP,"attempt to delete playlist with no dmap.itemid\n"); 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 * delete a playlist item
*/ */
void dispatch_deleteplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_deleteplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char playlist_response[20]; unsigned char playlist_response[20];
char *current; unsigned char *current;
char *tempstring; char *tempstring;
char *token; char *token;
@ -879,9 +879,9 @@ void dispatch_deleteplaylistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
} }
tempstring=strdup(ws_getvar(pwsc,"dmap.itemid")); tempstring=strdup(ws_getvar(pwsc,"dmap.itemid"));
current=tempstring; current=(unsigned char *)tempstring;
while((token=strsep(&current,","))) { while((token=strsep((char**)&current,","))) {
if(token) { if(token) {
db_delete_playlist_item(pqi->playlist_id,atoi(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 * add a playlist
*/ */
void dispatch_addplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_addplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char playlist_response[32]; unsigned char playlist_response[32];
char *current=playlist_response; unsigned char *current=playlist_response;
char *name, *query; char *name, *query;
int type; int type;
int retval, playlistid; int retval, playlistid;
@ -949,8 +949,8 @@ void dispatch_addplaylist(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
* enumerate and return playlistitems * enumerate and return playlistitems
*/ */
void dispatch_playlistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_playlistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char items_response[61]; unsigned char items_response[61];
char *current=items_response; unsigned char *current=items_response;
int song_count; int song_count;
int list_length; int list_length;
unsigned char *block; unsigned char *block;
@ -1002,8 +1002,8 @@ void dispatch_playlistitems(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
} }
void dispatch_browse(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_browse(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char browse_response[52]; unsigned char browse_response[52];
char *current=browse_response; unsigned char *current=browse_response;
int item_count; int item_count;
int list_length; int list_length;
unsigned char *block; unsigned char *block;
@ -1068,8 +1068,8 @@ void dispatch_browse(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
} }
void dispatch_playlists(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_playlists(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char playlist_response[61]; unsigned char playlist_response[61];
char *current=playlist_response; unsigned char *current=playlist_response;
int pl_count; int pl_count;
int list_length; int list_length;
unsigned char *block; unsigned char *block;
@ -1122,8 +1122,8 @@ void dispatch_playlists(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
} }
void dispatch_items(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_items(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char items_response[61]; unsigned char items_response[61];
char *current=items_response; unsigned char *current=items_response;
int song_count; int song_count;
int list_length; int list_length;
unsigned char *block; unsigned char *block;
@ -1171,12 +1171,12 @@ void dispatch_items(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
} }
void dispatch_update(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; int clientver=1;
fd_set rset; fd_set rset;
struct timeval tv; struct timeval tv;
int result; int result;
char *current=update_response;
DPRINTF(E_DBG,L_DAAP,"Preparing to send update response\n"); 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) { void dispatch_dbinfo(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char dbinfo_response[255]; /* FIXME */ unsigned char dbinfo_response[255]; /* FIXME */
char *current = dbinfo_response; unsigned char *current = dbinfo_response;
int namelen; int namelen;
namelen=strlen(config.servername); namelen=strlen(config.servername);
@ -1246,8 +1246,8 @@ void dispatch_logout(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
void dispatch_login(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) { void dispatch_login(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char login_response[32]; unsigned char login_response[32];
char *current = login_response; unsigned char *current = login_response;
int session; int session;
session = config_get_next_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) { void dispatch_content_codes(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char content_codes[20]; unsigned char content_codes[20];
char mdcl[256]; /* FIXME: Don't make this static */ unsigned char *current=content_codes;
unsigned char mdcl[256]; /* FIXME: Don't make this static */
int len; int len;
DAAP_ITEMS *dicurrent; DAAP_ITEMS *dicurrent;
char *current=content_codes;
dicurrent=taglist; dicurrent=taglist;
len=0; len=0;
while(dicurrent->type) { 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) { void dispatch_server_info(WS_CONNINFO *pwsc, DBQUERYINFO *pqi) {
char server_info[256]; /* FIXME: Don't make this static */ unsigned char server_info[256]; /* FIXME: Don't make this static */
char *current = server_info; unsigned char *current = server_info;
char *client_version; char *client_version;
int mpro = 2 << 16; int mpro = 2 << 16;
int apro = 3 << 16; int apro = 3 << 16;

View File

@ -82,10 +82,10 @@ int fcopyblock(FILE *fromfp, int tofd, size_t size);
* Get a file descriptor for a piece of cover art. * Get a file descriptor for a piece of cover art.
*/ */
int da_get_image_fd(char *filename) { int da_get_image_fd(char *filename) {
unsigned char buffer[255]; char buffer[PATH_MAX];
char *path_end; char *path_end;
int fd; int fd;
strncpy(buffer,filename,255); strncpy(buffer,filename,sizeof(buffer));
path_end = strrchr(buffer,'/'); path_end = strrchr(buffer,'/');
strcpy(path_end+1,config.artfilename); strcpy(path_end+1,config.artfilename);
fd = open(buffer,O_RDONLY); 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)); tag_info = (int *) calloc(2,sizeof(int));
r_read(file_fd,buffer,10); 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[0] = buffer[3];
tag_info[1] = ( buffer[6] << 21 ) + ( buffer[7] << 14 ) + ( buffer[8] << 7 ) + buffer[9]; tag_info[1] = ( buffer[6] << 21 ) + ( buffer[7] << 14 ) + ( buffer[8] << 7 ) + buffer[9];
return tag_info; 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]; unsigned char buffer[4];
off_t file_size; off_t file_size;
int atom_offset; int atom_offset;
int atom_length; unsigned int atom_length;
off_t cur_pos; off_t cur_pos;
off_t old_pos; off_t old_pos;
int i; 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; off_t old_pos;
unsigned char buffer[4]; unsigned char buffer[4];
int atom_offset; int atom_offset;
int atom_length; unsigned int atom_length;
off_t cur_pos; off_t cur_pos;
char *cp; char *cp;
unsigned char img_type_flag = 0; 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 da_aac_attach_image(int img_fd, int out_fd, int aac_fd, int offset)
{ {
off_t img_size; off_t img_size;
int atom_length; unsigned int atom_length;
unsigned int extra_size; unsigned int extra_size;
off_t file_size; off_t file_size;
unsigned char buffer[4]; unsigned char buffer[4];

View File

@ -283,11 +283,9 @@ typedef struct {
static int scan_path(char *path); static int scan_path(char *path);
static int scan_gettags(char *file, MP3FILE *pmp3); static int scan_gettags(char *file, MP3FILE *pmp3);
static int scan_get_mp3tags(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_nultags(char *file, MP3FILE *pmp3) { return 0; };
static int scan_get_fileinfo(char *file, MP3FILE *pmp3); static int scan_get_fileinfo(char *file, MP3FILE *pmp3);
static int scan_get_mp3fileinfo(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_wavfileinfo(char *file, MP3FILE *pmp3);
//static int scan_get_nulfileinfo(char *file, MP3FILE *pmp3) { return 0; }; //static int scan_get_nulfileinfo(char *file, MP3FILE *pmp3) { return 0; };
static int scan_get_urlfileinfo(char *file, MP3FILE *pmp3); static int scan_get_urlfileinfo(char *file, MP3FILE *pmp3);
@ -790,7 +788,7 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) {
int err; int err;
int index; int index;
int used; int used;
unsigned char *utf8_text; char *utf8_text;
int genre=WINAMP_GENRE_UNKNOWN; int genre=WINAMP_GENRE_UNKNOWN;
int have_utf8; int have_utf8;
int have_text; int have_text;
@ -835,11 +833,16 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) {
native_text=id3_field_getstrings(&pid3frame->fields[1],0); native_text=id3_field_getstrings(&pid3frame->fields[1],0);
if(native_text) { 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; have_utf8=1;
if(config.latin1_tags) { if(config.latin1_tags) {
utf8_text=id3_ucs4_latin1duplicate(native_text); utf8_text=(char *)id3_ucs4_latin1duplicate(native_text);
} else { } else {
utf8_text=id3_ucs4_utf8duplicate(native_text); utf8_text=(char *)id3_ucs4_utf8duplicate(native_text);
} }
MEMNOTIFY(utf8_text); MEMNOTIFY(utf8_text);
@ -900,20 +903,20 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) {
pmp3->comment = utf8_text; pmp3->comment = utf8_text;
DPRINTF(E_DBG,L_SCAN," Comment: %s\n",pmp3->comment); DPRINTF(E_DBG,L_SCAN," Comment: %s\n",pmp3->comment);
} else if(!strcmp(pid3frame->id,"TPOS")) { } else if(!strcmp(pid3frame->id,"TPOS")) {
tmp=(char*)utf8_text; tmp=utf8_text;
strsep(&tmp,"/"); strsep(&tmp,"/");
if(tmp) { if(tmp) {
pmp3->total_discs=atoi(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); DPRINTF(E_DBG,L_SCAN," Disc %d of %d\n",pmp3->disc,pmp3->total_discs);
} else if(!strcmp(pid3frame->id,"TRCK")) { } else if(!strcmp(pid3frame->id,"TRCK")) {
tmp=(char*)utf8_text; tmp=utf8_text;
strsep(&tmp,"/"); strsep(&tmp,"/");
if(tmp) { if(tmp) {
pmp3->total_tracks=atoi(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); DPRINTF(E_DBG,L_SCAN," Track %d of %d\n",pmp3->track,pmp3->total_tracks);
} else if(!strcmp(pid3frame->id,"TDRC")) { } else if(!strcmp(pid3frame->id,"TDRC")) {
pmp3->year = atoi(utf8_text); 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]); native_text=id3_field_getstring(&pid3frame->fields[2]);
if(native_text) { 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)) { if((utf8_text) && (strncasecmp(utf8_text,"iTun",4) != 0)) {
/* it's a real comment */ /* it's a real comment */
if(utf8_text) if(utf8_text)
@ -958,7 +961,7 @@ int scan_get_mp3tags(char *file, MP3FILE *pmp3) {
if(native_text) { if(native_text) {
if(pmp3->comment) if(pmp3->comment)
free(pmp3->comment); free(pmp3->comment);
utf8_text=id3_ucs4_utf8duplicate(native_text); utf8_text=(char*)id3_ucs4_utf8duplicate(native_text);
if(utf8_text) { if(utf8_text) {
pmp3->comment=utf8_text; pmp3->comment=utf8_text;
MEMNOTIFY(pmp3->comment); MEMNOTIFY(pmp3->comment);
@ -1136,10 +1139,10 @@ int scan_get_wavfileinfo(char *file, MP3FILE *pmp3) {
return -1; return -1;
} }
if (strncmp(hdr + 0, "RIFF", 4) || if (strncmp((char*)hdr + 0, "RIFF", 4) ||
strncmp(hdr + 8, "WAVE", 4) || strncmp((char*)hdr + 8, "WAVE", 4) ||
strncmp(hdr + 12, "fmt ", 4) || strncmp((char*)hdr + 12, "fmt ", 4) ||
strncmp(hdr + 36, "data", 4)) { strncmp((char*)hdr + 36, "data", 4)) {
DPRINTF(E_WARN,L_SCAN,"Invalid wav header in %s\n",file); DPRINTF(E_WARN,L_SCAN,"Invalid wav header in %s\n",file);
return -1; return -1;
} }
@ -1502,7 +1505,7 @@ int scan_get_mp3fileinfo(char *file, MP3FILE *pmp3) {
found=0; found=0;
fp_size=0; fp_size=0;
if(strncmp(pid3->id,"ID3",3)==0) { if(strncmp((char*)pid3->id,"ID3",3)==0) {
/* found an ID3 header... */ /* found an ID3 header... */
DPRINTF(E_DBG,L_SCAN,"Found ID3 header\n"); DPRINTF(E_DBG,L_SCAN,"Found ID3 header\n");
size = (pid3->size[0] << 21 | pid3->size[1] << 14 | 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); 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); fseek(infile,fp_size + index + fi.frame_length,SEEK_SET);
if(fread(frame_buffer,1,sizeof(frame_buffer),infile) == sizeof(frame_buffer)) { 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; found=1;
fp_size += index; fp_size += index;
} }

View File

@ -63,8 +63,8 @@ typedef struct tag_mp3file {
int got_id3; int got_id3;
unsigned int id; unsigned int id;
char *description; /* long file type */ char *description; /* long file type */
char *codectype; /* song.codectype */ char *codectype; /* song.codectype */
int item_kind; /* song or movie */ int item_kind; /* song or movie */
int data_kind; /* dmap.datakind (asdk) */ int data_kind; /* dmap.datakind (asdk) */
int force_update; int force_update;
@ -74,12 +74,12 @@ typedef struct tag_mp3file {
typedef struct tag_m3ufile { typedef struct tag_m3ufile {
int id; /**< integer id (miid) */ 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 type; /**< 0=static webmanaged, 1=smart, 2=static m3u (aeSP/MPTY) */
int items; /**< number of items (mimc) */ 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 */ 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 */ int index; /**< index of playlist for paths with multiple playlists */
} M3UFILE; } M3UFILE;

View File

@ -49,8 +49,8 @@
#include <FLAC/metadata.h> #include <FLAC/metadata.h>
#define GET_VORBIS_COMMENT(comment, name, len) \ #define GET_VORBIS_COMMENT(comment, name, len) (char*) \
(((strncasecmp(name, (comment).entry, strlen(name)) == 0) && \ (((strncasecmp(name, (char*)(comment).entry, strlen(name)) == 0) && \
((comment).entry[strlen(name)] == '=')) ? \ ((comment).entry[strlen(name)] == '=')) ? \
((*(len) = (comment).length - (strlen(name) + 1)), \ ((*(len) = (comment).length - (strlen(name) + 1)), \
(&((comment).entry[strlen(name) + 1]))) : \ (&((comment).entry[strlen(name) + 1]))) : \

View File

@ -241,11 +241,11 @@ typedef struct tag_wma_subheader {
/* /*
* Forwards * 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 short int wma_convert_short(unsigned char *src);
unsigned int wma_convert_int(unsigned char *src); unsigned int wma_convert_int(unsigned char *src);
unsigned long long wma_convert_ll(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_content_description(int fd,int size, MP3FILE *pmp3);
int wma_parse_extended_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); 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 * 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; char *out;
unsigned char *utf16; 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) { int wma_file_read_bytes(int fd,int len, unsigned char **data) {
*data = (char *)malloc(len); *data = (unsigned char *)malloc(len);
if(!*data) if(!*data)
return 0; return 0;
@ -331,11 +331,11 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3) {
unsigned short descriptor_count; unsigned short descriptor_count;
int index; int index;
unsigned short descriptor_name_len; unsigned short descriptor_name_len;
unsigned char *descriptor_name; char *descriptor_name;
unsigned short descriptor_value_type; unsigned short descriptor_value_type;
unsigned short descriptor_value_len; 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 int descriptor_int_value; /* bool and dword */
unsigned long long descriptor_ll_value; unsigned long long descriptor_ll_value;
unsigned short int descriptor_short_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 */ /* see what kind it is */
switch(descriptor_value_type) { switch(descriptor_value_type) {
case 0x0000: /* string */ 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); DPRINTF(E_DBG,L_SCAN,"Type: string, value: %s\n",descriptor_byte_value);
break; break;
case 0x0001: /* byte array */ 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"); DPRINTF(E_DBG,L_SCAN,"Type: bytes\n");
break; break;
case 0x0002: /* bool - dropthru */ 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) { int wma_parse_content_description(int fd,int size, MP3FILE *pmp3) {
unsigned short sizes[5]; unsigned short sizes[5];
int index; int index;
unsigned char *utf8; char *utf8;
if(size < 10) /* must be at least enough room for the size block */ if(size < 10) /* must be at least enough room for the size block */
return -1; 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 * \param pmp3 the mp3 struct we are filling with gleaned data
*/ */
int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) { int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) {
long long play_duration; unsigned long long play_duration;
long long send_duration; unsigned long long send_duration;
long long preroll; unsigned long long preroll;
int max_bitrate; unsigned int max_bitrate;
/* skip guid (16 bytes), filesize (8), creation time (8), /* skip guid (16 bytes), filesize (8), creation time (8),
* data packets (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 utf16 utf-16 to convert
* \param len length of utf-16 string * \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 *utf8;
char *src=utf16; unsigned char *src=utf16;
char *dst; char *dst;
unsigned int w1, w2; unsigned int w1, w2;
int bytes; int bytes;
@ -569,7 +575,7 @@ unsigned char *wma_utf16toutf8(char *utf16, int len) {
if(!len) if(!len)
return NULL; return NULL;
utf8=(unsigned char *)malloc(len*2 + 1); utf8=(char *)malloc(len*2 + 1);
if(!utf8) if(!utf8)
return NULL; return NULL;
@ -630,7 +636,7 @@ unsigned char *wma_utf16toutf8(char *utf16, int len) {
* *
* \param guid 16 byte guid to look up * \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; WMA_GUID *pguid = wma_guidlist;
while((pguid->name) && (memcmp(guid,pguid->value,16) != 0)) { while((pguid->name) && (memcmp(guid,pguid->value,16) != 0)) {
@ -728,8 +734,8 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) {
return -1; return -1;
} }
hdr.objects=wma_convert_int((char *)&hdr.objects); hdr.objects=wma_convert_int((unsigned char *)&hdr.objects);
hdr.size=wma_convert_ll((char *)&hdr.size); 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,"Found WMA header: %s\n",pguid->name);
DPRINTF(E_DBG,L_SCAN,"Header size: %lld\n",hdr.size); 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; 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); pguid = wma_find_guid(subhdr.objectid);
if(pguid) { if(pguid) {

View File

@ -135,7 +135,7 @@ int u_open(u_port_t port) {
* If hostn is NULL or hostnsize <= 0, no hostname is copied. * If hostn is NULL or hostnsize <= 0, no hostname is copied.
*/ */
int u_accept(int fd, char *hostn, int hostnsize) { int u_accept(int fd, char *hostn, int hostnsize) {
int len = sizeof(struct sockaddr); socklen_t len = sizeof(struct sockaddr);
struct sockaddr_in netclient; struct sockaddr_in netclient;
int retval; int retval;

View File

@ -1418,7 +1418,7 @@ int ws_decodepassword(char *header, char **username, char **password) {
memset(decodebuffer,0,strlen(header)); memset(decodebuffer,0,strlen(header));
len=0; len=0;
pout=decodebuffer; pout=decodebuffer;
pin=header; pin=(unsigned char *)header;
/* this is more than a little sloppy */ /* this is more than a little sloppy */
while(pin[rack]) { while(pin[rack]) {
@ -1465,7 +1465,7 @@ int ws_decodepassword(char *header, char **username, char **password) {
/* we now have the decoded string */ /* we now have the decoded string */
DPRINTF(E_DBG,L_WS,"Decoded %s\n",decodebuffer); DPRINTF(E_DBG,L_WS,"Decoded %s\n",decodebuffer);
*username = decodebuffer; *username = (char*)decodebuffer;
*password = *username; *password = *username;
strsep(password,":"); strsep(password,":");