summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/alsa.c15
-rw-r--r--src/canberra-gtk-module.c4
-rw-r--r--src/dso.c2
-rw-r--r--src/malloc.c6
-rw-r--r--src/proplist.c14
-rw-r--r--src/pulse.c8
-rw-r--r--src/read-sound-file.c14
-rw-r--r--src/read-sound-file.h6
-rw-r--r--src/read-vorbis.c30
-rw-r--r--src/read-vorbis.h4
-rw-r--r--src/read-wav.c41
-rw-r--r--src/read-wav.h6
-rw-r--r--src/sound-theme-spec.c6
14 files changed, 80 insertions, 78 deletions
diff --git a/configure.ac b/configure.ac
index 0253cbe..01ac888 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ AC_GNU_SOURCE
AC_PROG_CXX
-DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -ffast-math"
+DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wbad-function-cast -Wunreachable-code -Wno-long-long -Wvla -Wno-overlength-strings -Wconversion -Wundef -Wformat -Wlogical-op -Wmissing-format-attribute -Wpacked -Waggregate-return -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -ffast-math"
for flag in $DESIRED_FLAGS ; do
CC_CHECK_CFLAGS([$flag], [CFLAGS="$CFLAGS $flag"])
diff --git a/src/alsa.c b/src/alsa.c
index a8b8a56..21da013 100644
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -292,13 +292,13 @@ static void* thread_func(void *userdata) {
goto finish;
}
- n_pfd = ret + 1;
+ n_pfd = (nfds_t) ret + 1;
if (!(pfd = ca_new(struct pollfd, n_pfd))) {
ret = CA_ERROR_OOM;
goto finish;
}
- if ((ret = snd_pcm_poll_descriptors(out->pcm, pfd+1, n_pfd-1)) < 0) {
+ if ((ret = snd_pcm_poll_descriptors(out->pcm, pfd+1, (unsigned) n_pfd-1)) < 0) {
ret = translate_error(ret);
goto finish;
}
@@ -309,6 +309,7 @@ static void* thread_func(void *userdata) {
for (;;) {
unsigned short revents;
+ snd_pcm_sframes_t sframes;
if (out->dead)
break;
@@ -322,7 +323,7 @@ static void* thread_func(void *userdata) {
if (pfd[0].revents)
break;
- if ((ret = snd_pcm_poll_descriptors_revents(out->pcm, pfd+1, n_pfd-1, &revents)) < 0) {
+ if ((ret = snd_pcm_poll_descriptors_revents(out->pcm, pfd+1, (unsigned) n_pfd-1, &revents)) < 0) {
ret = translate_error(ret);
goto finish;
}
@@ -376,9 +377,9 @@ static void* thread_func(void *userdata) {
break;
}
- if ((ret = snd_pcm_writei(out->pcm, d, nbytes/fs)) < 0) {
+ if ((sframes = snd_pcm_writei(out->pcm, d, nbytes/fs)) < 0) {
- if ((ret = snd_pcm_recover(out->pcm, ret, 1)) < 0) {
+ if ((ret = snd_pcm_recover(out->pcm, (int) sframes, 1)) < 0) {
ret = translate_error(ret);
goto finish;
}
@@ -386,8 +387,8 @@ static void* thread_func(void *userdata) {
continue;
}
- nbytes -= ret*fs;
- d = (uint8_t*) d + ret*fs;
+ nbytes -= (size_t) sframes*fs;
+ d = (uint8_t*) d + (size_t) sframes*fs;
}
ret = CA_SUCCESS;
diff --git a/src/canberra-gtk-module.c b/src/canberra-gtk-module.c
index d82d34e..49cded7 100644
--- a/src/canberra-gtk-module.c
+++ b/src/canberra-gtk-module.c
@@ -30,9 +30,9 @@
typedef struct {
guint signal_id;
+ gboolean arg1_is_set;
GObject *object;
GValue arg1;
- gboolean arg1_is_set;
GdkEvent *event;
} SoundEventData;
@@ -80,7 +80,7 @@ static gboolean disabled = FALSE;
static GQueue sound_event_queue = G_QUEUE_INIT;
-static int idle_id = 0;
+static guint idle_id = 0;
static guint
signal_id_dialog_response,
diff --git a/src/dso.c b/src/dso.c
index 0b9c0ee..d1f8df0 100644
--- a/src/dso.c
+++ b/src/dso.c
@@ -79,7 +79,7 @@ static int ca_error_from_lt_error(int code) {
static int lt_error_from_string(const char *t) {
struct lt_error_code {
- unsigned code;
+ int code;
const char *text;
};
diff --git a/src/malloc.c b/src/malloc.c
index 2a15b70..e32cc1b 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -29,7 +29,7 @@
#include "macro.h"
char *ca_sprintf_malloc(const char *format, ...) {
- int size = 100;
+ size_t size = 100;
char *c = NULL;
ca_assert(format);
@@ -49,11 +49,11 @@ char *ca_sprintf_malloc(const char *format, ...) {
c[size-1] = 0;
- if (r > -1 && r < size)
+ if (r > -1 && (size_t) r < size)
return c;
if (r > -1) /* glibc 2.1 */
- size = r+1;
+ size = (size_t) r+1;
else /* glibc 2.0 */
size *= 2;
}
diff --git a/src/proplist.c b/src/proplist.c
index 15c6993..4488c57 100644
--- a/src/proplist.c
+++ b/src/proplist.c
@@ -33,7 +33,7 @@ static unsigned calc_hash(const char *c) {
unsigned hash = 0;
for (; *c; c++)
- hash = 31 * hash + *c;
+ hash = 31 * hash + (unsigned) *c;
return hash;
}
@@ -134,7 +134,7 @@ int ca_proplist_setf(ca_proplist *p, const char *key, const char *format, ...) {
int ret;
char *k;
ca_prop *prop;
- int size = 100;
+ size_t size = 100;
unsigned h;
ca_return_val_if_fail(p, CA_ERROR_INVALID);
@@ -160,13 +160,13 @@ int ca_proplist_setf(ca_proplist *p, const char *key, const char *format, ...) {
((char*) CA_PROP_DATA(prop))[size-1] = 0;
- if (r > -1 && r < size) {
- prop->nbytes = r+1;
+ if (r > -1 && (size_t) r < size) {
+ prop->nbytes = (size_t) r+1;
break;
}
if (r > -1) /* glibc 2.1 */
- size = r+1;
+ size = (size_t) r+1;
else /* glibc 2.0 */
size *= 2;
@@ -359,8 +359,8 @@ int ca_proplist_merge(ca_proplist **_a, ca_proplist *b, ca_proplist *c) {
ca_bool_t ca_proplist_contains(ca_proplist *p, const char *key) {
ca_bool_t b;
- ca_return_val_if_fail(p, CA_ERROR_INVALID);
- ca_return_val_if_fail(key, CA_ERROR_INVALID);
+ ca_return_val_if_fail(p, FALSE);
+ ca_return_val_if_fail(key, FALSE);
ca_mutex_lock(p->mutex);
b = !!ca_proplist_get_unlocked(p, key);
diff --git a/src/pulse.c b/src/pulse.c
index 04eac0d..067a63d 100644
--- a/src/pulse.c
+++ b/src/pulse.c
@@ -522,7 +522,7 @@ static void stream_drain_cb(pa_stream *s, int success, void *userdata) {
p = PRIVATE(out->context);
- ca_assert(out->type = OUTSTANDING_STREAM);
+ ca_assert(out->type == OUTSTANDING_STREAM);
ca_assert(out->clean_up);
ca_mutex_lock(p->outstanding_mutex);
@@ -748,7 +748,7 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal
goto finish;
ss.format = sample_type_table[ca_sound_file_get_sample_type(out->file)];
- ss.channels = ca_sound_file_get_nchannels(out->file);
+ ss.channels = (uint8_t) ca_sound_file_get_nchannels(out->file);
ss.rate = ca_sound_file_get_rate(out->file);
if (!name) {
@@ -947,7 +947,7 @@ int driver_cache(ca_context *c, ca_proplist *proplist) {
goto finish;
ss.format = sample_type_table[ca_sound_file_get_sample_type(out->file)];
- ss.channels = ca_sound_file_get_nchannels(out->file);
+ ss.channels = (uint8_t) ca_sound_file_get_nchannels(out->file);
ss.rate = ca_sound_file_get_rate(out->file);
pa_threaded_mainloop_lock(p->mainloop);
@@ -961,7 +961,7 @@ int driver_cache(ca_context *c, ca_proplist *proplist) {
pa_stream_set_state_callback(out->stream, stream_state_cb, out);
pa_stream_set_write_callback(out->stream, stream_write_cb, out);
- if (pa_stream_connect_upload(out->stream, ca_sound_file_get_size(out->file)) < 0) {
+ if (pa_stream_connect_upload(out->stream, (size_t) ca_sound_file_get_size(out->file)) < 0) {
ret = translate_error(pa_context_errno(p->context));
pa_threaded_mainloop_unlock(p->mainloop);
goto finish;
diff --git a/src/read-sound-file.c b/src/read-sound-file.c
index d1c718b..bbadb02 100644
--- a/src/read-sound-file.c
+++ b/src/read-sound-file.c
@@ -121,7 +121,7 @@ ca_sample_type_t ca_sound_file_get_sample_type(ca_sound_file *f) {
return f->type;
}
-int ca_sound_file_read_int16(ca_sound_file *f, int16_t *d, unsigned *n) {
+int ca_sound_file_read_int16(ca_sound_file *f, int16_t *d, size_t *n) {
ca_return_val_if_fail(f, CA_ERROR_INVALID);
ca_return_val_if_fail(d, CA_ERROR_INVALID);
ca_return_val_if_fail(n, CA_ERROR_INVALID);
@@ -135,7 +135,7 @@ int ca_sound_file_read_int16(ca_sound_file *f, int16_t *d, unsigned *n) {
return ca_vorbis_read_s16ne(f->vorbis, d, n);
}
-int ca_sound_file_read_uint8(ca_sound_file *f, uint8_t *d, unsigned *n) {
+int ca_sound_file_read_uint8(ca_sound_file *f, uint8_t *d, size_t *n) {
ca_return_val_if_fail(f, CA_ERROR_INVALID);
ca_return_val_if_fail(d, CA_ERROR_INVALID);
ca_return_val_if_fail(n, CA_ERROR_INVALID);
@@ -160,7 +160,7 @@ int ca_sound_file_read_arbitrary(ca_sound_file *f, void *d, size_t *n) {
switch (f->type) {
case CA_SAMPLE_S16NE:
case CA_SAMPLE_S16RE: {
- unsigned k;
+ size_t k;
k = *n / sizeof(int16_t);
if ((ret = ca_sound_file_read_int16(f, d, &k)) == CA_SUCCESS)
@@ -170,7 +170,7 @@ int ca_sound_file_read_arbitrary(ca_sound_file *f, void *d, size_t *n) {
}
case CA_SAMPLE_U8: {
- unsigned k;
+ size_t k;
k = *n;
if ((ret = ca_sound_file_read_uint8(f, d, &k)) == CA_SUCCESS)
@@ -186,8 +186,8 @@ int ca_sound_file_read_arbitrary(ca_sound_file *f, void *d, size_t *n) {
return ret;
}
-size_t ca_sound_file_get_size(ca_sound_file *f) {
- ca_return_val_if_fail(f, CA_ERROR_INVALID);
+off_t ca_sound_file_get_size(ca_sound_file *f) {
+ ca_return_val_if_fail(f, (off_t) -1);
if (f->wav)
return ca_wav_get_size(f->wav);
@@ -202,5 +202,5 @@ size_t ca_sound_file_frame_size(ca_sound_file *f) {
c = ca_sound_file_get_nchannels(f);
- return c * (ca_sound_file_get_sample_type(f) == CA_SAMPLE_U8 ? 1 : 2);
+ return c * (ca_sound_file_get_sample_type(f) == CA_SAMPLE_U8 ? 1U : 2U);
}
diff --git a/src/read-sound-file.h b/src/read-sound-file.h
index fe9d76a..2107c56 100644
--- a/src/read-sound-file.h
+++ b/src/read-sound-file.h
@@ -39,10 +39,10 @@ unsigned ca_sound_file_get_nchannels(ca_sound_file *f);
unsigned ca_sound_file_get_rate(ca_sound_file *f);
ca_sample_type_t ca_sound_file_get_sample_type(ca_sound_file *f);
-size_t ca_sound_file_get_size(ca_sound_file *f);
+off_t ca_sound_file_get_size(ca_sound_file *f);
-int ca_sound_file_read_int16(ca_sound_file *f, int16_t *d, unsigned *n);
-int ca_sound_file_read_uint8(ca_sound_file *f, uint8_t *d, unsigned *n);
+int ca_sound_file_read_int16(ca_sound_file *f, int16_t *d, size_t *n);
+int ca_sound_file_read_uint8(ca_sound_file *f, uint8_t *d, size_t *n);
int ca_sound_file_read_arbitrary(ca_sound_file *f, void *d, size_t *n);
diff --git a/src/read-vorbis.c b/src/read-vorbis.c
index 6bafd54..e450cb7 100644
--- a/src/read-vorbis.c
+++ b/src/read-vorbis.c
@@ -30,11 +30,11 @@
#include "macro.h"
#include "malloc.h"
-#define FILE_SIZE_MAX (64U*1024U*1024U)
+#define FILE_SIZE_MAX ((off_t) (64U*1024U*1024U))
struct ca_vorbis {
OggVorbis_File ovf;
- size_t size;
+ off_t size;
};
static int convert_error(int or) {
@@ -87,13 +87,13 @@ int ca_vorbis_open(ca_vorbis **_v, FILE *f) {
goto fail;
}
- if (n * sizeof(int16_t) > FILE_SIZE_MAX) {
+ if (((off_t) n * (off_t) sizeof(int16_t)) > FILE_SIZE_MAX) {
ret = CA_ERROR_TOOBIG;
ov_clear(&v->ovf);
goto fail;
}
- v->size = n * sizeof(int16_t) * ca_vorbis_get_nchannels(v);
+ v->size = (off_t) n * (off_t) sizeof(int16_t) * ca_vorbis_get_nchannels(v);
*_v = v;
@@ -118,7 +118,7 @@ unsigned ca_vorbis_get_nchannels(ca_vorbis *v) {
ca_assert_se(vi = ov_info(&v->ovf, -1));
- return vi->channels;
+ return (unsigned) vi->channels;
}
unsigned ca_vorbis_get_rate(ca_vorbis *v) {
@@ -130,7 +130,7 @@ unsigned ca_vorbis_get_rate(ca_vorbis *v) {
return (unsigned) vi->rate;
}
-int ca_vorbis_read_s16ne(ca_vorbis *v, int16_t *d, unsigned *n){
+int ca_vorbis_read_s16ne(ca_vorbis *v, int16_t *d, size_t *n){
long r;
int section;
int length;
@@ -141,7 +141,7 @@ int ca_vorbis_read_s16ne(ca_vorbis *v, int16_t *d, unsigned *n){
ca_return_val_if_fail(n, CA_ERROR_INVALID);
ca_return_val_if_fail(*n > 0, CA_ERROR_INVALID);
- length = *n * sizeof(int16_t);
+ length = (int) (*n * sizeof(int16_t));
do {
@@ -154,7 +154,7 @@ int ca_vorbis_read_s16ne(ca_vorbis *v, int16_t *d, unsigned *n){
2, 1, &section);
if (r < 0)
- return convert_error(r);
+ return convert_error((int) r);
if (r == 0)
break;
@@ -163,22 +163,22 @@ int ca_vorbis_read_s16ne(ca_vorbis *v, int16_t *d, unsigned *n){
if (section != 0)
break;
- length -= r;
+ length -= (int) r;
d += r/sizeof(int16_t);
- n_read += r;
+ n_read += (size_t) r;
} while (length >= 4096);
- ca_assert(v->size >= n_read);
- v->size -= n_read;
+ ca_assert(v->size >= (off_t) n_read);
+ v->size -= (off_t) n_read;
- *n = (unsigned) n_read/sizeof(int16_t);
+ *n = n_read/sizeof(int16_t);
return CA_SUCCESS;
}
-size_t ca_vorbis_get_size(ca_vorbis *v) {
- ca_return_val_if_fail(v, CA_ERROR_INVALID);
+off_t ca_vorbis_get_size(ca_vorbis *v) {
+ ca_return_val_if_fail(v, (off_t) -1);
return v->size;
}
diff --git a/src/read-vorbis.h b/src/read-vorbis.h
index ada9d25..c98c7e5 100644
--- a/src/read-vorbis.h
+++ b/src/read-vorbis.h
@@ -32,8 +32,8 @@ void ca_vorbis_close(ca_vorbis *v);
unsigned ca_vorbis_get_nchannels(ca_vorbis *v);
unsigned ca_vorbis_get_rate(ca_vorbis *v);
-int ca_vorbis_read_s16ne(ca_vorbis *v, int16_t *d, unsigned *n);
+int ca_vorbis_read_s16ne(ca_vorbis *v, int16_t *d, size_t *n);
-size_t ca_vorbis_get_size(ca_vorbis *f);
+off_t ca_vorbis_get_size(ca_vorbis *f);
#endif
diff --git a/src/read-wav.c b/src/read-wav.c
index 3d78255..dbb662a 100644
--- a/src/read-wav.c
+++ b/src/read-wav.c
@@ -30,9 +30,9 @@
#define FILE_SIZE_MAX (64U*1024U*1024U)
struct ca_wav {
- uint32_t data_size;
FILE *file;
+ off_t data_size;
unsigned nchannels;
unsigned rate;
unsigned depth;
@@ -45,7 +45,7 @@ static int skip_to_chunk(ca_wav *w, uint32_t id, uint32_t *size) {
for (;;) {
uint32_t chunk[2];
- size_t s;
+ uint32_t s;
if (fread(chunk, sizeof(uint32_t), CA_ELEMENTSOF(chunk), w->file) != CA_ELEMENTSOF(chunk))
goto fail_io;
@@ -80,7 +80,7 @@ int ca_wav_open(ca_wav **_w, FILE *f) {
uint32_t header[3], fmt_chunk[4];
int ret;
ca_wav *w;
- uint32_t file_size, fmt_size;
+ uint32_t file_size, fmt_size, data_size;
ca_return_val_if_fail(_w, CA_ERROR_INVALID);
ca_return_val_if_fail(f, CA_ERROR_INVALID);
@@ -138,8 +138,9 @@ int ca_wav_open(ca_wav **_w, FILE *f) {
}
/* Skip to the data chunk */
- if ((ret = skip_to_chunk(w, 0x61746164U, &w->data_size)) < 0)
+ if ((ret = skip_to_chunk(w, 0x61746164U, &data_size)) < 0)
goto fail;
+ w->data_size = (off_t) data_size;
if ((w->data_size % (w->depth/8)) != 0) {
ret = CA_ERROR_CORRUPT;
@@ -197,8 +198,8 @@ ca_sample_type_t ca_wav_get_sample_type(ca_wav *w) {
: CA_SAMPLE_U8;
}
-int ca_wav_read_s16le(ca_wav *w, int16_t *d, unsigned *n) {
- unsigned remaining;
+int ca_wav_read_s16le(ca_wav *w, int16_t *d, size_t *n) {
+ off_t remaining;
ca_return_val_if_fail(w, CA_ERROR_INVALID);
ca_return_val_if_fail(w->depth == 16, CA_ERROR_INVALID);
@@ -206,10 +207,10 @@ int ca_wav_read_s16le(ca_wav *w, int16_t *d, unsigned *n) {
ca_return_val_if_fail(n, CA_ERROR_INVALID);
ca_return_val_if_fail(*n > 0, CA_ERROR_INVALID);
- remaining = w->data_size / sizeof(int16_t);
+ remaining = w->data_size / (off_t) sizeof(int16_t);
- if (*n > remaining)
- *n = remaining;
+ if ((off_t) *n > remaining)
+ *n = (size_t) remaining;
if (*n > 0) {
*n = fread(d, sizeof(int16_t), *n, w->file);
@@ -217,15 +218,15 @@ int ca_wav_read_s16le(ca_wav *w, int16_t *d, unsigned *n) {
if (*n <= 0 && ferror(w->file))
return CA_ERROR_SYSTEM;
- ca_assert(w->data_size >= *n * sizeof(int16_t));
- w->data_size -= *n * sizeof(int16_t);
+ ca_assert(w->data_size >= (off_t) *n * (off_t) sizeof(int16_t));
+ w->data_size -= (off_t) *n * (off_t) sizeof(int16_t);
}
return CA_SUCCESS;
}
-int ca_wav_read_u8(ca_wav *w, uint8_t *d, unsigned *n) {
- unsigned remaining;
+int ca_wav_read_u8(ca_wav *w, uint8_t *d, size_t *n) {
+ off_t remaining;
ca_return_val_if_fail(w, CA_ERROR_INVALID);
ca_return_val_if_fail(w->depth == 8, CA_ERROR_INVALID);
@@ -233,10 +234,10 @@ int ca_wav_read_u8(ca_wav *w, uint8_t *d, unsigned *n) {
ca_return_val_if_fail(n, CA_ERROR_INVALID);
ca_return_val_if_fail(*n > 0, CA_ERROR_INVALID);
- remaining = w->data_size / sizeof(uint8_t);
+ remaining = w->data_size / (off_t) sizeof(uint8_t);
- if (*n > remaining)
- *n = remaining;
+ if ((off_t) *n > remaining)
+ *n = (size_t) remaining;
if (*n > 0) {
*n = fread(d, sizeof(uint8_t), *n, w->file);
@@ -244,15 +245,15 @@ int ca_wav_read_u8(ca_wav *w, uint8_t *d, unsigned *n) {
if (*n <= 0 && ferror(w->file))
return CA_ERROR_SYSTEM;
- ca_assert(w->data_size >= *n * sizeof(uint8_t));
- w->data_size -= *n * sizeof(uint8_t);
+ ca_assert(w->data_size >= (off_t) *n * (off_t) sizeof(uint8_t));
+ w->data_size -= (off_t) *n * (off_t) sizeof(uint8_t);
}
return CA_SUCCESS;
}
-size_t ca_wav_get_size(ca_wav *v) {
- ca_return_val_if_fail(v, CA_ERROR_INVALID);
+off_t ca_wav_get_size(ca_wav *v) {
+ ca_return_val_if_fail(v, (off_t) -1);
return v->data_size;
}
diff --git a/src/read-wav.h b/src/read-wav.h
index 9ecf263..00708c3 100644
--- a/src/read-wav.h
+++ b/src/read-wav.h
@@ -34,9 +34,9 @@ unsigned ca_wav_get_nchannels(ca_wav *f);
unsigned ca_wav_get_rate(ca_wav *f);
ca_sample_type_t ca_wav_get_sample_type(ca_wav *f);
-int ca_wav_read_u8(ca_wav *f, uint8_t *d, unsigned *n);
-int ca_wav_read_s16le(ca_wav *f, int16_t *d, unsigned *n);
+int ca_wav_read_u8(ca_wav *f, uint8_t *d, size_t *n);
+int ca_wav_read_s16le(ca_wav *f, int16_t *d, size_t *n);
-size_t ca_wav_get_size(ca_wav *f);
+off_t ca_wav_get_size(ca_wav *f);
#endif
diff --git a/src/sound-theme-spec.c b/src/sound-theme-spec.c
index f9c58d4..65aaba9 100644
--- a/src/sound-theme-spec.c
+++ b/src/sound-theme-spec.c
@@ -493,7 +493,7 @@ static int find_sound_for_locale(
if ((e = strchr(locale, '@'))) {
char *t;
- if (!(t = ca_strndup(locale, e - locale)))
+ if (!(t = ca_strndup(locale, (size_t) (e - locale))))
return CA_ERROR_OOM;
ret = find_sound_in_locale(f, theme, name, path, t, subdir);
@@ -507,7 +507,7 @@ static int find_sound_for_locale(
if ((e = strchr(locale, '_'))) {
char *t;
- if (!(t = ca_strndup(locale, e - locale)))
+ if (!(t = ca_strndup(locale, (size_t) (e - locale))))
return CA_ERROR_OOM;
ret = find_sound_in_locale(f, theme, name, path, t, subdir);
@@ -555,7 +555,7 @@ static int find_sound_for_name(
} while (*k != '-');
- if (!(n = ca_strndup(name, k-name)))
+ if (!(n = ca_strndup(name, (size_t) (k-name))))
return CA_ERROR_OOM;
if ((ret = find_sound_for_locale(f, t, n, path, locale, subdir)) != CA_ERROR_NOTFOUND) {