diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 6f64f16..8ad146d 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
GDestroyNotify destroy;
};
-static struct {
+static const struct {
const char *name;
uint8_t avc;
uint16_t uinput;
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index dda9a30..439fa27 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
uint8_t transaction);
};
-static struct {
+static const struct {
uint8_t feature_bit;
uint8_t avc;
} passthrough_map[] = {
static uint8_t default_features[16];
/* Company IDs supported by this device */
-static uint32_t company_ids[] = {
+static const uint32_t company_ids[] = {
IEEEID_BTSIG,
};
pdu->param_len = cpu_to_be16(1);
}
-static struct browsing_pdu_handler {
+static const struct browsing_pdu_handler {
uint8_t pdu_id;
void (*func) (struct avrcp *session, struct avrcp_browsing_header *pdu,
uint8_t transaction);
size_t operand_count, void *user_data)
{
struct avrcp *session = user_data;
- struct browsing_pdu_handler *handler;
+ const struct browsing_pdu_handler *handler;
struct avrcp_browsing_header *pdu = (void *) operands;
DBG("AVRCP Browsing PDU 0x%02X, len 0x%04X", pdu->pdu_id,
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 1faa1c2..edaff78 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
}
-static struct media_endpoint_init {
+static const struct media_endpoint_init {
const char *uuid;
bool (*func)(struct media_endpoint *endpoint, int *err);
bool (*supported)(struct btd_adapter *adapter);
int *err)
{
struct media_endpoint *endpoint;
- struct media_endpoint_init *init;
+ const struct media_endpoint_init *init;
size_t i;
bool succeeded = false;
DBUS_TYPE_STRING_AS_STRING, &entry);
for (i = 0; i < ARRAY_SIZE(init_table); i++) {
- struct media_endpoint_init *init = &init_table[i];
+ const struct media_endpoint_init *init = &init_table[i];
if (init->supported(adapter->btd_adapter))
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index 56c4917..a547dcb 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
static GSList *sink_callbacks = NULL;
-static char *str_state[] = {
+static const char *str_state[] = {
"SINK_STATE_DISCONNECTED",
"SINK_STATE_CONNECTING",
"SINK_STATE_CONNECTED",
diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index c6009d0..9fac352 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
static GSList *source_callbacks = NULL;
-static char *str_state[] = {
+static const char *str_state[] = {
"SOURCE_STATE_DISCONNECTED",
"SOURCE_STATE_CONNECTING",
"SOURCE_STATE_CONNECTED",
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index d89e759..b3c087d 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
TRANSPORT_STATE_SUSPENDING, /* Release in progress */
} transport_state_t;
-static char *str_state[] = {
+static const char *str_state[] = {
"TRANSPORT_STATE_IDLE",
"TRANSPORT_STATE_PENDING",
"TRANSPORT_STATE_REQUESTING",
uint16_t imtu; /* Transport input mtu */
uint16_t omtu; /* Transport output mtu */
transport_state_t state;
- struct media_transport_ops *ops;
+ const struct media_transport_ops *ops;
void *data;
};
#define BAP_BC_OPS(_uuid) \
BAP_OPS(_uuid, transport_bap_bc_properties, NULL, NULL)
-static struct media_transport_ops transport_ops[] = {
+static const struct media_transport_ops transport_ops[] = {
A2DP_OPS(A2DP_SOURCE_UUID, transport_a2dp_src_init,
transport_a2dp_src_set_volume,
transport_a2dp_src_destroy),
BAP_BC_OPS(BAA_SERVICE_UUID),
};
-static struct media_transport_ops *media_transport_find_ops(const char *uuid)
+static const struct media_transport_ops *
+media_transport_find_ops(const char *uuid)
{
size_t i;
for (i = 0; i < ARRAY_SIZE(transport_ops); i++) {
- struct media_transport_ops *ops = &transport_ops[i];
+ const struct media_transport_ops *ops = &transport_ops[i];
if (!strcasecmp(uuid, ops->uuid))
return ops;
{
struct media_endpoint *endpoint = data;
struct media_transport *transport;
- struct media_transport_ops *ops;
+ const struct media_transport_ops *ops;
static int fd = 0;
transport = g_new0(struct media_transport, 1);
diff --git a/profiles/health/hdp_util.c b/profiles/health/hdp_util.c
index ab3b78f..ad3702f 100644
--- a/profiles/health/hdp_util.c
+++ b/profiles/health/hdp_util.c
GError **err);
struct dict_entry_func {
- char *key;
+ const char *key;
parse_item_f func;
};
GDestroyNotify destroy;
};
-static gboolean parse_dict_entry(struct dict_entry_func dict_context[],
+static gboolean parse_dict_entry(const struct dict_entry_func dict_context[],
DBusMessageIter *iter,
GError **err,
gpointer user_data)
DBusMessageIter entry;
char *key;
int ctype, i;
- struct dict_entry_func df;
dbus_message_iter_recurse(iter, &entry);
ctype = dbus_message_iter_get_arg_type(&entry);
dbus_message_iter_get_basic(&entry, &key);
dbus_message_iter_next(&entry);
/* Find function and call it */
- for (i = 0, df = dict_context[0]; df.key; i++, df = dict_context[i]) {
- if (g_ascii_strcasecmp(df.key, key) == 0)
- return df.func(&entry, user_data, err);
+ for (i = 0; dict_context[i].key; i++) {
+ if (g_ascii_strcasecmp(dict_context[i].key, key) == 0)
+ return dict_context[i].func(&entry, user_data, err);
}
g_set_error(err, HDP_ERROR, HDP_DIC_ENTRY_PARSE_ERROR,
return FALSE;
}
-static gboolean parse_dict(struct dict_entry_func dict_context[],
+static gboolean parse_dict(const struct dict_entry_func dict_context[],
DBusMessageIter *iter,
GError **err,
gpointer user_data)
return TRUE;
}
-static struct dict_entry_func dict_parser[] = {
+static const struct dict_entry_func dict_parser[] = {
{"DataType", parse_data_type},
{"Role", parse_role},
{"Description", parse_desc},
diff --git a/profiles/iap/main.c b/profiles/iap/main.c
index 9a04f5c..054ff60 100644
--- a/profiles/iap/main.c
+++ b/profiles/iap/main.c
static gboolean option_version = FALSE;
-static GOptionEntry options[] = {
+static const GOptionEntry options[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
"Show version information and exit" },
{ NULL },