From 2a511a64fc9f454a58782414c4c44af9c1b903d2 Mon Sep 17 00:00:00 2001 From: moritz Date: Thu, 1 Mar 2007 14:50:14 +0000 Subject: [PATCH] Enable more warnings on gcc, and do some miscellaneous cleanups. git-svn-id: https://svn.xiph.org/trunk/ezstream@12597 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- configure.in | 2 +- src/ezstream.c | 35 ++++++++++++++++++----------------- src/playlist.c | 1 - src/strlcat.c | 1 + src/strlcpy.c | 1 + src/util.c | 1 - 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/configure.in b/configure.in index 75394aa..65d50a5 100644 --- a/configure.in +++ b/configure.in @@ -37,7 +37,7 @@ if test -z "$GCC"; then ;; esac else - XIPH_CPPFLAGS="-Wall -Wwrite-strings -Wpointer-arith" + XIPH_CPPFLAGS="-Wall -Wwrite-strings -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" fi diff --git a/src/ezstream.c b/src/ezstream.c index 94a57ce..b03a5cd 100644 --- a/src/ezstream.c +++ b/src/ezstream.c @@ -103,22 +103,6 @@ const int ezstream_signals[] = { SIGHUP, SIGUSR1 }; volatile sig_atomic_t rereadPlaylist = 0; volatile sig_atomic_t rereadPlaylist_notify = 0; volatile sig_atomic_t skipTrack = 0; - -void -sig_handler(int sig) -{ - switch (sig) { - case SIGHUP: - rereadPlaylist = 1; - rereadPlaylist_notify = 1; - break; - case SIGUSR1: - skipTrack = 1; - break; - default: - break; - } -} #else int rereadPlaylist = 0; int rereadPlaylist_notify = 0; @@ -135,6 +119,7 @@ typedef struct tag_ID3Tag { char genre; } ID3Tag; +void sig_handler(int); #ifdef WIN32 char * basename(const char *); #endif @@ -152,6 +137,22 @@ char * getProgname(const char *); void usage(void); void usageHelp(void); +void +sig_handler(int sig) +{ + switch (sig) { + case SIGHUP: + rereadPlaylist = 1; + rereadPlaylist_notify = 1; + break; + case SIGUSR1: + skipTrack = 1; + break; + default: + break; + } +} + #ifdef WIN32 char * basename(const char *fileName) @@ -225,7 +226,7 @@ replaceString(const char *source, char *dest, size_t size, p2 = strstr(p1, from); if (p2 != NULL) { - if (p2 - p1 >= size) { + if ((unsigned int)(p2 - p1) >= size) { printf("%s: replaceString(): Internal error: p2 - p1 >= size\n", __progname); abort(); diff --git a/src/playlist.c b/src/playlist.c index dd697ac..f639829 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -49,7 +49,6 @@ # define PATH_MAX 256 #endif -extern int errno; extern char *__progname; struct playlist { diff --git a/src/strlcat.c b/src/strlcat.c index 21f94da..c9317c3 100644 --- a/src/strlcat.c +++ b/src/strlcat.c @@ -24,6 +24,7 @@ # include #endif #include +#include "strlfctns.h" /* * Appends src to string dst of size siz (unlike strncat, siz is the diff --git a/src/strlcpy.c b/src/strlcpy.c index f91bf50..c64ca2a 100644 --- a/src/strlcpy.c +++ b/src/strlcpy.c @@ -24,6 +24,7 @@ # include #endif #include +#include "strlfctns.h" /* * Copy src to string dst of size siz. At most siz-1 characters diff --git a/src/util.c b/src/util.c index d90b58f..aca273c 100644 --- a/src/util.c +++ b/src/util.c @@ -33,7 +33,6 @@ # define SIZE_T_MAX UINT_MAX #endif -extern int errno; extern char *__progname; void *