Skip to content

Commit

Permalink
Fix some warnings reported by strict ISO C check
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq committed Sep 20, 2024
1 parent 4c7068b commit cd371d0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/a2dp-lc3plus.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ void *a2dp_lc3plus_enc_thread(struct ba_transport_pcm *t_pcm) {
struct io_poll io = { .timeout = -1 };

const a2dp_lc3plus_t *configuration = &t->a2dp.configuration.lc3plus;
const int lc3plus_frame_dms = a2dp_lc3plus_get_frame_dms(configuration);
const unsigned int channels = t_pcm->channels;
const unsigned int rate = t_pcm->rate;
const unsigned int rtp_ts_clockrate = 96000;
Expand All @@ -211,6 +210,7 @@ void *a2dp_lc3plus_enc_thread(struct ba_transport_pcm *t_pcm) {

pthread_cleanup_push(PTHREAD_CLEANUP(a2dp_lc3plus_enc_free), handle);

const int lc3plus_frame_dms = a2dp_lc3plus_get_frame_dms(configuration);
if ((err = lc3plus_enc_set_frame_dms(handle, lc3plus_frame_dms)) != LC3PLUS_OK) {
error("Couldn't set frame length: %s", lc3plus_strerror(err));
goto fail_setup;
Expand Down
2 changes: 1 addition & 1 deletion src/bluealsa-dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ static void bluealsa_pcm_select_codec(GDBusMethodInvocation *inv, void *userdata
* selection on the transport level. */
pthread_mutex_lock(&t->codec_select_client_mtx);

a2dp_t a2dp_configuration = {};
a2dp_t a2dp_configuration = { 0 };
size_t a2dp_configuration_size = 0;
unsigned int channels = 0;
unsigned int rate = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/bluez.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ static void bluez_endpoint_select_configuration(GDBusMethodInvocation *inv, void
const struct a2dp_sep *sep = dbus_obj->sep;

const void *data;
a2dp_t capabilities = {};
a2dp_t capabilities = { 0 };
size_t size = 0;

params = g_variant_get_child_value(params, 0);
Expand Down Expand Up @@ -454,7 +454,7 @@ static void bluez_endpoint_set_configuration(GDBusMethodInvocation *inv, void *u

enum bluez_a2dp_transport_state state = 0xFFFF;
char *device_path = NULL;
a2dp_t configuration = {};
a2dp_t configuration = { 0 };
uint16_t volume = 127;
uint16_t delay = 150;

Expand Down
2 changes: 1 addition & 1 deletion src/dbus-codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}} {struct}SkeletonClass;
G_DEFINE_TYPE({struct}Skeleton, {func}_skeleton,
G_TYPE_DBUS_INTERFACE_SKELETON);
G_TYPE_DBUS_INTERFACE_SKELETON)
static void {func}_skeleton_class_init({struct}SkeletonClass *ifc) {{
GDBusInterfaceSkeletonClass *ifc_ = G_DBUS_INTERFACE_SKELETON_CLASS(ifc);
Expand Down
2 changes: 1 addition & 1 deletion test/test-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static void *pcm_write_frames_sndfile_async(void *userdata) {
struct pollfd pfds[] = {{ pcm->fd, POLLOUT, 0 }};

SNDFILE *sf = NULL;
SF_INFO sf_info = {};
SF_INFO sf_info = { 0 };
if ((sf = sf_open(input_pcm_file, SFM_READ, &sf_info)) == NULL) {
error("Couldn't load input audio file: %s", sf_strerror(NULL));
ck_assert_ptr_ne(sf, NULL);
Expand Down
22 changes: 12 additions & 10 deletions utils/a2dpconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,21 +363,21 @@ static void dump_aptx_ll(const void *blob, size_t size) {
}

static void dump_faststream(const void *blob, size_t size) {
const a2dp_faststream_t *faststream = blob;
if (check_blob_size(sizeof(*faststream), size) == -1)
const a2dp_faststream_t *fs = blob;
if (check_blob_size(sizeof(*fs), size) == -1)
return;
printf("FastStream <hex:%s> {\n", bintohex(blob, size));
printf_vendor(&faststream->info);
printf_vendor(&fs->info);
printf(""
" direction:8 =%s%s\n"
" sample-rate-voice:8 =%s\n"
" sample-rate-music:8 =%s%s\n"
"}\n",
faststream->direction & FASTSTREAM_DIRECTION_MUSIC ? " Music" : "",
faststream->direction & FASTSTREAM_DIRECTION_VOICE ? " Voice" : "",
faststream->sampling_freq_voice & FASTSTREAM_SAMPLING_FREQ_VOICE_16000 ? " 16000" : "",
faststream->sampling_freq_music & FASTSTREAM_SAMPLING_FREQ_MUSIC_48000 ? " 48000" : "",
faststream->sampling_freq_music & FASTSTREAM_SAMPLING_FREQ_MUSIC_44100 ? " 44100" : "");
fs->direction & FASTSTREAM_DIRECTION_MUSIC ? " Music" : "",
fs->direction & FASTSTREAM_DIRECTION_VOICE ? " Voice" : "",
fs->sampling_freq_voice & FASTSTREAM_SAMPLING_FREQ_VOICE_16000 ? " 16000" : "",
fs->sampling_freq_music & FASTSTREAM_SAMPLING_FREQ_MUSIC_48000 ? " 48000" : "",
fs->sampling_freq_music & FASTSTREAM_SAMPLING_FREQ_MUSIC_44100 ? " 44100" : "");
}

static void dump_lc3plus(const void *blob, size_t size) {
Expand Down Expand Up @@ -537,11 +537,13 @@ static void dump_lhdc_v5(const void *blob, size_t size) {
return;
printf("LHDC v5 <hex:%s> {\n", bintohex(blob, size));
printf_vendor(&lhdc->info);
const void *data = (uint8_t *)lhdc + sizeof(lhdc->info);
size_t data_size = sizeof(*lhdc) - sizeof(lhdc->info);
printf(""
" data:%zu = hex:%s\n"
"}\n",
sizeof(*lhdc) - sizeof(lhdc->info),
bintohex(blob + sizeof(lhdc->info), sizeof(*lhdc) - sizeof(lhdc->info)));
data_size,
bintohex(data, data_size));
}

static void dump_opus(const void *blob, size_t size) {
Expand Down

0 comments on commit cd371d0

Please sign in to comment.