diff --git a/src/configfile.c b/src/configfile.c index 9a2e9a7..53cb7ab 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -468,7 +468,7 @@ parseConfig(const char *fileName) xmlNodePtr cur3; FORMAT_ENCDEC *pformatEncDec; - pformatEncDec = xcalloc(1, sizeof(FORMAT_ENCDEC)); + pformatEncDec = xcalloc(1UL, sizeof(FORMAT_ENCDEC)); for (cur3 = cur2->xmlChildrenNode; cur3 != NULL; cur3 = cur3->next) { diff --git a/src/ezstream.c b/src/ezstream.c index acc8abb..e2579b7 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -116,9 +116,9 @@ char * getMetadataString(const char *, metadata_t *); metadata_t * getMetadata(const char *); int setMetadata(shout_t *, metadata_t *, char **); FILE * openResource(shout_t *, const char *, int *, metadata_t **, - int *, int *); + int *, long *); int reconnectServer(shout_t *, int); -const char * getTimeString(int); +const char * getTimeString(long); int sendStream(shout_t *, FILE *, const char *, int, const char *, struct timeval *); int streamFile(shout_t *, const char *); @@ -568,7 +568,7 @@ setMetadata(shout_t *shout, metadata_t *mdata, char **mdata_copy) FILE * openResource(shout_t *shout, const char *fileName, int *popenFlag, - metadata_t **mdata_p, int *isStdin, int *songLen) + metadata_t **mdata_p, int *isStdin, long *songLen) { FILE *filep = NULL; char extension[25]; @@ -743,10 +743,10 @@ reconnectServer(shout_t *shout, int closeConn) } const char * -getTimeString(int seconds) +getTimeString(long seconds) { static char str[20]; - int secs, mins, hours; + long secs, mins, hours; if (seconds < 0) return (NULL); @@ -757,7 +757,7 @@ getTimeString(int seconds) mins = secs / 60; secs %= 60; - snprintf(str, sizeof(str), "%uh%02um%02us", hours, mins, secs); + snprintf(str, sizeof(str), "%ldh%02ldm%02lds", hours, mins, secs); return ((const char *)str); } @@ -782,7 +782,7 @@ sendStream(shout_t *shout, FILE *filepstream, const char *fileName, total = oldTotal = 0; ret = STREAM_DONE; - while ((bytes_read = fread(buff, 1, sizeof(buff), filepstream)) > 0) { + while ((bytes_read = fread(buff, 1UL, sizeof(buff), filepstream)) > 0) { if (shout_get_connected(shout) != SHOUTERR_CONNECTED && reconnectServer(shout, 0) == 0) { ret = STREAM_SERVERR; @@ -889,7 +889,8 @@ streamFile(shout_t *shout, const char *fileName) int popenFlag = 0; char *songLenStr = NULL; int isStdin = 0; - int ret, retval = 0, songLen; + int ret, retval = 0; + long songLen; metadata_t *mdata; struct timeval startTime; diff --git a/src/metadata.c b/src/metadata.c index 00df414..cde98bc 100644 --- a/src/metadata.c +++ b/src/metadata.c @@ -84,7 +84,7 @@ metadata_create(const char *filename) { metadata_t *md; - md = xcalloc(1, sizeof(metadata_t)); + md = xcalloc(1UL, sizeof(metadata_t)); md->filename = xstrdup(filename); md->songLen = -1; @@ -572,7 +572,7 @@ metadata_program_update(metadata_t *md, enum metadata_request md_req) return (0); } - if (fgets(buf, sizeof(buf), filep) == NULL) { + if (fgets(buf, (int)sizeof(buf), filep) == NULL) { if (ferror(filep)) printf("%s: Error while reading output from program '%s': %s\n", __progname, md->filename, strerror(errno)); diff --git a/src/playlist.c b/src/playlist.c index 265870d..f4e8404 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -57,7 +57,7 @@ playlist_create(const char *filename) { playlist_t *pl; - pl = xcalloc(1, sizeof(playlist_t)); + pl = xcalloc(1UL, sizeof(playlist_t)); pl->filename = xstrdup(filename); return (pl); @@ -77,14 +77,14 @@ playlist_add(playlist_t *pl, const char *entry) num = pl->num + 1; if (pl->size == 0) { - pl->list = xcalloc(2, sizeof(char *)); + pl->list = xcalloc(2UL, sizeof(char *)); pl->size = 2 * sizeof(char *); } if (pl->size / sizeof(char *) <= num) { size_t i; - pl->list = xrealloc(pl->list, 2, pl->size); + pl->list = xrealloc(pl->list, 2UL, pl->size); pl->size = 2 * pl->size; for (i = num; i < pl->size / sizeof(char *); i++) @@ -146,7 +146,7 @@ playlist_read(const char *filename) } line = 0; - while (fgets(buf, sizeof(buf), filep) != NULL) { + while (fgets(buf, (int)sizeof(buf), filep) != NULL) { line++; if (strlen(buf) == sizeof(buf) - 1) { @@ -155,7 +155,7 @@ playlist_read(const char *filename) printf("%s[%lu]: File or path name too long\n", filename, line); /* Discard any excess chars in that line. */ - while (fgets(skip_buf, sizeof(skip_buf), filep) != NULL) { + while (fgets(skip_buf, (int)sizeof(skip_buf), filep) != NULL) { if (skip_buf[0] == '\n') break; } @@ -504,7 +504,7 @@ playlist_run_program(playlist_t *pl) return (NULL); } - if (fgets(buf, sizeof(buf), filep) == NULL) { + if (fgets(buf, (int)sizeof(buf), filep) == NULL) { if (ferror(filep)) printf("%s: Error while reading output from program '%s': %s\n", __progname, pl->filename, strerror(errno)); diff --git a/src/util.c b/src/util.c index 257d7ff..053618e 100644 --- a/src/util.c +++ b/src/util.c @@ -237,7 +237,7 @@ CHARtoUTF8(const char *in_str, int mode) # if defined(HAVE_NL_LANGINFO) && defined(HAVE_SETLOCALE) && defined(CODESET) setlocale(LC_CTYPE, ""); - codeset = nl_langinfo(CODESET); + codeset = nl_langinfo((nl_item)CODESET); setlocale(LC_CTYPE, "C"); # else codeset = (char *)""; @@ -259,7 +259,7 @@ UTF8toCHAR(const char *in_str, int mode) # if defined(HAVE_NL_LANGINFO) && defined(HAVE_SETLOCALE) && defined(CODESET) setlocale(LC_CTYPE, ""); - codeset = nl_langinfo(CODESET); + codeset = nl_langinfo((nl_item)CODESET); setlocale(LC_CTYPE, "C"); # else codeset = (char *)"";