diff options
author | DeltaVonNeumann <deltavprogrammer@gmail.com> | 2023-06-17 10:29:39 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2023-06-17 10:29:39 +0100 |
commit | a16d5ff10b2225c7cf7b33ddfff1d947b0dbe40a (patch) | |
tree | f741f98765b955eb0ac893991dd83cf91616f210 /content/handlers | |
parent | 21e636a3a6056c23bbd4257f50315532fe010aa5 (diff) | |
download | netsurf-a16d5ff10b2225c7cf7b33ddfff1d947b0dbe40a.tar.gz netsurf-a16d5ff10b2225c7cf7b33ddfff1d947b0dbe40a.tar.bz2 |
Avoid integer types with platform dependent size
Diffstat (limited to 'content/handlers')
-rw-r--r-- | content/handlers/css/dump.c | 22 | ||||
-rw-r--r-- | content/handlers/html/css.c | 3 | ||||
-rw-r--r-- | content/handlers/html/form.c | 7 | ||||
-rw-r--r-- | content/handlers/html/html.c | 4 | ||||
-rw-r--r-- | content/handlers/html/layout.c | 4 | ||||
-rw-r--r-- | content/handlers/javascript/duktape/dukky.c | 6 |
6 files changed, 25 insertions, 21 deletions
diff --git a/content/handlers/css/dump.c b/content/handlers/css/dump.c index 4138f9343..799ee5e54 100644 --- a/content/handlers/css/dump.c +++ b/content/handlers/css/dump.c @@ -19,6 +19,8 @@ #include <stdio.h> #include <libcss/libcss.h> +#include "netsurf/inttypes.h" + #include "css/dump.h" #include "css/utils.h" @@ -36,7 +38,7 @@ static void dump_css_fixed(FILE *stream, css_fixed f) uint32_t fracpart = ((NSCSS_ABS(f) & 0x3ff) * 1000 + 500) / (1 << 10); #undef NSCSS_ABS - fprintf(stream, "%s%d.%03d", f < 0 ? "-" : "", uintpart, fracpart); + fprintf(stream, "%s%"PRId32".%03ld", f < 0 ? "-" : "", uintpart, fracpart); } /** @@ -48,7 +50,7 @@ static void dump_css_fixed(FILE *stream, css_fixed f) static void dump_css_number(FILE *stream, css_fixed val) { if (INTTOFIX(FIXTOINT(val)) == val) - fprintf(stream, "%d", FIXTOINT(val)); + fprintf(stream, "%"PRId32"", FIXTOINT(val)); else dump_css_fixed(stream, val); } @@ -181,7 +183,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) val = css_computed_background_color(style, &color); switch (val) { case CSS_BACKGROUND_COLOR_COLOR: - fprintf(stream, "background-color: #%08x ", color); + fprintf(stream, "background-color: #%08"PRIx32" ", color); break; default: break; @@ -255,7 +257,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) val = css_computed_border_top_color(style, &color); switch (val) { case CSS_BORDER_COLOR_COLOR: - fprintf(stream, "border-top-color: #%08x ", color); + fprintf(stream, "border-top-color: #%08"PRIx32" ", color); break; default: break; @@ -265,7 +267,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) val = css_computed_border_right_color(style, &color); switch (val) { case CSS_BORDER_COLOR_COLOR: - fprintf(stream, "border-right-color: #%08x ", color); + fprintf(stream, "border-right-color: #%08"PRIx32" ", color); break; default: break; @@ -275,7 +277,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) val = css_computed_border_bottom_color(style, &color); switch (val) { case CSS_BORDER_COLOR_COLOR: - fprintf(stream, "border-bottom-color: #%08x ", color); + fprintf(stream, "border-bottom-color: #%08"PRIx32" ", color); break; default: break; @@ -285,7 +287,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) val = css_computed_border_left_color(style, &color); switch (val) { case CSS_BORDER_COLOR_COLOR: - fprintf(stream, "border-left-color: #%08x ", color); + fprintf(stream, "border-left-color: #%08"PRIx32" ", color); break; default: break; @@ -610,7 +612,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) /* color */ val = css_computed_color(style, &color); if (val == CSS_COLOR_COLOR) { - fprintf(stream, "color: #%08x ", color); + fprintf(stream, "color: #%08"PRIx32" ", color); } /* content */ @@ -1353,7 +1355,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) fprintf(stream, "outline-color: invert "); break; case CSS_OUTLINE_COLOR_COLOR: - fprintf(stream, "outline-color: #%08x ", color); + fprintf(stream, "outline-color: #%08"PRIx32" ", color); break; default: break; @@ -1820,7 +1822,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style) fprintf(stream, "z-index: auto "); break; case CSS_Z_INDEX_SET: - fprintf(stream, "z-index: %d ", zindex); + fprintf(stream, "z-index: %"PRId32" ", zindex); break; default: break; diff --git a/content/handlers/html/css.c b/content/handlers/html/css.c index 2434b1783..be17ac852 100644 --- a/content/handlers/html/css.c +++ b/content/handlers/html/css.c @@ -33,6 +33,7 @@ #include "utils/nsoption.h" #include "utils/corestrings.h" #include "utils/log.h" +#include "netsurf/inttypes.h" #include "netsurf/misc.h" #include "netsurf/content.h" #include "content/hlcache.h" @@ -173,7 +174,7 @@ html_stylesheet_from_domnode(html_content *c, dom_string_unref(style); - snprintf(urlbuf, sizeof(urlbuf), "x-ns-css:%u", key); + snprintf(urlbuf, sizeof(urlbuf), "x-ns-css:%"PRIu32"", key); error = nsurl_create(urlbuf, &url); if (error != NSERROR_OK) { diff --git a/content/handlers/html/form.c b/content/handlers/html/form.c index 97ec19518..b1e911cb8 100644 --- a/content/handlers/html/form.c +++ b/content/handlers/html/form.c @@ -41,6 +41,7 @@ #include "utils/utf8.h" #include "utils/ascii.h" #include "netsurf/browser_window.h" +#include "netsurf/inttypes.h" #include "netsurf/mouse.h" #include "netsurf/plotters.h" #include "netsurf/misc.h" @@ -486,7 +487,7 @@ form_dom_to_data_select(dom_html_select_element *select_element, &option_element); if (exp != DOM_NO_ERR) { NSLOG(netsurf, INFO, - "Could not get options item %d", option_index); + "Could not get options item %"PRId32"", option_index); res = NSERROR_DOM; } else { res = form_dom_to_data_select_option( @@ -1100,7 +1101,7 @@ form_dom_to_data(struct form *form, exp = dom_html_collection_item(elements, element_idx, &element); if (exp != DOM_NO_ERR) { NSLOG(netsurf, INFO, - "retrieving form element %d failed with %d", + "retrieving form element %"PRId32" failed with %d", element_idx, exp); res = NSERROR_DOM; goto form_dom_to_data_error; @@ -1110,7 +1111,7 @@ form_dom_to_data(struct form *form, exp = dom_node_get_node_name(element, &nodename); if (exp != DOM_NO_ERR) { NSLOG(netsurf, INFO, - "getting element node name %d failed with %d", + "getting element node name %"PRId32" failed with %d", element_idx, exp); dom_node_unref(element); res = NSERROR_DOM; diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c index 2b6b1a865..82f5f1388 100644 --- a/content/handlers/html/html.c +++ b/content/handlers/html/html.c @@ -123,7 +123,7 @@ bool fire_generic_dom_event(dom_string *type, dom_node *target, return false; } NSLOG(netsurf, INFO, "Dispatching '%*s' against %p", - dom_string_length(type), dom_string_data(type), target); + (int)dom_string_length(type), dom_string_data(type), target); result = fire_dom_event(evt, target); dom_event_unref(evt); return result; @@ -200,7 +200,7 @@ bool fire_dom_keyboard_event(dom_string *type, dom_node *target, } NSLOG(netsurf, INFO, "Dispatching '%*s' against %p", - dom_string_length(type), dom_string_data(type), target); + (int)dom_string_length(type), dom_string_data(type), target); result = fire_dom_event((dom_event *) evt, target); dom_event_unref(evt); diff --git a/content/handlers/html/layout.c b/content/handlers/html/layout.c index d9de14b37..827180cce 100644 --- a/content/handlers/html/layout.c +++ b/content/handlers/html/layout.c @@ -4194,7 +4194,7 @@ layout__get_ol_reversed(dom_node *ol_node) */ static bool layout__get_list_item_count( - dom_node *list_owner, int *count_out) + dom_node *list_owner, dom_long *count_out) { dom_html_element_type tag_type; dom_exception exc; @@ -4266,7 +4266,7 @@ layout__ordered_list_count( dom_exception exc; dom_node *child; int step = 1; - int next; + dom_long next; if (box->node == NULL) { return; diff --git a/content/handlers/javascript/duktape/dukky.c b/content/handlers/javascript/duktape/dukky.c index 52a9c82cf..c0a2749a9 100644 --- a/content/handlers/javascript/duktape/dukky.c +++ b/content/handlers/javascript/duktape/dukky.c @@ -1156,7 +1156,7 @@ static void dukky_generic_event_handler(dom_event *evt, void *pw) NSLOG(dukky, DEBUG, "Unable to find the event name"); return; } - NSLOG(dukky, DEBUG, "Event's name is %*s", dom_string_length(name), + NSLOG(dukky, DEBUG, "Event's name is %*s", (int)dom_string_length(name), dom_string_data(name)); exc = dom_event_get_event_phase(evt, &phase); if (exc != DOM_NO_ERR) { @@ -1394,10 +1394,10 @@ void dukky_register_event_listener_for(duk_context *ctx, if (exc != DOM_NO_ERR) { NSLOG(dukky, DEBUG, "Unable to register listener for %p.%*s", ele, - dom_string_length(name), dom_string_data(name)); + (int)dom_string_length(name), dom_string_data(name)); } else { NSLOG(dukky, DEBUG, "have registered listener for %p.%*s", - ele, dom_string_length(name), dom_string_data(name)); + ele, (int)dom_string_length(name), dom_string_data(name)); } dom_event_listener_unref(listen); } |