diff --git a/spa/examples/adapter-control.c b/spa/examples/adapter-control.c index 3434d2752..956b4d427 100644 --- a/spa/examples/adapter-control.c +++ b/spa/examples/adapter-control.c @@ -906,9 +906,9 @@ static void run_async_sink(struct data *data) printf("got error %d\n", res); } -static char *getscale(uint32_t scale) +static const char *getscale(uint32_t scale) { - char *scale_s = NULL; + const char *scale_s = NULL; if (scale == SPA_AUDIO_VOLUME_RAMP_LINEAR) scale_s = LINEAR; diff --git a/spa/plugins/alsa/alsa-compress-offload-sink.c b/spa/plugins/alsa/alsa-compress-offload-sink.c index b30350c8a..df8e43a25 100644 --- a/spa/plugins/alsa/alsa-compress-offload-sink.c +++ b/spa/plugins/alsa/alsa-compress-offload-sink.c @@ -843,7 +843,7 @@ static int parse_device(struct impl *this) nextptr = device + 3; for (value_index = 0; ; ++value_index) { - char *value_label; + const char *value_label; switch (value_index) { case 0: value_label = "card"; break; diff --git a/spa/plugins/bluez5/backend-native.c b/spa/plugins/bluez5/backend-native.c index 2e81adf3a..57281137c 100644 --- a/spa/plugins/bluez5/backend-native.c +++ b/spa/plugins/bluez5/backend-native.c @@ -2399,7 +2399,7 @@ static int register_profile(struct impl *backend, const char *profile, const cha DBusMessageIter it[4]; dbus_bool_t autoconnect; dbus_uint16_t version, chan, features; - char *str; + const char *str; if (!(backend->enabled_profiles & spa_bt_profile_from_uuid(uuid))) return -ECANCELED; diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index ac07d10f2..62cb37ddd 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -1435,7 +1435,7 @@ static bool device_remove_device_set(struct spa_bt_device *device, const char *p int spa_bt_format_vendor_product_id(uint16_t source_id, uint16_t vendor_id, uint16_t product_id, char *vendor_str, int vendor_str_size, char *product_str, int product_str_size) { - char *source_str; + const char *source_str; switch (source_id) { case SOURCE_ID_USB: diff --git a/src/modules/module-rtp-session.c b/src/modules/module-rtp-session.c index 0df26a89b..9733f16f0 100644 --- a/src/modules/module-rtp-session.c +++ b/src/modules/module-rtp-session.c @@ -1335,7 +1335,8 @@ static struct service *make_service(struct impl *impl, const struct service_info if (spa_streq(service_name, "_pipewire-audio._udp")) { uint32_t mask = 0; for (l = txt; l && compatible; l = l->next) { - char *key, *value, *k = NULL; + const char *k = NULL; + char *key, *value; if (avahi_string_list_get_pair(l, &key, &value, NULL) != 0) break; diff --git a/src/tools/pw-link.c b/src/tools/pw-link.c index 23c559db1..78b0d5680 100644 --- a/src/tools/pw-link.c +++ b/src/tools/pw-link.c @@ -197,7 +197,9 @@ static char *port_alias(char *buffer, int size, struct object *n, struct object static void print_port(struct data *data, const char *prefix, struct object *n, struct object *p, bool verbose) { - char buffer[1024], id[64] = "", *prefix2 = ""; + char buffer[1024], id[64] = ""; + const char *prefix2 = ""; + if (data->opt_id) { snprintf(id, sizeof(id), "%4d ", p->id); prefix2 = " "; diff --git a/test/pwtest.c b/test/pwtest.c index 8a9d1cf67..80217d999 100644 --- a/test/pwtest.c +++ b/test/pwtest.c @@ -1207,7 +1207,7 @@ static char* make_xdg_runtime_dir(void) time_t t = time(NULL); struct tm *tm = localtime(&t); char *dir; - char *tmpdir = getenv("TMPDIR"); + const char *tmpdir = getenv("TMPDIR"); char path[PATH_MAX]; FILE *fp; diff --git a/test/test-logger.c b/test/test-logger.c index 3ad29da0b..0b3648b05 100644 --- a/test/test-logger.c +++ b/test/test-logger.c @@ -232,7 +232,7 @@ PWTEST(logger_debug_env_alpha) enum spa_log_level level = pwtest_get_iteration(current_test); enum spa_log_level default_level = pw_log_level; struct spa_log *default_logger = pw_log_get(); - char *lvl = NULL; + const char *lvl = NULL; char *oldenv = getenv("PIPEWIRE_DEBUG"); if (oldenv) @@ -276,7 +276,7 @@ PWTEST(logger_debug_env_topic_all) struct spa_log *default_logger = pw_log_get(); char *oldenv = getenv("PIPEWIRE_DEBUG"); char lvlstr[32]; - char *lvl = "X"; + const char *lvl = "X"; if (oldenv) oldenv = strdup(oldenv); diff --git a/test/test-spa-json.c b/test/test-spa-json.c index 629e29c82..063a14ed9 100644 --- a/test/test-spa-json.c +++ b/test/test-spa-json.c @@ -166,7 +166,7 @@ PWTEST(json_encode) return PWTEST_PASS; } -static void test_array(char *str, char **vals) +static void test_array(const char *str, const char * const vals[]) { struct spa_json it[2]; char val[256]; @@ -183,12 +183,12 @@ static void test_array(char *str, char **vals) PWTEST(json_array) { - test_array("FL,FR", (char *[]){ "FL", "FR", NULL }); - test_array(" FL , FR ", (char *[]){ "FL", "FR", NULL }); - test_array("[ FL , FR ]", (char *[]){ "FL", "FR", NULL }); - test_array("[FL FR]", (char *[]){ "FL", "FR", NULL }); - test_array("FL FR", (char *[]){ "FL", "FR", NULL }); - test_array("[ FL FR ]", (char *[]){ "FL", "FR", NULL }); + test_array("FL,FR", (const char *[]){ "FL", "FR", NULL }); + test_array(" FL , FR ", (const char *[]){ "FL", "FR", NULL }); + test_array("[ FL , FR ]", (const char *[]){ "FL", "FR", NULL }); + test_array("[FL FR]", (const char *[]){ "FL", "FR", NULL }); + test_array("FL FR", (const char *[]){ "FL", "FR", NULL }); + test_array("[ FL FR ]", (const char *[]){ "FL", "FR", NULL }); return PWTEST_PASS; }