diff --git a/lib/wp/client.c b/lib/wp/client.c index 0d8a52d2..b8cfaacd 100644 --- a/lib/wp/client.c +++ b/lib/wp/client.c @@ -121,7 +121,7 @@ wp_client_update_permissions (WpClient * self, guint n_perm, ...) g_alloca (n_perm * sizeof (struct pw_permission)); 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].permissions = va_arg (args, guint32); } diff --git a/lib/wp/debug.c b/lib/wp/debug.c index d58c03f2..638dff98 100644 --- a/lib/wp/debug.c +++ b/lib/wp/debug.c @@ -108,7 +108,7 @@ log_level_index (GLogLevelFlags log_level) static inline gint 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 @@ -236,7 +236,7 @@ static inline void extract_common_fields (struct common_fields *cf, const GLogField *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) { cf->log_domain = fields[i].value; } @@ -406,7 +406,7 @@ wp_log_structured_standard ( g_log_structured_array (log_level, fields, n_fields); } -static void +static G_GNUC_PRINTF (6, 0) void wp_spa_log_logv (void *object, enum spa_log_level level, const char *file, @@ -436,7 +436,7 @@ wp_spa_log_logv (void *object, 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, enum spa_log_level level, const char *file, diff --git a/lib/wp/endpoint.c b/lib/wp/endpoint.c index cdf5d593..68be3334 100644 --- a/lib/wp/endpoint.c +++ b/lib/wp/endpoint.c @@ -760,9 +760,9 @@ impl_create_link (void *object, const struct spa_dict *props) /* convert to int - allow unspecified streams */ self_ep_id = wp_proxy_get_bound_id (WP_PROXY (self)); - self_stream_id = self_stream ? atoi (self_stream) : SPA_ID_INVALID; - peer_ep_id = atoi (peer_ep); - peer_stream_id = peer_stream ? atoi (peer_stream) : SPA_ID_INVALID; + self_stream_id = self_stream ? (guint32) atoi (self_stream) : SPA_ID_INVALID; + peer_ep_id = (guint32) atoi (peer_ep); + peer_stream_id = peer_stream ? (guint32) atoi (peer_stream) : SPA_ID_INVALID; /* find our stream */ if (self_stream_id != SPA_ID_INVALID) { diff --git a/lib/wp/object-interest.c b/lib/wp/object-interest.c index 72694ae3..8e14a9ff 100644 --- a/lib/wp/object-interest.c +++ b/lib/wp/object-interest.c @@ -747,7 +747,7 @@ wp_object_interest_matches_full (WpObjectInterest * self, switch (c->type) { case WP_CONSTRAINT_TYPE_PW_PROPERTY: lookup_props = pw_props; - /* G_GNUC_FALLTHROUGH */; + SPA_FALLTHROUGH; case WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY: { const gchar *lookup_str = NULL; diff --git a/lib/wp/object-manager.c b/lib/wp/object-manager.c index 60289b54..2eeba620 100644 --- a/lib/wp/object-manager.c +++ b/lib/wp/object-manager.c @@ -552,7 +552,7 @@ static gboolean wp_object_manager_is_interested_in_object (WpObjectManager * self, GObject * object) { - gint i; + guint i; WpObjectInterest *interest = NULL; for (i = 0; i < self->interests->len; i++) { @@ -567,7 +567,7 @@ static gboolean wp_object_manager_is_interested_in_global (WpObjectManager * self, WpGlobal * global, WpProxyFeatures * wanted_features) { - gint i; + guint i; WpObjectInterest *interest = NULL; 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); - 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]); if (g_strcmp0 (klass->pw_iface_type, type) == 0 && klass->pw_iface_version == version) { diff --git a/lib/wp/properties.h b/lib/wp/properties.h index 3021c1af..f6470a80 100644 --- a/lib/wp/properties.h +++ b/lib/wp/properties.h @@ -131,7 +131,7 @@ gint wp_properties_setf (WpProperties * self, const gchar * key, WP_API 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 */ diff --git a/modules/module-monitor.c b/modules/module-monitor.c index fa6d740c..7e53df6f 100644 --- a/modules/module-monitor.c +++ b/modules/module-monitor.c @@ -666,7 +666,7 @@ wireplumber__module_init (WpModule * module, WpCore * core, GVariant * args) if (g_variant_lookup (value, "flags", "as", &flags_iter)) { const gchar *flag_str = NULL; 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)) flags |= flag_names[i].flag; } diff --git a/modules/module-si-bluez5-endpoint.c b/modules/module-si-bluez5-endpoint.c index 1f626939..0346cbd7 100644 --- a/modules/module-si-bluez5-endpoint.c +++ b/modules/module-si-bluez5-endpoint.c @@ -461,11 +461,10 @@ static void abort_acquisition (WpSessionItem * ac, GTask *task, const gchar *msg) { g_autoptr (WpProxy) link = NULL; - GError *e = NULL; /* return error to abort the link activation */ - e = g_error_new (WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED, msg); - g_task_return_error (task, e); + g_task_return_new_error (task, WP_DOMAIN_LIBRARY, + WP_LIBRARY_ERROR_OPERATION_FAILED, "%s", msg); /* destroy the link */ link = wp_session_item_get_associated_proxy (ac, WP_TYPE_ENDPOINT_LINK); diff --git a/src/main.c b/src/main.c index d3a6fd9c..bdbc84b8 100644 --- a/src/main.c +++ b/src/main.c @@ -40,7 +40,7 @@ struct WpDaemonData GPtrArray *sessions; }; -static void +static G_GNUC_PRINTF (3, 4) void daemon_exit (struct WpDaemonData * d, gint code, const gchar *format, ...) { va_list args; @@ -316,17 +316,20 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream, /* 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, "line %i exceeds the maximum allowed line size (%d bytes)", lineno, (gint) sizeof (buffer)); return FALSE; } else if (cur - linestart > 0) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" /* we have unparsed data, move it to the * beginning of the buffer and continue */ strncpy (buffer, linestart, cur - linestart); linestart = buffer; cur = buffer + (cur - linestart); +#pragma GCC diagnostic pop } else { /* reset for the next g_input_stream_read() call */ linestart = cur = buffer; diff --git a/tests/modules/config-policy.c b/tests/modules/config-policy.c index 9e8dbb1f..aaf08ee4 100644 --- a/tests/modules/config-policy.c +++ b/tests/modules/config-policy.c @@ -226,7 +226,7 @@ on_state_changed (WpEndpointLink *ep_link, WpEndpointLinkState old_state, case WP_ENDPOINT_LINK_STATE_ACTIVE: break; case WP_ENDPOINT_LINK_STATE_ERROR: - wp_message_object ("link failed: %s", error); + wp_warning ("link failed: %s", error); g_test_fail (); case WP_ENDPOINT_LINK_STATE_INACTIVE: case WP_ENDPOINT_LINK_STATE_PREPARING: