Added and fixed extra compiler warnings

This commit is contained in:
Andreas Eversberg
2016-10-07 08:55:18 +02:00
parent 8ef966aa21
commit 27938d111e
31 changed files with 90 additions and 89 deletions

View File

@@ -1,5 +1,5 @@
AUTOMAKE_OPTIONS = subdir-objects
AM_CPPFLAGS = -Wall -g $(all_includes)
AM_CPPFLAGS = -Wall -Wextra -g $(all_includes)
noinst_LIBRARIES = libcommon.a

View File

@@ -525,14 +525,14 @@ static void process_ui(int c)
switch (call.state) {
case CALL_IDLE:
if (c > 0) {
if (c >= '0' && c <= '9' && strlen(call.station_id) < call.dial_digits) {
if (c >= '0' && c <= '9' && (int)strlen(call.station_id) < call.dial_digits) {
call.station_id[strlen(call.station_id) + 1] = '\0';
call.station_id[strlen(call.station_id)] = c;
}
if ((c == 8 || c == 127) && strlen(call.station_id))
call.station_id[strlen(call.station_id) - 1] = '\0';
dial_after_hangup:
if (c == 'd' && strlen(call.station_id) == call.dial_digits) {
if (c == 'd' && (int)strlen(call.station_id) == call.dial_digits) {
int rc;
int callref = ++new_callref;

View File

@@ -60,7 +60,7 @@ int debuglevel = DEBUG_INFO;
uint64_t debug_mask = ~0;
extern int num_kanal;
void _printdebug(const char *file, const char *function, int line, int cat, int level, int chan, const char *fmt, ...)
void _printdebug(const char *file, const char __attribute__((unused)) *function, int line, int cat, int level, int chan, const char *fmt, ...)
{
char buffer[4096], *b = buffer;
const char *p;

View File

@@ -70,7 +70,7 @@ static int set_hw_params(snd_pcm_t *handle, int samplerate, int *channels)
PDEBUG(DSOUND, DEBUG_ERROR, "cannot set sample rate (%s)\n", snd_strerror(rc));
goto error;
}
if (rrate != samplerate) {
if ((int)rrate != samplerate) {
PDEBUG(DSOUND, DEBUG_ERROR, "Rate doesn't match (requested %dHz, get %dHz)\n", samplerate, rrate);
rc = -EIO;
goto error;
@@ -180,9 +180,9 @@ void sound_close(void *inst)
{
sound_t *sound = (sound_t *)inst;
if (sound->phandle > 0)
if (sound->phandle != NULL)
snd_pcm_close(sound->phandle);
if (sound->chandle > 0)
if (sound->chandle != NULL)
snd_pcm_close(sound->chandle);
free(sound);
}

View File

@@ -1,6 +1,6 @@
#include <stdint.h>
static int16_t pattern[] = {
static uint16_t pattern[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0000,
0x0000, 0x0000, 0x0001, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0000, 0xffff,
@@ -30069,7 +30069,7 @@ extern int test_max;
void init_testton(void)
{
test_spl = pattern;
test_spl = (int16_t *)pattern;
test_size = sizeof(pattern) / sizeof(pattern[0]);
test_max = test_size;
}

View File

@@ -60,7 +60,7 @@ int wave_create_playback(wave_play_t *play, const char *filename, int samplerate
{
uint8_t buffer[256];
struct fmt fmt;
uint32_t size, chunk, len;
int32_t size, chunk, len;
int gotfmt = 0, gotdata = 0;
int rc = -EINVAL;
@@ -110,7 +110,7 @@ int wave_create_playback(wave_play_t *play, const char *filename, int samplerate
goto error;
}
if (!strncmp((char *)buffer, "fmt ", 4)) {
if (chunk < 16 || chunk > sizeof(buffer)) {
if (chunk < 16 || chunk > (int)sizeof(buffer)) {
fprintf(stderr, "WAVE error: Short or corrupt 'fmt' chunk!\n");
rc = -EINVAL;
goto error;
@@ -133,7 +133,7 @@ int wave_create_playback(wave_play_t *play, const char *filename, int samplerate
gotdata = 1;
break;
} else {
while(chunk > sizeof(buffer)) {
while(chunk > (int)sizeof(buffer)) {
len = fread(buffer, 1, sizeof(buffer), play->fp);
chunk -= sizeof(buffer);
}
@@ -158,7 +158,7 @@ int wave_create_playback(wave_play_t *play, const char *filename, int samplerate
rc = -EINVAL;
goto error;
}
if (fmt.sample_rate != samplerate) {
if ((int)fmt.sample_rate != samplerate) {
fprintf(stderr, "WAVE error: The WAVE file's sample rate (%d) does not match our sample rate (%d)!\n", fmt.sample_rate, samplerate);
rc = -EINVAL;
goto error;
@@ -187,7 +187,7 @@ int wave_read(wave_play_t *play, int16_t *samples, int length)
int __attribute__((__unused__)) len;
int i;
if (length > play->left) {
if (length > (int)play->left) {
memset(samples, 0, length << 1);
length = play->left;
}