[ghex/gtk4-port: 83/91] GHex4 now compiles with zarro woornings.




commit 105979cd9fb15cdd3096fef76125b0e8279ab83f
Author: Logan Rathbone <poprocks gmail com>
Date:   Wed Aug 4 13:25:14 2021 -0400

    GHex4 now compiles with zarro woornings.

 src/findreplace.c           | 20 ++++++++++----------
 src/gtkhex-layout-manager.c |  9 +--------
 src/gtkhex-paste-data.c     | 12 ++++++------
 src/gtkhex-paste-data.h     |  6 +++---
 src/gtkhex.c                | 10 +++++-----
 src/paste-special.c         |  8 ++++----
 6 files changed, 29 insertions(+), 36 deletions(-)
---
diff --git a/src/findreplace.c b/src/findreplace.c
index 6f4fc60b..035a6b9d 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -116,7 +116,7 @@ create_hex_view (HexDocument *doc)
 
        gtk_widget_set_hexpand (gh, TRUE);
        gtk_hex_set_group_type (GTK_HEX(gh), def_group_type);
-       common_set_gtkhex_font_from_settings (gh);
+       common_set_gtkhex_font_from_settings (GTK_HEX(gh));
     gtk_hex_set_insert_mode (GTK_HEX(gh), TRUE);
     gtk_hex_set_geometry (GTK_HEX(gh), 16, 4);
 
@@ -178,9 +178,9 @@ find_next_cb (GtkButton *button, gpointer user_data)
        FindDialogPrivate *f_priv;
        GtkWindow *parent;
        HexDocument *doc;
-       guint cursor_pos;
-       guint offset, str_len;
-       gchar *str;
+       int cursor_pos;
+       int offset, str_len;
+       char *str;
        static gboolean found = FALSE;
        
        (void)button;   /* unused */
@@ -454,9 +454,9 @@ replace_one_cb (GtkButton *button, gpointer user_data)
        FindDialogPrivate *f_priv;
        GtkWindow *parent;
        HexDocument *doc;
-       guint cursor_pos;
-       gchar *find_str = NULL, *rep_str = NULL;
-       guint find_len, rep_len, offset;
+       int cursor_pos;
+       char *find_str = NULL, *rep_str = NULL;
+       int find_len, rep_len, offset;
 
        (void)button;   /* unused */
        g_return_if_fail (REPLACE_IS_DIALOG(self));
@@ -517,9 +517,9 @@ replace_all_cb (GtkButton *button, gpointer user_data)
        FindDialogPrivate *f_priv;
        GtkWindow *parent;
        HexDocument *doc;
-       guint cursor_pos;
-       gchar *find_str = NULL, *rep_str = NULL;
-       guint find_len, rep_len, offset, count;
+       int cursor_pos;
+       char *find_str = NULL, *rep_str = NULL;
+       int find_len, rep_len, offset, count;
 
        (void)button;   /* unused */
        g_return_if_fail (REPLACE_IS_DIALOG (self));
diff --git a/src/gtkhex-layout-manager.c b/src/gtkhex-layout-manager.c
index 705c855d..357d4fcd 100644
--- a/src/gtkhex-layout-manager.c
+++ b/src/gtkhex-layout-manager.c
@@ -1,6 +1,6 @@
 /* vim: ts=4 sw=4 colorcolumn=80
  * -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* gtkhex-layout-manager.h - declaration of a GtkHex layout manager
+/* gtkhex-layout-manager.c - definition of a GtkHex layout manager
 
    Copyright © 2021 Logan Rathbone <poprocks gmail com>
 
@@ -179,7 +179,6 @@ gtk_hex_layout_measure (GtkLayoutManager *layout_manager,
                int                             *minimum_baseline,
                int                             *natural_baseline)
 {
-       GtkHexLayoutChild *child_info;
        GtkWidget *child;
        int minimum_size = 0;
        int natural_size = 0;
@@ -193,10 +192,6 @@ gtk_hex_layout_measure (GtkLayoutManager *layout_manager,
                if (!gtk_widget_should_layout (child))
                        continue;
 
-               child_info =
-                       GTK_HEX_LAYOUT_CHILD(gtk_layout_manager_get_layout_child
-                                       (layout_manager, child));
-
                gtk_widget_measure (child, orientation,
                                /* for-size: */ -1,             /* == unknown. */
                                &child_min, &child_nat,
