mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
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.
This commit is contained in:
parent
f8127943cd
commit
0e765de519
9 changed files with 166 additions and 147 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue