diff --git a/content/fetchers/file/dirlist.c b/content/fetchers/file/dirlist.c
index d49dc7fe7..345dbd8f3 100644
--- a/content/fetchers/file/dirlist.c
+++ b/content/fetchers/file/dirlist.c
@@ -29,6 +29,7 @@
#include "utils/messages.h"
#include "utils/nscolour.h"
+#include "netsurf/inttypes.h"
#include "netsurf/types.h"
#include "netsurf/plot_style.h"
@@ -158,7 +159,7 @@ bool dirlist_generate_title(const char *title, char *buffer, int buffer_length)
"
%s\n"
"\n"
diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c
index ede729f9a..fa9fffeea 100644
--- a/content/fs_backing_store.c
+++ b/content/fs_backing_store.c
@@ -1614,7 +1614,7 @@ static nserror store_write_block(struct store_state *state,
offst);
if (wr != (ssize_t)bse->elem[elem_idx].size) {
NSLOG(netsurf, ERROR,
- "Write failed %"PRIssizet" of %d bytes from %p at %"PRIsizet" block %d errno %d",
+ "Write failed %"PRIssizet" of %"PRId32" bytes from %p at %"PRIsizet" block %d errno %d",
wr,
bse->elem[elem_idx].size,
bse->elem[elem_idx].data,
@@ -1661,7 +1661,7 @@ static nserror store_write_file(struct store_state *state,
close(fd);
if (wr != (ssize_t)bse->elem[elem_idx].size) {
NSLOG(netsurf, ERROR,
- "Write failed %"PRIssizet" of %d bytes from %p errno %d",
+ "Write failed %"PRIssizet" of %"PRId32" bytes from %p errno %d",
wr,
bse->elem[elem_idx].size,
bse->elem[elem_idx].data,
@@ -1784,7 +1784,7 @@ static nserror store_read_block(struct store_state *state,
offst);
if (rd != (ssize_t)bse->elem[elem_idx].size) {
NSLOG(netsurf, ERROR,
- "Failed reading %"PRIssizet" of %d bytes into %p from %"PRIsizet" block %d errno %d",
+ "Failed reading %"PRIssizet" of %"PRId32" bytes into %p from %"PRIsizet" block %d errno %d",
rd,
bse->elem[elem_idx].size,
bse->elem[elem_idx].data,
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
#include
+#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);
}
diff --git a/content/hlcache.c b/content/hlcache.c
index d860015a5..59ed17e4d 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -30,6 +30,7 @@
#include "utils/messages.h"
#include "utils/ring.h"
#include "utils/utils.h"
+#include "netsurf/inttypes.h"
#include "netsurf/misc.h"
#include "netsurf/content.h"
#include "desktop/gui_internal.h"
@@ -592,7 +593,7 @@ void hlcache_finalise(void)
num_contents++;
}
- NSLOG(netsurf, INFO, "%d contents remain before cache drain",
+ NSLOG(netsurf, INFO, "%"PRId32" contents remain before cache drain",
num_contents);
/* Drain cache */
@@ -607,7 +608,7 @@ void hlcache_finalise(void)
}
} while (num_contents > 0 && num_contents != prev_contents);
- NSLOG(netsurf, INFO, "%d contents remaining after being polite", num_contents);
+ NSLOG(netsurf, INFO, "%"PRId32" contents remaining after being polite", num_contents);
/* Drain cache again, forcing the matter */
do {
@@ -621,12 +622,12 @@ void hlcache_finalise(void)
}
} while (num_contents > 0 && num_contents != prev_contents);
- NSLOG(netsurf, INFO, "%d contents remaining:", num_contents);
+ NSLOG(netsurf, INFO, "%"PRId32" contents remaining:", num_contents);
for (entry = hlcache->content_list; entry != NULL; entry = entry->next) {
hlcache_handle entry_handle = { entry, NULL, NULL };
if (entry->content != NULL) {
- NSLOG(netsurf, INFO, " %p : %s (%d users)",
+ NSLOG(netsurf, INFO, " %p : %s (%"PRId32" users)",
entry,
nsurl_access(hlcache_handle_get_url(&entry_handle)),
content_count_users(entry->content));
diff --git a/content/llcache.c b/content/llcache.c
index f86ae0d42..9d69c9651 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1923,7 +1923,7 @@ llcache_object_retrieve_from_cache(nsurl *url,
llcache_object *obj, *newest = NULL;
NSLOG(llcache, DEBUG,
- "Searching cache for %s flags:%x referer:%s post:%p",
+ "Searching cache for %s flags:%"PRIx32" referer:%s post:%p",
nsurl_access(url), flags,
referer==NULL?"":nsurl_access(referer),
post);
@@ -2100,7 +2100,7 @@ llcache_object_retrieve(nsurl *url,
nsurl *defragmented_url;
bool uncachable = false;
- NSLOG(llcache, DEBUG, "Retrieve %s (%x, %s, %p)", nsurl_access(url), flags,
+ NSLOG(llcache, DEBUG, "Retrieve %s (%"PRIx32", %s, %p)", nsurl_access(url), flags,
referer==NULL?"":nsurl_access(referer), post);
@@ -3876,7 +3876,7 @@ void llcache_clean(bool purge)
}
}
- NSLOG(llcache, DEBUG, "Size: %u (limit: %u)", llcache_size, limit);
+ NSLOG(llcache, DEBUG, "Size: %"PRIu32" (limit: %"PRIu32")", llcache_size, limit);
}
/* Exported interface documented in content/llcache.h */
@@ -3897,7 +3897,7 @@ llcache_initialise(const struct llcache_parameters *prm)
llcache->all_caught_up = true;
NSLOG(llcache, INFO,
- "llcache initialising with a limit of %d bytes",
+ "llcache initialising with a limit of %"PRId32" bytes",
llcache->limit);
/* backing store initialisation */
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index fd838b80b..bd785898f 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -99,7 +99,7 @@
static void netsurf_lwc_iterator(lwc_string *str, void *pw)
{
- NSLOG(netsurf, WARNING, "[%3u] %.*s", str->refcnt,
+ NSLOG(netsurf, WARNING, "[%3"PRIu32"] %.*s", str->refcnt,
(int)lwc_string_length(str), lwc_string_data(str));
}
diff --git a/test/monkey-see-monkey-do b/test/monkey-see-monkey-do
index 4dc761aae..431731511 100755
--- a/test/monkey-see-monkey-do
+++ b/test/monkey-see-monkey-do
@@ -117,7 +117,7 @@ def main():
index = index.read()
print("Parsing tests...")
- test_set = yaml.load_all(index)
+ test_set = yaml.load_all(index, Loader=yaml.FullLoader)
print("Running tests...")
ret = 0
diff --git a/utils/idna.c b/utils/idna.c
index 628ef1fac..3ce3e1be1 100644
--- a/utils/idna.c
+++ b/utils/idna.c
@@ -440,7 +440,7 @@ static bool idna__is_valid(int32_t *label, size_t len)
/* 4. Check characters not DISALLOWED by RFC5892 */
if (idna_prop == IDNA_P_DISALLOWED) {
NSLOG(netsurf, INFO,
- "Check failed: character %"PRIsizet" (%x) is DISALLOWED",
+ "Check failed: character %"PRIsizet" (%"PRIx32") is DISALLOWED",
i,
label[i]);
return false;
@@ -450,7 +450,7 @@ static bool idna__is_valid(int32_t *label, size_t len)
if (idna_prop == IDNA_P_CONTEXTJ) {
if (idna__contextj_rule(label, i, len) == false) {
NSLOG(netsurf, INFO,
- "Check failed: character %"PRIsizet" (%x) does not conform to CONTEXTJ rule",
+ "Check failed: character %"PRIsizet" (%"PRIx32") does not conform to CONTEXTJ rule",
i,
label[i]);
return false;
@@ -462,7 +462,7 @@ static bool idna__is_valid(int32_t *label, size_t len)
if (idna_prop == IDNA_P_CONTEXTO) {
if (idna__contexto_rule(label[i]) == false) {
NSLOG(netsurf, INFO,
- "Check failed: character %"PRIsizet" (%x) has no CONTEXTO rule defined",
+ "Check failed: character %"PRIsizet" (%"PRIx32") has no CONTEXTO rule defined",
i,
label[i]);
return false;
@@ -472,7 +472,7 @@ static bool idna__is_valid(int32_t *label, size_t len)
/* 7. Check characters are not UNASSIGNED */
if (idna_prop == IDNA_P_UNASSIGNED) {
NSLOG(netsurf, INFO,
- "Check failed: character %"PRIsizet" (%x) is UNASSIGNED",
+ "Check failed: character %"PRIsizet" (%"PRIx32") is UNASSIGNED",
i,
label[i]);
return false;
diff --git a/utils/nscolour.c b/utils/nscolour.c
index a07175201..5a772b8a6 100644
--- a/utils/nscolour.c
+++ b/utils/nscolour.c
@@ -28,6 +28,7 @@
#include
#include
+#include "netsurf/inttypes.h"
#include "netsurf/plot_style.h"
#include "utils/errors.h"
@@ -211,49 +212,49 @@ nserror nscolour_get_stylesheet(const char **stylesheet_out)
ret = snprintf(buffer, sizeof(buffer),
".ns-odd-bg {\n"
- "\tbackground-color: #%06x;\n"
+ "\tbackground-color: #%06"PRIx32";\n"
"}\n"
".ns-odd-bg-hover {\n"
- "\tbackground-color: #%06x;\n"
+ "\tbackground-color: #%06"PRIx32";\n"
"}\n"
".ns-odd-fg {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-odd-fg-subtle {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-odd-fg-faded {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-odd-fg-good {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-odd-fg-bad {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-even-bg {\n"
- "\tbackground-color: #%06x;\n"
+ "\tbackground-color: #%06"PRIx32";\n"
"}\n"
".ns-even-bg-hover {\n"
- "\tbackground-color: #%06x;\n"
+ "\tbackground-color: #%06"PRIx32";\n"
"}\n"
".ns-even-fg {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-even-fg-subtle {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-even-fg-faded {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-even-fg-good {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-even-fg-bad {\n"
- "\tcolor: #%06x;\n"
+ "\tcolor: #%06"PRIx32";\n"
"}\n"
".ns-border {\n"
- "\tborder-color: #%06x;\n"
+ "\tborder-color: #%06"PRIx32";\n"
"}\n",
colour_rb_swap(nscolours[NSCOLOUR_WIN_ODD_BG]),
colour_rb_swap(nscolours[NSCOLOUR_WIN_ODD_BG_HOVER]),
diff --git a/utils/nsoption.c b/utils/nsoption.c
index a8a29b3bf..cd7791d75 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -32,6 +32,7 @@
#include
#include
+#include "netsurf/inttypes.h"
#include "netsurf/plot_style.h"
#include "utils/errors.h"
#include "utils/log.h"
@@ -112,7 +113,7 @@ strtooption(const char *value, struct nsoption_s *option)
break;
case OPTION_COLOUR:
- if (sscanf(value, "%x", &rgbcolour) == 1) {
+ if (sscanf(value, "%"SCNx32"", &rgbcolour) == 1) {
option->value.c = (((0x000000FF & rgbcolour) << 16) |
((0x0000FF00 & rgbcolour) << 0) |
((0x00FF0000 & rgbcolour) >> 16));
@@ -323,7 +324,7 @@ nsoption_output(FILE *fp,
rgbcolour = (((0x000000FF & opts[entry].value.c) << 16) |
((0x0000FF00 & opts[entry].value.c) << 0) |
((0x00FF0000 & opts[entry].value.c) >> 16));
- fprintf(fp, "%s:%06x\n",
+ fprintf(fp, "%s:%06"PRIx32"\n",
opts[entry].key,
rgbcolour);
@@ -387,9 +388,9 @@ nsoption_output_value_html(struct nsoption_s *option,
slen = snprintf(string + pos,
size - pos,
""
- "#%06X"
+ "#%06"PRIX32
" "
- ""
@@ -459,7 +460,7 @@ nsoption_output_value_text(struct nsoption_s *option,
rgbcolour = (((0x000000FF & option->value.c) << 16) |
((0x0000FF00 & option->value.c) << 0) |
((0x00FF0000 & option->value.c) >> 16));
- slen = snprintf(string + pos, size - pos, "%06x", rgbcolour);
+ slen = snprintf(string + pos, size - pos, "%06"PRIx32"", rgbcolour);
break;
case OPTION_STRING:
diff --git a/utils/utf8.c b/utils/utf8.c
index 7091ad405..3eedd0810 100644
--- a/utils/utf8.c
+++ b/utils/utf8.c
@@ -32,6 +32,7 @@
#include "utils/log.h"
#include "utils/utf8.h"
+#include "netsurf/inttypes.h"
#include "netsurf/utf8.h"
#include "desktop/gui_internal.h"
@@ -346,7 +347,7 @@ utf8_convert_html_chunk(iconv_t cd,
return NSERROR_NOMEM;
ucs4 = utf8_to_ucs4(chunk, inlen);
- esclen = snprintf(escape, sizeof(escape), "%06x;", ucs4);
+ esclen = snprintf(escape, sizeof(escape), "%06"PRIx32";", ucs4);
pescape = escape;
ret = iconv(cd, (void *) &pescape, &esclen,
(void *) out, outlen);