From ae8d5664c3fc944a61b52e33223b05f13c618523 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Thu, 27 Oct 2022 14:00:23 +0900 Subject: Silence warnings and port to gnunet 0.18.0 --- src/conversation/gnunet-conversation-gtk_import.c | 35 +++++++++-------------- src/fs/gnunet-fs-gtk_main-window-search.c | 11 +++---- src/namestore/gnunet-namestore-gtk.c | 12 ++++---- src/statistics/gtk_statistics.c | 4 +-- 4 files changed, 25 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/conversation/gnunet-conversation-gtk_import.c b/src/conversation/gnunet-conversation-gtk_import.c index cc16d386..9602ff7d 100644 --- a/src/conversation/gnunet-conversation-gtk_import.c +++ b/src/conversation/gnunet-conversation-gtk_import.c @@ -99,17 +99,14 @@ static int private_record; * operation. * * @param cls NULL - * @param success #GNUNET_SYSERR on failure (including timeout/queue - * drop/failure to validate) #GNUNET_NO if content was already there #GNUNET_YES - * (or other positive value) on success - * @param emsg NULL on success, otherwise an error message + * @param ec the error code */ static void -add_contact_continuation (void *cls, int32_t success, const char *emsg) +add_contact_continuation (void *cls, enum GNUNET_ErrorCode ec) { - if (GNUNET_YES != success) + if (GNUNET_EC_NONE != ec) GCG_log (_ ("Adding contact failed: %s\n"), - (GNUNET_NO == success) ? _ ("record exists") : emsg); + GNUNET_ErrorCode_get_hint (ec)); add_contact_qe = NULL; } @@ -195,18 +192,16 @@ GSC_add_contact (const gchar *name, const gchar *address) * add operation. Finish 'add phone' operation. * * @param cls closure - * @param success #GNUNET_SYSERR on failure (including timeout/queue - * drop/failure to validate) #GNUNET_NO if content was already there or not - * found #GNUNET_YES (or other positive value) on success - * @param emsg NULL on success, otherwise an error message + * @param ec the errro code */ static void -add_phone_continuation (void *cls, int32_t success, const char *emsg) +add_phone_continuation (void *cls, enum GNUNET_ErrorCode ec) { add_phone_qe = NULL; - if (GNUNET_SYSERR == success) + if (GNUNET_EC_NONE != ec) { - GCG_log (_ ("Failed to publish my PHONE record: %s\n"), emsg); + GCG_log (_ ("Failed to publish my PHONE record: %s\n"), + GNUNET_ErrorCode_get_hint (ec)); GNUNET_free (phone_label); phone_label = NULL; } @@ -354,17 +349,15 @@ finish_shutdown () * with 'add phone' operation if one is pending. * * @param cls closure - * @param success #GNUNET_SYSERR on failure (including timeout/queue - * drop/failure to validate) #GNUNET_NO if content was already there or not - * found #GNUNET_YES (or other positive value) on success - * @param emsg NULL on success, otherwise an error message + * @param ec the error code */ static void -remove_phone_continuation (void *cls, int32_t success, const char *emsg) +remove_phone_continuation (void *cls, enum GNUNET_ErrorCode ec) { remove_phone_qe = NULL; - if (GNUNET_SYSERR == success) - GCG_log (_ ("Failed to remove PHONE record: %s\n"), emsg); + if (GNUNET_EC_NONE != ec) + GCG_log (_ ("Failed to remove PHONE record: %s\n"), + GNUNET_ErrorCode_get_hint (ec)); if (GNUNET_YES == add_waiting) add_phone (); if (GNUNET_YES == in_shutdown) diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c b/src/fs/gnunet-fs-gtk_main-window-search.c index 438a9517..fed27001 100644 --- a/src/fs/gnunet-fs-gtk_main-window-search.c +++ b/src/fs/gnunet-fs-gtk_main-window-search.c @@ -364,22 +364,19 @@ abort_pseu_lookup (struct PseuLookupContext *lctx) * operation. * * @param cls closure - * @param success #GNUNET_SYSERR on failure (including timeout/queue - * drop/failure to validate) #GNUNET_NO if content was already there or not - * found #GNUNET_YES (or other positive value) on success - * @param emsg NULL on success, otherwise an error message + * @param success the error code */ static void -store_continuation (void *cls, int32_t success, const char *emsg) +store_continuation (void *cls, enum GNUNET_ErrorCode success) { struct PseuLookupContext *lctx = cls; lctx->qe = NULL; - if (NULL != emsg) + if (GNUNET_EC_NONE != success) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Failed to save record: %s\n"), - emsg); + GNUNET_ErrorCode_get_hint (success)); beep (); } abort_pseu_lookup (lctx); diff --git a/src/namestore/gnunet-namestore-gtk.c b/src/namestore/gnunet-namestore-gtk.c index ad5aa099..025aa9c5 100644 --- a/src/namestore/gnunet-namestore-gtk.c +++ b/src/namestore/gnunet-namestore-gtk.c @@ -764,26 +764,26 @@ check_record_permitted (unsigned int rd_count, * Function called upon completion of an operation. * * @param cls the `struct OperationContext` of the operation that completed - * @param success #GNUNET_OK if the operation succeeded - * @param emsg error message if the operation failed + * @param ec the error code */ static void -operation_done_cont (void *cls, int32_t success, const char *emsg) +operation_done_cont (void *cls, enum GNUNET_ErrorCode ec) { struct OperationContext *oc = cls; GtkWidget *dialog; oc->qe = NULL; GNUNET_CONTAINER_DLL_remove (oc_head, oc_tail, oc); - if (GNUNET_SYSERR == success) + if (GNUNET_EC_NONE != ec) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Operation failed: `%s'\n"), emsg); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Operation failed: `%s'\n"), + GNUNET_ErrorCode_get_hint (ec)); dialog = gtk_message_dialog_new (GTK_WINDOW (main_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, _ ("Operation failed: `%s'\n"), - emsg); + GNUNET_ErrorCode_get_hint (ec)); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), diff --git a/src/statistics/gtk_statistics.c b/src/statistics/gtk_statistics.c index 3a7aba8e..e9e4360c 100644 --- a/src/statistics/gtk_statistics.c +++ b/src/statistics/gtk_statistics.c @@ -178,9 +178,7 @@ gtk_statistics_init (GtkStatistics *statistics) { GtkStatisticsPrivate *priv; - statistics->priv = G_TYPE_INSTANCE_GET_PRIVATE (statistics, - GTK_TYPE_STATISTICS, - GtkStatisticsPrivate); + statistics->priv = gtk_statistics_get_instance_private (statistics); priv = statistics->priv; #if GTK_MAJOR_VERSION < 3 g_signal_connect (statistics, -- cgit v1.2.3