mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2025-12-20 06:30:04 +01:00
Fix compiler warnings that appear with the warning flags enabled
Fixes #20
This commit is contained in:
parent
bb9b59181b
commit
e48cb30828
10 changed files with 22 additions and 20 deletions
|
|
@ -121,7 +121,7 @@ wp_client_update_permissions (WpClient * self, guint n_perm, ...)
|
||||||
g_alloca (n_perm * sizeof (struct pw_permission));
|
g_alloca (n_perm * sizeof (struct pw_permission));
|
||||||
|
|
||||||
va_start (args, n_perm);
|
va_start (args, n_perm);
|
||||||
for (gint i = 0; i < n_perm; i++) {
|
for (guint i = 0; i < n_perm; i++) {
|
||||||
perm[i].id = va_arg (args, guint32);
|
perm[i].id = va_arg (args, guint32);
|
||||||
perm[i].permissions = va_arg (args, guint32);
|
perm[i].permissions = va_arg (args, guint32);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ log_level_index (GLogLevelFlags log_level)
|
||||||
static inline gint
|
static inline gint
|
||||||
level_index_from_spa (gint spa_lvl)
|
level_index_from_spa (gint spa_lvl)
|
||||||
{
|
{
|
||||||
return CLAMP (spa_lvl + 2, 0, G_N_ELEMENTS (log_level_info) - 1);
|
return CLAMP (spa_lvl + 2, 0, (gint) G_N_ELEMENTS (log_level_info) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gint
|
static inline gint
|
||||||
|
|
@ -236,7 +236,7 @@ static inline void
|
||||||
extract_common_fields (struct common_fields *cf, const GLogField *fields,
|
extract_common_fields (struct common_fields *cf, const GLogField *fields,
|
||||||
gsize n_fields)
|
gsize n_fields)
|
||||||
{
|
{
|
||||||
for (gint i = 0; i < n_fields; i++) {
|
for (guint i = 0; i < n_fields; i++) {
|
||||||
if (g_strcmp0 (fields[i].key, "GLIB_DOMAIN") == 0) {
|
if (g_strcmp0 (fields[i].key, "GLIB_DOMAIN") == 0) {
|
||||||
cf->log_domain = fields[i].value;
|
cf->log_domain = fields[i].value;
|
||||||
}
|
}
|
||||||
|
|
@ -406,7 +406,7 @@ wp_log_structured_standard (
|
||||||
g_log_structured_array (log_level, fields, n_fields);
|
g_log_structured_array (log_level, fields, n_fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static G_GNUC_PRINTF (6, 0) void
|
||||||
wp_spa_log_logv (void *object,
|
wp_spa_log_logv (void *object,
|
||||||
enum spa_log_level level,
|
enum spa_log_level level,
|
||||||
const char *file,
|
const char *file,
|
||||||
|
|
@ -436,7 +436,7 @@ wp_spa_log_logv (void *object,
|
||||||
g_log_structured_array (log_level, fields, SPA_N_ELEMENTS (fields));
|
g_log_structured_array (log_level, fields, SPA_N_ELEMENTS (fields));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static G_GNUC_PRINTF (6, 7) void
|
||||||
wp_spa_log_log (void *object,
|
wp_spa_log_log (void *object,
|
||||||
enum spa_log_level level,
|
enum spa_log_level level,
|
||||||
const char *file,
|
const char *file,
|
||||||
|
|
|
||||||
|
|
@ -760,9 +760,9 @@ impl_create_link (void *object, const struct spa_dict *props)
|
||||||
|
|
||||||
/* convert to int - allow unspecified streams */
|
/* convert to int - allow unspecified streams */
|
||||||
self_ep_id = wp_proxy_get_bound_id (WP_PROXY (self));
|
self_ep_id = wp_proxy_get_bound_id (WP_PROXY (self));
|
||||||
self_stream_id = self_stream ? atoi (self_stream) : SPA_ID_INVALID;
|
self_stream_id = self_stream ? (guint32) atoi (self_stream) : SPA_ID_INVALID;
|
||||||
peer_ep_id = atoi (peer_ep);
|
peer_ep_id = (guint32) atoi (peer_ep);
|
||||||
peer_stream_id = peer_stream ? atoi (peer_stream) : SPA_ID_INVALID;
|
peer_stream_id = peer_stream ? (guint32) atoi (peer_stream) : SPA_ID_INVALID;
|
||||||
|
|
||||||
/* find our stream */
|
/* find our stream */
|
||||||
if (self_stream_id != SPA_ID_INVALID) {
|
if (self_stream_id != SPA_ID_INVALID) {
|
||||||
|
|
|
||||||
|
|
@ -747,7 +747,7 @@ wp_object_interest_matches_full (WpObjectInterest * self,
|
||||||
switch (c->type) {
|
switch (c->type) {
|
||||||
case WP_CONSTRAINT_TYPE_PW_PROPERTY:
|
case WP_CONSTRAINT_TYPE_PW_PROPERTY:
|
||||||
lookup_props = pw_props;
|
lookup_props = pw_props;
|
||||||
/* G_GNUC_FALLTHROUGH */;
|
SPA_FALLTHROUGH;
|
||||||
|
|
||||||
case WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY: {
|
case WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY: {
|
||||||
const gchar *lookup_str = NULL;
|
const gchar *lookup_str = NULL;
|
||||||
|
|
|
||||||
|
|
@ -552,7 +552,7 @@ static gboolean
|
||||||
wp_object_manager_is_interested_in_object (WpObjectManager * self,
|
wp_object_manager_is_interested_in_object (WpObjectManager * self,
|
||||||
GObject * object)
|
GObject * object)
|
||||||
{
|
{
|
||||||
gint i;
|
guint i;
|
||||||
WpObjectInterest *interest = NULL;
|
WpObjectInterest *interest = NULL;
|
||||||
|
|
||||||
for (i = 0; i < self->interests->len; i++) {
|
for (i = 0; i < self->interests->len; i++) {
|
||||||
|
|
@ -567,7 +567,7 @@ static gboolean
|
||||||
wp_object_manager_is_interested_in_global (WpObjectManager * self,
|
wp_object_manager_is_interested_in_global (WpObjectManager * self,
|
||||||
WpGlobal * global, WpProxyFeatures * wanted_features)
|
WpGlobal * global, WpProxyFeatures * wanted_features)
|
||||||
{
|
{
|
||||||
gint i;
|
guint i;
|
||||||
WpObjectInterest *interest = NULL;
|
WpObjectInterest *interest = NULL;
|
||||||
|
|
||||||
for (i = 0; i < self->interests->len; i++) {
|
for (i = 0; i < self->interests->len; i++) {
|
||||||
|
|
@ -815,7 +815,7 @@ find_proxy_instance_type (const char * type, guint32 version)
|
||||||
|
|
||||||
children = g_type_children (WP_TYPE_PROXY, &n_children);
|
children = g_type_children (WP_TYPE_PROXY, &n_children);
|
||||||
|
|
||||||
for (gint i = 0; i < n_children; i++) {
|
for (guint i = 0; i < n_children; i++) {
|
||||||
WpProxyClass *klass = (WpProxyClass *) g_type_class_ref (children[i]);
|
WpProxyClass *klass = (WpProxyClass *) g_type_class_ref (children[i]);
|
||||||
if (g_strcmp0 (klass->pw_iface_type, type) == 0 &&
|
if (g_strcmp0 (klass->pw_iface_type, type) == 0 &&
|
||||||
klass->pw_iface_version == version) {
|
klass->pw_iface_version == version) {
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ gint wp_properties_setf (WpProperties * self, const gchar * key,
|
||||||
|
|
||||||
WP_API
|
WP_API
|
||||||
gint wp_properties_setf_valist (WpProperties * self, const gchar * key,
|
gint wp_properties_setf_valist (WpProperties * self, const gchar * key,
|
||||||
const gchar * format, va_list args);
|
const gchar * format, va_list args) G_GNUC_PRINTF(3, 0);
|
||||||
|
|
||||||
/* iterate */
|
/* iterate */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -666,7 +666,7 @@ wireplumber__module_init (WpModule * module, WpCore * core, GVariant * args)
|
||||||
if (g_variant_lookup (value, "flags", "as", &flags_iter)) {
|
if (g_variant_lookup (value, "flags", "as", &flags_iter)) {
|
||||||
const gchar *flag_str = NULL;
|
const gchar *flag_str = NULL;
|
||||||
while (g_variant_iter_loop (flags_iter, "&s", &flag_str)) {
|
while (g_variant_iter_loop (flags_iter, "&s", &flag_str)) {
|
||||||
for (gint i = 0; i < SPA_N_ELEMENTS (flag_names); i++) {
|
for (guint i = 0; i < SPA_N_ELEMENTS (flag_names); i++) {
|
||||||
if (!g_strcmp0 (flag_str, flag_names[i].name))
|
if (!g_strcmp0 (flag_str, flag_names[i].name))
|
||||||
flags |= flag_names[i].flag;
|
flags |= flag_names[i].flag;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -461,11 +461,10 @@ static void
|
||||||
abort_acquisition (WpSessionItem * ac, GTask *task, const gchar *msg)
|
abort_acquisition (WpSessionItem * ac, GTask *task, const gchar *msg)
|
||||||
{
|
{
|
||||||
g_autoptr (WpProxy) link = NULL;
|
g_autoptr (WpProxy) link = NULL;
|
||||||
GError *e = NULL;
|
|
||||||
|
|
||||||
/* return error to abort the link activation */
|
/* return error to abort the link activation */
|
||||||
e = g_error_new (WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED, msg);
|
g_task_return_new_error (task, WP_DOMAIN_LIBRARY,
|
||||||
g_task_return_error (task, e);
|
WP_LIBRARY_ERROR_OPERATION_FAILED, "%s", msg);
|
||||||
|
|
||||||
/* destroy the link */
|
/* destroy the link */
|
||||||
link = wp_session_item_get_associated_proxy (ac, WP_TYPE_ENDPOINT_LINK);
|
link = wp_session_item_get_associated_proxy (ac, WP_TYPE_ENDPOINT_LINK);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ struct WpDaemonData
|
||||||
GPtrArray *sessions;
|
GPtrArray *sessions;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static G_GNUC_PRINTF (3, 4) void
|
||||||
daemon_exit (struct WpDaemonData * d, gint code, const gchar *format, ...)
|
daemon_exit (struct WpDaemonData * d, gint code, const gchar *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
@ -316,17 +316,20 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
|
||||||
|
|
||||||
/* reached the end of the data that was read */
|
/* reached the end of the data that was read */
|
||||||
|
|
||||||
if (cur - linestart >= sizeof (buffer)) {
|
if (cur - linestart >= (gssize) sizeof (buffer)) {
|
||||||
g_set_error (error, WP_DOMAIN_DAEMON, WP_CODE_OPERATION_FAILED,
|
g_set_error (error, WP_DOMAIN_DAEMON, WP_CODE_OPERATION_FAILED,
|
||||||
"line %i exceeds the maximum allowed line size (%d bytes)",
|
"line %i exceeds the maximum allowed line size (%d bytes)",
|
||||||
lineno, (gint) sizeof (buffer));
|
lineno, (gint) sizeof (buffer));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (cur - linestart > 0) {
|
} else if (cur - linestart > 0) {
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
||||||
/* we have unparsed data, move it to the
|
/* we have unparsed data, move it to the
|
||||||
* beginning of the buffer and continue */
|
* beginning of the buffer and continue */
|
||||||
strncpy (buffer, linestart, cur - linestart);
|
strncpy (buffer, linestart, cur - linestart);
|
||||||
linestart = buffer;
|
linestart = buffer;
|
||||||
cur = buffer + (cur - linestart);
|
cur = buffer + (cur - linestart);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
} else {
|
} else {
|
||||||
/* reset for the next g_input_stream_read() call */
|
/* reset for the next g_input_stream_read() call */
|
||||||
linestart = cur = buffer;
|
linestart = cur = buffer;
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ on_state_changed (WpEndpointLink *ep_link, WpEndpointLinkState old_state,
|
||||||
case WP_ENDPOINT_LINK_STATE_ACTIVE:
|
case WP_ENDPOINT_LINK_STATE_ACTIVE:
|
||||||
break;
|
break;
|
||||||
case WP_ENDPOINT_LINK_STATE_ERROR:
|
case WP_ENDPOINT_LINK_STATE_ERROR:
|
||||||
wp_message_object ("link failed: %s", error);
|
wp_warning ("link failed: %s", error);
|
||||||
g_test_fail ();
|
g_test_fail ();
|
||||||
case WP_ENDPOINT_LINK_STATE_INACTIVE:
|
case WP_ENDPOINT_LINK_STATE_INACTIVE:
|
||||||
case WP_ENDPOINT_LINK_STATE_PREPARING:
|
case WP_ENDPOINT_LINK_STATE_PREPARING:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue