[ghex: 1/2] API: Standardize datatypes and signedness




commit 6de58741694553b0a781bf69fa9b749eba349bba
Author: Logan Rathbone <poprocks gmail com>
Date:   Sat Dec 18 06:57:35 2021 -0500

    API: Standardize datatypes and signedness
    
    Standardize on gint64 so that we have a minimum cursor pos and file size
    that works with files larger than 2 GB.
    
    This doesn't fix all issues. nb: Find/Replace needs to be optimized. It
    gets OOM-killed when searching for a string towards the end of the
    Fedora Core 35 ISO, for instance.

 src/findreplace.c             |  35 +++++-----
 src/ghex-application-window.c |   8 +--
 src/gtkhex-layout-manager.c   |   9 +--
 src/gtkhex-layout-manager.h   |   4 +-
 src/gtkhex.c                  | 157 +++++++++++++++++++++---------------------
 src/gtkhex.h                  |  42 +++++------
 src/hex-buffer-iface.c        |  10 +--
 src/hex-buffer-iface.h        |  18 ++---
 src/hex-buffer-malloc.c       |  25 ++++---
 src/hex-buffer-mmap.c         |  40 +++++------
 src/hex-document.c            |  32 ++++-----
 src/hex-document.h            |  16 ++---
 src/print.c                   |   4 +-
 13 files changed, 202 insertions(+), 198 deletions(-)
---
diff --git a/src/findreplace.c b/src/findreplace.c
index 5858939..a89c484 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -109,7 +109,7 @@ static void replace_one_cb (GtkButton *button, gpointer user_data);
 static void replace_all_cb (GtkButton *button, gpointer user_data);
 static void replace_clear_cb (GtkButton *button, gpointer user_data);
 static void goto_byte_cb (GtkButton *button, gpointer user_data);
-static size_t get_search_string (HexDocument *doc, gchar **str);
+static gint64 get_search_string (HexDocument *doc, gchar **str);
 
 
 static GtkWidget *
@@ -129,10 +129,10 @@ create_hex_view (HexDocument *doc)
     return gh;
 }
 
