summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-01-21 14:20:55 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2017-01-21 14:20:55 (GMT)
commit6075feb4875ed2035de460fcdc7858f314ad0bef (patch)
tree9ebc96049523deceef76a4170257ffac8b5b71eb
parent11f11e0a7f8f7dd03d5b1fc22a8e54af305fbe6f (diff)
downloadnetsurf-6075feb4875ed2035de460fcdc7858f314ad0bef.tar.gz
netsurf-6075feb4875ed2035de460fcdc7858f314ad0bef.tar.bz2
create netsurf inttypes header to have portable integer formatting macros
-rw-r--r--content/content.c3
-rw-r--r--content/fetchers/data.c1
-rw-r--r--content/fetchers/file.c1
-rw-r--r--content/fetchers/resource.c1
-rw-r--r--content/fs_backing_store.c2
-rw-r--r--content/handlers/image/image_cache.c2
-rw-r--r--content/handlers/image/png.c1
-rw-r--r--content/handlers/javascript/duktape/dukky.c7
-rw-r--r--content/llcache.c4
-rw-r--r--desktop/netsurf.c2
-rw-r--r--frontends/amiga/iff_dr2d.c2
-rw-r--r--frontends/atari/bitmap.c2
-rw-r--r--frontends/atari/cookies.c2
-rw-r--r--frontends/atari/deskmenu.c1
-rw-r--r--frontends/atari/font.c2
-rw-r--r--frontends/atari/treeview.c2
-rw-r--r--frontends/framebuffer/font_freetype.c2
-rw-r--r--frontends/gtk/window.c2
-rw-r--r--frontends/riscos/url_complete.h3
-rw-r--r--frontends/riscos/window.c3
-rw-r--r--frontends/windows/font.c2
-rw-r--r--include/netsurf/inttypes.h59
-rw-r--r--render/html_css_fetcher.c9
-rw-r--r--utils/http/primitives.c2
-rw-r--r--utils/idna.c2
-rw-r--r--utils/utils.h25
26 files changed, 95 insertions, 49 deletions
diff --git a/content/content.c b/content/content.c
index 51c40d7..2eb035c 100644
--- a/content/content.c
+++ b/content/content.c
@@ -21,10 +21,11 @@
* Content handling implementation.
*/
-#include <inttypes.h>
+#include <stdint.h>
#include <stdlib.h>
#include <nsutils/time.h>
+#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/browser_window.h"
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index 139d09a..cb99e6f 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -27,6 +27,7 @@
#include <libwapcaplet/libwapcaplet.h>
#include <nsutils/base64.h>
+#include "netsurf/inttypes.h"
#include "utils/url.h"
#include "utils/nsurl.h"
#include "utils/corestrings.h"
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index 6ffa638..4fa1a21 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -44,6 +44,7 @@
#endif
#include <libwapcaplet/libwapcaplet.h>
+#include "netsurf/inttypes.h"
#include "utils/nsurl.h"
#include "utils/dirent.h"
#include "utils/corestrings.h"
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index 21ad8c7..b8b4b19 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -29,6 +29,7 @@
#include <stdarg.h>
#include <libwapcaplet/libwapcaplet.h>
+#include "netsurf/inttypes.h"
#include "utils/nsurl.h"
#include "utils/corestrings.h"
#include "utils/log.h"
diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c
index 635f917..8670c31 100644
--- a/content/fs_backing_store.c
+++ b/content/fs_backing_store.c
@@ -43,11 +43,11 @@
#include <stdlib.h>
#include <nsutils/unistd.h>
+#include "netsurf/inttypes.h"
#include "utils/filepath.h"
#include "utils/file.h"
#include "utils/nsurl.h"
#include "utils/log.h"
-#include "utils/utils.h"
#include "utils/messages.h"
#include "desktop/gui_internal.h"
#include "netsurf/misc.h"
diff --git a/content/handlers/image/image_cache.c b/content/handlers/image/image_cache.c
index 9c7ce22..02107f7 100644
--- a/content/handlers/image/image_cache.c
+++ b/content/handlers/image/image_cache.c
@@ -22,12 +22,12 @@
*/
#include <assert.h>
-#include <inttypes.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
+#include "netsurf/inttypes.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "netsurf/misc.h"
diff --git a/content/handlers/image/png.c b/content/handlers/image/png.c
index 93185c1..0baf411 100644
--- a/content/handlers/image/png.c
+++ b/content/handlers/image/png.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <png.h>
+#include "netsurf/inttypes.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/content/handlers/javascript/duktape/dukky.c b/content/handlers/javascript/duktape/dukky.c
index 7dd3bd7..1282ad9 100644
--- a/content/handlers/javascript/duktape/dukky.c
+++ b/content/handlers/javascript/duktape/dukky.c
@@ -23,16 +23,15 @@
* Duktapeish implementation of javascript engine functions.
*/
-#include <inttypes.h>
-
+#include <stdint.h>
#include <nsutils/time.h>
-#include "content/content.h"
-
+#include "netsurf/inttypes.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/corestrings.h"
+#include "content/content.h"
#include "javascript/js.h"
#include "javascript/content.h"
diff --git a/content/llcache.c b/content/llcache.c
index 4bd6eb3..eb30053 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -35,12 +35,10 @@
#include <stdint.h>
#include <string.h>
#include <strings.h>
-#include <inttypes.h>
-
#include <nsutils/time.h>
+#include "netsurf/inttypes.h"
#include "utils/config.h"
-
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index 4a14737..0f597aa 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -25,12 +25,12 @@
#include <stdlib.h>
#include <libwapcaplet/libwapcaplet.h>
+#include "netsurf/inttypes.h"
#include "utils/config.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/utf8.h"
-#include "utils/utils.h"
#include "utils/messages.h"
#include "content/content_factory.h"
#include "content/fetchers.h"
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index 91973f4..a4c5855 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -20,12 +20,12 @@
#include <stdio.h>
#include <stdlib.h>
-#include <inttypes.h>
#include <svgtiny.h>
#include <proto/exec.h>
#include <string.h>
#include <proto/dos.h>
+#include "netsurf/inttypes.h"
#ifndef AMIGA_DR2D_STANDALONE
#include "utils/nsurl.h"
#include "netsurf/content.h"
diff --git a/frontends/atari/bitmap.c b/frontends/atari/bitmap.c
index d0de378..cbb7195 100644
--- a/frontends/atari/bitmap.c
+++ b/frontends/atari/bitmap.c
@@ -16,12 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
+#include "netsurf/inttypes.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "netsurf/bitmap.h"
diff --git a/frontends/atari/cookies.c b/frontends/atari/cookies.c
index a49aec7..9045009 100644
--- a/frontends/atari/cookies.c
+++ b/frontends/atari/cookies.c
@@ -17,8 +17,8 @@
*/
#include <assert.h>
-#include <inttypes.h>
+#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/mouse.h"
diff --git a/frontends/atari/deskmenu.c b/frontends/atari/deskmenu.c
index 77df4e5..addba27 100644
--- a/frontends/atari/deskmenu.c
+++ b/frontends/atari/deskmenu.c
@@ -23,6 +23,7 @@
#include "utils/nsurl.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
+#include "utils/utils.h"
#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "desktop/save_complete.h"
diff --git a/frontends/atari/font.c b/frontends/atari/font.c
index 5402e78..7971655 100644
--- a/frontends/atari/font.c
+++ b/frontends/atari/font.c
@@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <inttypes.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
+#include "netsurf/inttypes.h"
#include "utils/utf8.h"
#include "utils/log.h"
#include "utils/nsoption.h"
diff --git a/frontends/atari/treeview.c b/frontends/atari/treeview.c
index 731c032..78da2b0 100644
--- a/frontends/atari/treeview.c
+++ b/frontends/atari/treeview.c
@@ -16,13 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <inttypes.h>
#include <sys/types.h>
#include <string.h>
#include "assert.h"
#include "cflib.h"
+#include "netsurf/inttypes.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
diff --git a/frontends/framebuffer/font_freetype.c b/frontends/framebuffer/font_freetype.c
index ccc60ea..e7c07f5 100644
--- a/frontends/framebuffer/font_freetype.c
+++ b/frontends/framebuffer/font_freetype.c
@@ -17,12 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <inttypes.h>
#include <assert.h>
#include <ft2build.h>
#include FT_CACHE_H
+#include "netsurf/inttypes.h"
#include "utils/filepath.h"
#include "utils/utf8.h"
#include "utils/log.h"
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index abfda93..326e573 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -23,7 +23,6 @@
*/
#include <stdlib.h>
-#include <inttypes.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
@@ -32,6 +31,7 @@
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixdata.h>
+#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/nsoption.h"
diff --git a/frontends/riscos/url_complete.h b/frontends/riscos/url_complete.h
index 6a4660e..9243612 100644
--- a/frontends/riscos/url_complete.h
+++ b/frontends/riscos/url_complete.h
@@ -23,9 +23,8 @@
#ifndef _NETSURF_RISCOS_URLCOMPLETE_H_
#define _NETSURF_RISCOS_URLCOMPLETE_H_
-#include <inttypes.h>
#include <stdbool.h>
-#include "oslib/wimp.h"
+#include <oslib/wimp.h>
struct gui_window;
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index 45d5b14..b1ea58a 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -29,10 +29,10 @@
#include <assert.h>
#include <ctype.h>
-#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <stdbool.h>
+#include <stdint.h>
#include <time.h>
#include <string.h>
#include <oslib/colourtrans.h>
@@ -43,6 +43,7 @@
#include <oslib/wimpspriteop.h>
#include <nsutils/time.h>
+#include "netsurf/inttypes.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/talloc.h"
diff --git a/frontends/windows/font.c b/frontends/windows/font.c
index 791b8cd..f50ba6e 100644
--- a/frontends/windows/font.c
+++ b/frontends/windows/font.c
@@ -23,10 +23,10 @@
*/
#include "utils/config.h"
-#include <inttypes.h>
#include <assert.h>
#include <windows.h>
+#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/nsoption.h"
#include "utils/utf8.h"
diff --git a/include/netsurf/inttypes.h b/include/netsurf/inttypes.h
new file mode 100644
index 0000000..874d83f
--- a/dev/null
+++ b/include/netsurf/inttypes.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Netsurf additional integer type formatting macros.
+ */
+
+#ifndef NETSURF_INTTYPES_H
+#define NETSURF_INTTYPES_H
+
+#include <inttypes.h>
+
+#ifndef PRIxPTR
+#define PRIxPTR "x"
+#endif
+
+#ifndef PRId64
+#define PRId64 "lld"
+#endif
+
+/* Windows does not have sizet formating codes */
+#if defined(_WIN32)
+
+/** windows printf formatting for size_t type */
+#define PRIsizet "Iu"
+
+/** windows printf formatting for ssize_t type */
+#define PRIssizet "Id"
+
+#else
+
+/** c99 standard printf formatting for size_t type */
+#define PRIsizet "zu"
+
+/** c99 standard printf formatting for ssize_t type */
+#define PRIssizet "zd"
+
+#endif
+
+
+
+#endif
+
diff --git a/render/html_css_fetcher.c b/render/html_css_fetcher.c
index b9d79a7..9eda6ae 100644
--- a/render/html_css_fetcher.c
+++ b/render/html_css_fetcher.c
@@ -21,18 +21,19 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
-
#include <dom/dom.h>
#include <libwapcaplet/libwapcaplet.h>
+#include "netsurf/inttypes.h"
#include "utils/config.h"
-#include "content/fetch.h"
-#include "content/fetchers.h"
-#include "render/html_internal.h"
#include "utils/log.h"
#include "utils/ring.h"
#include "utils/nsurl.h"
#include "utils/utils.h"
+#include "content/fetch.h"
+#include "content/fetchers.h"
+
+#include "render/html_internal.h"
typedef struct html_css_fetcher_item {
uint32_t key;
diff --git a/utils/http/primitives.c b/utils/http/primitives.c
index f4c4e05..1e24d2a 100644
--- a/utils/http/primitives.c
+++ b/utils/http/primitives.c
@@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
+#include "netsurf/inttypes.h"
#include "utils/http/primitives.h"
/**
diff --git a/utils/idna.c b/utils/idna.c
index d75f957..34cc40f 100644
--- a/utils/idna.c
+++ b/utils/idna.c
@@ -28,6 +28,8 @@
#include <string.h>
#include <libutf8proc/utf8proc.h>
+#include "netsurf/inttypes.h"
+
#include "utils/errors.h"
#include "utils/idna.h"
#include "utils/idna_props.h"
diff --git a/utils/utils.h b/utils/utils.h
index 6f2ee45..3995071 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -23,10 +23,9 @@
* \todo Many of these functions and macros should have their own headers.
*/
-#ifndef _NETSURF_UTILS_UTILS_H_
-#define _NETSURF_UTILS_UTILS_H_
+#ifndef NETSURF_UTILS_UTILS_H
+#define NETSURF_UTILS_UTILS_H
-#include <inttypes.h>
#include <stdbool.h>
#ifndef NOF_ELEMENTS
@@ -52,29 +51,11 @@
#endif
#endif
-#ifndef PRIxPTR
-#define PRIxPTR "x"
-#endif
-
-#ifndef PRId64
-#define PRId64 "lld"
-#endif
-
-/* Windows does not have sizet formating codes or POSIX mkdir so work
- * around that
- */
+/* Windows does not have POSIX mkdir so work around that */
#if defined(_WIN32)
-/** windows printf formatting for size_t type */
-#define PRIsizet "Iu"
-/** windows printf formatting for ssize_t type */
-#define PRIssizet "Id"
/** windows mkdir function */
#define nsmkdir(dir, mode) mkdir((dir))
#else
-/** c99 standard printf formatting for size_t type */
-#define PRIsizet "zu"
-/** c99 standard printf formatting for ssize_t type */
-#define PRIssizet "zd"
/** POSIX mkdir function */
#define nsmkdir(dir, mode) mkdir((dir), (mode))
#endif