@@ -240,7 +235,6 @@ gtk_hex_layout_allocate (GtkLayoutManager *layout_manager,
        GtkHexLayout *self = GTK_HEX_LAYOUT (layout_manager);
        GtkHexLayoutChild *child_info;
        GtkWidget *child;
-       gboolean have_offsets = FALSE;
        gboolean have_hex = FALSE;
        gboolean have_ascii = FALSE;
        GtkAllocation base_alloc = {.x = 0, .y = 0, .width = 0, .height = height};
@@ -272,7 +266,6 @@ gtk_hex_layout_allocate (GtkLayoutManager *layout_manager,
                switch (child_info->column)
                {
                        case OFFSETS_COLUMN:
-                               have_offsets = TRUE;
                                off_alloc.width = OFFSETS_CPL * self->char_width;
                                break;
                        case HEX_COLUMN:
diff --git a/src/gtkhex-paste-data.c b/src/gtkhex-paste-data.c
index b2849ed0..6c95e554 100644
--- a/src/gtkhex-paste-data.c
+++ b/src/gtkhex-paste-data.c
@@ -31,8 +31,8 @@ struct _GtkHexPasteData
 {
        GObject parent_instance;
 
-       guchar *doc_data;
-       guint elems;
+       char *doc_data;
+       int elems;
 };
 
 G_DEFINE_TYPE (GtkHexPasteData, gtk_hex_paste_data, G_TYPE_OBJECT)
@@ -46,7 +46,7 @@ G_DEFINE_TYPE (GtkHexPasteData, gtk_hex_paste_data, G_TYPE_OBJECT)
  * String returned should be freed with g_free.
  */
 static char *
-doc_data_to_string (const guchar *data, guint len)
+doc_data_to_string (const char *data, int len)
 {
        char *str;
 
@@ -89,7 +89,7 @@ gtk_hex_paste_data_class_init (GtkHexPasteDataClass *klass)
 /* Public Method Definitions */
 
 GtkHexPasteData *
-gtk_hex_paste_data_new (guchar *doc_data, guint elems)
+gtk_hex_paste_data_new (char *doc_data, int elems)
 {
        GtkHexPasteData *self;
 
@@ -118,7 +118,7 @@ gtk_hex_paste_data_get_string (GtkHexPasteData *self)
        return string;
 }
 
-guchar *
+char *
 gtk_hex_paste_data_get_doc_data (GtkHexPasteData *self)
 {
        g_return_val_if_fail (self->doc_data, NULL);
@@ -126,7 +126,7 @@ gtk_hex_paste_data_get_doc_data (GtkHexPasteData *self)
        return self->doc_data;
 }
 
-guint
+int
 gtk_hex_paste_data_get_elems (GtkHexPasteData *self)
 {
        return self->elems;
diff --git a/src/gtkhex-paste-data.h b/src/gtkhex-paste-data.h
index 3afd9dd3..dcf08647 100644
--- a/src/gtkhex-paste-data.h
+++ b/src/gtkhex-paste-data.h
@@ -37,10 +37,10 @@ G_DECLARE_FINAL_TYPE (GtkHexPasteData, gtk_hex_paste_data, GTK, HEX_PASTE_DATA,
 
 /* Method Declarations */
 
-GtkHexPasteData *      gtk_hex_paste_data_new (guchar *doc_data, guint elems);
+GtkHexPasteData *      gtk_hex_paste_data_new (char *doc_data, int elems);
 char *                         gtk_hex_paste_data_get_string (GtkHexPasteData *self);
-guchar *                       gtk_hex_paste_data_get_doc_data (GtkHexPasteData *self);
-guint                          gtk_hex_paste_data_get_elems (GtkHexPasteData *self);
+char *                 gtk_hex_paste_data_get_doc_data (GtkHexPasteData *self);
+int                            gtk_hex_paste_data_get_elems (GtkHexPasteData *self);
 
 G_END_DECLS
 
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 642d6da7..434fdfa8 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -2098,8 +2098,8 @@ gtk_hex_real_copy_to_clipboard (GtkHex *gh)
        GtkHexPasteData *paste;
        GdkContentProvider *provider_union;
        GdkContentProvider *provider_array[2];
-       guint start_pos, end_pos, len;
-       guchar *doc_data;
+       int start_pos, end_pos, len;
+       char *doc_data;
        char *string;
 
        clipboard = gtk_widget_get_clipboard (widget);
@@ -2168,7 +2168,7 @@ plaintext_paste_received_cb (GObject *source_object,
                                gh->cursor_pos,
                                strlen(text),
                                0,      /* rep_len (0 to insert w/o replacing; what we want) */
-                               (guchar *)text,
+                               text,
                                TRUE);
 
                gtk_hex_set_cursor(gh, gh->cursor_pos + strlen(text));
@@ -2216,8 +2216,8 @@ gtk_hex_real_paste_from_clipboard (GtkHex *gh,
 
        if (have_hex_paste_data)
        {
-               guchar *doc_data;
-               guint elems;
+               char *doc_data;
+               int elems;
 
                g_debug("%s: We HAVE our special HexPasteData.",
                                __func__);
diff --git a/src/paste-special.c b/src/paste-special.c
index 2c148a39..b0e0c794 100644
--- a/src/paste-special.c
+++ b/src/paste-special.c
@@ -162,8 +162,8 @@ static char *
 hex_paste_data_to_delimited_hex (void)
 {
        GString *buf;
-       guchar *doc_data = NULL;
-       guint elems;
+       char *doc_data = NULL;
+       int elems;
        char *ret_str;
 
        g_return_val_if_fail (GTK_IS_HEX_PASTE_DATA (hex_paste_data), NULL);
@@ -172,7 +172,7 @@ hex_paste_data_to_delimited_hex (void)
        doc_data = gtk_hex_paste_data_get_doc_data (hex_paste_data);
        elems = gtk_hex_paste_data_get_elems (hex_paste_data);
 
-       for (guint i = 0; i < elems; ++i)
+       for (int i = 0; i < elems; ++i)
        {
                g_string_append_printf (buf, "%.2X", doc_data[i]);
 
@@ -269,7 +269,7 @@ delimited_paste_received_cb (GObject *source_object,
                        gtk_hex_get_cursor (gh),
                        buf->len,
                        0,      /* rep_len (0 to insert w/o replacing; what we want) */
-                       (guchar *)buf->str,
+                       buf->str,
                        TRUE);
 }
 


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