dbus-common: Remove unused functions

This commit is contained in:
ERAMOTO Masaya 2018-03-01 13:27:42 +09:00 committed by Luiz Augusto von Dentz
parent b81f6b3ce2
commit 093d42d33e
3 changed files with 4 additions and 90 deletions

View File

@ -41,97 +41,16 @@
static DBusConnection *connection = NULL;
static void append_variant(DBusMessageIter *iter, int type, void *val)
{
DBusMessageIter value;
char sig[2] = { type, '\0' };
dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, sig, &value);
dbus_message_iter_append_basic(&value, type, val);
dbus_message_iter_close_container(iter, &value);
}
static void append_array_variant(DBusMessageIter *iter, int type, void *val,
int n_elements)
{
DBusMessageIter variant, array;
char type_sig[2] = { type, '\0' };
char array_sig[3] = { DBUS_TYPE_ARRAY, type, '\0' };
dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
array_sig, &variant);
dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
type_sig, &array);
if (dbus_type_is_fixed(type) == TRUE) {
dbus_message_iter_append_fixed_array(&array, type, val,
n_elements);
} else if (type == DBUS_TYPE_STRING || type == DBUS_TYPE_OBJECT_PATH) {
const char ***str_array = val;
int i;
for (i = 0; i < n_elements; i++)
dbus_message_iter_append_basic(&array, type,
&((*str_array)[i]));
}
dbus_message_iter_close_container(&variant, &array);
dbus_message_iter_close_container(iter, &variant);
}
void dict_append_basic(DBusMessageIter *dict, int key_type, const void *key,
int type, void *val)
{
DBusMessageIter entry;
if (type == DBUS_TYPE_STRING) {
const char *str = *((const char **) val);
if (str == NULL)
return;
}
dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
NULL, &entry);
dbus_message_iter_append_basic(&entry, key_type, key);
append_variant(&entry, type, val);
dbus_message_iter_close_container(dict, &entry);
}
void dict_append_entry(DBusMessageIter *dict,
const char *key, int type, void *val)
{
dict_append_basic(dict, DBUS_TYPE_STRING, &key, type, val);
}
void dict_append_basic_array(DBusMessageIter *dict, int key_type,
const void *key, int type, void *val,
int n_elements)
{
DBusMessageIter entry;
dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
NULL, &entry);
dbus_message_iter_append_basic(&entry, key_type, key);
append_array_variant(&entry, type, val, n_elements);
dbus_message_iter_close_container(dict, &entry);
g_dbus_dict_append_entry(dict, key, type, val);
}
void dict_append_array(DBusMessageIter *dict, const char *key, int type,
void *val, int n_elements)
{
dict_append_basic_array(dict, DBUS_TYPE_STRING, &key, type, val,
n_elements);
g_dbus_dict_append_array(dict, key, type, val, n_elements);
}
void set_dbus_connection(DBusConnection *conn)

View File

@ -21,14 +21,8 @@
*
*/
void dict_append_basic(DBusMessageIter *dict, int key_type, const void *key,
int type, void *val);
void dict_append_entry(DBusMessageIter *dict,
const char *key, int type, void *val);
void dict_append_basic_array(DBusMessageIter *dict, int key_type,
const void *key, int type, void *val,
int n_elements);
void dict_append_array(DBusMessageIter *dict, const char *key, int type,
void *val, int n_elements);

View File

@ -1199,7 +1199,8 @@ static void append_manufacturer_data(void *data, void *user_data)
struct bt_ad_manufacturer_data *md = data;
DBusMessageIter *dict = user_data;
dict_append_basic_array(dict, DBUS_TYPE_UINT16, &md->manufacturer_id,
g_dbus_dict_append_basic_array(dict,
DBUS_TYPE_UINT16, &md->manufacturer_id,
DBUS_TYPE_BYTE, &md->data, md->len);
}