fix some warnings

This commit is contained in:
Wim Taymans 2021-02-18 12:42:06 +01:00
parent 2efdb78239
commit 63a3811aa7
2 changed files with 14 additions and 6 deletions

View file

@ -437,7 +437,7 @@ static bool rfcomm_hfp_hf(struct spa_source *source, char* buf)
struct rfcomm *rfcomm = source->data; struct rfcomm *rfcomm = source->data;
struct spa_bt_backend *backend = rfcomm->backend; struct spa_bt_backend *backend = rfcomm->backend;
unsigned int features; unsigned int features;
unsigned int gain; unsigned int SPA_UNUSED gain;
unsigned int selected_codec; unsigned int selected_codec;
char* token; char* token;
char separators[] = "\r\n:"; char separators[] = "\r\n:";

View file

@ -240,8 +240,7 @@ static char *serialize_props(struct device *dev, const struct spa_pod *param)
{ {
struct spa_pod_prop *prop; struct spa_pod_prop *prop;
struct spa_pod_object *obj = (struct spa_pod_object *) param; struct spa_pod_object *obj = (struct spa_pod_object *) param;
float val = 0.0f; bool comma = false;
bool b = false, comma = false;
char *ptr; char *ptr;
size_t size; size_t size;
FILE *f; FILE *f;
@ -252,13 +251,21 @@ static char *serialize_props(struct device *dev, const struct spa_pod *param)
SPA_POD_OBJECT_FOREACH(obj, prop) { SPA_POD_OBJECT_FOREACH(obj, prop) {
switch (prop->key) { switch (prop->key) {
case SPA_PROP_volume: case SPA_PROP_volume:
spa_pod_get_float(&prop->value, &val); {
float val;
if (spa_pod_get_float(&prop->value, &val) < 0)
continue;
fprintf(f, "%s \"volume\": %f", (comma ? "," : ""), val); fprintf(f, "%s \"volume\": %f", (comma ? "," : ""), val);
break; break;
}
case SPA_PROP_mute: case SPA_PROP_mute:
spa_pod_get_bool(&prop->value, &b); {
bool b;
if (spa_pod_get_bool(&prop->value, &b) < 0)
continue;
fprintf(f, "%s \"mute\": %s", (comma ? "," : ""), b ? "true" : "false"); fprintf(f, "%s \"mute\": %s", (comma ? "," : ""), b ? "true" : "false");
break; break;
}
case SPA_PROP_channelVolumes: case SPA_PROP_channelVolumes:
{ {
uint32_t i, n_vals; uint32_t i, n_vals;
@ -294,7 +301,8 @@ static char *serialize_props(struct device *dev, const struct spa_pod *param)
case SPA_PROP_latencyOffsetNsec: case SPA_PROP_latencyOffsetNsec:
{ {
int64_t delay; int64_t delay;
spa_pod_get_long(&prop->value, &delay); if (spa_pod_get_long(&prop->value, &delay) < 0)
continue;
fprintf(f, "%s \"latencyOffsetNsec\": %"PRIi64, (comma ? "," : ""), delay); fprintf(f, "%s \"latencyOffsetNsec\": %"PRIi64, (comma ? "," : ""), delay);
break; break;
} }