diff options
46 files changed, 144 insertions, 140 deletions
diff --git a/configure.ac b/configure.ac index 9f3d1020..8d342605 100644 --- a/configure.ac +++ b/configure.ac @@ -655,7 +655,9 @@ if eval "test x$GCC = xyes"; then if test "`echo $CFLAGS | grep '\-Wno-unused-parameter' 2> /dev/null`" = ""; then CFLAGS="$CFLAGS -Wno-unused-parameter" fi + CFLAGS="$CFLAGS -pedantic -std=c99 -D_POSIX_C_SOURCE=200112L" fi + dnl ----------- dnl CXX options dnl ----------- diff --git a/dlib/dlib.c b/dlib/dlib.c index cd8e8a72..f4c8db2d 100644 --- a/dlib/dlib.c +++ b/dlib/dlib.c @@ -883,7 +883,7 @@ void dLib_show_messages(bool_t show) /** * Return the current working directory in a new string */ -char *dGetcwd () +char *dGetcwd (void) { size_t size = 128; @@ -901,7 +901,7 @@ char *dGetcwd () /** * Return the home directory in a static string (don't free) */ -char *dGethomedir () +char *dGethomedir (void) { static char *homedir = NULL; diff --git a/dlib/dlib.h b/dlib/dlib.h index 87335e00..81301a55 100644 --- a/dlib/dlib.h +++ b/dlib/dlib.h @@ -173,8 +173,8 @@ void dLib_show_messages(bool_t show); /* *- Misc utility functions ---------------------------------------------------- */ -char *dGetcwd(); -char *dGethomedir(); +char *dGetcwd(void); +char *dGethomedir(void); char *dGetline(FILE *stream); int dClose(int fd); diff --git a/dpi/cookies.c b/dpi/cookies.c index 420bd69d..f629768e 100644 --- a/dpi/cookies.c +++ b/dpi/cookies.c @@ -3,7 +3,7 @@ * Cookies server. * * Copyright 2001 Lars Clausen <lrclause@cs.uiuc.edu> - * Jörgen Viksell <jorgen.viksell@telia.com> + * Jörgen Viksell <jorgen.viksell@telia.com> * Copyright 2002-2007 Jorge Arellano Cid <jcid@dillo.org> * * This program is free software; you can redistribute it and/or modify @@ -332,7 +332,7 @@ static void Cookies_load_cookies(FILE *stream) * Initialize the cookies module * (The 'disabled' variable is writeable only within Cookies_init) */ -static void Cookies_init() +static void Cookies_init(void) { char *filename; #ifndef HAVE_LOCKF @@ -387,7 +387,7 @@ static void Cookies_init() /* * Flush cookies to disk and free all the memory allocated. */ -static void Cookies_save_and_free() +static void Cookies_save_and_free(void) { int i, fd, saved = 0; DomainNode *node; diff --git a/dpi/datauri.c b/dpi/datauri.c index 0e3560ec..f968baa2 100644 --- a/dpi/datauri.c +++ b/dpi/datauri.c @@ -20,6 +20,7 @@ #include "../dpip/dpip.h" #include "dpiutil.h" +#include "../src/misc.h" /* * Debugging macros @@ -44,7 +45,7 @@ static void b64strip_illegal_chars(unsigned char* str) MSG("len=%d{%s}\n", strlen((char*)str), str); for (p = s; (*p = *s); ++s) { - if (isascii(*p) && (isalnum(*p) || strchr("+/=", *p))) + if (d_isascii(*p) && (isalnum(*p) || strchr("+/=", *p))) ++p; } @@ -1000,7 +1000,7 @@ static void File_serve_client(void *data, int f_write) /* * Serve the client queue. */ -static void File_serve_clients() +static void File_serve_clients(void) { int i, f_read, f_write; ClientInfo *client; diff --git a/dpid/dpid.c b/dpid/dpid.c index 06ae86b7..93df2e6a 100644 --- a/dpid/dpid.c +++ b/dpid/dpid.c @@ -47,7 +47,7 @@ char *SharedKey = NULL; * This avoids that dillo instances connect to a stale port after dpid * has exited (e.g. after a reboot). */ -void cleanup() +void cleanup(void) { char *fname; fname = dStrconcat(dGethomedir(), "/", dotDILLO_DPID_COMM_KEYS, NULL); @@ -112,7 +112,7 @@ static void terminator(int sig) /*! Establish handler for termination signals * and register cleanup with atexit */ -void est_dpi_terminator() +void est_dpi_terminator(void) { struct sigaction act; sigset_t block; @@ -526,7 +526,7 @@ int fill_services_list(struct dp *attlist, int numdpis, Dlist **services_list) * Return a socket file descriptor * (useful to set socket options in a uniform way) */ -static int make_socket_fd() +static int make_socket_fd(void) { int ret, one = 1; @@ -618,7 +618,7 @@ int save_comm_keys(int srs_port) * \li Number of sockets (1 == success) * \li -1 on failure */ -int init_ids_srs_socket() +int init_ids_srs_socket(void) { int srs_port, ret = -1; @@ -806,7 +806,7 @@ void ignore_dpi_sockets(struct dp *dpi_attr_list, int numdpis) * \Return * Number of available dpis */ -int register_all_cmd() +int register_all_cmd(void) { stop_active_dpis(dpi_attr_list, numdpis); free_plugin_list(&dpi_attr_list, numdpis); diff --git a/dpid/dpid.h b/dpid/dpid.h index 7186d4ff..b1dc6aab 100644 --- a/dpid/dpid.h +++ b/dpid/dpid.h @@ -68,7 +68,7 @@ extern volatile sig_atomic_t caught_sigchld; void rm_dpi_sockets(struct dp *dpi_attr_list, int numdpis); -void cleanup(); +void cleanup(void); void free_dpi_attr(struct dp *dpi_attr); @@ -86,7 +86,7 @@ int register_all(struct dp **attlist); int fill_services_list(struct dp *attlist, int numdpis, Dlist **services_list); -int init_ids_srs_socket(); +int init_ids_srs_socket(void); int init_dpi_socket(struct dp *dpi_attr); @@ -104,7 +104,7 @@ void stop_active_dpis(struct dp *dpi_attr_list, int numdpis); void ignore_dpi_sockets(struct dp *dpi_attr_list, int numdpis); -int register_all_cmd(); +int register_all_cmd(void); char *get_message(int sock, char *dpi_tag); diff --git a/dpid/dpid_common.h b/dpid/dpid_common.h index 11bd0148..ca67d67f 100644 --- a/dpid/dpid_common.h +++ b/dpid/dpid_common.h @@ -10,6 +10,8 @@ */ #include <dirent.h> +#include <stddef.h> /* size_t */ +#include <sys/types.h> /* ssize_t */ #include "../dlib/dlib.h" diff --git a/dpid/main.c b/dpid/main.c index 2c3c3271..b73eb4af 100644 --- a/dpid/main.c +++ b/dpid/main.c @@ -48,7 +48,6 @@ struct dp *dpi_attr_list; Dlist *services_list; int numsocks; int srs_fd; -; // end of fix diff --git a/dpid/misc_new.c b/dpid/misc_new.c index 94b4d320..b1355718 100644 --- a/dpid/misc_new.c +++ b/dpid/misc_new.c @@ -59,7 +59,7 @@ char *a_Misc_readtag(int sock) { char *tag, c; size_t i; - size_t taglen = 0, tagmem = 10; + size_t tagmem = 10; ssize_t rdln = 1; tag = NULL; @@ -71,7 +71,6 @@ char *a_Misc_readtag(int sock) tag = (char *) dRealloc(tag, tagmem + 1); } tag[i] = c; - taglen += rdln; if (c == '>') { tag[i + 1] = '\0'; break; diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index 91d4ee57..6d2c5ecd 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -121,13 +121,15 @@ void FltkViewport::adjustScrollbarsAndGadgetsAllocation () vscrollbar->resize(x () + w () - SCROLLBAR_THICKNESS, y (), SCROLLBAR_THICKNESS, h () - vdiff); - int X = x () + w () - SCROLLBAR_THICKNESS; - int Y = y () + h () - SCROLLBAR_THICKNESS; + //int X = x () + w () - SCROLLBAR_THICKNESS; + //int Y = y () + h () - SCROLLBAR_THICKNESS; for (Iterator <TypedPointer < Fl_Widget> > it = gadgets->iterator (); it.hasNext (); ) { Fl_Widget *widget = it.getNext()->getTypedValue (); widget->resize(x (), y (), SCROLLBAR_THICKNESS, SCROLLBAR_THICKNESS); + /* FIXME: This has no effect */ +#if 0 switch (gadgetOrientation [visibility]) { case GADGET_VERTICAL: Y -= SCROLLBAR_THICKNESS; @@ -137,6 +139,7 @@ void FltkViewport::adjustScrollbarsAndGadgetsAllocation () X -= SCROLLBAR_THICKNESS; break; } +#endif } } diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index aed1f936..54ea5744 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -548,7 +548,7 @@ int OOFFloatsMgr::addWidgetOOF (Widget *widget, OOFAwareWidget *generatingBlock, DBG_OBJ_ENTER ("construct.oofm", 0, "addWidgetOOF", "%p, %p, %d", widget, generatingBlock, externalIndex); - int subRef; + int subRef = 0; TBInfo *tbInfo = getOOFAwareWidget (generatingBlock); Float *vloat = new Float (this, widget, generatingBlock, externalIndex); diff --git a/dw/table.cc b/dw/table.cc index 582c8184..18bf81cd 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -1196,10 +1196,13 @@ void Table::actuallyCalcCellSizes (bool calcHeights) for (int col = 0; col < numCols; col++) { int n = row * numCols + col; if (childDefined (n)) { + /* FIXME: Variable width is not used */ +#if 0 int width = (children->get(n)->cell.colspanEff - 1) * getStyle()->hBorderSpacing; for (int i = 0; i < children->get(n)->cell.colspanEff; i++) width += colWidths->get (col + i); +#endif core::Requisition childRequisition; //children->get(n)->cell.widget->setWidth (width); diff --git a/dw/table.hh b/dw/table.hh index 3729da71..ad1a2ddc 100644 --- a/dw/table.hh +++ b/dw/table.hh @@ -325,6 +325,14 @@ namespace dw { class Table: public oof::OOFAwareWidget { private: + struct Cell { + core::Widget *widget; + int colspanOrig, colspanEff, rowspan; + }; + struct SpanSpace { + int startCol, startRow; // where the cell starts + }; + struct Child { enum { @@ -332,13 +340,8 @@ private: SPAN_SPACE // part of a spanning cell } type; union { - struct { - core::Widget *widget; - int colspanOrig, colspanEff, rowspan; - } cell; - struct { - int startCol, startRow; // where the cell starts - } spanSpace; + struct Cell cell; + struct SpanSpace spanSpace; }; }; @@ -48,7 +48,7 @@ public: * Scrolling and Related. Only usesViewport must be * implemented, if it returns false, the other methods * are never called. - * ------------------------------------------------------- + * --------------------------------------------------------- */ /** diff --git a/src/IO/dpi.c b/src/IO/dpi.c index d7dd7d0b..c1786de6 100644 --- a/src/IO/dpi.c +++ b/src/IO/dpi.c @@ -419,7 +419,7 @@ static int Dpi_read_comm_keys(int *port) /** * Return a socket file descriptor */ -static int Dpi_make_socket_fd() +static int Dpi_make_socket_fd(void) { int fd, one = 1, ret = -1; @@ -435,7 +435,7 @@ static int Dpi_make_socket_fd() * Make a connection test for a IDS. * Return: 1 OK, -1 Not working. */ -static int Dpi_check_dpid_ids() +static int Dpi_check_dpid_ids(void) { struct sockaddr_in sin; const socklen_t sin_sz = sizeof(sin); @@ -504,12 +504,12 @@ static int Dpi_check_dpid(int num_tries) static int Dpi_blocking_start_dpid(void) { int cst, try = 0, - n_tries = 12; /* 3 seconds */ + n_tries = 3; /* 3 seconds */ /* test the dpid, and wait a bit for it to start if necessary */ while ((cst = Dpi_check_dpid(n_tries)) == 1) { MSG("Dpi_blocking_start_dpid: try %d\n", ++try); - usleep(250000); /* 1/4 sec */ + sleep(1); } return cst; } @@ -757,7 +757,7 @@ void a_Dpi_ccc(int Op, int Branch, int Dir, ChainLink *Info, * Note: currently disabled. It may serve to let the cookies dpi know * when to expire session cookies. */ -void a_Dpi_dillo_exit() +void a_Dpi_dillo_exit(void) { } diff --git a/src/IO/http.c b/src/IO/http.c index 4c4618c5..c7915fc5 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -234,7 +234,7 @@ void a_Http_connect_done(int fd, bool_t success) dFree(info); } } else { - MSG("**** but no luck with fme %p or sd\n", fme); + MSG("**** but no luck with fme %p or sd\n", (void *) fme); } } @@ -1091,7 +1091,7 @@ static void Http_server_remove(Server_t *srv) dFree(srv); } -static void Http_servers_remove_all() +static void Http_servers_remove_all(void) { Server_t *srv; SocketData_t *sd; @@ -1107,7 +1107,7 @@ static void Http_servers_remove_all() dList_free(servers); } -static void Http_fd_map_remove_all() +static void Http_fd_map_remove_all(void) { FdMapEntry_t *fme; int i, n = dList_length(fd_map); diff --git a/src/IO/mime.c b/src/IO/mime.c index bc70a85f..1f6a3d47 100644 --- a/src/IO/mime.c +++ b/src/IO/mime.c @@ -94,7 +94,7 @@ static Viewer_t Mime_major_type_fetch(const char *Key, uint_t Size) /** * Initializes Mime module and, sets the supported Mime types. */ -void a_Mime_init() +void a_Mime_init(void) { #ifdef ENABLE_GIF Mime_add_minor_type("image/gif", a_Dicache_gif_image); diff --git a/src/IO/tls.c b/src/IO/tls.c index 05ae2514..4c0cfe7e 100644 --- a/src/IO/tls.c +++ b/src/IO/tls.c @@ -28,7 +28,7 @@ /** * Initialize TLS library. */ -void a_Tls_init() +void a_Tls_init(void) { #if ! defined(ENABLE_TLS) MSG("TLS: Disabled at compilation time.\n"); diff --git a/src/IO/tls.h b/src/IO/tls.h index 25da6ea6..500b2421 100644 --- a/src/IO/tls.h +++ b/src/IO/tls.h @@ -31,13 +31,13 @@ extern "C" { #define TLS_CONNECT_NOT_YET 0 #define TLS_CONNECT_READY 1 -void a_Tls_init(); +void a_Tls_init(void); int a_Tls_certificate_is_clean(const DilloUrl *url); int a_Tls_connect_ready(const DilloUrl *url); void a_Tls_reset_server_state(const DilloUrl *url); void a_Tls_connect(int fd, const DilloUrl *url); void *a_Tls_connection(int fd); -void a_Tls_freeall(); +void a_Tls_freeall(void); void a_Tls_close_by_fd(int fd); int a_Tls_read(void *conn, void *buf, size_t len); int a_Tls_write(void *conn, void *buf, size_t len); diff --git a/src/IO/tls_mbedtls.h b/src/IO/tls_mbedtls.h index 4a679698..8ce16318 100644 --- a/src/IO/tls_mbedtls.h +++ b/src/IO/tls_mbedtls.h @@ -21,13 +21,13 @@ extern "C" { #include "../url.h" -void a_Tls_mbedtls_init(); +void a_Tls_mbedtls_init(void); int a_Tls_mbedtls_certificate_is_clean(const DilloUrl *url); int a_Tls_mbedtls_connect_ready(const DilloUrl *url); void a_Tls_mbedtls_reset_server_state(const DilloUrl *url); void a_Tls_mbedtls_connect(int fd, const DilloUrl *url); void *a_Tls_mbedtls_connection(int fd); -void a_Tls_mbedtls_freeall(); +void a_Tls_mbedtls_freeall(void); void a_Tls_mbedtls_close_by_fd(int fd); int a_Tls_mbedtls_read(void *conn, void *buf, size_t len); int a_Tls_mbedtls_write(void *conn, void *buf, size_t len); diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c index 10a68dbd..3e68e928 100644 --- a/src/IO/tls_openssl.c +++ b/src/IO/tls_openssl.c @@ -199,7 +199,7 @@ static void Tls_info_cb(const SSL *ssl, int where, int ret) * abysmal openssl documentation, this was worked out from reading discussion * on the web and then reading openssl source to see what it normally does. */ -static void Tls_load_certificates() +static void Tls_load_certificates(void) { /* curl-7.37.1 says that the following bundle locations are used on "Debian * systems", "Redhat and Mandriva", "old(er) Redhat", "FreeBSD", and @@ -1338,7 +1338,7 @@ void a_Tls_openssl_close_by_fd(int fd) } } -static void Tls_servers_freeall() +static void Tls_servers_freeall(void) { if (servers) { Server_t *s; @@ -1353,7 +1353,7 @@ static void Tls_servers_freeall() } } -static void Tls_fd_map_remove_all() +static void Tls_fd_map_remove_all(void) { if (fd_map) { FdMapEntry_t *fme; diff --git a/src/IO/tls_openssl.h b/src/IO/tls_openssl.h index 5cfd5dfd..edde93ef 100644 --- a/src/IO/tls_openssl.h +++ b/src/IO/tls_openssl.h @@ -31,13 +31,13 @@ extern "C" { #include "../url.h" -void a_Tls_openssl_init(); +void a_Tls_openssl_init(void); int a_Tls_openssl_certificate_is_clean(const DilloUrl *url); int a_Tls_openssl_connect_ready(const DilloUrl *url); void a_Tls_openssl_reset_server_state(const DilloUrl *url); void a_Tls_openssl_connect(int fd, const DilloUrl *url); void *a_Tls_openssl_connection(int fd); -void a_Tls_openssl_freeall(); +void a_Tls_openssl_freeall(void); void a_Tls_openssl_close_by_fd(int fd); int a_Tls_openssl_read(void *conn, void *buf, size_t len); int a_Tls_openssl_write(void *conn, void *buf, size_t len); @@ -17,7 +17,7 @@ */ -#include <ctype.h> /* iscntrl */ +#include <ctype.h> /* iscntrl, isascii */ #include "auth.h" #include "msg.h" #include "misc.h" @@ -61,7 +61,7 @@ void a_Auth_init(void) auth_hosts = dList_new(1); } -static AuthParse_t *Auth_parse_new() +static AuthParse_t *Auth_parse_new(void) { AuthParse_t *auth_parse = dNew(AuthParse_t, 1); auth_parse->ok = 0; @@ -105,7 +105,7 @@ static int Auth_path_is_inside(const char *path1, const char *path2, int len) static int Auth_is_token_char(char c) { const char *invalid = "\"()<>@,;:\\[]?=/{} \t"; - return (!isascii(c) || strchr(invalid, c) || iscntrl((uchar_t)c)) ? 0 : 1; + return (!d_isascii(c) || strchr(invalid, c) || iscntrl((uchar_t)c)) ? 0 : 1; } /** @@ -231,7 +231,7 @@ static int Auth_parse_basic_challenge_cb(AuthParse_t *auth_parse, char *token, { if (dStrAsciiCasecmp("realm", token) == 0) { if (!auth_parse->realm) - auth_parse->realm = strdup(value); + auth_parse->realm = dStrdup(value); return 0; /* end parsing */ } else MSG("Auth_parse_basic_challenge_cb: Ignoring unknown parameter: %s = " @@ -245,13 +245,13 @@ static int Auth_parse_digest_challenge_cb(AuthParse_t *auth_parse, char *token, const char *const fn = "Auth_parse_digest_challenge_cb"; if (!dStrAsciiCasecmp("realm", token) && !auth_parse->realm) - auth_parse->realm = strdup(value); + auth_parse->realm = dStrdup(value); else if (!strcmp("domain", token) && !auth_parse->domain) - auth_parse->domain = strdup(value); + auth_parse->domain = dStrdup(value); else if (!strcmp("nonce", token) && !auth_parse->nonce) - auth_parse->nonce = strdup(value); + auth_parse->nonce = dStrdup(value); else if (!strcmp("opaque", token) && !auth_parse->opaque) - auth_parse->opaque = strdup(value); + auth_parse->opaque = dStrdup(value); else if (strcmp("stale", token) == 0) { if (dStrAsciiCasecmp("true", value) == 0) auth_parse->stale = 1; @@ -44,7 +44,7 @@ void a_Bw_init(void) * Create a new browser window and return it. * (the new window is stored in browser_window[]) */ -BrowserWindow *a_Bw_new() +BrowserWindow *a_Bw_new(void) { BrowserWindow *bw; @@ -302,7 +302,7 @@ void a_Bw_cleanup(BrowserWindow *bw) /*--------------------------------------------------------------------------*/ -int a_Bw_num() +int a_Bw_num(void) { return num_bws; } @@ -81,10 +81,10 @@ extern "C" { void a_Bw_init(void); -BrowserWindow *a_Bw_new(); +BrowserWindow *a_Bw_new(void); void a_Bw_free(BrowserWindow *bw); BrowserWindow *a_Bw_get(int i); -int a_Bw_num(); +int a_Bw_num(void); void a_Bw_add_client(BrowserWindow *bw, int Key, int Root); int a_Bw_remove_client(BrowserWindow *bw, int ClientKey); diff --git a/src/cache.c b/src/cache.c index acdeb8b4..8c05c0eb 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1359,9 +1359,10 @@ static CacheEntry_t *Cache_process_queue(CacheEntry_t *entry) /** * Callback function for Cache_delayed_process_queue. */ -static void Cache_delayed_process_queue_callback() +static void Cache_delayed_process_queue_callback(void *ptr) { CacheEntry_t *entry; + (void) ptr; /* Unused */ while ((entry = (CacheEntry_t *)dList_nth_data(DelayedQueue, 0))) { Cache_ref_data(entry); diff --git a/src/cookies.c b/src/cookies.c index 589c244f..c2381e04 100644 --- a/src/cookies.c +++ b/src/cookies.c @@ -2,7 +2,7 @@ * File: cookies.c * * Copyright 2001 Lars Clausen <lrclause@cs.uiuc.edu> - * Jörgen Viksell <jorgen.viksell@telia.com> + * Jörgen Viksell <jorgen.viksell@telia.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -132,7 +132,7 @@ void a_Cookies_init(void) /** * Flush cookies to disk and free all the memory allocated. */ -void a_Cookies_freeall() +void a_Cookies_freeall(void) { } diff --git a/src/decode.c b/src/decode.c index 974e1c39..0e95f386 100644 --- a/src/decode.c +++ b/src/decode.c @@ -304,7 +304,7 @@ DecodeTransfer *a_Decode_transfer_init(const char *format) return dc; } -static Decode *Decode_content_init_common() +static Decode *Decode_content_init_common(void) { z_stream *zs = dNew(z_stream, 1); Decode *dc = dNew(Decode, 1); diff --git a/src/dialog.cc b/src/dialog.cc index 70771be9..34928095 100644 --- a/src/dialog.cc +++ b/src/dialog.cc @@ -184,7 +184,7 @@ const char *a_Dialog_input(const char *title, const char *msg) if (!pm) { int n_it = dList_length(prefs.search_urls); pm = new Fl_Menu_Item[n_it+1]; - memset(pm, '\0', sizeof(*pm)); + memset(pm, '\0', (n_it + 1) * sizeof(Fl_Menu_Item)); for (int i = 0, j = 0; i < n_it; i++) { char *label, *url, *source; source = (char *)dList_nth_data(prefs.search_urls, i); diff --git a/src/dillo.cc b/src/dillo.cc index 889b5256..e9fbfdd7 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -125,6 +125,8 @@ static void raw_sigchld2(int signum) pid_t pid; int status; + (void) signum; /* Unused */ + while (1) { pid = waitpid(-1, &status, WNOHANG); if (pid > 0) { @@ -141,7 +143,6 @@ static void raw_sigchld2(int signum) break; } } - ++signum; /* compiler happiness */ } /** @@ -288,17 +288,7 @@ static void *Dns_server(void *data) if (error != 0) { dns_server[channel].status = error; - if (error == EAI_NONAME) - MSG("DNS error: HOST_NOT_FOUND\n"); - else if (error == EAI_AGAIN) - MSG("DNS error: TRY_AGAIN\n"); -#ifdef EAI_NODATA - /* Some FreeBSD don't have this anymore */ - else if (error == EAI_NODATA) - MSG("DNS error: NO_ADDRESS\n"); -#endif - else if (h_errno == EAI_FAIL) - MSG("DNS error: NO_RECOVERY\n"); + MSG("DNS error: %s\n", gai_strerror(error)); } else { Dns_note_hosts(hosts, res0); dns_server[channel].status = 0; diff --git a/src/history.c b/src/history.c index de77b5c9..49541dfd 100644 --- a/src/history.c +++ b/src/history.c @@ -33,7 +33,7 @@ static int history_size_max = 16; /** * Debug procedure. */ -void History_show() +void History_show(void) { int i; @@ -149,7 +149,7 @@ void a_History_set_title_by_url(const DilloUrl *url, const char *title) /** * Free all the memory used by this module */ -void a_History_freeall() +void a_History_freeall(void) { int i; @@ -52,7 +52,7 @@ static void Hsts_free_policy(HstsData_t *p) dFree(p); } -void a_Hsts_freeall() +void a_Hsts_freeall(void) { if (prefs.http_strict_transport_security) { HstsData_t *policy; @@ -119,13 +119,9 @@ static void Jpeg_close(DilloJpeg *jpeg, CacheClient_t *Client) Jpeg_free(jpeg); } -/* - * The proper signature is: - * static void init_source(j_decompress_ptr cinfo) - * (declaring it with no parameter avoids a compiler warning) - */ -static void init_source() +static void init_source(struct jpeg_decompress_struct *p) { + (void) p; /* unused */ } static boolean fill_input_buffer(j_decompress_ptr cinfo) @@ -181,8 +177,9 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) * static void term_source(j_decompress_ptr cinfo) * (declaring it with no parameter avoids a compiler warning) */ -static void term_source() +static void term_source(struct jpeg_decompress_struct *p) { + (void) p; /* unused */ } void *a_Jpeg_new(DilloImage *Image, DilloUrl *url, int version) @@ -63,6 +63,7 @@ #include "md5.h" #include <string.h> +#include <stdint.h> #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ #ifdef ARCH_IS_BIG_ENDIAN @@ -171,7 +172,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) * On little-endian machines, we can process properly aligned * data without copying it. */ - if (!((data - (const md5_byte_t *)0) & 3)) { + if (((uintptr_t) data & 3) == 0) { /* data are properly aligned */ X = (const md5_word_t *)data; } else { diff --git a/src/menu.cc b/src/menu.cc index b045bf66..7cea24a7 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -397,7 +397,7 @@ void a_Menu_page_popup(BrowserWindow *bw, const DilloUrl *url, if (cssUrls && cssUrls->size () > 0) { stylesheets = new Fl_Menu_Item[cssUrls->size() + 1]; - memset(stylesheets, '\0', sizeof(*stylesheets)); + memset(stylesheets, '\0', (cssUrls->size() + 1) * sizeof(Fl_Menu_Item)); for (j = 0; j < cssUrls->size(); j++) { DilloUrl *url = cssUrls->get(j); @@ -638,7 +638,7 @@ void a_Menu_history_popup(BrowserWindow *bw, int x, int y, int direction) ; pm = new Fl_Menu_Item[n + 1]; - memset(pm, '\0', sizeof(*pm)); + memset(pm, '\0', (n + 1) * sizeof(Fl_Menu_Item)); for (i = 0; i < n; i++) { pm[i].label(FL_NORMAL_LABEL, a_History_get_title(history_list[i], 1)); @@ -222,13 +222,13 @@ void a_Misc_parse_content_type(const char *type, char **major, char **minor, if (!(str = type)) return; - for (s = str; *s && isascii((uchar_t)*s) && !iscntrl((uchar_t)*s) && + for (s = str; *s && d_isascii((uchar_t)*s) && !iscntrl((uchar_t)*s) && !strchr(tspecials_space, *s); s++) ; if (major) *major = dStrndup(str, s - str); if (*s == '/') { - for (str = ++s; *s && isascii((uchar_t)*s) && !iscntrl((uchar_t)*s) && + for (str = ++s; *s && d_isascii((uchar_t)*s) && !iscntrl((uchar_t)*s) && !strchr(tspecials_space, *s); s++) ; if (minor) *minor = dStrndup(str, s - str); @@ -8,6 +8,7 @@ extern "C" { #endif /* __cplusplus */ +#define d_isascii(c) (((c) & ~0x7f) == 0) char *a_Misc_escape_chars(const char *str, const char *esc_set); int a_Misc_expand_tabs(char **start, char *end, char *buf, int buflen); diff --git a/src/nanosvg.h b/src/nanosvg.h index 98b06bea..77617f65 100644 --- a/src/nanosvg.h +++ b/src/nanosvg.h @@ -125,7 +125,7 @@ typedef struct NSVGpaint { union { unsigned int color; NSVGgradient* gradient; - }; + } v; } NSVGpaint; typedef struct NSVGpath @@ -405,7 +405,7 @@ typedef struct NSVGgradientData union { NSVGlinearData linear; NSVGradialData radial; - }; + } grad; char spread; char units; float xform[6]; @@ -673,7 +673,7 @@ static void nsvg__deletePaths(NSVGpath* path) static void nsvg__deletePaint(NSVGpaint* paint) { if (paint->type == NSVG_PAINT_LINEAR_GRADIENT || paint->type == NSVG_PAINT_RADIAL_GRADIENT) - free(paint->gradient); + free(paint->v.gradient); } static void nsvg__deleteGradientData(NSVGgradientData* grad) @@ -875,10 +875,10 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f if (data->type == NSVG_PAINT_LINEAR_GRADIENT) { float x1, y1, x2, y2, dx, dy; - x1 = nsvg__convertToPixels(p, data->linear.x1, ox, sw); - y1 = nsvg__convertToPixels(p, data->linear.y1, oy, sh); - x2 = nsvg__convertToPixels(p, data->linear.x2, ox, sw); - y2 = nsvg__convertToPixels(p, data->linear.y2, oy, sh); + x1 = nsvg__convertToPixels(p, data->grad.linear.x1, ox, sw); + y1 = nsvg__convertToPixels(p, data->grad.linear.y1, oy, sh); + x2 = nsvg__convertToPixels(p, data->grad.linear.x2, ox, sw); + y2 = nsvg__convertToPixels(p, data->grad.linear.y2, oy, sh); // Calculate transform aligned to the line dx = x2 - x1; dy = y2 - y1; @@ -887,11 +887,11 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f grad->xform[4] = x1; grad->xform[5] = y1; } else { float cx, cy, fx, fy, r; - cx = nsvg__convertToPixels(p, data->radial.cx, ox, sw); - cy = nsvg__convertToPixels(p, data->radial.cy, oy, sh); - fx = nsvg__convertToPixels(p, data->radial.fx, ox, sw); - fy = nsvg__convertToPixels(p, data->radial.fy, oy, sh); - r = nsvg__convertToPixels(p, data->radial.r, 0, sl); + cx = nsvg__convertToPixels(p, data->grad.radial.cx, ox, sw); + cy = nsvg__convertToPixels(p, data->grad.radial.cy, oy, sh); + fx = nsvg__convertToPixels(p, data->grad.radial.fx, ox, sw); + fy = nsvg__convertToPixels(p, data->grad.radial.fy, oy, sh); + r = nsvg__convertToPixels(p, data->grad.radial.r, 0, sl); // Calculate transform aligned to the circle grad->xform[0] = r; grad->xform[1] = 0; grad->xform[2] = 0; grad->xform[3] = r; @@ -1001,8 +1001,8 @@ static void nsvg__addShape(NSVGparser* p) shape->fill.type = NSVG_PAINT_NONE; } else if (attr->hasFill == 1) { shape->fill.type = NSVG_PAINT_COLOR; - shape->fill.color = attr->fillColor; - shape->fill.color |= (unsigned int)(attr->fillOpacity*255) << 24; + shape->fill.v.color = attr->fillColor; + shape->fill.v.color |= (unsigned int)(attr->fillOpacity*255) << 24; } else if (attr->hasFill == 2) { shape->fill.type = NSVG_PAINT_UNDEF; } @@ -1012,8 +1012,8 @@ static void nsvg__addShape(NSVGparser* p) shape->stroke.type = NSVG_PAINT_NONE; } else if (attr->hasStroke == 1) { shape->stroke.type = NSVG_PAINT_COLOR; - shape->stroke.color = attr->strokeColor; - shape->stroke.color |= (unsigned int)(attr->strokeOpacity*255) << 24; + shape->stroke.v.color = attr->strokeColor; + shape->stroke.v.color |= (unsigned int)(attr->strokeOpacity*255) << 24; } else if (attr->hasStroke == 2) { shape->stroke.type = NSVG_PAINT_UNDEF; } @@ -2717,14 +2717,14 @@ static void nsvg__parseGradient(NSVGparser* p, const char** attr, signed char ty grad->units = NSVG_OBJECT_SPACE; grad->type = type; if (grad->type == NSVG_PAINT_LINEAR_GRADIENT) { - grad->linear.x1 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); - grad->linear.y1 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); - grad->linear.x2 = nsvg__coord(100.0f, NSVG_UNITS_PERCENT); - grad->linear.y2 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); + grad->grad.linear.x1 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); + grad->grad.linear.y1 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); + grad->grad.linear.x2 = nsvg__coord(100.0f, NSVG_UNITS_PERCENT); + grad->grad.linear.y2 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); } else if (grad->type == NSVG_PAINT_RADIAL_GRADIENT) { - grad->radial.cx = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); - grad->radial.cy = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); - grad->radial.r = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); + grad->grad.radial.cx = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); + grad->grad.radial.cy = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); + grad->grad.radial.r = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); } nsvg__xformIdentity(grad->xform); @@ -2742,23 +2742,23 @@ static void nsvg__parseGradient(NSVGparser* p, const char** attr, signed char ty } else if (strcmp(attr[i], "gradientTransform") == 0) { nsvg__parseTransform(grad->xform, attr[i + 1]); } else if (strcmp(attr[i], "cx") == 0) { - grad->radial.cx = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.radial.cx = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "cy") == 0) { - grad->radial.cy = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.radial.cy = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "r") == 0) { - grad->radial.r = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.radial.r = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "fx") == 0) { - grad->radial.fx = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.radial.fx = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "fy") == 0) { - grad->radial.fy = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.radial.fy = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "x1") == 0) { - grad->linear.x1 = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.linear.x1 = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "y1") == 0) { - grad->linear.y1 = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.linear.y1 = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "x2") == 0) { - grad->linear.x2 = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.linear.x2 = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "y2") == 0) { - grad->linear.y2 = nsvg__parseCoordinateRaw(attr[i + 1]); + grad->grad.linear.y2 = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "spreadMethod") == 0) { if (strcmp(attr[i+1], "pad") == 0) grad->spread = NSVG_SPREAD_PAD; @@ -3050,14 +3050,14 @@ static void nsvg__scaleToViewbox(NSVGparser* p, const char* units) } if (shape->fill.type == NSVG_PAINT_LINEAR_GRADIENT || shape->fill.type == NSVG_PAINT_RADIAL_GRADIENT) { - nsvg__scaleGradient(shape->fill.gradient, tx,ty, sx,sy); - memcpy(t, shape->fill.gradient->xform, sizeof(float)*6); - nsvg__xformInverse(shape->fill.gradient->xform, t); + nsvg__scaleGradient(shape->fill.v.gradient, tx,ty, sx,sy); + memcpy(t, shape->fill.v.gradient->xform, sizeof(float)*6); + nsvg__xformInverse(shape->fill.v.gradient->xform, t); } if (shape->stroke.type == NSVG_PAINT_LINEAR_GRADIENT || shape->stroke.type == NSVG_PAINT_RADIAL_GRADIENT) { - nsvg__scaleGradient(shape->stroke.gradient, tx,ty, sx,sy); - memcpy(t, shape->stroke.gradient->xform, sizeof(float)*6); - nsvg__xformInverse(shape->stroke.gradient->xform, t); + nsvg__scaleGradient(shape->stroke.v.gradient, tx,ty, sx,sy); + memcpy(t, shape->stroke.v.gradient->xform, sizeof(float)*6); + nsvg__xformInverse(shape->stroke.v.gradient->xform, t); } shape->strokeWidth *= avgs; @@ -3080,7 +3080,7 @@ static void nsvg__createGradients(NSVGparser* p) float inv[6], localBounds[4]; nsvg__xformInverse(inv, shape->xform); nsvg__getLocalBounds(localBounds, shape, inv); - shape->fill.gradient = nsvg__createGradient(p, shape->fillGradient, localBounds, shape->xform, &shape->fill.type); + shape->fill.v.gradient = nsvg__createGradient(p, shape->fillGradient, localBounds, shape->xform, &shape->fill.type); } if (shape->fill.type == NSVG_PAINT_UNDEF) { shape->fill.type = NSVG_PAINT_NONE; @@ -3091,7 +3091,7 @@ static void nsvg__createGradients(NSVGparser* p) float inv[6], localBounds[4]; nsvg__xformInverse(inv, shape->xform); nsvg__getLocalBounds(localBounds, shape, inv); - shape->stroke.gradient = nsvg__createGradient(p, shape->strokeGradient, localBounds, shape->xform, &shape->stroke.type); + shape->stroke.v.gradient = nsvg__createGradient(p, shape->strokeGradient, localBounds, shape->xform, &shape->stroke.type); } if (shape->stroke.type == NSVG_PAINT_UNDEF) { shape->stroke.type = NSVG_PAINT_NONE; diff --git a/src/nanosvgrast.h b/src/nanosvgrast.h index 89a2e243..35175ee9 100644 --- a/src/nanosvgrast.h +++ b/src/nanosvgrast.h @@ -1288,11 +1288,11 @@ static void nsvg__initPaint(NSVGcachedPaint* cache, NSVGpaint* paint, float opac cache->type = paint->type; if (paint->type == NSVG_PAINT_COLOR) { - cache->colors[0] = nsvg__applyOpacity(paint->color, opacity); + cache->colors[0] = nsvg__applyOpacity(paint->v.color, opacity); return; } - grad = paint->gradient; + grad = paint->v.gradient; cache->spread = grad->spread; memcpy(cache->xform, grad->xform, sizeof(float)*6); @@ -555,7 +555,7 @@ static void Nav_save_cb(int Op, CacheClient_t *Client) a_UIcmd_set_msg(Web->bw, "File saved (%d Bytes)", st.st_size); } else { if ((Bytes = Client->BufSize - Web->SavedBytes) > 0) { - Bytes = fwrite(Client->Buf + Web->SavedBytes, 1, Bytes, Web->stream); + Bytes = fwrite((char *) Client->Buf + Web->SavedBytes, 1, Bytes, Web->stream); Web->SavedBytes += Bytes; } } diff --git a/src/timeout.hh b/src/timeout.hh index 5b7f4759..14f24e2a 100644 --- a/src/timeout.hh +++ b/src/timeout.hh @@ -9,7 +9,7 @@ typedef void (*TimeoutCb_t)(void *data); void a_Timeout_add(float t, TimeoutCb_t cb, void *cbdata); void a_Timeout_repeat(float t, TimeoutCb_t cb, void *cbdata); -void a_Timeout_remove(); +void a_Timeout_remove(void); #ifdef __cplusplus diff --git a/src/uicmd.hh b/src/uicmd.hh index ec630d65..0a5c8fb5 100644 --- a/src/uicmd.hh +++ b/src/uicmd.hh @@ -44,7 +44,7 @@ void a_UIcmd_stop(void *vbw); void a_UIcmd_tools(void *vbw, int x, int y); void a_UIcmd_save_link(BrowserWindow *bw, const DilloUrl *url); void a_UIcmd_open_file(void *vbw); -const char *a_UIcmd_select_file(); +const char *a_UIcmd_select_file(void); void a_UIcmd_search_dialog(void *vbw); const char *a_UIcmd_get_passwd(const char *user); void a_UIcmd_book(void *vbw); @@ -48,6 +48,7 @@ #include "url.h" #include "hsts.h" +#include "misc.h" #include "msg.h" static const char *HEX = "0123456789ABCDEF"; @@ -627,7 +628,7 @@ char *a_Url_encode_hex_str(const char *str) newstr = dNew(char, 6*strlen(str)+1); for (c = newstr; *str; str++) - if ((dIsalnum(*str) && isascii(*str)) || strchr(verbatim, *str)) + if ((dIsalnum(*str) && d_isascii(*str)) || strchr(verbatim, *str)) *c++ = *str; else if (*str == ' ') *c++ = '+'; |