[project @ 2004-08-14 14:30:10 by joty]

Removed a chunk of Norcroft compiler warnings.  Re-ident some pieces.

svn path=/import/netsurf/; revision=1231
This commit is contained in:
John Tytgat 2004-08-14 14:30:12 +00:00
parent 7d3a242132
commit 402c4ca66c
11 changed files with 390 additions and 412 deletions

View File

@ -384,7 +384,7 @@ CURLcode fetch_set_options(struct fetch *f)
SETOPT(CURLOPT_COOKIEFILE, 0); SETOPT(CURLOPT_COOKIEFILE, 0);
SETOPT(CURLOPT_COOKIEJAR, 0); SETOPT(CURLOPT_COOKIEJAR, 0);
} }
if ((li = login_list_get(f->url))) { if ((li = login_list_get(f->url)) != NULL) {
SETOPT(CURLOPT_HTTPAUTH, CURLAUTH_ANY); SETOPT(CURLOPT_HTTPAUTH, CURLAUTH_ANY);
SETOPT(CURLOPT_USERPWD, li->logindetails); SETOPT(CURLOPT_USERPWD, li->logindetails);
} else { } else {

View File

@ -72,19 +72,17 @@ struct content * fetchcache(const char *url,
char *url1; char *url1;
char *hash; char *hash;
url1 = strdup(url); if ((url1 = strdup(url)) == NULL)
if (!url1) return NULL;
return 0;
/* strip fragment identifier */ /* strip fragment identifier */
if ((hash = strchr(url1, '#'))) if ((hash = strchr(url1, '#')) != NULL)
*hash = 0; *hash = NULL;
LOG(("url %s", url1)); LOG(("url %s", url1));
if (!post_urlenc && !post_multipart) { if (!post_urlenc && !post_multipart) {
c = content_get(url1); if ((c = content_get(url1)) != NULL) {
if (c) {
free(url1); free(url1);
content_add_user(c, callback, p1, p2); content_add_user(c, callback, p1, p2);
return c; return c;
@ -94,7 +92,7 @@ struct content * fetchcache(const char *url,
c = content_create(url1); c = content_create(url1);
free(url1); free(url1);
if (!c) if (!c)
return 0; return NULL;
content_add_user(c, callback, p1, p2); content_add_user(c, callback, p1, p2);
if (!post_urlenc && !post_multipart) if (!post_urlenc && !post_multipart)

View File

@ -395,8 +395,8 @@ bool css_convert(struct content *c, int width, int height)
current = source_data; current = source_data;
end = source_data + c->source_size; end = source_data + c->source_size;
while (current < end && (token = css_tokenise(&current, end + 10, while (current < end
&token_text))) { && (token = css_tokenise(&current, end + 10, &token_text)) != NULL) {
token_data.text = token_text; token_data.text = token_text;
token_data.length = current - token_text; token_data.length = current - token_text;
css_parser_(parser, token, token_data, &param); css_parser_(parser, token, token_data, &param);
@ -1207,8 +1207,8 @@ void css_parse_property_list(struct content *c, struct css_style * style,
current = source_data; current = source_data;
end = source_data + strlen(str); end = source_data + strlen(str);
while (current < end && (token = css_tokenise(&current, end + 10, while (current < end
&token_text))) { && (token = css_tokenise(&current, end + 10, &token_text)) != NULL) {
token_data.text = token_text; token_data.text = token_text;
token_data.length = current - token_text; token_data.length = current - token_text;
css_parser_(parser, token, token_data, &param); css_parser_(parser, token, token_data, &param);

View File

@ -605,7 +605,7 @@ void browser_window_mouse_click_html(struct browser_window *bw,
url_func_result res; url_func_result res;
/* search the box tree for a link, imagemap, or form control */ /* search the box tree for a link, imagemap, or form control */
while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) { while ((box = box_at_point(box, x, y, &box_x, &box_y, &content)) != NULL) {
if (box->style && if (box->style &&
box->style->visibility == CSS_VISIBILITY_HIDDEN) box->style->visibility == CSS_VISIBILITY_HIDDEN)
continue; continue;

View File

@ -201,8 +201,7 @@ void imagemap_extract(xmlNode *node, struct content *c) {
if (node->type == XML_ELEMENT_NODE) { if (node->type == XML_ELEMENT_NODE) {
if (strcmp(node->name, "map") == 0) { if (strcmp(node->name, "map") == 0) {
if (!(name = (char*)xmlGetProp(node, if ((name = (char*)xmlGetProp(node, (const xmlChar*)"name")) == NULL)
(const xmlChar*)"name")))
return; return;
entry = imagemap_extract_map(node, c, entry); entry = imagemap_extract_map(node, c, entry);
imagemap_add(c, name, entry); imagemap_add(c, name, entry);
@ -254,16 +253,16 @@ struct mapentry *imagemap_addtolist(xmlNode *n, struct mapentry *entry) {
} }
} }
/* no href -> ignore */ /* no href -> ignore */
if (!(href = (char*)xmlGetProp(n, (const xmlChar*)"href"))) { if ((href = (char*)xmlGetProp(n, (const xmlChar*)"href")) == NULL) {
return entry; return entry;
} }
/* no shape -> shape is a rectangle */ /* no shape -> shape is a rectangle */
if (!(shape = (char*)xmlGetProp(n, (const xmlChar*)"shape"))) { if ((shape = (char*)xmlGetProp(n, (const xmlChar*)"shape")) == NULL) {
shape = (char*)xmlMemStrdup("rect"); shape = (char*)xmlMemStrdup("rect");
} }
if (strcasecmp(shape, "default") != 0) { if (strcasecmp(shape, "default") != 0) {
/* no coords -> ignore */ /* no coords -> ignore */
if (!(coords = (char*)xmlGetProp(n, (const xmlChar*)"coords"))) { if ((coords = (char*)xmlGetProp(n, (const xmlChar*)"coords")) == NULL) {
xmlFree(href); xmlFree(href);
xmlFree(shape); xmlFree(shape);
return entry; return entry;

File diff suppressed because it is too large Load Diff

View File

@ -232,11 +232,11 @@ struct column {
void xml_to_box(xmlNode *n, struct content *c); void xml_to_box(xmlNode *n, struct content *c);
void box_dump(struct box * box, unsigned int depth); void box_dump(struct box *box, unsigned int depth);
struct box * box_create(struct css_style * style, struct box * box_create(struct css_style *style,
const char *href, const char *title, const char *href, const char *title,
const char *id, pool box_pool); const char *id, pool box_pool);
void box_add_child(struct box * parent, struct box * child); void box_add_child(struct box * parent, struct box *child);
void box_insert_sibling(struct box *box, struct box *new_box); void box_insert_sibling(struct box *box, struct box *new_box);
void box_free(struct box *box); void box_free(struct box *box);
void box_coords(struct box *box, int *x, int *y); void box_coords(struct box *box, int *x, int *y);
@ -244,6 +244,6 @@ struct box *box_at_point(struct box *box, int x, int y,
int *box_x, int *box_y, int *box_x, int *box_y,
struct content **content); struct content **content);
struct box *box_object_at_point(struct content *c, int x, int y); struct box *box_object_at_point(struct content *c, int x, int y);
struct box *box_find_by_id(struct box *box, char *id); struct box *box_find_by_id(struct box *box, const char *id);
#endif #endif

View File

@ -386,7 +386,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
if (strcmp(node->name, "link") == 0) { if (strcmp(node->name, "link") == 0) {
/* rel='stylesheet' */ /* rel='stylesheet' */
if (!(rel = (char *) xmlGetProp(node, (const xmlChar *) "rel"))) if ((rel = (char *) xmlGetProp(node, (const xmlChar *) "rel")) == NULL)
continue; continue;
if (strcasecmp(rel, "stylesheet") != 0) { if (strcasecmp(rel, "stylesheet") != 0) {
xmlFree(rel); xmlFree(rel);
@ -395,7 +395,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
xmlFree(rel); xmlFree(rel);
/* type='text/css' or not present */ /* type='text/css' or not present */
if ((type = (char *) xmlGetProp(node, (const xmlChar *) "type"))) { if ((type = (char *) xmlGetProp(node, (const xmlChar *) "type")) != NULL) {
if (strcmp(type, "text/css") != 0) { if (strcmp(type, "text/css") != 0) {
xmlFree(type); xmlFree(type);
continue; continue;
@ -404,7 +404,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
} }
/* media contains 'screen' or 'all' or not present */ /* media contains 'screen' or 'all' or not present */
if ((media = (char *) xmlGetProp(node, (const xmlChar *) "media"))) { if ((media = (char *) xmlGetProp(node, (const xmlChar *) "media")) != NULL) {
if (strstr(media, "screen") == 0 && if (strstr(media, "screen") == 0 &&
strstr(media, "all") == 0) { strstr(media, "all") == 0) {
xmlFree(media); xmlFree(media);
@ -414,7 +414,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
} }
/* href='...' */ /* href='...' */
if (!(href = (char *) xmlGetProp(node, (const xmlChar *) "href"))) if ((href = (char *) xmlGetProp(node, (const xmlChar *) "href")) == NULL)
continue; continue;
/* TODO: only the first preferred stylesheets (ie. those with a /* TODO: only the first preferred stylesheets (ie. those with a
@ -447,7 +447,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
} else if (strcmp(node->name, "style") == 0) { } else if (strcmp(node->name, "style") == 0) {
/* type='text/css', or not present (invalid but common) */ /* type='text/css', or not present (invalid but common) */
if ((type = (char *) xmlGetProp(node, (const xmlChar *) "type"))) { if ((type = (char *) xmlGetProp(node, (const xmlChar *) "type")) != NULL) {
if (strcmp(type, "text/css") != 0) { if (strcmp(type, "text/css") != 0) {
xmlFree(type); xmlFree(type);
continue; continue;
@ -456,7 +456,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
} }
/* media contains 'screen' or 'all' or not present */ /* media contains 'screen' or 'all' or not present */
if ((media = (char *) xmlGetProp(node, (const xmlChar *) "media"))) { if ((media = (char *) xmlGetProp(node, (const xmlChar *) "media")) != NULL) {
if (strstr(media, "screen") == 0 && if (strstr(media, "screen") == 0 &&
strstr(media, "all") == 0) { strstr(media, "all") == 0) {
xmlFree(media); xmlFree(media);

View File

@ -18,18 +18,18 @@
/* SCREEN BUFFERING /* SCREEN BUFFERING
================ ================
Because RISC OS provides no native way for windows to be buffered (ie Because RISC OS provides no native way for windows to be buffered (ie
the contents is only updated when the task has finished doing any the contents is only updated when the task has finished doing any
drawing) certain situation cause the window contents to flicker in an drawing) certain situation cause the window contents to flicker in an
undesirable manner. Examples of this are GIF and MNG animations, and undesirable manner. Examples of this are GIF and MNG animations, and
web pages with fixed backgrounds. web pages with fixed backgrounds.
To overcome this, a very simple, transparent, interface is provided here To overcome this, a very simple, transparent, interface is provided here
to allow for output to be buffered. It should be noted that screen to allow for output to be buffered. It should be noted that screen
buffering can lower the perceived client response time as the user is buffering can lower the perceived client response time as the user is
unable to see that the application is doing anything. unable to see that the application is doing anything.
[rjw] - Mon 19th July 2004 [rjw] - Mon 19th July 2004
*/ */
@ -104,13 +104,14 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
buffer->sprite_count = 0; buffer->sprite_count = 0;
buffer->first = 16; buffer->first = 16;
buffer->used = 16; buffer->used = 16;
/* Fill in the sprite header details /* Fill in the sprite header details
*/ */
sprintf(name, "buffer"); sprintf(name, "buffer");
if ((error = xosspriteop_get_sprite_user_coords(osspriteop_NAME, buffer, if ((error = xosspriteop_get_sprite_user_coords(osspriteop_NAME,
name, palette, buffer, name, palette,
clipping.x0, clipping.y0, clipping.x1, clipping.y1))) { clipping.x0, clipping.y0,
clipping.x1, clipping.y1)) != NULL) {
// LOG(("Grab error '%s'", error->errmess)); // LOG(("Grab error '%s'", error->errmess));
free(buffer); free(buffer);
buffer = NULL; buffer = NULL;
@ -119,14 +120,14 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
/* Allocate OS_SpriteOp save area /* Allocate OS_SpriteOp save area
*/ */
if ((error = xosspriteop_read_save_area_size(osspriteop_NAME, buffer, if ((error = xosspriteop_read_save_area_size(osspriteop_NAME,
(osspriteop_id)name, &size))) { buffer, (osspriteop_id)name, &size)) != NULL) {
// LOG(("Save area error '%s'", error->errmess)); // LOG(("Save area error '%s'", error->errmess));
free(buffer); free(buffer);
buffer = NULL; buffer = NULL;
return; return;
} }
if (!(save_area = malloc((unsigned)size))) { if ((save_area = malloc((size_t)size)) == NULL) {
free(buffer); free(buffer);
buffer = NULL; buffer = NULL;
return; return;
@ -135,9 +136,10 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
/* Switch output to sprite /* Switch output to sprite
*/ */
if ((error = xosspriteop_switch_output_to_sprite(osspriteop_NAME, buffer, if ((error = xosspriteop_switch_output_to_sprite(osspriteop_NAME,
(osspriteop_id)name, save_area, buffer, (osspriteop_id)name, save_area, 0,
0, (int *)&context1, (int *)&context2, (int *)&context3))) { (int *)&context1, (int *)&context2,
(int *)&context3)) != NULL) {
// LOG(("Switching error '%s'", error->errmess)); // LOG(("Switching error '%s'", error->errmess));
free(save_area); free(save_area);
free(buffer); free(buffer);
@ -161,7 +163,7 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
* Closes any open buffer and flushes the contents to screen * Closes any open buffer and flushes the contents to screen
*/ */
void ro_gui_buffer_close(void) { void ro_gui_buffer_close(void) {
/* Check we have an open buffer /* Check we have an open buffer
*/ */
if (!buffer) return; if (!buffer) return;
@ -178,7 +180,7 @@ void ro_gui_buffer_close(void) {
xosspriteop_put_sprite_user_coords(osspriteop_NAME, xosspriteop_put_sprite_user_coords(osspriteop_NAME,
buffer, (osspriteop_id)name, buffer, (osspriteop_id)name,
clipping.x0, clipping.y0, (os_action)0); clipping.x0, clipping.y0, (os_action)0);
/* Free our memory /* Free our memory
*/ */
free(buffer); free(buffer);

View File

@ -692,7 +692,7 @@ void ro_gui_redraw_window_request(wimp_draw *redraw)
ro_gui_hotlist_redraw(redraw); ro_gui_hotlist_redraw(redraw);
else if (redraw->w == dialog_debug) else if (redraw->w == dialog_debug)
ro_gui_debugwin_redraw(redraw); ro_gui_debugwin_redraw(redraw);
else if ((g = ro_gui_window_lookup(redraw->w))) else if ((g = ro_gui_window_lookup(redraw->w)) != NULL)
ro_gui_window_redraw(g, redraw); ro_gui_window_redraw(g, redraw);
else { else {
error = xwimp_redraw_window(redraw, &more); error = xwimp_redraw_window(redraw, &more);
@ -760,9 +760,9 @@ void ro_gui_close_window_request(wimp_close *close)
if (close->w == dialog_debug) if (close->w == dialog_debug)
ro_gui_debugwin_close(); ro_gui_debugwin_close();
else if ((g = ro_gui_window_lookup(close->w))) else if ((g = ro_gui_window_lookup(close->w)) != NULL)
browser_window_destroy(g->bw); browser_window_destroy(g->bw);
else if ((dw = ro_gui_download_window_lookup(close->w))) else if ((dw = ro_gui_download_window_lookup(close->w)) != NULL)
ro_gui_download_window_destroy(dw); ro_gui_download_window_destroy(dw);
else else
ro_gui_dialog_close(close->w); ro_gui_dialog_close(close->w);
@ -823,13 +823,13 @@ void ro_gui_mouse_click(wimp_pointer *pointer)
else if (hotlist_toolbar && else if (hotlist_toolbar &&
hotlist_toolbar->toolbar_handle == pointer->w) hotlist_toolbar->toolbar_handle == pointer->w)
ro_gui_hotlist_toolbar_click(pointer); ro_gui_hotlist_toolbar_click(pointer);
else if ((g = ro_gui_window_lookup(pointer->w))) else if ((g = ro_gui_window_lookup(pointer->w)) != NULL)
ro_gui_window_click(g, pointer); ro_gui_window_click(g, pointer);
else if ((g = ro_gui_toolbar_lookup(pointer->w))) else if ((g = ro_gui_toolbar_lookup(pointer->w)) != NULL)
ro_gui_toolbar_click(g, pointer); ro_gui_toolbar_click(g, pointer);
else if ((g = ro_gui_status_lookup(pointer->w))) else if ((g = ro_gui_status_lookup(pointer->w)) != NULL)
ro_gui_status_click(g, pointer); ro_gui_status_click(g, pointer);
else if ((dw = ro_gui_download_window_lookup(pointer->w))) else if ((dw = ro_gui_download_window_lookup(pointer->w)) != NULL)
ro_gui_download_window_click(dw, pointer); ro_gui_download_window_click(dw, pointer);
else else
ro_gui_dialog_click(pointer); ro_gui_dialog_click(pointer);
@ -915,9 +915,9 @@ void ro_gui_keypress(wimp_key *key)
if (key->w == hotlist_window) if (key->w == hotlist_window)
handled = ro_gui_hotlist_keypress(key->c); handled = ro_gui_hotlist_keypress(key->c);
else if ((g = ro_gui_window_lookup(key->w))) else if ((g = ro_gui_window_lookup(key->w)) != NULL)
handled = ro_gui_window_keypress(g, key->c, false); handled = ro_gui_window_keypress(g, key->c, false);
else if ((g = ro_gui_toolbar_lookup(key->w))) else if ((g = ro_gui_toolbar_lookup(key->w)) != NULL)
handled = ro_gui_window_keypress(g, key->c, true); handled = ro_gui_window_keypress(g, key->c, true);
else else
handled = ro_gui_dialog_keypress(key); handled = ro_gui_dialog_keypress(key);

View File

@ -51,7 +51,7 @@
of numbers representing the menu structure (eg 'HelpBrowserMenu3-1-2'). of numbers representing the menu structure (eg 'HelpBrowserMenu3-1-2').
If '<key><identifier>' is not available, then simply '<key>' is then used. For example If '<key><identifier>' is not available, then simply '<key>' is then used. For example
if 'HelpToolbar7' is not available then 'HelpToolbar' is then tried. if 'HelpToolbar7' is not available then 'HelpToolbar' is then tried.
If an item is greyed out then a suffix of 'g' is added (eg 'HelpToolbar7g'). For this to If an item is greyed out then a suffix of 'g' is added (eg 'HelpToolbar7g'). For this to
work, windows must have bit 4 of the window flag byte set and the user must be running work, windows must have bit 4 of the window flag byte set and the user must be running
RISC OS 5.03 or greater. RISC OS 5.03 or greater.
@ -126,11 +126,11 @@ void ro_gui_interactive_help_request(wimp_message *message) {
} else if (hotlist_toolbar && } else if (hotlist_toolbar &&
window == hotlist_toolbar->toolbar_handle) { window == hotlist_toolbar->toolbar_handle) {
sprintf(message_token, "HelpHotToolbar%i", (int)icon); sprintf(message_token, "HelpHotToolbar%i", (int)icon);
} else if ((g = ro_gui_window_lookup(window))) { } else if ((g = ro_gui_window_lookup(window)) != NULL) {
sprintf(message_token, "HelpBrowser%i", (int)icon); sprintf(message_token, "HelpBrowser%i", (int)icon);
} else if ((g = ro_gui_toolbar_lookup(window))) { } else if ((g = ro_gui_toolbar_lookup(window)) != NULL) {
sprintf(message_token, "HelpToolbar%i", (int)icon); sprintf(message_token, "HelpToolbar%i", (int)icon);
} else if ((g = ro_gui_status_lookup(window))) { } else if ((g = ro_gui_status_lookup(window)) != NULL) {
sprintf(message_token, "HelpStatus%i", (int)icon); sprintf(message_token, "HelpStatus%i", (int)icon);
} }
@ -142,7 +142,7 @@ void ro_gui_interactive_help_request(wimp_message *message) {
if ((icon >= 0) && (ro_gui_get_icon_shaded_state(window, icon))) { if ((icon >= 0) && (ro_gui_get_icon_shaded_state(window, icon))) {
strcat(message_token, "g"); strcat(message_token, "g");
} }
/* Broadcast out message /* Broadcast out message
*/ */
ro_gui_interactive_help_broadcast(message, &message_token[0]); ro_gui_interactive_help_broadcast(message, &message_token[0]);
@ -183,7 +183,7 @@ void ro_gui_interactive_help_request(wimp_message *message) {
*/ */
greyed |= test_menu->entries[menu_tree.items[index]].icon_flags & wimp_ICON_SHADED; greyed |= test_menu->entries[menu_tree.items[index]].icon_flags & wimp_ICON_SHADED;
test_menu = test_menu->entries[menu_tree.items[index]].sub_menu; test_menu = test_menu->entries[menu_tree.items[index]].sub_menu;
/* Continue adding the entries /* Continue adding the entries
*/ */
if (index == 0) { if (index == 0) {
@ -230,7 +230,7 @@ static void ro_gui_interactive_help_broadcast(wimp_message *message, char *token
base_token = token; base_token = token;
while (base_token[0] != 0x00) { while (base_token[0] != 0x00) {
if ((base_token[0] == '-') || if ((base_token[0] == '-') ||
((base_token[0] >= '0') && (base_token[0] <= '9'))) { ((base_token[0] >= '0') && (base_token[0] <= '9'))) {
base_token[0] = 0x00; base_token[0] = 0x00;
} else { } else {
++base_token; ++base_token;
@ -242,7 +242,7 @@ static void ro_gui_interactive_help_broadcast(wimp_message *message, char *token
translated_token = messages_get(token); translated_token = messages_get(token);
} }
} }
/* Copy our message string /* Copy our message string
*/ */