diff --git a/src/configfile.c b/src/configfile.c index 6d5ecd31..eeff0460 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -36,6 +36,9 @@ #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include @@ -257,7 +260,7 @@ void config_subst_stream(WS_CONNINFO *pwsc, int fd_src) { } else { outbuffer[out_index] = next; out_index++; - + if(out_index == sizeof(outbuffer)) { r_write(pwsc->fd,outbuffer,out_index); out_index=0; diff --git a/src/dynamic-art.c b/src/dynamic-art.c index 5f58d434..cdcb7679 100644 --- a/src/dynamic-art.c +++ b/src/dynamic-art.c @@ -28,6 +28,9 @@ #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #ifdef HAVE_UNISTD_H diff --git a/src/err.c b/src/err.c index ac9675ff..f01e76ef 100644 --- a/src/err.c +++ b/src/err.c @@ -38,6 +38,9 @@ #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include @@ -95,7 +98,7 @@ uint32_t _err_get_threadid(void) { } else { thread_id = util_djb_hash_block((unsigned char *)&tid,sizeof(pthread_t)); } - + return thread_id; } @@ -108,7 +111,7 @@ void err_reopen(void) { if(!(err_logdest & LOGDEST_LOGFILE)) return; - + // _err_lock(); fclose(err_file); err_file = fopen(err_filename,"a"); @@ -171,13 +174,13 @@ void err_log(int level, unsigned int cat, char *fmt, ...) if(!level) fprintf(err_file,"%s: Aborting\n",timebuf); fflush(err_file); } - + /* always log to stderr on fatal error */ if((err_logdest & LOGDEST_STDERR) || (!level)) { fprintf(stderr, "%s",errbuf); if(!level) fprintf(stderr,"Aborting\n"); } - + /* always log fatals and level 1 to syslog */ if(level <= 1) { if(!err_syslog_open) @@ -194,12 +197,12 @@ void err_log(int level, unsigned int cat, char *fmt, ...) } #endif - + if(!level) { exit(EXIT_FAILURE); /* this should go to an OS-specific exit routine */ } } - + /** * simple get/set interface to debuglevel to avoid global */ @@ -227,7 +230,7 @@ int err_getlevel(void) { */ int err_getdest(void) { int dest; - + _err_lock(); dest=err_logdest; _err_unlock(); @@ -278,7 +281,7 @@ int err_setlogfile(char *file) { if(!err_syslog_open) os_opensyslog(); os_syslog(1,"Error opening logfile"); - + result=FALSE; } @@ -323,7 +326,7 @@ extern int err_setdebugmask(char *list) { str=tmpstr=strdup(list); if(!str) return 0; - + _err_lock(); while(1) { token=strtok_r(str,",",&last); diff --git a/src/main.c b/src/main.c index 7c4dca33..1c5bce03 100644 --- a/src/main.c +++ b/src/main.c @@ -57,6 +57,9 @@ #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include diff --git a/src/plugins/out-daap-proto.c b/src/plugins/out-daap-proto.c index e1327d7b..937831a2 100644 --- a/src/plugins/out-daap-proto.c +++ b/src/plugins/out-daap-proto.c @@ -9,6 +9,9 @@ #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include "ff-dbstruct.h" #include "ff-plugins.h" @@ -560,7 +563,7 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) { if(daap_wantsmeta(pinfo->meta, metaSongArtist)) /* asar */ size += DMAPLEN(valarray[SG_ARTIST]); - if(valarray[SG_BPM] && atoi(valarray[SG_BPM]) && + if(valarray[SG_BPM] && atoi(valarray[SG_BPM]) && daap_wantsmeta(pinfo->meta, metaSongBPM)) /* asbt */ size += 10; @@ -579,7 +582,7 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) { if(daap_wantsmeta(pinfo->meta, metaSongComment)) /* ascm */ size += DMAPLEN(valarray[SG_COMMENT]); - if(valarray[SG_COMPILATION] && atoi(valarray[SG_COMPILATION]) && + if(valarray[SG_COMPILATION] && atoi(valarray[SG_COMPILATION]) && daap_wantsmeta(pinfo->meta,metaSongCompilation)) /* asco */ size += 9; @@ -589,7 +592,7 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) { if(daap_wantsmeta(pinfo->meta, metaSongGrouping)) /* agrp */ size += DMAPLEN(valarray[SG_GROUPING]); - if(valarray[SG_TIME_ADDED] && atoi(valarray[SG_TIME_ADDED]) && + if(valarray[SG_TIME_ADDED] && atoi(valarray[SG_TIME_ADDED]) && daap_wantsmeta(pinfo->meta, metaSongDateAdded)) /* asda */ size += 12; @@ -597,11 +600,11 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) { daap_wantsmeta(pinfo->meta,metaSongDateModified)) /* asdm */ size += 12; - if(valarray[SG_TOTAL_DISCS] && atoi(valarray[SG_TOTAL_DISCS]) && + if(valarray[SG_TOTAL_DISCS] && atoi(valarray[SG_TOTAL_DISCS]) && daap_wantsmeta(pinfo->meta, metaSongDiscCount)) /* asdc */ size += 10; - if(valarray[SG_DISC] && atoi(valarray[SG_DISC]) && + if(valarray[SG_DISC] && atoi(valarray[SG_DISC]) && daap_wantsmeta(pinfo->meta, metaSongDiscNumber)) /* asdn */ size += 10; @@ -630,15 +633,15 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) { if(daap_wantsmeta(pinfo->meta,metaItemName)) /* minm */ size += DMAPLEN(valarray[SG_TITLE]); - if(valarray[SG_DISABLED] && atoi(valarray[SG_DISABLED]) && + if(valarray[SG_DISABLED] && atoi(valarray[SG_DISABLED]) && daap_wantsmeta(pinfo->meta,metaSongDisabled)) /* asdb */ size += 9; - if(valarray[SG_SAMPLERATE] && atoi(valarray[SG_SAMPLERATE]) && + if(valarray[SG_SAMPLERATE] && atoi(valarray[SG_SAMPLERATE]) && daap_wantsmeta(pinfo->meta,metaSongSampleRate)) /* assr */ size += 12; - if(valarray[SG_FILE_SIZE] && atoi(valarray[SG_FILE_SIZE]) && + if(valarray[SG_FILE_SIZE] && atoi(valarray[SG_FILE_SIZE]) && daap_wantsmeta(pinfo->meta,metaSongSize)) /* assz */ size += 12; @@ -648,23 +651,23 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) { * is required, so I'm going to disabled it */ - if(valarray[SG_SONG_LENGTH] && atoi(valarray[SG_SONG_LENGTH]) && + if(valarray[SG_SONG_LENGTH] && atoi(valarray[SG_SONG_LENGTH]) && daap_wantsmeta(pinfo->meta, metaSongTime)) /* astm */ size += 12; - if(valarray[SG_TOTAL_TRACKS] && atoi(valarray[SG_TOTAL_TRACKS]) && + if(valarray[SG_TOTAL_TRACKS] && atoi(valarray[SG_TOTAL_TRACKS]) && daap_wantsmeta(pinfo->meta, metaSongTrackCount)) /* astc */ size += 10; - if(valarray[SG_TRACK] && atoi(valarray[SG_TRACK]) && + if(valarray[SG_TRACK] && atoi(valarray[SG_TRACK]) && daap_wantsmeta(pinfo->meta, metaSongTrackNumber)) /* astn */ size += 10; - if(valarray[SG_RATING] && atoi(valarray[SG_RATING]) && + if(valarray[SG_RATING] && atoi(valarray[SG_RATING]) && daap_wantsmeta(pinfo->meta, metaSongUserRating)) /* asur */ size += 9; - if(valarray[SG_YEAR] && atoi(valarray[SG_YEAR]) && + if(valarray[SG_YEAR] && atoi(valarray[SG_YEAR]) && daap_wantsmeta(pinfo->meta, metaSongYear)) /* asyr */ size += 10; @@ -672,8 +675,8 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) { /* mcti */ size += 12; /* FIXME: This is not right - doesn't have to be 4 */ - if((valarray[SG_CODECTYPE]) && (strlen(valarray[SG_CODECTYPE])==4) && - daap_wantsmeta(pinfo->meta,metaSongCodecType)) + if((valarray[SG_CODECTYPE]) && (strlen(valarray[SG_CODECTYPE])==4) && + daap_wantsmeta(pinfo->meta,metaSongCodecType)) /* ascd */ size += 12; if(daap_wantsmeta(pinfo->meta,metaSongContentRating)) @@ -748,10 +751,10 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in if(valarray[23] && atoi(valarray[23]) && daap_wantsmeta(pinfo->meta, metaSongBPM)) current += dmap_add_short(current,"asbt", (short)atoi(valarray[SG_BPM])); - if(valarray[SG_BITRATE] && atoi(valarray[SG_BITRATE]) && + if(valarray[SG_BITRATE] && atoi(valarray[SG_BITRATE]) && daap_wantsmeta(pinfo->meta, metaSongBitRate)) { if(transcode) { - if(valarray[SG_SAMPLERATE]) + if(valarray[SG_SAMPLERATE]) samplerate=atoi(valarray[SG_SAMPLERATE]); if(samplerate) { current += dmap_add_short(current,"asbr", @@ -762,45 +765,45 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in (short)atoi(valarray[SG_BITRATE])); } } - if(EMIT(valarray[SG_COMMENT]) && + if(EMIT(valarray[SG_COMMENT]) && daap_wantsmeta(pinfo->meta, metaSongComment)) current += dmap_add_string(current,"ascm",valarray[SG_COMMENT]); - if(valarray[SG_COMPILATION] && atoi(valarray[SG_COMPILATION]) && + if(valarray[SG_COMPILATION] && atoi(valarray[SG_COMPILATION]) && daap_wantsmeta(pinfo->meta,metaSongCompilation)) current += dmap_add_char(current,"asco", (char)atoi(valarray[SG_COMPILATION])); - if(EMIT(valarray[SG_COMPOSER]) && + if(EMIT(valarray[SG_COMPOSER]) && daap_wantsmeta(pinfo->meta, metaSongComposer)) current += dmap_add_string(current,"ascp", valarray[SG_COMPOSER]); - if(EMIT(valarray[SG_GROUPING]) && + if(EMIT(valarray[SG_GROUPING]) && daap_wantsmeta(pinfo->meta, metaSongGrouping)) current += dmap_add_string(current,"agrp", valarray[SG_GROUPING]); - if(valarray[SG_TIME_ADDED] && atoi(valarray[SG_TIME_ADDED]) && + if(valarray[SG_TIME_ADDED] && atoi(valarray[SG_TIME_ADDED]) && daap_wantsmeta(pinfo->meta, metaSongDateAdded)) current += dmap_add_int(current,"asda", (int)atoi(valarray[SG_TIME_ADDED])); - if(valarray[SG_TIME_MODIFIED] && atoi(valarray[SG_TIME_MODIFIED]) && + if(valarray[SG_TIME_MODIFIED] && atoi(valarray[SG_TIME_MODIFIED]) && daap_wantsmeta(pinfo->meta,metaSongDateModified)) current += dmap_add_int(current,"asdm", (int)atoi(valarray[SG_TIME_MODIFIED])); - if(valarray[SG_TOTAL_DISCS] && atoi(valarray[SG_TOTAL_DISCS]) && + if(valarray[SG_TOTAL_DISCS] && atoi(valarray[SG_TOTAL_DISCS]) && daap_wantsmeta(pinfo->meta, metaSongDiscCount)) current += dmap_add_short(current,"asdc", (short)atoi(valarray[SG_TOTAL_DISCS])); - if(valarray[SG_DISC] && atoi(valarray[SG_DISC]) && + if(valarray[SG_DISC] && atoi(valarray[SG_DISC]) && daap_wantsmeta(pinfo->meta, metaSongDiscNumber)) current += dmap_add_short(current,"asdn", (short)atoi(valarray[SG_DISC])); - if(EMIT(valarray[SG_GENRE]) && + if(EMIT(valarray[SG_GENRE]) && daap_wantsmeta(pinfo->meta, metaSongGenre)) current += dmap_add_string(current,"asgn",valarray[SG_GENRE]); @@ -808,7 +811,7 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in current += dmap_add_int(current,"miid", (int)atoi(valarray[SG_ID])); - if(EMIT(valarray[SG_TYPE]) && + if(EMIT(valarray[SG_TYPE]) && daap_wantsmeta(pinfo->meta,metaSongFormat)) { if(transcode) { current += dmap_add_string(current,"asfm","wav"); @@ -818,7 +821,7 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in } } - if(EMIT(valarray[SG_DESCRIPTION]) && + if(EMIT(valarray[SG_DESCRIPTION]) && daap_wantsmeta(pinfo->meta,metaSongDescription)) { if(transcode) { current += dmap_add_string(current,"asdt","wav audio file"); @@ -827,46 +830,46 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in valarray[SG_DESCRIPTION]); } } - if(EMIT(valarray[SG_TITLE]) && + if(EMIT(valarray[SG_TITLE]) && daap_wantsmeta(pinfo->meta,metaItemName)) current += dmap_add_string(current,"minm",valarray[SG_TITLE]); - if(valarray[SG_DISABLED] && atoi(valarray[SG_DISABLED]) && + if(valarray[SG_DISABLED] && atoi(valarray[SG_DISABLED]) && daap_wantsmeta(pinfo->meta,metaSongDisabled)) current += dmap_add_char(current,"asdb", (char)atoi(valarray[SG_DISABLED])); - if(valarray[SG_SAMPLERATE] && atoi(valarray[SG_SAMPLERATE]) && + if(valarray[SG_SAMPLERATE] && atoi(valarray[SG_SAMPLERATE]) && daap_wantsmeta(pinfo->meta,metaSongSampleRate)) current += dmap_add_int(current,"assr", atoi(valarray[SG_SAMPLERATE])); - if(valarray[SG_FILE_SIZE] && atoi(valarray[SG_FILE_SIZE]) && + if(valarray[SG_FILE_SIZE] && atoi(valarray[SG_FILE_SIZE]) && daap_wantsmeta(pinfo->meta,metaSongSize)) current += dmap_add_int(current,"assz", atoi(valarray[SG_FILE_SIZE])); - if(valarray[SG_SONG_LENGTH] && atoi(valarray[SG_SONG_LENGTH]) && + if(valarray[SG_SONG_LENGTH] && atoi(valarray[SG_SONG_LENGTH]) && daap_wantsmeta(pinfo->meta, metaSongTime)) current += dmap_add_int(current,"astm", atoi(valarray[SG_SONG_LENGTH])); - if(valarray[SG_TOTAL_TRACKS] && atoi(valarray[SG_TOTAL_TRACKS]) && + if(valarray[SG_TOTAL_TRACKS] && atoi(valarray[SG_TOTAL_TRACKS]) && daap_wantsmeta(pinfo->meta, metaSongTrackCount)) current += dmap_add_short(current,"astc", (short)atoi(valarray[SG_TOTAL_TRACKS])); - if(valarray[SG_TRACK] && atoi(valarray[SG_TRACK]) && + if(valarray[SG_TRACK] && atoi(valarray[SG_TRACK]) && daap_wantsmeta(pinfo->meta, metaSongTrackNumber)) current += dmap_add_short(current,"astn", (short)atoi(valarray[SG_TRACK])); - if(valarray[SG_RATING] && atoi(valarray[SG_RATING]) && + if(valarray[SG_RATING] && atoi(valarray[SG_RATING]) && daap_wantsmeta(pinfo->meta, metaSongUserRating)) current += dmap_add_char(current,"asur", (char)atoi(valarray[SG_RATING])); - if(valarray[SG_YEAR] && atoi(valarray[SG_YEAR]) && + if(valarray[SG_YEAR] && atoi(valarray[SG_YEAR]) && daap_wantsmeta(pinfo->meta, metaSongYear)) current += dmap_add_short(current,"asyr", (short)atoi(valarray[SG_YEAR])); diff --git a/src/plugins/rsp.c b/src/plugins/rsp.c index 939b7e14..e85ce52f 100644 --- a/src/plugins/rsp.c +++ b/src/plugins/rsp.c @@ -6,6 +6,10 @@ #include "config.h" #endif +#ifdef HAVE_STDINT_H +#include +#endif + #include #include #include @@ -42,7 +46,7 @@ PLUGIN_REND_INFO _pri[] = { }; PLUGIN_INPUT_FN *_ppi; -PLUGIN_INFO _pi = { +PLUGIN_INFO _pi = { PLUGIN_VERSION, /* version */ PLUGIN_OUTPUT, /* type */ "rsp/" VERSION, /* server */ @@ -57,7 +61,7 @@ typedef struct tag_response { char *uri[10]; void (*dispatch)(WS_CONNINFO *, PRIVINFO *); } PLUGIN_RESPONSE; - + PLUGIN_RESPONSE rsp_uri_map[] = { {{"rsp", "info",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }, rsp_info }, @@ -203,7 +207,7 @@ void plugin_handler(WS_CONNINFO *pwsc) { string = _ppi->ws_uri(pwsc); string++; - + _ppi->log(E_DBG,"Mallocing privinfo...\n"); ppi = (PRIVINFO *)malloc(sizeof(PRIVINFO)); if(ppi) { @@ -239,7 +243,7 @@ void plugin_handler(WS_CONNINFO *pwsc) { if((ppi->uri_sections[part]) && (!rsp_uri_map[index].uri[part])) break; - if((rsp_uri_map[index].uri[part]) && + if((rsp_uri_map[index].uri[part]) && (strcmp(rsp_uri_map[index].uri[part],"*") != 0)) { if(strcmp(rsp_uri_map[index].uri[part], ppi->uri_sections[part])!= 0) @@ -270,7 +274,7 @@ void plugin_handler(WS_CONNINFO *pwsc) { } /** - * get server info + * get server info */ void rsp_info(WS_CONNINFO *pwsc, PRIVINFO *ppi) { XMLSTRUCT *pxml; @@ -308,7 +312,7 @@ void rsp_info(WS_CONNINFO *pwsc, PRIVINFO *ppi) { /** * /rsp/db * - * dump details about all playlists + * dump details about all playlists */ void rsp_db(WS_CONNINFO *pwsc, PRIVINFO *ppi) { XMLSTRUCT *pxml; @@ -384,7 +388,7 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) { if(_ppi->ws_getvar(pwsc,"limit")) { ppi->dq.limit = atoi(_ppi->ws_getvar(pwsc,"limit")); } - + browse_type = _ppi->ws_getvar(pwsc,"type"); type = F_FULL; @@ -414,7 +418,7 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) { returned = 0; } else { returned = ppi->dq.limit; - if(returned > (ppi->dq.totalcount - ppi->dq.offset)) + if(returned > (ppi->dq.totalcount - ppi->dq.offset)) returned = ppi->dq.totalcount - ppi->dq.offset; } @@ -428,7 +432,7 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) { xml_push(pxml,"items"); - while((!done) && (_ppi->db_enum_fetch_row(NULL,&row,&ppi->dq) == 0) && + while((!done) && (_ppi->db_enum_fetch_row(NULL,&row,&ppi->dq) == 0) && (row)) { xml_push(pxml,"item"); rowindex=0; @@ -505,7 +509,7 @@ void rsp_browse(WS_CONNINFO *pwsc, PRIVINFO *ppi) { if(_ppi->ws_getvar(pwsc,"offset")) { ppi->dq.offset = atoi(_ppi->ws_getvar(pwsc,"offset")); } - + if(_ppi->ws_getvar(pwsc,"limit")) { ppi->dq.limit = atoi(_ppi->ws_getvar(pwsc,"limit")); } @@ -524,7 +528,7 @@ void rsp_browse(WS_CONNINFO *pwsc, PRIVINFO *ppi) { returned = 0; } else { returned = ppi->dq.limit; - if(returned > (ppi->dq.totalcount - ppi->dq.offset)) + if(returned > (ppi->dq.totalcount - ppi->dq.offset)) returned = ppi->dq.totalcount - ppi->dq.offset; } diff --git a/src/plugins/ssc-script.c b/src/plugins/ssc-script.c index c476c468..3a454262 100644 --- a/src/plugins/ssc-script.c +++ b/src/plugins/ssc-script.c @@ -6,6 +6,10 @@ # include "config.h" #endif +#ifdef HAVE_STDINT_H +#include +#endif + #include #include #include @@ -85,12 +89,12 @@ PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) { } -/* - * get a new transcode handle +/* + * get a new transcode handle */ void *ssc_script_init(void) { SSCHANDLE *handle; - + handle = (SSCHANDLE*)malloc(sizeof(SSCHANDLE)); if(handle) { memset(handle,0,sizeof(SSCHANDLE)); @@ -109,7 +113,7 @@ char *ssc_script_error(void *vp) { /** * dispose of the transocde handle obtained from init - * + * * @param pv handle to dispose */ void ssc_script_deinit(void *vp) { diff --git a/src/plugins/xml-rpc.c b/src/plugins/xml-rpc.c index 29066cd5..3a97ab7a 100644 --- a/src/plugins/xml-rpc.c +++ b/src/plugins/xml-rpc.c @@ -8,6 +8,10 @@ # include "config.h" #endif +#ifdef HAVE_STDINT_H +#include +#endif + #include #include #include @@ -152,7 +156,7 @@ int xml_stream_write(XMLSTRUCT *pxml, char *out) { psb->strm.avail_out = XML_STREAM_BLOCK; psb->strm.next_out = psb->out_buffer; } - } + } return TRUE; } @@ -169,7 +173,7 @@ int xml_stream_close(XMLSTRUCT *pxml) { psb->strm.next_out = psb->out_buffer; psb->strm.avail_in = 0; psb->strm.next_in = psb->in_buffer; - + deflate(&psb->strm,Z_FINISH); _ppi->ws_writebinary(pxml->pwsc,(char*)psb->out_buffer, XML_STREAM_BLOCK - psb->strm.avail_out); @@ -331,7 +335,7 @@ void xml_deinit(XMLSTRUCT *pxml) { free(pstack->tag); free(pstack); } - + if(pxml->psb) { xml_stream_close(pxml); } diff --git a/src/scan-flac.c b/src/scan-flac.c index a01aa2c4..b49428f6 100644 --- a/src/scan-flac.c +++ b/src/scan-flac.c @@ -29,6 +29,9 @@ #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include @@ -57,7 +60,7 @@ NULL) /** - * scan a flac file for metainfo. + * scan a flac file for metainfo. * * @param filename file to read metainfo for * @param pmp3 MP3FILE structure to fill diff --git a/src/scan-mp3.c b/src/scan-mp3.c index 6b928f6b..fb54af87 100644 --- a/src/scan-mp3.c +++ b/src/scan-mp3.c @@ -26,6 +26,9 @@ #include #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include @@ -306,7 +309,7 @@ int scan_mp3_get_mp3tags(char *file, MP3FILE *pmp3) { DPRINTF(E_WARN,L_SCAN,"Cannot open %s\n",file); return FALSE; } - + pid3file=id3_file_fdopen(mp3_fd,ID3_FILE_MODE_READONLY); if(!pid3file) { DPRINTF(E_WARN,L_SCAN,"Cannot open %s\n",file); diff --git a/src/scan-mpc.c b/src/scan-mpc.c index 7e2cf000..1f4ed766 100644 --- a/src/scan-mpc.c +++ b/src/scan-mpc.c @@ -23,6 +23,9 @@ # include "config.h" #endif +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include @@ -32,7 +35,7 @@ #include "err.h" /** - * scan a musepack file for metainfo. + * scan a musepack file for metainfo. * * @param filename file to read metainfo for * @param pmp3 MP3FILE structure to fill @@ -108,8 +111,8 @@ int scan_get_mpcinfo(char *filename, MP3FILE *pmp3) { pmp3->song_length = taglib_audioproperties_length(properties) * 1000; pmp3->bitrate = taglib_audioproperties_bitrate(properties); pmp3->samplerate = taglib_audioproperties_samplerate(properties); - + taglib_file_free(file); - + return TRUE; } diff --git a/src/scan-ogg.c b/src/scan-ogg.c index f0cc6a9c..d3a0a30e 100644 --- a/src/scan-ogg.c +++ b/src/scan-ogg.c @@ -12,6 +12,9 @@ #endif #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include diff --git a/src/scan-url.c b/src/scan-url.c index 6b7af48f..35fc9a46 100644 --- a/src/scan-url.c +++ b/src/scan-url.c @@ -1,4 +1,4 @@ -/* +/* * $Id$ * * Copyright (C) 2003 Ron Pedde (ron@pedde.com) @@ -23,6 +23,9 @@ #endif #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include @@ -34,7 +37,7 @@ * Get info from a "url" file -- a media stream file. * This should really get more metainfo, but I'll leave that * to later. - * + * * @param filename .url file to process * @param pmp3 MP3FILE structure that must be filled * @returns TRUE if file should be added to db, FALSE otherwise @@ -75,7 +78,7 @@ int scan_get_urlinfo(char *filename, MP3FILE *pmp3) { } *tail++='\0'; - + pmp3->title=strdup(head); pmp3->url=strdup(tail); fclose(infile); diff --git a/src/scan-wav.c b/src/scan-wav.c index dc64f19f..e0d05231 100644 --- a/src/scan-wav.c +++ b/src/scan-wav.c @@ -22,6 +22,9 @@ # include "config.h" #endif +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include diff --git a/src/scan-wma.c b/src/scan-wma.c index 02ed8d37..d6a87252 100644 --- a/src/scan-wma.c +++ b/src/scan-wma.c @@ -25,6 +25,9 @@ #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include @@ -235,8 +238,8 @@ typedef struct tag_wma_header { char reserved1; char reserved2; } _PACKED WMA_HEADER; - - + + typedef struct tag_wma_subheader { unsigned char objectid[16]; long long size; @@ -262,7 +265,7 @@ typedef struct tag_wma_header_extension { /* * Forwards - */ + */ 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); @@ -322,7 +325,7 @@ int wma_file_read_utf16(int fd, int len, char **utf8) { if(!utf16) return 0; - if(r_read(fd,utf16,len) != len) + if(r_read(fd,utf16,len) != len) return 0; out = wma_utf16toutf8(utf16,len); @@ -417,7 +420,7 @@ int wma_parse_stream_properties(int fd, int size, MP3FILE *pmp3) { if(!pguid) return TRUE; - if(strcmp(pguid->name,"ASF_Audio_Media") != 0) + if(strcmp(pguid->name,"ASF_Audio_Media") != 0) return TRUE; /* it is an audio stream... find codec. The Type-Specific @@ -428,7 +431,7 @@ int wma_parse_stream_properties(int fd, int size, MP3FILE *pmp3) { } /** - * parse the audio media section... This is essentially a + * parse the audio media section... This is essentially a * WAVFORMATEX structure. Generally we only care about the * codec type. * @@ -514,9 +517,9 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3, int e DPRINTF(E_DBG,L_SCAN,"Reading descr %d of %d\n",index,descriptor_count); if(!extended) { if(!wma_file_read_short(fd,&descriptor_name_len)) return FALSE; - if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name)) + if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name)) return FALSE; - if(!wma_file_read_short(fd,&descriptor_value_type)) { + if(!wma_file_read_short(fd,&descriptor_value_type)) { free(descriptor_name); return FALSE; } @@ -531,7 +534,7 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3, int e if(!wma_file_read_short(fd,&descriptor_name_len)) return FALSE; if(!wma_file_read_short(fd,&descriptor_value_type)) return FALSE; if(!wma_file_read_int(fd,&descriptor_value_int)) return FALSE; - if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name)) + if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name)) return FALSE; } @@ -631,7 +634,7 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3, int e pmp3->composer = descriptor_byte_value; descriptor_byte_value = NULL; } else { - size = (int)strlen(pmp3->composer) + 1 + + size = (int)strlen(pmp3->composer) + 1 + (int)strlen(descriptor_byte_value) + 1; tmp = malloc(size); if(!tmp) @@ -716,7 +719,7 @@ int wma_parse_content_description(int fd,int size, MP3FILE *pmp3) { return FALSE; DPRINTF(E_DBG,L_SCAN,"Got item of length %d: %s\n",sizes[index],utf8); - + switch(index) { case 0: /* title */ if(pmp3->title) @@ -729,7 +732,7 @@ int wma_parse_content_description(int fd,int size, MP3FILE *pmp3) { pmp3->artist = utf8; break; case 2: /* copyright - dontcare */ - free(utf8); + free(utf8); break; case 3: /* description */ if(pmp3->comment) @@ -761,11 +764,11 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) { unsigned long long play_duration; unsigned long long send_duration; unsigned long long preroll; - + unsigned int max_bitrate; /* skip guid (16 bytes), filesize (8), creation time (8), - * data packets (8) + * data packets (8) */ lseek(fd,40,SEEK_CUR); @@ -787,7 +790,7 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) { * length. */ pmp3->song_length = (int)((play_duration / 10000) - preroll); - + /* skip flags(4), * min_packet_size (4), max_packet_size(4) */ @@ -805,7 +808,7 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) { * convert utf16 string to utf8. This is a bit naive, but... * Since utf-8 can't expand past 4 bytes per code point, and * we're converting utf-16, we can't be more than 2n+1 bytes, so - * we'll just allocate that much. + * we'll just allocate that much. * * Probably it could be more efficiently calculated, but this will * always work. Besides, these are small strings, and will be freed @@ -964,7 +967,7 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) { int err; int res=TRUE; int encrypted = 0; - + wma_fd = r_open2(filename,O_RDONLY); if(wma_fd == -1) { DPRINTF(E_INF,L_SCAN,"Error opening WMA file (%s): %s\n",filename, @@ -998,7 +1001,7 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) { /* Now we just walk through all the headers and see if we * find anything interesting */ - + for(item=0; item < (int) hdr.objects; item++) { if(lseek(wma_fd,offset,SEEK_SET) == (off_t)-1) { DPRINTF(E_INF,L_SCAN,"Error seeking in %s\n",filename); @@ -1061,7 +1064,7 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) { } r_close(wma_fd); - + if(encrypted) { if(pmp3->codectype) diff --git a/src/scan-xml.c b/src/scan-xml.c index 13d01f3a..91184d2a 100644 --- a/src/scan-xml.c +++ b/src/scan-xml.c @@ -25,6 +25,9 @@ #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include @@ -220,7 +223,7 @@ int scan_xml_translate_path(char *pold, char *pnew) { ptemp++; } strcpy(working_path,pold); - + if(!path_found) { DPRINTF(E_DBG,L_SCAN,"Translating %s, base %s\n",pold,scan_xml_file); @@ -690,7 +693,7 @@ int scan_xml_tracks_section(int action, char *info) { if((!is_streaming)&&scan_xml_translate_path(song_path,real_path)) { /* FIXME: Error handling */ pmp3=db_fetch_path(NULL,real_path,0); - if(!pmp3) { + if(!pmp3) { /* file doesn't exist... let's add it? */ scan_filename(real_path,SCAN_TEST_COMPDIR,NULL); pmp3=db_fetch_path(NULL,real_path,0); @@ -734,7 +737,7 @@ int scan_xml_tracks_section(int action, char *info) { DPRINTF(E_DBG,L_SCAN,"Adding %s\n",song_path); pmp3 = calloc(sizeof(MP3FILE),1); - if(!pmp3) + if(!pmp3) DPRINTF(E_FATAL,L_SCAN, "malloc: scan_xml_tracks_section\n"); } else { @@ -761,7 +764,7 @@ int scan_xml_tracks_section(int action, char *info) { MAYBECOPY(time_added); MAYBECOPY(disabled); MAYBECOPYSTRING(album_artist); - + make_composite_tags(pmp3); if(db_add(NULL,pmp3,&added_id) == DB_E_SUCCESS) { scan_xml_add_lookup(current_track_id,added_id); @@ -944,7 +947,7 @@ int scan_xml_playlists_section(int action, char *info) { DPRINTF(E_LOG,L_SCAN,"err adding playlist %s\n",current_name); current_id=0; } - } + } dont_scan=0; state=XML_PL_ST_EXPECTING_PL_TRACKLIST; return XML_STATE_PLAYLISTS; diff --git a/src/xml-rpc.c b/src/xml-rpc.c index 2acd92e1..68418d92 100644 --- a/src/xml-rpc.c +++ b/src/xml-rpc.c @@ -13,6 +13,9 @@ #endif #include #include +#ifdef HAVE_STDINT_H +#include +#endif #include #include #include @@ -460,7 +463,7 @@ void xml_browse_path(WS_CONNINFO *pwsc) { continue; /* skip symlinks and devices and whatnot */ - if((!(sb.st_mode & S_IFDIR)) && + if((!(sb.st_mode & S_IFDIR)) && (!(sb.st_mode & S_IFREG))) continue;