[ghex] Various non-substantive cleanups.



commit 1c11af82a72ee88ee56bd3d8b781a33256e8f17c
Author: Logan Rathbone <poprocks gmail com>
Date:   Sat Apr 23 03:21:03 2022 -0400

    Various non-substantive cleanups.
    
    - appwin: cleanup: remove unused/commented-out function
    - pastedata: cleanup unused commented-out function
    - hexdoc: cleanup/remove commented-out code block
            This has been commented out since 2002 according to git-blame. I
            *think* it's safe to delete it now.
    - hexdoc: cleanup: delete untrue comment
    - remove explicit void casts for unused vars

 src/chartable.c               |  4 ----
 src/findreplace.c             |  7 -------
 src/ghex-application-window.c | 47 -------------------------------------------
 src/ghex-notebook-tab.c       |  2 --
 src/gtkhex-paste-data.c       | 16 ---------------
 src/gtkhex.c                  | 13 ------------
 src/hex-document.c            |  9 +++------
 src/main.c                    |  2 --
 src/preferences.c             | 13 ------------
 9 files changed, 3 insertions(+), 110 deletions(-)
---
diff --git a/src/chartable.c b/src/chartable.c
index a72cc31..86c904d 100644
--- a/src/chartable.c
+++ b/src/chartable.c
@@ -125,8 +125,6 @@ inbtn_clicked_cb (GtkButton *button, gpointer user_data)
 
        g_return_if_fail (GTK_IS_TREE_VIEW(treeview));
 
-       (void)button;   /* unused */
-
        model = gtk_tree_view_get_model (treeview);
 
        insert_char (treeview, model);
@@ -137,8 +135,6 @@ hide_chartable_cb (GtkButton *button, gpointer user_data)
 {
        GtkWindow *win = GTK_WINDOW(user_data);
 
-       (void)button;   /* unused */
-
        gtk_window_close (win);
 }
 
