aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2016-10-07 08:55:18 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2016-10-07 08:55:18 +0200
commit27938d111e2f49ed3e8c39647d9a8fbc1482a686 (patch)
tree073f0cf2ebab7d7eb68a414fc553f0723da72b86 /src/common
parent8ef966aa21f58c867a9dd8b60108e489c1dc2f8f (diff)
Added and fixed extra compiler warnings
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Makefile.am2
-rw-r--r--src/common/call.c4
-rw-r--r--src/common/debug.c2
-rw-r--r--src/common/sound_alsa.c6
-rw-r--r--src/common/testton.c4
-rw-r--r--src/common/wave.c10
6 files changed, 14 insertions, 14 deletions
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 5941b09..bd569d3 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -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
diff --git a/src/common/call.c b/src/common/call.c
index 3b462a9..7817502 100644
--- a/src/common/call.c
+++ b/src/common/call.c
@@ -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;
diff --git a/src/common/debug.c b/src/common/debug.c
index dfbc368..b49e056 100644
--- a/src/common/debug.c
+++ b/src/common/debug.c
@@ -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;
diff --git a/src/common/sound_alsa.c b/src/common/sound_alsa.c
index 8762f1a..63fcd06 100644
--- a/src/common/sound_alsa.c
+++ b/src/common/sound_alsa.c
@@ -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);
}
diff --git a/src/common/testton.c b/src/common/testton.c
index 6ce0d89..87f866f 100644
--- a/src/common/testton.c
+++ b/src/common/testton.c
@@ -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;
}
diff --git a/src/common/wave.c b/src/common/wave.c
index 572f989..2365078 100644
--- a/src/common/wave.c
+++ b/src/common/wave.c
@@ -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;
}