-static size_t
+static gint64
 get_search_string (HexDocument *doc, char **str)
 {
-       size_t size = hex_buffer_get_payload_size (hex_document_get_buffer (doc));
+       gint64 size = hex_buffer_get_payload_size (hex_document_get_buffer (doc));
        
        if (size > 0)
                *str = hex_buffer_get_data (hex_document_get_buffer (doc), 0, size);
@@ -185,9 +185,9 @@ find_common (FindDialog *self, enum FindDirection direction,
        FindDialogPrivate *f_priv;
        GtkWindow *parent;
        HexDocument *doc;
-       int cursor_pos;
-       int str_len;
-       size_t offset;
+       gint64 cursor_pos;
+       gint64 str_len;
+       gint64 offset;
        char *str;
        static gboolean found = FALSE;
        
@@ -303,14 +303,14 @@ goto_byte_cb (GtkButton *button, gpointer user_data)
        PaneDialogPrivate *priv;
        GtkWindow *parent;
        HexDocument *doc;
-       int cursor_pos;
+       gint64 cursor_pos;
        GtkEntry *entry;
        GtkEntryBuffer *buffer;
        int byte = 2, len, i;
        int is_relative = 0;
        gboolean is_hex;
        const gchar *byte_str;
-       size_t payload;
+       gint64 payload;
        
        (void)button;   /* unused */
 
@@ -404,11 +404,11 @@ replace_one_cb (GtkButton *button, gpointer user_data)
        FindDialogPrivate *f_priv;
        GtkWindow *parent;
        HexDocument *doc;
-       int cursor_pos;
+       gint64 cursor_pos;
        char *find_str = NULL, *rep_str = NULL;
-       int find_len, rep_len;
-       size_t offset;
-       size_t payload;
+       size_t find_len, rep_len;
+       gint64 offset;
+       gint64 payload;
 
        (void)button;   /* unused */
        g_return_if_fail (REPLACE_IS_DIALOG(self));
@@ -433,7 +433,7 @@ replace_one_cb (GtkButton *button, gpointer user_data)
                no_string_dialog (parent);
                return;
        }
-       rep_len = get_search_string(self->r_doc, &rep_str);
+       rep_len = get_search_string (self->r_doc, &rep_str);
        
        if (find_len > payload - cursor_pos)
                goto clean_up;
@@ -470,11 +470,12 @@ replace_all_cb (GtkButton *button, gpointer user_data)
        FindDialogPrivate *f_priv;
        GtkWindow *parent;
        HexDocument *doc;
-       int cursor_pos;
+       gint64 cursor_pos;
        char *find_str = NULL, *rep_str = NULL;
-       size_t find_len, rep_len, count;
-       size_t offset;
-       size_t payload;
+       size_t find_len, rep_len;
+       int count;
+       gint64 offset;
+       gint64 payload;
 
        (void)button;   /* unused */
        g_return_if_fail (REPLACE_IS_DIALOG (self));
diff --git a/src/ghex-application-window.c b/src/ghex-application-window.c
index 98a6dd9..cdb90e8 100644
--- a/src/ghex-application-window.c
+++ b/src/ghex-application-window.c
@@ -1359,8 +1359,8 @@ static void
 update_status_message (GHexApplicationWindow *self)
 {
        char fmt[FMT_LEN], status[STATUS_LEN];
-       int current_pos;
-       int ss, se, len;
+       gint64 current_pos, ss, se;
+       int len;
 
        if (! ACTIVE_GH)
        {
@@ -1372,10 +1372,10 @@ update_status_message (GHexApplicationWindow *self)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"
 #endif
-       current_pos = gtk_hex_get_cursor(ACTIVE_GH);
+       current_pos = gtk_hex_get_cursor (ACTIVE_GH);
        if (g_snprintf(fmt, FMT_LEN, _("Offset: %s"), offset_fmt) < FMT_LEN) {
                g_snprintf(status, STATUS_LEN, fmt, current_pos);
-               if (gtk_hex_get_selection(ACTIVE_GH, &ss, &se)) {
+               if (gtk_hex_get_selection (ACTIVE_GH, &ss, &se)) {
                        if (g_snprintf(fmt, FMT_LEN, _("; %s bytes from %s to %s selected"),
                                                offset_fmt, offset_fmt, offset_fmt) < FMT_LEN) {
                                len = strlen(status);
diff --git a/src/gtkhex-layout-manager.c b/src/gtkhex-layout-manager.c
index ff81cb9..d0adf91 100644
--- a/src/gtkhex-layout-manager.c
+++ b/src/gtkhex-layout-manager.c
@@ -32,8 +32,8 @@
 struct _GtkHexLayout {
        GtkLayoutManager parent_instance;
 
-       guint char_width;
-       guint group_type;
+       int char_width;
+       GtkHexGroupType group_type;
 
        int cpl;
        int hex_cpl;
@@ -481,7 +481,7 @@ gtk_hex_layout_new (void)
 }
 
 void
-gtk_hex_layout_set_char_width (GtkHexLayout *layout, guint width)
+gtk_hex_layout_set_char_width (GtkHexLayout *layout, int width)
 {
        layout->char_width = width;
 
@@ -489,7 +489,8 @@ gtk_hex_layout_set_char_width (GtkHexLayout *layout, guint width)
 }
 
 void
-gtk_hex_layout_set_group_type (GtkHexLayout *layout, guint group_type)
+gtk_hex_layout_set_group_type (GtkHexLayout *layout,
+               GtkHexGroupType group_type)
 {
        layout->group_type = group_type;
 
diff --git a/src/gtkhex-layout-manager.h b/src/gtkhex-layout-manager.h
index d2ec998..023955d 100644
--- a/src/gtkhex-layout-manager.h
+++ b/src/gtkhex-layout-manager.h
@@ -52,13 +52,13 @@ G_DECLARE_FINAL_TYPE (GtkHexLayoutChild, gtk_hex_layout_child,
 
 GtkLayoutManager *     gtk_hex_layout_new (void);
 void                           gtk_hex_layout_set_char_width (GtkHexLayout *layout,
-                                               guint width);
+                                               int width);
 void                           gtk_hex_layout_child_set_column (GtkHexLayoutChild *child,
                                                GtkHexLayoutColumn column);
 int                                    gtk_hex_layout_get_cpl (GtkHexLayout *layout);
 int                            gtk_hex_layout_get_hex_cpl (GtkHexLayout *layout);
 void                           gtk_hex_layout_set_group_type (GtkHexLayout *layout,
-                                               guint group_type);
+                                               GtkHexGroupType group_type);
 void                           gtk_hex_layout_set_cursor_pos (GtkHexLayout *layout,
                                                int x, int y);
 
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 7c6e367..88b702c 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -88,8 +88,8 @@ typedef struct _GtkHex_Highlight GtkHex_Highlight;
  * valid is set to TRUE. */
 struct _GtkHex_Highlight
 {
-       int start, end;
-       int start_line, end_line;
+       gint64 start, end;
+       gint64 start_line, end_line;
 
        gboolean valid;
 
@@ -101,7 +101,6 @@ struct _GtkHex_Highlight
  */
 struct _GtkHex_AutoHighlight
 {
-       int search_view;
        char *search_string;
        int search_len;
 
@@ -140,24 +139,39 @@ struct _GtkHex
 
        GtkHexViewType active_view;
 
-       guint char_width, char_height;
+       int char_width, char_height;
+
+       /* Cache of the mouse button. guint to marry up with GtkGesture. */
        guint button;
 
-       int cursor_pos;
+       gint64 cursor_pos;
        GtkHex_Highlight selection;
-       int lower_nibble;
+       gboolean lower_nibble;
 
-       guint group_type;
+       GtkHexGroupType group_type;
 
-       int lines, vis_lines, cpl, top_line;
-       int cursor_shown;
+       /* cpl == `characters per line` */
+       int cpl;
+       /* number of lines visible in the display */
+       int vis_lines;
+
+       /* These are the lines in absolute terms, shown within the display. So they
+        * will be some fraction of `index`, but could still theoretically be quite
+        * large if dealing with a huge file.
+        */
+       gint64 lines, top_line;
+       gboolean cursor_shown;
 
-       int xdisp_width, adisp_width, extra_width;
+       /* width of the hex display `xdisp` and ascii display `adisp` */
+       int xdisp_width, adisp_width;
 
        GtkHex_AutoHighlight *auto_highlight;
 
+       /* scroll direction: 0 means no scrolling; a -ve number means we're
+        * scrolling up, and a +ve number means we're scrolling down. */
        int scroll_dir;
        guint scroll_timeout;
+
        gboolean show_offsets;
        gboolean insert;
        gboolean selecting;
@@ -175,33 +189,34 @@ G_DEFINE_TYPE (GtkHex, gtk_hex, GTK_TYPE_WIDGET)
 
 /* ----- */
 
-static int gtkhex_signals[LAST_SIGNAL] = { 0 };
+/* STATIC FORWARD DECLARATIONS */
+
+static guint gtkhex_signals[LAST_SIGNAL] = { 0 };
 
 static char *char_widths = NULL;
 
-static void render_highlights (GtkHex *gh, cairo_t *cr, int cursor_line,
+static void render_highlights (GtkHex *gh, cairo_t *cr, gint64 cursor_line,
                GtkHexViewType type);
-static void render_lines (GtkHex *gh, cairo_t *cr, int, int,
+static void render_lines (GtkHex *gh, cairo_t *cr, int min_lines, int max_lines,
                GtkHexViewType type);
 
-static void gtk_hex_validate_highlight(GtkHex *gh, GtkHex_Highlight *hl);
-static void gtk_hex_invalidate_highlight(GtkHex *gh, GtkHex_Highlight *hl);
-static void gtk_hex_invalidate_all_highlights(GtkHex *gh);
+static void gtk_hex_validate_highlight (GtkHex *gh, GtkHex_Highlight *hl);
+static void gtk_hex_invalidate_highlight (GtkHex *gh, GtkHex_Highlight *hl);
+static void gtk_hex_invalidate_all_highlights (GtkHex *gh);
 
-static void gtk_hex_update_all_auto_highlights(GtkHex *gh, gboolean delete,
+static void gtk_hex_update_all_auto_highlights (GtkHex *gh, gboolean delete,
                gboolean add);
 
 static GtkHex_Highlight *gtk_hex_insert_highlight (GtkHex *gh,
-               GtkHex_AutoHighlight *ahl,
-               int start, int end);
+               GtkHex_AutoHighlight *ahl, gint64 start, gint64 end);
 
 static void gtk_hex_delete_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
                GtkHex_Highlight *hl);
 
-static void gtk_hex_update_auto_highlight(GtkHex *gh, GtkHex_AutoHighlight *ahl,
+static void gtk_hex_update_auto_highlight (GtkHex *gh, GtkHex_AutoHighlight *ahl,
                gboolean delete, gboolean add);
 
-static void recalc_displays(GtkHex *gh);
+static void recalc_displays (GtkHex *gh);
 
 static void show_cursor (GtkHex *gh, gboolean show);
 
@@ -430,14 +445,15 @@ get_char_width (GtkHex *gh)
  * Returns: length of resulting number of bytes/characters in buffer.
  */
 static int
-format_xblock (GtkHex *gh, char *out, int start, int end)
+format_xblock (GtkHex *gh, char *out, gint64 start, gint64 end)
 {
-       int i, j, low, high;
+       gint64 i, j;
+       int low, high;
        guchar c;
 
        for (i = start + 1, j = 0; i <= end; i++)
        {
-               c = gtk_hex_get_byte(gh, i - 1);
+               c = gtk_hex_get_byte (gh, i - 1);
                low = c & 0x0F;
                high = (c & 0xF0) >> 4;
                
@@ -451,13 +467,13 @@ format_xblock (GtkHex *gh, char *out, int start, int end)
 }
 
 static int
-format_ablock (GtkHex *gh, char *out, int start, int end)
+format_ablock (GtkHex *gh, char *out, gint64 start, gint64 end)
 {
-       int i, j;
+       gint64 i, j;
        guchar c;
 
        for (i = start, j = 0; i < end; i++, j++) {
-               c = gtk_hex_get_byte(gh, i);
+               c = gtk_hex_get_byte (gh, i);
                if (is_displayable(c))
                        out[j] = c;
                else
@@ -707,7 +723,7 @@ show_cursor (GtkHex *gh, gboolean show)
 static void
 render_highlights (GtkHex *gh,
                cairo_t *cr,
-               int cursor_line,
+               gint64 cursor_line,
                GtkHexViewType type)
 {
        /* Shorthand tracers to walk through highlight lists */
@@ -934,14 +950,13 @@ render_lines (GtkHex *gh,
        GtkWidget *widget;
        GtkStateFlags state;
        PangoLayout *layout;
-       int (*format_func) (GtkHex *gh, char *out, int start, int end);
+       int (*block_format_func) (GtkHex *gh, char *out, gint64 start, gint64 end);
+       int block_format_len;
        GtkAllocation allocation;
        GtkStyleContext *context;
-       int frm_len;
-       int cursor_line;
+       gint64 cursor_line;
        int cpl;
        gboolean cursor_drawn = FALSE;
-       int i;
 
        g_return_if_fail (gtk_widget_get_realized (GTK_WIDGET(gh)));
        g_return_if_fail (gh->cpl);
@@ -952,14 +967,14 @@ render_lines (GtkHex *gh,
        {
                widget = gh->xdisp;
                layout = gh->xlayout;
-               format_func = format_xblock;
+               block_format_func = format_xblock;
                cpl = gtk_hex_layout_get_hex_cpl (GTK_HEX_LAYOUT(gh->layout_manager));
        }
        else    /* VIEW_ASCII */
        {
                widget = gh->adisp;
                layout = gh->alayout;
-               format_func = format_ablock;
+               block_format_func = format_ablock;
                cpl = gh->cpl;
        }
 
@@ -992,17 +1007,15 @@ render_lines (GtkHex *gh,
        max_lines = MIN(max_lines, gh->vis_lines);
        max_lines = MIN(max_lines, gh->lines);
 
-       /* FIXME -  Maybe break this down/comment it to make it clearer?
-        */
-       frm_len = format_func (gh,
+       block_format_len = block_format_func (gh,
                        (char *)gh->disp_buffer,
                        (gh->top_line + min_lines) * gh->cpl,
                        MIN( (gh->top_line + max_lines + 1) * gh->cpl,
                                HEX_BUFFER_PAYLOAD (gh->document) ));
        
-       for (i = min_lines; i <= max_lines; i++)
+       for (int i = min_lines; i <= max_lines; i++)
        {
-               int tmp = frm_len - ((i - min_lines) * cpl);
+               int tmp = block_format_len - ((i - min_lines) * cpl);
 
                if (tmp <= 0)
                        break;
@@ -1064,7 +1077,7 @@ render_offsets (GtkHex *gh,
 
        for (int i = min_lines; i <= max_lines; i++) {
                /* generate offset string and place in temporary buffer */
-               sprintf(offstr, "%08X",
+               sprintf(offstr, "%08lX",
                                (gh->top_line + i) * gh->cpl + STARTING_OFFSET);
 
                /* build pango layout for offset line; draw line with gtk. */
@@ -1230,7 +1243,7 @@ display_scrolled (GtkAdjustment *adj, GtkHex *gh)
  * mouse signal handlers (button 1 and motion) for both displays
  */
 static gboolean
-scroll_timeout_handler(GtkHex *gh)
+scroll_timeout_handler (GtkHex *gh)
 {
        if (gh->scroll_dir < 0)
        {
@@ -1243,7 +1256,7 @@ scroll_timeout_handler(GtkHex *gh)
                                MIN (HEX_BUFFER_PAYLOAD (gh->document) - 1,
                                                gh->cursor_pos + gh->cpl));
        }
-       return TRUE;
+       return G_SOURCE_CONTINUE;
 }
 
 static gboolean
@@ -1253,7 +1266,6 @@ scroll_cb (GtkEventControllerScroll *controller,
                gpointer                  user_data)
 {
        GtkHex *gh = GTK_HEX (user_data);
-       guint button;
        double old_value, new_value;
 
        g_return_val_if_fail (GTK_IS_HEX(gh), FALSE);
@@ -1436,9 +1448,9 @@ drag_update_helper (GtkHex *gh,
        }
 
        if (gh->scroll_dir != 0) {
-               if (gh->scroll_timeout == 0) {
+               if (! gh->scroll_timeout) {
                        gh->scroll_timeout =
-                               g_timeout_add(SCROLL_TIMEOUT,
+                               g_timeout_add (SCROLL_TIMEOUT,
                                                          G_SOURCE_FUNC(scroll_timeout_handler),
                                                          gh);
                }
@@ -1446,7 +1458,7 @@ drag_update_helper (GtkHex *gh,
        }
        else {
                if (gh->scroll_timeout != 0) {
-                       g_source_remove(gh->scroll_timeout);
+                       g_source_remove (gh->scroll_timeout);
                        gh->scroll_timeout = 0;
                }
        }
@@ -1872,7 +1884,8 @@ gtk_hex_invalidate_all_highlights (GtkHex *gh)
 static GtkHex_Highlight *
 gtk_hex_insert_highlight (GtkHex *gh,
                GtkHex_AutoHighlight *ahl,
-               int start, int end)
+               gint64 start,
+               gint64 end)
 {
        size_t payload_size;
 
@@ -1891,7 +1904,7 @@ gtk_hex_insert_highlight (GtkHex *gh,
        if (new->next) new->next->prev = new;
        ahl->highlights = new;
 
-       bytes_changed(gh, new->start, new->end);
+       bytes_changed (gh, new->start, new->end);
 
        return new;
 }
@@ -1922,7 +1935,7 @@ gtk_hex_compare_data (GtkHex *gh, guchar *cmp, guint pos, int len)
        int i;
        for (i = 0; i < len; i++)
        {
-               guchar c = gtk_hex_get_byte(gh, pos + i);
+               guchar c = gtk_hex_get_byte (gh, pos + i);
                if (c != *(cmp + i))
                        return FALSE;
        }
@@ -2496,7 +2509,6 @@ gtk_hex_init (GtkHex *gh)
 
        gh->document = NULL;
 
-       gh->extra_width = 0;
        gh->active_view = VIEW_HEX;
        gh->group_type = GTK_HEX_GROUP_BYTE;
        gh->lines = gh->vis_lines = gh->top_line = gh->cpl = 0;
@@ -2807,10 +2819,10 @@ gtk_hex_paste_from_clipboard (GtkHex *gh)
 }
 
 void
-gtk_hex_set_selection (GtkHex *gh, int start, int end)
+gtk_hex_set_selection (GtkHex *gh, gint64 start, gint64 end)
 {
        size_t payload_size;
-       int oe, os, ne, ns;
+       gint64 oe, os, ne, ns;
 
        g_return_if_fail (HEX_IS_DOCUMENT (gh->document));
 
@@ -2842,9 +2854,9 @@ gtk_hex_set_selection (GtkHex *gh, int start, int end)
 }
 
 gboolean
-gtk_hex_get_selection (GtkHex *gh, int *start, int *end)
+gtk_hex_get_selection (GtkHex *gh, gint64 *start, gint64 *end)
 {
-       int ss, se;
+       gint64 ss, se;
 
        if (gh->selection.start > gh->selection.end) {
                se = gh->selection.start;
@@ -2864,13 +2876,13 @@ gtk_hex_get_selection (GtkHex *gh, int *start, int *end)
 }
 
 void
-gtk_hex_clear_selection(GtkHex *gh)
+gtk_hex_clear_selection (GtkHex *gh)
 {
        gtk_hex_set_selection(gh, 0, 0);
 }
 
 void
-gtk_hex_delete_selection(GtkHex *gh)
+gtk_hex_delete_selection (GtkHex *gh)
 {
        int start, end, len;
 
@@ -2892,7 +2904,7 @@ gtk_hex_delete_selection(GtkHex *gh)
  * moves cursor to UPPER_NIBBLE or LOWER_NIBBLE of the current byte
  */
 void
-gtk_hex_set_nibble (GtkHex *gh, int lower_nibble)
+gtk_hex_set_nibble (GtkHex *gh, gboolean lower_nibble)
 {
        g_return_if_fail (GTK_IS_HEX(gh));
 
@@ -2918,10 +2930,10 @@ gtk_hex_set_nibble (GtkHex *gh, int lower_nibble)
  * moves cursor to byte index
  */
 void
-gtk_hex_set_cursor (GtkHex *gh, int index)
+gtk_hex_set_cursor (GtkHex *gh, gint64 index)
 {
        int y;
-       int old_pos;
+       gint64 old_pos;
        size_t payload_size;
 
        g_return_if_fail (GTK_IS_HEX (gh));
@@ -3045,8 +3057,8 @@ gtk_hex_set_cursor_xy (GtkHex *gh, int x, int y)
 /*
  * returns cursor position
  */
-guint
-gtk_hex_get_cursor(GtkHex *gh)
+gint64
+gtk_hex_get_cursor (GtkHex *gh)
 {
        g_return_val_if_fail(gh != NULL, -1);
        g_return_val_if_fail(GTK_IS_HEX(gh), -1);
@@ -3058,7 +3070,7 @@ gtk_hex_get_cursor(GtkHex *gh)
  * returns value of the byte at position offset
  */
 guchar
-gtk_hex_get_byte (GtkHex *gh, int offset)
+gtk_hex_get_byte (GtkHex *gh, gint64 offset)
 {
        g_return_val_if_fail (GTK_IS_HEX(gh), 0);
 
@@ -3069,13 +3081,8 @@ gtk_hex_get_byte (GtkHex *gh, int offset)
 }
 
 void
-gtk_hex_set_group_type (GtkHex *gh, guint gt)
+gtk_hex_set_group_type (GtkHex *gh, GtkHexGroupType gt)
 {
-       /* FIXME - See comment above about redraws. */
-#if 0
-       GtkAllocation allocation;
-#endif
-
        g_return_if_fail(gh != NULL);
        g_return_if_fail(GTK_IS_HEX(gh));
 
@@ -3084,12 +3091,8 @@ gtk_hex_set_group_type (GtkHex *gh, guint gt)
 
        gtk_hex_layout_set_group_type (GTK_HEX_LAYOUT(gh->layout_manager), gt);
 
-#if 0
-       gtk_widget_get_allocation(GTK_WIDGET(gh), &allocation);
-       recalc_displays(gh, allocation.width, allocation.height);
-#endif
        recalc_displays(gh);
-       gtk_widget_queue_resize(GTK_WIDGET(gh));
+       gtk_widget_queue_resize (GTK_WIDGET(gh));
        show_cursor (gh, TRUE);
 }
 
@@ -3097,7 +3100,7 @@ gtk_hex_set_group_type (GtkHex *gh, guint gt)
  *  do we show the offsets of lines?
  */
 void
-gtk_hex_show_offsets(GtkHex *gh, gboolean show)
+gtk_hex_show_offsets (GtkHex *gh, gboolean show)
 {
        g_return_if_fail (GTK_IS_HEX (gh));
 
@@ -3164,14 +3167,14 @@ void gtk_hex_delete_autohighlight(GtkHex *gh, GtkHex_AutoHighlight *ahl)
        g_free(ahl);
 }
 
-void gtk_hex_set_geometry(GtkHex *gh, int cpl, int vis_lines)
+void gtk_hex_set_geometry (GtkHex *gh, int cpl, int vis_lines)
 {
     gh->default_cpl = cpl;
     gh->default_lines = vis_lines;
 }
 
 GtkAdjustment *
-gtk_hex_get_adjustment(GtkHex *gh)
+gtk_hex_get_adjustment (GtkHex *gh)
 {
        g_return_val_if_fail (GTK_IS_ADJUSTMENT(gh->adj), NULL);
 
@@ -3194,7 +3197,7 @@ gtk_hex_get_insert_mode (GtkHex *gh)
        return gh->insert;
 }
 
-guint
+GtkHexGroupType
 gtk_hex_get_group_type (GtkHex *gh)
 {
        g_assert (GTK_IS_HEX (gh));
diff --git a/src/gtkhex.h b/src/gtkhex.h
index f12e7bf..e6bc6c8 100644
--- a/src/gtkhex.h
+++ b/src/gtkhex.h
@@ -60,37 +60,33 @@ typedef struct _GtkHex_AutoHighlight GtkHex_AutoHighlight;
 
 /* PUBLIC METHOD DECLARATIONS */
 
-GtkWidget *gtk_hex_new(HexDocument *);
+GtkWidget *gtk_hex_new (HexDocument *owner);
 
-void gtk_hex_set_cursor(GtkHex *, gint);
-void gtk_hex_set_cursor_xy(GtkHex *, gint, gint);
-void gtk_hex_set_nibble(GtkHex *, gint);
+void gtk_hex_set_cursor (GtkHex *gh, gint64 index);
+void gtk_hex_set_cursor_xy (GtkHex *gh, int x, int y);
+void gtk_hex_set_nibble (GtkHex *gh, gboolean lower_nibble);
 
-guint gtk_hex_get_cursor(GtkHex *);
-guchar gtk_hex_get_byte(GtkHex *, int);
+gint64 gtk_hex_get_cursor (GtkHex *gh);
+guchar gtk_hex_get_byte (GtkHex *gh, gint64 offset);
 
-void gtk_hex_set_group_type(GtkHex *, guint);
-guint gtk_hex_get_group_type (GtkHex *gh);
+void gtk_hex_set_group_type (GtkHex *gh, GtkHexGroupType gt);
+GtkHexGroupType gtk_hex_get_group_type (GtkHex *gh);
 
-void gtk_hex_show_offsets(GtkHex *, gboolean);
-void gtk_hex_set_font(GtkHex *, PangoFontMetrics *,
-               const PangoFontDescription *);
+void gtk_hex_show_offsets (GtkHex *gh, gboolean show);
 
-gboolean gtk_hex_get_insert_mode(GtkHex *gh);
-void gtk_hex_set_insert_mode(GtkHex *, gboolean);
+gboolean gtk_hex_get_insert_mode (GtkHex *gh);
+void gtk_hex_set_insert_mode (GtkHex *gh, gboolean insert);
 
-void gtk_hex_set_geometry(GtkHex *gh, gint cpl, gint vis_lines);
+void gtk_hex_set_geometry (GtkHex *gh, int cpl, int vis_lines);
 
-PangoFontMetrics* gtk_hex_load_font (const char *font_name); 
+void gtk_hex_copy_to_clipboard (GtkHex *gh);
+void gtk_hex_cut_to_clipboard (GtkHex *gh);
+void gtk_hex_paste_from_clipboard (GtkHex *gh);
 
-void gtk_hex_copy_to_clipboard(GtkHex *gh);
-void gtk_hex_cut_to_clipboard(GtkHex *gh);
-void gtk_hex_paste_from_clipboard(GtkHex *gh);
-
-void gtk_hex_set_selection(GtkHex *gh, gint start, gint end);
-gboolean gtk_hex_get_selection(GtkHex *gh, gint *start, gint *end);
-void gtk_hex_clear_selection(GtkHex *gh);
-void gtk_hex_delete_selection(GtkHex *gh);
+void gtk_hex_set_selection (GtkHex *gh, gint64 start, gint64 end);
+gboolean gtk_hex_get_selection (GtkHex *gh, gint64 *start, gint64 *end);
+void gtk_hex_clear_selection (GtkHex *gh);
+void gtk_hex_delete_selection (GtkHex *gh);
 
 GtkHex_AutoHighlight *
 gtk_hex_insert_autohighlight (GtkHex *gh, const char *search, int len);
diff --git a/src/hex-buffer-iface.c b/src/hex-buffer-iface.c
index df3a635..efaa1a9 100644
--- a/src/hex-buffer-iface.c
+++ b/src/hex-buffer-iface.c
@@ -23,7 +23,7 @@ hex_buffer_default_init (HexBufferInterface *iface)
 
 char *
 hex_buffer_get_data (HexBuffer *self,
-               size_t offset,
+               gint64 offset,
                size_t len)
 {
        HexBufferInterface *iface;
@@ -37,7 +37,7 @@ hex_buffer_get_data (HexBuffer *self,
 
 char
 hex_buffer_get_byte (HexBuffer *self,
-                       size_t offset)
+                       gint64 offset)
 {
        HexBufferInterface *iface;
 
@@ -50,7 +50,7 @@ hex_buffer_get_byte (HexBuffer *self,
 
 gboolean
 hex_buffer_set_data (HexBuffer *self,
-                       size_t offset,
+                       gint64 offset,
                        size_t len,
                        size_t rep_len,
                        char *data)
@@ -129,7 +129,7 @@ hex_buffer_write_to_file (HexBuffer *self, GFile *file)
        return iface->write_to_file (self, file);
 }
 
-size_t
+gint64
 hex_buffer_get_payload_size (HexBuffer *self)
 {
        HexBufferInterface *iface;
@@ -143,7 +143,7 @@ hex_buffer_get_payload_size (HexBuffer *self)
 
 /* Utility functions */
 
-size_t /* converted from guint64 at the backend anyway... */
+gint64
 hex_buffer_util_get_file_size (GFile *file)
 {
        GFileInfo *info;
diff --git a/src/hex-buffer-iface.h b/src/hex-buffer-iface.h
index 43e9516..ef69b71 100644
--- a/src/hex-buffer-iface.h
+++ b/src/hex-buffer-iface.h
@@ -28,14 +28,14 @@ struct _HexBufferInterface
        GTypeInterface parent_iface;
 
        char * (*get_data) (HexBuffer *self,
-                       size_t offset,
+                       gint64 offset,
                        size_t len);
 
        char (*get_byte) (HexBuffer *self,
-                       size_t offset);
+                       gint64 offset);
 
        gboolean (*set_data) (HexBuffer *self,
-                       size_t offset,
+                       gint64 offset,
                        size_t len,
                        size_t rep_len,
                        char *data);
@@ -57,7 +57,7 @@ struct _HexBufferInterface
        gboolean (*write_to_file) (HexBuffer *self,
                        GFile *file);
 
-       size_t (*get_payload_size) (HexBuffer *self);
+       gint64 (*get_payload_size) (HexBuffer *self);
 
        /* --- padding starts here -- started w/ 12 extra vfuncs --- */
 
@@ -67,14 +67,14 @@ struct _HexBufferInterface
 /* Interface functions */
 
 char * hex_buffer_get_data (HexBuffer *self,
-               size_t offset,
+               gint64 offset,
                size_t len);
 
 char hex_buffer_get_byte (HexBuffer *self,
-               size_t offset);
+               gint64 offset);
 
 gboolean hex_buffer_set_data (HexBuffer *self,
-               size_t offset,
+               gint64 offset,
                size_t len,
                size_t rep_len,
                char *data);
@@ -93,11 +93,11 @@ gboolean hex_buffer_read_finish (HexBuffer *buf, GAsyncResult *result,
 gboolean hex_buffer_write_to_file (HexBuffer *self,
                GFile *file);
 
-size_t hex_buffer_get_payload_size (HexBuffer *self);
+gint64 hex_buffer_get_payload_size (HexBuffer *self);
 
 /* Common utility functions */
 
-size_t hex_buffer_util_get_file_size (GFile *file);
+gint64 hex_buffer_util_get_file_size (GFile *file);
 
 G_END_DECLS
 #endif
diff --git a/src/hex-buffer-malloc.c b/src/hex-buffer-malloc.c
index 25dd2d1..d079416 100644
--- a/src/hex-buffer-malloc.c
+++ b/src/hex-buffer-malloc.c
@@ -17,8 +17,8 @@ struct _HexBufferMalloc
        char *gap_pos;                  /* pointer to the start of insertion gap */
 
        size_t gap_size;                /* insertion gap size */
-       size_t buffer_size;             /* buffer size = file size + gap size */
-       size_t payload_size;
+       gint64 buffer_size;             /* buffer size = file size + gap size */
+       gint64 payload_size;
 };
 
 static void hex_buffer_malloc_iface_init (HexBufferInterface *iface);
@@ -57,7 +57,7 @@ hex_buffer_malloc_set_file (HexBuffer *buf, GFile *file)
 }
 
 static char
-hex_buffer_malloc_get_byte (HexBuffer *buf, size_t offset)
+hex_buffer_malloc_get_byte (HexBuffer *buf, gint64 offset)
 {
        HexBufferMalloc *self = HEX_BUFFER_MALLOC (buf);
 
@@ -73,7 +73,7 @@ hex_buffer_malloc_get_byte (HexBuffer *buf, size_t offset)
 }
 
 static char *
-hex_buffer_malloc_get_data (HexBuffer *buf, size_t offset, size_t len)
+hex_buffer_malloc_get_data (HexBuffer *buf, gint64 offset, size_t len)
 {
        HexBufferMalloc *self = HEX_BUFFER_MALLOC (buf);
        char *ptr, *data, *dptr;
@@ -97,7 +97,7 @@ hex_buffer_malloc_get_data (HexBuffer *buf, size_t offset, size_t len)
 }
 
 static void
-hex_buffer_malloc_place_gap (HexBuffer *buf, size_t offset, size_t min_size)
+hex_buffer_malloc_place_gap (HexBuffer *buf, gint64 offset, size_t min_size)
 {
        HexBufferMalloc *self = HEX_BUFFER_MALLOC (buf);
        char *tmp, *buf_ptr, *tmp_ptr;
@@ -152,11 +152,11 @@ hex_buffer_malloc_place_gap (HexBuffer *buf, size_t offset, size_t min_size)
 }
 
 static gboolean
-hex_buffer_malloc_set_data (HexBuffer *buf, size_t offset, size_t len,
+hex_buffer_malloc_set_data (HexBuffer *buf, gint64 offset, size_t len,
                                          size_t rep_len, char *data)
 {
        HexBufferMalloc *self = HEX_BUFFER_MALLOC (buf);
-       size_t i;
+       gint64 i;
        char *ptr;
 
        if (offset > self->payload_size)
@@ -209,7 +209,7 @@ hex_buffer_malloc_read (HexBuffer *buf)
        HexBufferMalloc *self = HEX_BUFFER_MALLOC (buf);
        char *path = NULL;
        FILE *file = NULL;
-       size_t fread_ret;
+       gint64 fread_ret;
        gboolean retval = FALSE;
 
        if (! G_IS_FILE (self->file))
@@ -228,6 +228,8 @@ hex_buffer_malloc_read (HexBuffer *buf)
        self->buffer_size = self->payload_size + self->gap_size;
        self->buffer = g_malloc (self->buffer_size);                               
 
+       /* FIXME - I believe this will crap out after 4GB on a 32-bit machine
+        */
        fread_ret = fread (
                        self->buffer + self->gap_size, 1, self->payload_size, file);
        if (fread_ret != self->payload_size)
@@ -291,7 +293,7 @@ hex_buffer_malloc_write_to_file (HexBuffer *buf, GFile *file)
        char *path = NULL;
        FILE *fp = NULL;
        gboolean ret = FALSE;
-       int exp_len;
+       gint64 exp_len;
 
        path = g_file_get_path (file);
        if (! path)
@@ -304,7 +306,8 @@ hex_buffer_malloc_write_to_file (HexBuffer *buf, GFile *file)
 
        if (self->gap_pos > self->buffer)
        {
-               exp_len = MIN (self->payload_size, (size_t)(self->gap_pos - self->buffer));
+               exp_len = MIN (self->payload_size,
+                               (gint64)(self->gap_pos - self->buffer));
                ret = fwrite (self->buffer, 1, exp_len, fp);
                ret = (ret == exp_len) ? TRUE : FALSE;
        }
@@ -322,7 +325,7 @@ out:
        return ret;
 }
 
-static size_t
+static gint64
 hex_buffer_malloc_get_payload_size (HexBuffer *buf)
 {
        HexBufferMalloc *self = HEX_BUFFER_MALLOC (buf);
diff --git a/src/hex-buffer-mmap.c b/src/hex-buffer-mmap.c
index b633e67..0c8eb4c 100644
--- a/src/hex-buffer-mmap.c
+++ b/src/hex-buffer-mmap.c
@@ -33,14 +33,14 @@ struct _HexBufferMmap
        int last_errno;         /* cache in case we need to re-report errno error. */
 
        char *data;                     /* buffer for modification and info */
-       size_t payload;
-       size_t mapped;
+       gint64 payload;
+       gint64 mapped;
        size_t gap;
        char *tmpfile_path;     /* path to buffer tmpfile in mkstemp format */
        int fd;                         /* file descriptor of tmpfile. */
 
        char *clean;            /* unmodified content, mmap'ed */
-       size_t clean_bytes;
+       gint64 clean_bytes;
        int clean_fd;
 
        size_t pagesize;        /* is only fetched once and cached. */
@@ -82,8 +82,8 @@ set_error (HexBufferMmap *self, const char *blurb)
        g_free (message);
 }
 
-static inline
-size_t buffer_gap_bytes (HexBufferMmap *self)
+static inline size_t
+buffer_gap_bytes (HexBufferMmap *self)
 {
        return self->mapped - self->payload;
 }
@@ -136,7 +136,7 @@ hex_buffer_mmap_class_init (HexBufferMmapClass *klass)
 }
 
 static void
-hex_buffer_mmap_place_gap (HexBufferMmap *self, size_t offset)
+hex_buffer_mmap_place_gap (HexBufferMmap *self, gint64 offset)
 {
        g_return_if_fail (HEX_IS_BUFFER_MMAP (self));
 
@@ -161,13 +161,13 @@ hex_buffer_mmap_place_gap (HexBufferMmap *self, size_t offset)
 }
 
 static void
-hex_buffer_mmap_resize (HexBufferMmap *self, size_t payload_bytes)
+hex_buffer_mmap_resize (HexBufferMmap *self, gint64 payload_bytes)
 {
        void *p;
        char *old = self->data;
        int fd;
        int mapflags = 0;
-       size_t map_bytes = payload_bytes;
+       gint64 map_bytes = payload_bytes;
 
        g_return_if_fail (HEX_IS_BUFFER_MMAP (self));
 
@@ -263,7 +263,7 @@ done:
 
 size_t
 hex_buffer_mmap_raw (HexBufferMmap *self,
-               char **out, size_t offset, size_t bytes)
+               char **out, gint64 offset, size_t bytes)
 {
        g_assert (HEX_IS_BUFFER_MMAP (self));
        
@@ -286,7 +286,7 @@ hex_buffer_mmap_raw (HexBufferMmap *self,
 
 size_t
 hex_buffer_mmap_copy_data (HexBufferMmap *self,
-               void *out, size_t offset, size_t bytes)
+               void *out, gint64 offset, size_t bytes)
 {
        size_t left;
 
@@ -320,7 +320,7 @@ hex_buffer_mmap_copy_data (HexBufferMmap *self,
 
 size_t
 hex_buffer_mmap_delete (HexBufferMmap *self,
-                    size_t offset, size_t bytes)
+                    gint64 offset, size_t bytes)
 {
        g_assert (HEX_IS_BUFFER_MMAP (self));
 
@@ -335,7 +335,7 @@ hex_buffer_mmap_delete (HexBufferMmap *self,
 
 static size_t
 hex_buffer_mmap_insert (HexBufferMmap *self,
-               const void *in, size_t offset, size_t bytes)
+               const void *in, gint64 offset, size_t bytes)
 {
        g_assert (HEX_IS_BUFFER_MMAP (self));
 
@@ -362,9 +362,9 @@ hex_buffer_mmap_insert (HexBufferMmap *self,
 
 size_t
 hex_buffer_mmap_move (HexBufferMmap *to,
-               size_t to_offset,
+               gint64 to_offset,
                HexBufferMmap *from,
-               size_t from_offset,
+               gint64 from_offset,
                size_t bytes)
 {
        char *raw = NULL;
@@ -390,7 +390,7 @@ hex_buffer_mmap_snap (HexBufferMmap *self)
 }
 
 char * hex_buffer_mmap_get_data (HexBuffer *buf,
-               size_t offset,
+               gint64 offset,
                size_t len)
 {
        HexBufferMmap *self = HEX_BUFFER_MMAP (buf);
@@ -403,7 +403,7 @@ char * hex_buffer_mmap_get_data (HexBuffer *buf,
 }
 
 char hex_buffer_mmap_get_byte (HexBuffer *buf,
-               size_t offset)
+               gint64 offset)
 {
        HexBufferMmap *self = HEX_BUFFER_MMAP (buf);
        char *cp;
@@ -415,7 +415,7 @@ char hex_buffer_mmap_get_byte (HexBuffer *buf,
        return c;
 }
 
-static size_t
+static gint64
 hex_buffer_mmap_get_payload_size (HexBuffer *buf)
 {
        HexBufferMmap *self = HEX_BUFFER_MMAP (buf);
@@ -512,8 +512,8 @@ hex_buffer_mmap_read (HexBuffer *buf)
 {
        HexBufferMmap *self = HEX_BUFFER_MMAP (buf);
        void *p;
-       size_t bytes = 0;
-       size_t pages;
+       gint64 bytes = 0;
+       gint64 pages;
        const char *file_path;
        int tmp_clean_fd;
 
@@ -606,7 +606,7 @@ hex_buffer_mmap_read_async (HexBuffer *buf,
 }
 
 static gboolean hex_buffer_mmap_set_data (HexBuffer *buf,
-               size_t offset,
+               gint64 offset,
                size_t len,
                size_t rep_len,
                char *data)
diff --git a/src/hex-document.c b/src/hex-document.c
index 83f39b9..ffbab45 100644
--- a/src/hex-document.c
+++ b/src/hex-document.c
@@ -359,7 +359,7 @@ hex_document_new_from_file (GFile *file)
 }
 
 void
-hex_document_set_nibble (HexDocument *doc, char val, size_t offset,
+hex_document_set_nibble (HexDocument *doc, char val, gint64 offset,
                                                gboolean lower_nibble, gboolean insert,
                                                gboolean undoable)
 {
@@ -401,7 +401,7 @@ hex_document_set_nibble (HexDocument *doc, char val, size_t offset,
 }
 
 void
-hex_document_set_byte (HexDocument *doc, char val, size_t offset,
+hex_document_set_byte (HexDocument *doc, char val, gint64 offset,
                                          gboolean insert, gboolean undoable)
 {
        static HexChangeData tmp_change_data;
@@ -430,7 +430,7 @@ hex_document_set_byte (HexDocument *doc, char val, size_t offset,
 }
 
 void
-hex_document_set_data (HexDocument *doc, size_t offset, size_t len,
+hex_document_set_data (HexDocument *doc, gint64 offset, size_t len,
                                          size_t rep_len, char *data, gboolean undoable)
 {
        int i;
@@ -474,7 +474,7 @@ document_ready_cb (GObject *source_object,
        HexBuffer *buf = HEX_BUFFER(source_object);
        HexDocument *doc = HEX_DOCUMENT(user_data);
        static HexChangeData change_data;
-       size_t payload;
+       gint64 payload;
 
        success = hex_buffer_read_finish (buf, res, &local_error);
        g_debug ("%s: DONE -- result: %d", __func__, success);
@@ -500,7 +500,7 @@ void
 hex_document_read (HexDocument *doc)
 {
        static HexChangeData change_data;
-       size_t payload;
+       gint64 payload;
 
        g_return_if_fail (G_IS_FILE (doc->file));
 
@@ -564,14 +564,14 @@ hex_document_set_max_undo(HexDocument *doc, int max_undo)
 
 gboolean
 hex_document_export_html (HexDocument *doc, char *html_path, char *base_name,
-                                                size_t start, size_t end, guint cpl, guint lpp,
+                                                gint64 start, gint64 end, guint cpl, guint lpp,
                                                 guint cpw)
 {
        FILE *file;
        guint page, line, pos, lines, pages, c;
        gchar *page_name, b;
        gchar *progress_str;
-       size_t payload = hex_buffer_get_payload_size (hex_document_get_buffer (doc));
+       gint64 payload = hex_buffer_get_payload_size (hex_document_get_buffer (doc));
        char *basename;
 
        basename = g_file_get_basename (doc->file);
@@ -741,11 +741,11 @@ hex_document_compare_data(HexDocument *doc, char *s2, int pos, int len)
 }
 
 gboolean
-hex_document_find_forward (HexDocument *doc, size_t start, char *what,
-                                                 size_t len, size_t *found)
+hex_document_find_forward (HexDocument *doc, gint64 start, char *what,
+                                                 size_t len, gint64 *found)
 {
-       size_t pos;
-       size_t payload = hex_buffer_get_payload_size (
+       gint64 pos;
+       gint64 payload = hex_buffer_get_payload_size (
                        hex_document_get_buffer (doc));
 
        pos = start;
@@ -763,10 +763,10 @@ hex_document_find_forward (HexDocument *doc, size_t start, char *what,
 }
 
 gboolean
-hex_document_find_backward (HexDocument *doc, size_t start, char *what,
-                                                  size_t len, size_t *found)
+hex_document_find_backward (HexDocument *doc, gint64 start, char *what,
+                                                  size_t len, gint64 *found)
 {
-       size_t pos;
+       gint64 pos;
        
        pos = start;
 
@@ -809,7 +809,7 @@ hex_document_real_undo (HexDocument *doc)
 
        case HEX_CHANGE_BYTE:
        {
-               size_t payload = hex_buffer_get_payload_size (
+               gint64 payload = hex_buffer_get_payload_size (
                                hex_document_get_buffer (doc));
 
                if (cd->end < payload)
@@ -869,7 +869,7 @@ hex_document_real_redo(HexDocument *doc)
 
        case HEX_CHANGE_BYTE:
        {
-               size_t payload = hex_buffer_get_payload_size (
+               gint64 payload = hex_buffer_get_payload_size (
                                hex_document_get_buffer (doc));
 
                if (cd->end <= payload)
diff --git a/src/hex-document.h b/src/hex-document.h
index f9337af..a5921b5 100644
--- a/src/hex-document.h
+++ b/src/hex-document.h
@@ -52,7 +52,7 @@ typedef enum {
 typedef struct _HexChangeData HexChangeData;
 struct _HexChangeData
 {
-       size_t start, end;
+       gint64 start, end;
        /* length to replace (overwrite); (0 to insert without overwriting) */
        size_t rep_len;
        gboolean lower_nibble;
@@ -65,26 +65,26 @@ struct _HexChangeData
 
 HexDocument *hex_document_new(void);
 HexDocument *hex_document_new_from_file (GFile *file);
-void        hex_document_set_data(HexDocument *doc, size_t offset, size_t len, size_t rep_len, char *data, 
gboolean undoable);
-void        hex_document_set_byte(HexDocument *doc, char val, size_t offset, gboolean insert, gboolean 
undoable);
-void        hex_document_set_nibble(HexDocument *doc, char val, size_t offset, gboolean lower_nibble, 
gboolean insert, gboolean undoable);
+void        hex_document_set_data(HexDocument *doc, gint64 offset, size_t len, size_t rep_len, char *data, 
gboolean undoable);
+void        hex_document_set_byte(HexDocument *doc, char val, gint64 offset, gboolean insert, gboolean 
undoable);
+void        hex_document_set_nibble(HexDocument *doc, char val, gint64 offset, gboolean lower_nibble, 
gboolean insert, gboolean undoable);
 void        hex_document_delete_data(HexDocument *doc, guint offset, guint len, gboolean undoable);
 void           hex_document_read (HexDocument *doc);
 gboolean   hex_document_write(HexDocument *doc);
 
 gboolean   hex_document_write_to_file (HexDocument *doc, GFile *file);
-gboolean    hex_document_export_html (HexDocument *doc, char *html_path, char *base_name, size_t start, 
size_t end, guint cpl, guint lpp, guint cpw);
+gboolean    hex_document_export_html (HexDocument *doc, char *html_path, char *base_name, gint64 start, 
gint64 end, guint cpl, guint lpp, guint cpw);
 gboolean    hex_document_has_changed(HexDocument *doc);
 void        hex_document_changed(HexDocument *doc, gpointer change_data, gboolean push_undo);
 void        hex_document_set_max_undo(HexDocument *doc, int max_undo);
 gboolean    hex_document_undo(HexDocument *doc);
 gboolean    hex_document_redo(HexDocument *doc);
 int        hex_document_compare_data(HexDocument *doc, char *s2, int pos, int len);
-gboolean   hex_document_find_forward (HexDocument *doc, size_t start, char *what, size_t len, size_t *found);
-gboolean   hex_document_find_backward (HexDocument *doc, size_t start, char *what, size_t len, size_t 
*found);
+gboolean   hex_document_find_forward (HexDocument *doc, gint64 start, char *what, size_t len, gint64 *found);
+gboolean   hex_document_find_backward (HexDocument *doc, gint64 start, char *what, size_t len, gint64 
*found);
 gboolean    hex_document_can_undo (HexDocument *doc);
 gboolean    hex_document_can_redo (HexDocument *doc);
-size_t         hex_document_get_file_size (HexDocument *doc);
+gint64         hex_document_get_file_size (HexDocument *doc);
 HexChangeData *hex_document_get_undo_data (HexDocument *doc);
 
 HexBuffer * hex_document_get_buffer (HexDocument *doc);
diff --git a/src/print.c b/src/print.c
index 5befd82..ad16f23 100644
--- a/src/print.c
+++ b/src/print.c
@@ -288,7 +288,7 @@ begin_print (GtkPrintOperation *operation,
     pji->pc = context;
     int font_width, font_height;
     int printable_width, printable_height;
-       size_t payload = hex_buffer_get_payload_size (hex_document_get_buffer (pji->doc));
+       gint64 payload = hex_buffer_get_payload_size (hex_document_get_buffer (pji->doc));
 
     layout = gtk_print_context_create_pango_layout (context);
     pango_layout_set_text (layout, " ", -1);
@@ -329,7 +329,7 @@ print_page (GtkPrintOperation *operation,
             gpointer           data)
 {
        int j, max_row;
-       size_t payload;
+       gint64 payload;
 
        GHexPrintJobInfo *pji = (GHexPrintJobInfo *)data;
        g_return_if_fail(pji != NULL);


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