diff --git a/src/findreplace.c b/src/findreplace.c
index 83694af..7422ace 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -169,7 +169,6 @@ common_cancel_cb (GtkButton *button, gpointer user_data)
 {
        PaneDialog *self = PANE_DIALOG(user_data);
 
-       (void)button;   /* unused */
        g_return_if_fail (PANE_IS_DIALOG (self));
 
        g_signal_emit(self,
@@ -367,8 +366,6 @@ find_clear_cb (GtkButton *button, gpointer user_data)
        GtkWidget *new_gh;
        HexDocument *new_doc;
 
-       (void)user_data;
-
        g_return_if_fail (FIND_IS_DIALOG (self));
 
        f_priv = find_dialog_get_instance_private (self);
@@ -404,8 +401,6 @@ goto_byte_cb (GtkButton *button, gpointer user_data)
        const gchar *byte_str;
        gint64 payload;
        
-       (void)button;   /* unused */
-
        g_return_if_fail (JUMP_IS_DIALOG(self));
 
        priv = pane_dialog_get_instance_private (PANE_DIALOG(self));
@@ -502,7 +497,6 @@ replace_one_cb (GtkButton *button, gpointer user_data)
        gint64 offset;
        gint64 payload;
 
-       (void)button;   /* unused */
        g_return_if_fail (REPLACE_IS_DIALOG(self));
 
        priv = pane_dialog_get_instance_private (PANE_DIALOG(self));
@@ -566,7 +560,6 @@ replace_all_cb (GtkButton *button, gpointer user_data)
        gint64 offset;
        gint64 payload;
 
-       (void)button;   /* unused */
        g_return_if_fail (REPLACE_IS_DIALOG (self));
 
        priv = pane_dialog_get_instance_private (PANE_DIALOG(self));
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 071d8dd..b5be0ef 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -537,45 +537,6 @@ close_doc_confirmation_dialog (GHexApplicationWindow *self,
        gtk_widget_show (dialog);
 }
 
-/* FIXME / TODO - I could see this function being useful, but right now it is
- * not used by anything, so I'm disabling it to silence warnings about unused
- * functions.
- */
-#if 0
-static void
-enable_all_actions (GHexApplicationWindow *self, gboolean enable)
-{
-       GHexApplicationWindowClass *klass =
-               g_type_class_peek (GHEX_TYPE_APPLICATION_WINDOW);
-       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-       guint i = 0;
-       /* Note: don't be tempted to omit any of these and pass NULL to the
-        * function below. The docs do not say you can do this, and looking at the
-        * gtkwidget.c source code, doing so may result in dereferencing a NULL ptr
-        */
-       GType owner;
-       const char *action_name;
-       const GVariantType *parameter_type;
-       const char *property_name;
-
-       while (gtk_widget_class_query_action (widget_class,
-                       i,
-                       &owner,
-                       &action_name,
-                       &parameter_type,
-                       &property_name))
-       {
-               g_debug("%s: action %u : %s - setting enabled: %d",
-                               __func__, i, action_name, enable);
-
-               gtk_widget_action_set_enabled (GTK_WIDGET(self),
-                               action_name, enable);
-               ++i;
-       }
-}
-#endif
-
-/* Kinda like enable_all_actions, but only for ghex-specific ones. */
 static void
 enable_main_actions (GHexApplicationWindow *self, gboolean enable)
 {
@@ -612,7 +573,6 @@ copy_special (GtkWidget *widget,
        GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
        GdkClipboard *clipboard;
 
-       (void)action_name; (void)parameter;
        g_return_if_fail (HEX_IS_WIDGET (ACTIVE_GH));
 
        clipboard = gtk_widget_get_clipboard (GTK_WIDGET(ACTIVE_GH));
@@ -636,7 +596,6 @@ paste_special (GtkWidget *widget,
        GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
        GdkClipboard *clipboard;
 
-       (void)action_name; (void)parameter;
        g_return_if_fail (HEX_IS_WIDGET (ACTIVE_GH));
 
        clipboard = gtk_widget_get_clipboard (GTK_WIDGET(ACTIVE_GH));
@@ -1205,7 +1164,6 @@ print_preview (GtkWidget *widget,
        GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
 
        g_return_if_fail (HEX_IS_WIDGET(ACTIVE_GH));
-       (void)widget, (void)action_name, (void)parameter;       /* unused */
 
        common_print (GTK_WINDOW(self), ACTIVE_GH, /* preview: */ TRUE);
 }
@@ -1218,7 +1176,6 @@ do_print (GtkWidget *widget,
        GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
 
        g_return_if_fail (HEX_IS_WIDGET(ACTIVE_GH));
-       (void)widget, (void)action_name, (void)parameter;       /* unused */
 
        common_print (GTK_WINDOW(self), ACTIVE_GH, /* preview: */ FALSE);
 }
@@ -1418,8 +1375,6 @@ open_about (GtkWidget *widget,
 {
        GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
 
-       (void)parameter, (void)action_name;             /* unused */
-
        common_about_cb (GTK_WINDOW(self));
 }
 
@@ -1430,8 +1385,6 @@ open_preferences (GtkWidget *widget,
 {
        GHexApplicationWindow *self = GHEX_APPLICATION_WINDOW(widget);
 
-       (void)parameter, (void)action_name;             /* unused */
-
        if (! GTK_IS_WIDGET (self->prefs_dialog) ||
                        ! gtk_widget_get_visible (self->prefs_dialog)) {
                self->prefs_dialog = create_preferences_dialog (GTK_WINDOW(self));
diff --git a/src/ghex-notebook-tab.c b/src/ghex-notebook-tab.c
index df90168..2e02bc8 100644
--- a/src/ghex-notebook-tab.c
+++ b/src/ghex-notebook-tab.c
@@ -75,8 +75,6 @@ ghex_notebook_tab_document_changed_cb (HexDocument *doc,
 {
        GHexNotebookTab *self = GHEX_NOTEBOOK_TAB(user_data);
 
-       (void)change_data, (void)push_undo;     /* unused */
-
        tab_bold_label (self, hex_document_has_changed (doc));
 }
 
diff --git a/src/gtkhex-paste-data.c b/src/gtkhex-paste-data.c
index f28ad23..3db05b4 100644
--- a/src/gtkhex-paste-data.c
+++ b/src/gtkhex-paste-data.c
@@ -57,22 +57,6 @@ doc_data_to_string (const char *data, int len)
        return str;
 }
 
-
-/* FIXME/TODO - this transforms certain problematic characters for copy/paste
- * to a '?'. Maybe find a home for this guy at some point.
- */
-#if 0
-{
-       char *cp;
-               for (cp = text; *cp != '\0'; ++cp)
-               {
-                       if (! is_copyable(*cp))
-                               *cp = '?';
-               }
-}
-#endif
-               
-
 /* Constructors and Destructors */
 
 static void
diff --git a/src/gtkhex.c b/src/gtkhex.c
index dc5beb7..28ace89 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -250,7 +250,6 @@ copy_action (GtkWidget *widget,
        HexWidget *self = HEX_WIDGET(widget);
 
        g_return_if_fail (HEX_IS_WIDGET(self));
-       (void)action_name, (void)parameter;
 
        hex_widget_copy_to_clipboard (self);
 }
@@ -263,7 +262,6 @@ cut_action (GtkWidget *widget,
        HexWidget *self = HEX_WIDGET(widget);
 
        g_return_if_fail (HEX_IS_WIDGET(self));
-       (void)action_name, (void)parameter;
 
        hex_widget_cut_to_clipboard (self);
 }
@@ -276,7 +274,6 @@ paste_action (GtkWidget *widget,
        HexWidget *self = HEX_WIDGET(widget);
 
        g_return_if_fail (HEX_IS_WIDGET(self));
-       (void)action_name, (void)parameter;
 
        hex_widget_paste_from_clipboard (self);
 }
@@ -289,8 +286,6 @@ redo_action (GtkWidget *widget,
        HexWidget *self = HEX_WIDGET(widget);
        HexChangeData *cd;
 
-       (void)action_name, (void)parameter;
-
        g_return_if_fail (HEX_IS_WIDGET(self));
        g_return_if_fail (HEX_IS_DOCUMENT(self->document));
 
@@ -325,8 +320,6 @@ undo_action (GtkWidget *widget,
        HexWidget *self = HEX_WIDGET(widget);
        HexChangeData *cd;
 
-       (void)action_name, (void)parameter;
-
        g_return_if_fail (HEX_IS_WIDGET(self));
        g_return_if_fail (HEX_IS_DOCUMENT(self->document));
 
@@ -2139,8 +2132,6 @@ static void
 hex_widget_real_cut_to_clipboard(HexWidget *self,
                gpointer user_data)
 {
-       (void)user_data;
-
        if (self->selection.start != -1 && self->selection.end != -1) {
                hex_widget_real_copy_to_clipboard(self);
                hex_widget_delete_selection(self);
@@ -2196,8 +2187,6 @@ hex_widget_real_paste_from_clipboard (HexWidget *self,
        HexPasteData *paste;
        gboolean have_hex_paste_data = FALSE;
 
-       (void)user_data;        /* unused */
-
        clipboard = gtk_widget_get_clipboard (widget);
        content = gdk_clipboard_get_content (clipboard);
        g_value_init (&value, HEX_TYPE_PASTE_DATA);
@@ -2250,8 +2239,6 @@ static void
 hex_widget_real_draw_complete (HexWidget *self,
                gpointer user_data)
 {
-       (void)user_data;
-
        recalc_scrolling (self);
 }
 
diff --git a/src/hex-document.c b/src/hex-document.c
index 8b7cb91..f47ed66 100644
--- a/src/hex-document.c
+++ b/src/hex-document.c
@@ -658,7 +658,7 @@ cleanup:
  */
 void
 hex_document_read_async (HexDocument *doc,
-               GCancellable *cancellable,      /* FIXME: presently ignored */
+               GCancellable *cancellable,
                GAsyncReadyCallback callback,
                gpointer user_data)
 {
@@ -802,7 +802,7 @@ write_ready_cb (GObject *source_object,
  */
 void
 hex_document_write_async (HexDocument *doc,
-               GCancellable *cancellable,      /* FIXME: presently ignored */
+               GCancellable *cancellable,
                GAsyncReadyCallback callback,
                gpointer user_data)
 {
@@ -846,7 +846,7 @@ out:
 void
 hex_document_write_to_file_async (HexDocument *doc,
                GFile *file,
-               GCancellable *cancellable,      /* FIXME: presently ignored */
+               GCancellable *cancellable,
                GAsyncReadyCallback callback,
                gpointer user_data)
 {
@@ -1460,9 +1460,6 @@ hex_document_real_redo(HexDocument *doc)
                                hex_document_set_byte(doc, cd->v_byte, cd->start, FALSE, FALSE);
                        else if(cd->rep_len == 0)
                                hex_document_set_byte(doc, cd->v_byte, cd->start, cd->insert, FALSE);
-#if 0
-                               hex_document_delete_data(doc, cd->start, 1, FALSE);
-#endif
                        else
                                hex_document_set_byte(doc, cd->v_byte, cd->start, TRUE, FALSE);
                        cd->v_byte = c_val;
diff --git a/src/main.c b/src/main.c
index 29cc354..e57bee2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -113,8 +113,6 @@ static void
 activate (GtkApplication *app,
        gpointer user_data)
 {
-       (void)user_data;        /* unused */
-
        do_app_window (app);
 
        gtk_window_set_application (window, app);
diff --git a/src/preferences.c b/src/preferences.c
index fb01845..29f188a 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -124,7 +124,6 @@ static void
 help_clicked_cb (GtkButton *button,
                gpointer user_data)
 {
-       (void)user_data;        /* unused */
        g_return_if_fail (GTK_IS_WINDOW (prefs_dialog));
 
        common_help_cb (GTK_WINDOW(prefs_dialog));
@@ -149,8 +148,6 @@ static void
 shaded_box_spinbtn_value_changed_cb (GtkSpinButton *spin_button,
                gpointer user_data)
 {
-       (void)spin_button, (void)user_data; /* unused */
-
        sync_shaded_box_size_with_spinbtn ();
 }
 
@@ -160,8 +157,6 @@ shaded_box_chkbtn_toggled_cb (GtkCheckButton *checkbutton,
 {
        gboolean checked;
 
-       (void)user_data;        /* unused */
-
        checked = gtk_check_button_get_active (checkbutton);
 
        gtk_widget_set_sensitive (shaded_box_box,
@@ -182,8 +177,6 @@ show_offsets_set_cb (GtkCheckButton *checkbutton,
 {
        gboolean show_or_hide;
 
-       (void)user_data;        /* unused */
-
        show_or_hide = gtk_check_button_get_active (checkbutton);
 
        g_settings_set_boolean (settings,
@@ -216,8 +209,6 @@ monospace_font_filter (/* const */ PangoFontFamily *family,
                const PangoFontFace *face,
                gpointer data)
 {
-       (void)face, (void)data;
-
        if (pango_font_family_is_monospace (family))
                return TRUE;
        else
@@ -286,8 +277,6 @@ dark_mode_set_cb (GtkSwitch *widget,
 {
        int dark_mode;
 
-       (void)user_data;        /* unused */
-
        if (state)
                dark_mode = DARK_MODE_ON;
        else
@@ -307,8 +296,6 @@ system_default_set_cb (GtkCheckButton *checkbutton,
        gboolean checked;
        int dark_mode;
 
-       (void)user_data;        /* unused */
-
        checked = gtk_check_button_get_active (checkbutton);
 
        gtk_widget_set_sensitive (dark_mode_switch,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]