summaryrefslogtreecommitdiff
path: root/libdleyna
diff options
context:
space:
mode:
Diffstat (limited to 'libdleyna')
-rw-r--r--libdleyna/server/device.c46
-rw-r--r--libdleyna/server/props.c22
2 files changed, 50 insertions, 18 deletions
diff --git a/libdleyna/server/device.c b/libdleyna/server/device.c
index 977479a..a6268d0 100644
--- a/libdleyna/server/device.c
+++ b/libdleyna/server/device.c
@@ -1419,25 +1419,41 @@ static void prv_get_object(GUPnPDIDLLiteParser *parser,
{
dls_async_task_t *cb_data = user_data;
dls_async_get_all_t *cb_task_data = &cb_data->ut.get_all;
- const char *id;
+ const char *object_id;
+ const char *parent_id;
const char *parent_path;
gchar *path = NULL;
- id = gupnp_didl_lite_object_get_parent_id(object);
+ object_id = gupnp_didl_lite_object_get_id(object);
+ if (!object_id)
+ goto on_error;
+
+ parent_id = gupnp_didl_lite_object_get_parent_id(object);
+ if (!parent_id)
+ goto on_error;
- if (!id || !strcmp(id, "-1") || !strcmp(id, "")) {
+ if (!strcmp(object_id, "0") || !strcmp(parent_id, "-1")) {
parent_path = cb_data->task.target.root_path;
} else {
- path = dls_path_from_id(cb_data->task.target.root_path, id);
+ path = dls_path_from_id(cb_data->task.target.root_path,
+ parent_id);
parent_path = path;
}
if (!dls_props_add_object(cb_task_data->vb, object,
cb_data->task.target.root_path,
parent_path, DLS_UPNP_MASK_ALL_PROPS))
- cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
- DLEYNA_ERROR_BAD_RESULT,
- "Unable to retrieve mandatory object properties");
+ goto on_error;
+
+ g_free(path);
+
+ return;
+
+on_error:
+
+ cb_data->error = g_error_new(DLEYNA_SERVER_ERROR,
+ DLEYNA_ERROR_BAD_RESULT,
+ "Unable to retrieve mandatory object properties");
g_free(path);
}
@@ -2571,7 +2587,8 @@ static void prv_found_target(GUPnPDIDLLiteParser *parser,
{
dls_async_task_t *cb_data = user_data;
dls_async_bas_t *cb_task_data = &cb_data->ut.bas;
- const char *id;
+ const char *object_id;
+ const char *parent_id;
const char *parent_path;
gchar *path = NULL;
gboolean have_child_count;
@@ -2581,12 +2598,19 @@ static void prv_found_target(GUPnPDIDLLiteParser *parser,
builder = g_new0(dls_device_object_builder_t, 1);
- id = gupnp_didl_lite_object_get_parent_id(object);
+ object_id = gupnp_didl_lite_object_get_id(object);
+ if (!object_id)
+ goto on_error;
+
+ parent_id = gupnp_didl_lite_object_get_parent_id(object);
+ if (!parent_id)
+ goto on_error;
- if (!id || !strcmp(id, "-1") || !strcmp(id, "")) {
+ if (!strcmp(object_id, "0") || !strcmp(parent_id, "-1")) {
parent_path = cb_data->task.target.root_path;
} else {
- path = dls_path_from_id(cb_data->task.target.root_path, id);
+ path = dls_path_from_id(cb_data->task.target.root_path,
+ parent_id);
parent_path = path;
}
diff --git a/libdleyna/server/props.c b/libdleyna/server/props.c
index f88c800..ad36174 100644
--- a/libdleyna/server/props.c
+++ b/libdleyna/server/props.c
@@ -1729,7 +1729,8 @@ on_exit:
GVariant *dls_props_get_object_prop(const gchar *prop, const gchar *root_path,
GUPnPDIDLLiteObject *object)
{
- const char *id;
+ const char *object_id;
+ const char *parent_id;
gchar *path;
const char *upnp_class;
const char *media_spec_type;
@@ -1740,14 +1741,21 @@ GVariant *dls_props_get_object_prop(const gchar *prop, const gchar *root_path,
guint uint_val;
if (!strcmp(prop, DLS_INTERFACE_PROP_PARENT)) {
- id = gupnp_didl_lite_object_get_parent_id(object);
- if (!id || !strcmp(id, "-1")) {
+ object_id = gupnp_didl_lite_object_get_id(object);
+ if (!object_id)
+ goto on_error;
+
+ parent_id = gupnp_didl_lite_object_get_parent_id(object);
+ if (!parent_id)
+ goto on_error;
+
+ if (!strcmp(object_id, "0") || !strcmp(parent_id, "-1")) {
DLEYNA_LOG_DEBUG("Prop %s = %s", prop, root_path);
retval = g_variant_ref_sink(g_variant_new_string(
root_path));
} else {
- path = dls_path_from_id(root_path, id);
+ path = dls_path_from_id(root_path, parent_id);
DLEYNA_LOG_DEBUG("Prop %s = %s", prop, path);
@@ -1756,11 +1764,11 @@ GVariant *dls_props_get_object_prop(const gchar *prop, const gchar *root_path,
g_free(path);
}
} else if (!strcmp(prop, DLS_INTERFACE_PROP_PATH)) {
- id = gupnp_didl_lite_object_get_id(object);
- if (!id)
+ object_id = gupnp_didl_lite_object_get_id(object);
+ if (!object_id)
goto on_error;
- path = dls_path_from_id(root_path, id);
+ path = dls_path_from_id(root_path, object_id);
DLEYNA_LOG_DEBUG("Prop %s = %s", prop, path);