Index: css/ruleset.c =================================================================== --- css/ruleset.c (revision 3879) +++ css/ruleset.c (working copy) @@ -681,6 +681,7 @@ colour named_colour(const char *name) { struct css_colour_entry *col; + int length; col = bsearch(name, css_colour_table, sizeof css_colour_table / sizeof css_colour_table[0], @@ -693,7 +694,7 @@ * start of a colour specified in #rrggbb or #rgb format. * This attempts to detect and recover from this. */ - int length = strlen(name); + length = strlen(name); if ((length == 3) || (length == 6)) return hex_colour(name, length); return CSS_COLOR_NONE; Index: css/css.c =================================================================== --- css/css.c (revision 3879) +++ css/css.c (working copy) @@ -2437,7 +2437,10 @@ /** * Set all members to false */ -void css_importance_reset(struct css_importance *i) { +void css_importance_reset(struct css_importance *i) +{ + int j; + i->background_color = false; i->background_image = false; i->border_spacing = false; @@ -2446,7 +2449,7 @@ i->width = false; /**< top, right, bottom, left */ - for (int j = 0; j < 4; j++) { + for (j = 0; j < 4; j++) { i->border_color[j] = false; i->border_style[j] = false; i->border_width[j] = false; Index: Makefile.unix =================================================================== --- Makefile.unix (revision 3879) +++ Makefile.unix (working copy) @@ -74,8 +74,19 @@ ENDGROUP := endif +ifeq ($(HOST),riscos) +# Building on RO - no lint +# FIXME: this will probably break +LINT := echo +else +# Anything else -- assume splint +LINT := splint +endif + LDFLAGS := -lxml2 -lz -lm -lcurl -lssl -lcrypto -lmng \ -ljpeg +# Joyous hackery to cause splint to actually work +LINTFLAGS := -weak +posixlib -DUINT_MAX=0xffffffffu -DPRIxPTR="\"lx\"" ifeq ($(TARGET),gtk) # Building for GTK, we need the GTK flags @@ -92,6 +103,9 @@ GTKLDFLAGS := $(shell pkg-config --cflags --libs libglade-2.0 gtk+-2.0 gthread-2.0 gmodule-2.0 librsvg-2.0) CFLAGS += $(GTKCFLAGS) LDFLAGS += $(GTKLDFLAGS) -llcms +LINTFLAGS += -I. \ + $(shell pkg-config --cflags libglade-2.0 gtk+-2.0 librsvg-2.0) \ + $(shell xml2-config --cflags) ifneq ($(HOST),riscos) ifeq ($(shell uname -s),Windows_NT) @@ -114,6 +128,9 @@ ASFLAGS += -I. -I$(GCCSDK_INSTALL_ENV)/include LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib -lcares -lOSLib32 -lrufl -lpencil \ -lsvgtiny +LINTFLAGS += -I. -I$(GCCSDK_INSTALL_ENV)/include \ + -I$(GCCSDK_INSTALL_ENV)/include/libxml2 \ + -I$(GCCSDK_INSTALL_ENV)/include/libmng endif CLEANS := clean-target @@ -216,3 +233,8 @@ clean: $(CLEANS) + +lint: $(filter %.c,$(SOURCES)) + $(VQ)echo " LINT: $(EXETARGET)" + $(Q)$(LINT) $(LINTFLAGS) $(filter %.c,$(SOURCES)) + Index: utils/utils.c =================================================================== --- utils/utils.c (revision 3879) +++ utils/utils.c (working copy) @@ -173,6 +173,9 @@ static char buffer3[BYTESIZE_BUFFER_SIZE]; static char *curbuffer = buffer3; + enum {bytes, kilobytes, megabytes, gigabytes} unit = bytes; + static char units[][7] = {"Bytes", "kBytes", "MBytes", "GBytes"}; + float bytesize = (float)bsize; if (curbuffer == buffer1) @@ -181,10 +184,7 @@ curbuffer = buffer3; else curbuffer = buffer1; - - enum {bytes, kilobytes, megabytes, gigabytes} unit = bytes; - static char units[][7] = {"Bytes", "kBytes", "MBytes", "GBytes"}; - + if (bytesize > 1024) { bytesize /= 1024; unit = kilobytes; Index: utils/filename.c =================================================================== --- utils/filename.c (revision 3879) +++ utils/filename.c (working copy) @@ -362,6 +362,7 @@ int index; struct directory *old_dir, *new_dir, *prev_dir = NULL; char dir_prefix[16]; + int i; /* get the lowest unique prefix, or use the provided one */ if (!prefix) { @@ -433,7 +434,7 @@ TEMP_FILENAME_PREFIX); last_1 = filename_directory + strlen(TEMP_FILENAME_PREFIX) + 1; last_2 = new_dir->prefix; - for (int i = 0; i < 3 && *last_2; i++) { + for (i = 0; i < 3 && *last_2; i++) { *last_1++ = *last_2++; while (*last_2 && *last_2 != '/') *last_1++ = *last_2++; Index: desktop/browser.c =================================================================== --- desktop/browser.c (revision 3879) +++ desktop/browser.c (working copy) @@ -2230,11 +2230,12 @@ { struct form_option *o; int count; + struct box *inline_box; assert(bw); assert(control); - struct box *inline_box = control->box->children->children; + inline_box = control->box->children->children; for (count = 0, o = control->data.select.items; o != NULL; Index: desktop/selection.c =================================================================== --- desktop/selection.c (revision 3879) +++ desktop/selection.c (working copy) @@ -503,6 +503,8 @@ bool selection_traverse(struct selection *s, seln_traverse_handler handler, void *handle) { struct content *c; + size_t length; + const char *text; if (!selection_defined(s)) return true; /* easy case, nothing to do */ @@ -513,8 +515,7 @@ c = s->bw->current_content; if (!c) return true; - size_t length; - const char *text = textplain_get_raw_data(c, s->start_idx, s->end_idx, &length); + text = textplain_get_raw_data(c, s->start_idx, s->end_idx, &length); if (text && !handler(text, length, false, NULL, handle)) return false; Index: content/fetchers/fetch_curl.c =================================================================== --- content/fetchers/fetch_curl.c (revision 3879) +++ content/fetchers/fetch_curl.c (working copy) @@ -257,8 +257,9 @@ LOG(("Finalise cURL fetcher %s", scheme)); if (curl_fetchers_registered == 0) { /* All the fetchers have been finalised. */ + CURLMcode codem; + LOG(("All cURL fetchers finalised, closing down cURL")); - CURLMcode codem; curl_easy_cleanup(fetch_blank_curl); Index: content/urldb.c =================================================================== --- content/urldb.c (revision 3879) +++ content/urldb.c (working copy) @@ -2379,6 +2379,7 @@ char *ret; char *scheme; time_t now; + int i; url_func_result res; assert(url); @@ -2592,7 +2593,7 @@ ret_used = strlen(ret) + 1; } - for (int i = 0; i < count; i++) { + for (i = 0; i < count; i++) { if (!urldb_concat_cookie(matched_cookies[i], version, &ret_used, &ret_alloc, &ret)) { free(path); @@ -3531,6 +3532,7 @@ int version, domain_specified, path_specified, secure, no_destroy, value_quoted; time_t expires, last_used; + struct cookie_internal_data *c; if(s[0] == 0 || s[0] == '#') /* Skip blank lines or comments */ @@ -3588,8 +3590,7 @@ assert(p <= end); /* Now create cookie */ - struct cookie_internal_data *c = - malloc(sizeof(struct cookie_internal_data)); + c = malloc(sizeof(struct cookie_internal_data)); if (!c) break; @@ -3642,11 +3643,13 @@ void urldb_delete_cookie_hosts(const char *domain, const char *path, const char *name, struct host_part *parent) { + struct host_part *h; + assert(parent); urldb_delete_cookie_paths(domain, path, name, &parent->paths); - for (struct host_part *h = parent->children; h; h = h->next) + for (h = parent->children; h; h = h->next) urldb_delete_cookie_hosts(domain, path, name, h); } @@ -3654,6 +3657,7 @@ const char *name, struct path_data *parent) { struct cookie_internal_data *c; + struct path_data *p; assert(parent); @@ -3675,7 +3679,7 @@ } } - for (struct path_data *p = parent->children; p; p = p->next) + for (p = parent->children; p; p = p->next) urldb_delete_cookie_paths(domain, path, name, p); } @@ -3722,11 +3726,13 @@ */ void urldb_save_cookie_hosts(FILE *fp, struct host_part *parent) { + struct host_part *h; + assert(fp && parent); urldb_save_cookie_paths(fp, &parent->paths); - for (struct host_part *h = parent->children; h; h = h->next) + for (h = parent->children; h; h = h->next) urldb_save_cookie_hosts(fp, h); } @@ -3738,13 +3744,14 @@ */ void urldb_save_cookie_paths(FILE *fp, struct path_data *parent) { + struct path_data *p; time_t now = time(NULL); assert(fp && parent); if (parent->cookies) { - for (struct cookie_internal_data *c = parent->cookies; c; - c = c->next) { + struct cookie_internal_data *c; + for (c = parent->cookies; c; c = c->next) { if (c->expires < now) /* Skip expired cookies */ continue; @@ -3764,7 +3771,7 @@ } } - for (struct path_data *p = parent->children; p; p = p->next) + for (p = parent->children; p; p = p->next) urldb_save_cookie_paths(fp, p); } @@ -3828,9 +3835,10 @@ void urldb_destroy(void) { struct host_part *a, *b; + int i; /* Clean up search trees */ - for (int i = 0; i < NUM_SEARCH_TREES; i++) { + for (i = 0; i < NUM_SEARCH_TREES; i++) { if (search_trees[i] != &empty) urldb_destroy_search_tree(search_trees[i]); } @@ -3900,11 +3908,12 @@ void urldb_destroy_path_node_content(struct path_data *node) { struct cookie_internal_data *a, *b; + unsigned int i; free(node->url); free(node->scheme); free(node->segment); - for (unsigned int i = 0; i < node->frag_cnt; i++) + for (i = 0; i < node->frag_cnt; i++) free(node->fragment[i]); free(node->fragment); Index: content/fetch.c =================================================================== --- content/fetch.c (revision 3879) +++ content/fetch.c (working copy) @@ -352,6 +352,7 @@ void fetch_dispatch_jobs(void) { int all_active, all_queued; + struct fetch *q, *f; if (!queue_ring) return; /* Nothing to do, the queue is empty */ @@ -360,14 +361,15 @@ LOG(("queue_ring %i, fetch_ring %i", all_queued, all_active)); - struct fetch *q = queue_ring; + q = queue_ring; if (q) { do { LOG(("queue_ring: %s", q->url)); q = q->r_next; } while (q != queue_ring); } - struct fetch *f = fetch_ring; + + f = fetch_ring; if (f) { do { LOG(("fetch_ring: %s", f->url)); Index: content/fetchcache.c =================================================================== --- content/fetchcache.c (revision 3879) +++ content/fetchcache.c (working copy) @@ -556,6 +556,8 @@ r = regexec(&re_content_type, s, 2 + MAX_ATTRS * 3, pmatch, 0); if (r) { + char *semi; + LOG(("failed to parse content-type '%s'", s)); /* The mime type must be first, so only copy up to the * first semicolon in the string. This allows us to have @@ -563,7 +565,7 @@ * Content-Type headers. Obviously, any truly broken * Content-Type headers will be unaffected by this heuristic */ - char *semi = strchr(s, ';'); + semi = strchr(s, ';'); if (semi) type = strndup(s, semi - s); else