summaryrefslogtreecommitdiff
path: root/spa
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-07-11 12:52:55 +0200
committerWim Taymans <wtaymans@redhat.com>2019-07-11 12:52:55 +0200
commit0e765de5194e2585ceb5a83a6c0d816fbbd8a124 (patch)
tree890db2553bc4a45f45e08600df1b43c41081f0fa /spa
parentf8127943cdbd1aa344ee710e5ffd1bd0f7b483fe (diff)
props: remove pointers in property values in protocol
Mark pointers in property values with pointer: and remove them when sending the properties over the wire to avoid errors.
Diffstat (limited to 'spa')
-rw-r--r--spa/plugins/audioconvert/audioadapter.c2
-rw-r--r--spa/plugins/bluez5/a2dp-sink.c2
-rw-r--r--spa/plugins/bluez5/a2dp-source.c2
-rw-r--r--spa/plugins/bluez5/bluez5-device.c10
-rw-r--r--spa/plugins/bluez5/bluez5-monitor.c4
5 files changed, 10 insertions, 10 deletions
diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c
index 7528b0f6..b9a383cc 100644
--- a/spa/plugins/audioconvert/audioadapter.c
+++ b/spa/plugins/audioconvert/audioadapter.c
@@ -887,7 +887,7 @@ impl_init(const struct spa_handle_factory *factory,
if (info == NULL || (str = spa_dict_lookup(info, "audio.adapt.slave")) == NULL)
return -EINVAL;
- sscanf(str, "%p", &this->slave);
+ sscanf(str, "pointer:%p", &this->slave);
if (this->slave == NULL)
return -EINVAL;
diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c
index 8010e3e2..69e3d7a1 100644
--- a/spa/plugins/bluez5/a2dp-sink.c
+++ b/spa/plugins/bluez5/a2dp-sink.c
@@ -1481,7 +1481,7 @@ impl_init(const struct spa_handle_factory *factory,
for (i = 0; info && i < info->n_items; i++) {
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
- sscanf(info->items[i].value, "%p", &this->transport);
+ sscanf(info->items[i].value, "pointer:%p", &this->transport);
}
if (this->transport == NULL) {
spa_log_error(this->log, "a transport is needed");
diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c
index 2c5d4cfb..ebdc0b3f 100644
--- a/spa/plugins/bluez5/a2dp-source.c
+++ b/spa/plugins/bluez5/a2dp-source.c
@@ -1178,7 +1178,7 @@ impl_init(const struct spa_handle_factory *factory,
for (i = 0; info && i < info->n_items; i++) {
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_TRANSPORT) == 0)
- sscanf(info->items[i].value, "%p", &this->transport);
+ sscanf(info->items[i].value, "pointer:%p", &this->transport);
}
if (this->transport == NULL) {
spa_log_error(this->log, "a transport is needed");
diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c
index 2dcecc95..768f7ee6 100644
--- a/spa/plugins/bluez5/bluez5-device.c
+++ b/spa/plugins/bluez5/bluez5-device.c
@@ -99,9 +99,9 @@ static int emit_source_node(struct impl *this)
spa_list_for_each(t, &device->transport_list, device_link) {
if (t->profile == profile) {
struct spa_device_object_info info;
- char transport[16];
+ char transport[32];
- snprintf(transport, 16, "%p", t);
+ snprintf(transport, sizeof(transport), "pointer:%p", t);
items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_TRANSPORT, transport);
spa_bt_transport_acquire(t, true);
@@ -148,9 +148,9 @@ static int emit_sink_node(struct impl *this)
spa_list_for_each(t, &device->transport_list, device_link) {
if (t->profile == profile) {
struct spa_device_object_info info;
- char transport[16];
+ char transport[32];
- snprintf(transport, 16, "%p", t);
+ snprintf(transport, sizeof(transport), "pointer:%p", t);
items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_TRANSPORT, transport);
info = SPA_DEVICE_OBJECT_INFO_INIT();
@@ -301,7 +301,7 @@ impl_init(const struct spa_handle_factory *factory,
for (i = 0; info && i < info->n_items; i++) {
if (strcmp(info->items[i].key, SPA_KEY_API_BLUEZ5_DEVICE) == 0)
- sscanf(info->items[i].value, "%p", &this->bt_dev);
+ sscanf(info->items[i].value, "pointer:%p", &this->bt_dev);
}
if (this->bt_dev == NULL) {
spa_log_error(this->log, "a device is needed");
diff --git a/spa/plugins/bluez5/bluez5-monitor.c b/spa/plugins/bluez5/bluez5-monitor.c
index 64b7ec4f..7f22d65d 100644
--- a/spa/plugins/bluez5/bluez5-monitor.c
+++ b/spa/plugins/bluez5/bluez5-monitor.c
@@ -491,7 +491,7 @@ static int device_free(struct spa_bt_device *device)
static int device_add(struct spa_bt_monitor *monitor, struct spa_bt_device *device)
{
struct spa_monitor_object_info info;
- char dev[16];
+ char dev[32];
struct spa_dict_item items[20];
uint32_t n_items = 0;
@@ -511,7 +511,7 @@ static int device_add(struct spa_bt_monitor *monitor, struct spa_bt_device *devi
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_ICON_NAME, device->icon);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_PATH, device->path);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_ADDRESS, device->address);
- snprintf(dev, sizeof(dev), "%p", device);
+ snprintf(dev, sizeof(dev), "pointer:%p", device);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_DEVICE, dev);
info.props = &SPA_DICT_INIT(items, n_items);