summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Langenau <holger.langenau@mathematik.tu-chemnitz.de>2021-02-19 23:22:13 +0100
committerGitHub <noreply@github.com>2021-02-19 23:22:13 +0100
commit3f9a42b9501b8d062be94e0aaa7c440e3deb7e8b (patch)
treed4a565d220a18e06b7d6cb1d22893c684a698373
parent55fb9cc58a1c8fc675b2df4a10e0f99b264f4a40 (diff)
Use guint64 instead of glong. (#660)
The glong type is not always guaranteed to be large enough, e.g., on 32 bit platform. One result is that the scroll percentage is a weird number. Using explict 64 bit types fixes this.
-rw-r--r--src/ext-proxy.c2
-rw-r--r--src/main.h6
-rw-r--r--src/normal.c4
-rw-r--r--src/webextension/ext-main.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/ext-proxy.c b/src/ext-proxy.c
index c0740c9..84ab325 100644
--- a/src/ext-proxy.c
+++ b/src/ext-proxy.c
@@ -180,7 +180,7 @@ static void on_vertical_scroll(GDBusConnection *connection,
const char *interface_name, const char *signal_name,
GVariant *parameters, gpointer data)
{
- glong max, top;
+ guint64 max, top;
guint percent;
guint64 pageid;
Client *c;
diff --git a/src/main.h b/src/main.h
index 9fa47f1..ad000a8 100644
--- a/src/main.h
+++ b/src/main.h
@@ -169,13 +169,13 @@ struct State {
#define PROMPT_SIZE 4
char prompt[PROMPT_SIZE];/* current prompt ':', 'g;t', '/' including nul */
- glong marks[MARK_SIZE]; /* holds marks set to page with 'm{markchar}' */
+ guint64 marks[MARK_SIZE]; /* holds marks set to page with 'm{markchar}' */
guint input_timer;
MessageType input_type;
StatusType status_type;
- glong scroll_max; /* Maxmimum scrollable height of the document. */
+ guint64 scroll_max; /* Maxmimum scrollable height of the document. */
guint scroll_percent; /* Current position of the viewport in document (percent). */
- glong scroll_top; /* Current position of the viewport in document (pixel). */
+ guint64 scroll_top; /* Current position of the viewport in document (pixel). */
char *title; /* Window title of the client. */
char *reg[REG_SIZE]; /* holds the yank buffers */
diff --git a/src/normal.c b/src/normal.c
index eda7deb..1cf6364 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -547,7 +547,7 @@ static VbResult normal_input_open(Client *c, const NormalCmdInfo *info)
static VbResult normal_mark(Client *c, const NormalCmdInfo *info)
{
- glong current;
+ guint64 current;
char *js, *mark;
int idx;
@@ -570,7 +570,7 @@ static VbResult normal_mark(Client *c, const NormalCmdInfo *info)
current = c->state.scroll_top;
/* jump to the location */
- js = g_strdup_printf("window.scroll(window.screenLeft,%ld);", c->state.marks[idx]);
+ js = g_strdup_printf("window.scroll(window.screenLeft,%" G_GUINT64_FORMAT ");", c->state.marks[idx]);
ext_proxy_eval_script(c, js, NULL);
g_free(js);
diff --git a/src/webextension/ext-main.c b/src/webextension/ext-main.c
index 998a329..9bd4fd6 100644
--- a/src/webextension/ext-main.c
+++ b/src/webextension/ext-main.c
@@ -250,7 +250,7 @@ static void on_document_scroll(WebKitDOMEventTarget *target, WebKitDOMEvent *eve
if (doc) {
WebKitDOMElement *body, *de;
- glong max = 0, top = 0, scrollTop, scrollHeight, clientHeight;
+ guint64 max = 0, top = 0, scrollTop, scrollHeight, clientHeight;
guint percent = 0;
de = webkit_dom_document_get_document_element(doc);