[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_COOKIEJAR, 0);
}
if ((li = login_list_get(f->url))) {
if ((li = login_list_get(f->url)) != NULL) {
SETOPT(CURLOPT_HTTPAUTH, CURLAUTH_ANY);
SETOPT(CURLOPT_USERPWD, li->logindetails);
} else {

View File

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

View File

@ -395,8 +395,8 @@ bool css_convert(struct content *c, int width, int height)
current = source_data;
end = source_data + c->source_size;
while (current < end && (token = css_tokenise(&current, end + 10,
&token_text))) {
while (current < end
&& (token = css_tokenise(&current, end + 10, &token_text)) != NULL) {
token_data.text = token_text;
token_data.length = current - token_text;
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;
end = source_data + strlen(str);
while (current < end && (token = css_tokenise(&current, end + 10,
&token_text))) {
while (current < end
&& (token = css_tokenise(&current, end + 10, &token_text)) != NULL) {
token_data.text = token_text;
token_data.length = current - token_text;
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;
/* 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 &&
box->style->visibility == CSS_VISIBILITY_HIDDEN)
continue;

View File

@ -201,8 +201,7 @@ void imagemap_extract(xmlNode *node, struct content *c) {
if (node->type == XML_ELEMENT_NODE) {
if (strcmp(node->name, "map") == 0) {
if (!(name = (char*)xmlGetProp(node,
(const xmlChar*)"name")))
if ((name = (char*)xmlGetProp(node, (const xmlChar*)"name")) == NULL)
return;
entry = imagemap_extract_map(node, c, entry);
imagemap_add(c, name, entry);
@ -254,16 +253,16 @@ struct mapentry *imagemap_addtolist(xmlNode *n, struct mapentry *entry) {
}
}
/* no href -> ignore */
if (!(href = (char*)xmlGetProp(n, (const xmlChar*)"href"))) {
if ((href = (char*)xmlGetProp(n, (const xmlChar*)"href")) == NULL) {
return entry;
}
/* 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");
}
if (strcasecmp(shape, "default") != 0) {
/* no coords -> ignore */
if (!(coords = (char*)xmlGetProp(n, (const xmlChar*)"coords"))) {
if ((coords = (char*)xmlGetProp(n, (const xmlChar*)"coords")) == NULL) {
xmlFree(href);
xmlFree(shape);
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 box_dump(struct box * box, unsigned int depth);
struct box * box_create(struct css_style * style,
void box_dump(struct box *box, unsigned int depth);
struct box * box_create(struct css_style *style,
const char *href, const char *title,
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_free(struct box *box);
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,
struct content **content);
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

View File

@ -386,7 +386,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
if (strcmp(node->name, "link") == 0) {
/* rel='stylesheet' */
if (!(rel = (char *) xmlGetProp(node, (const xmlChar *) "rel")))
if ((rel = (char *) xmlGetProp(node, (const xmlChar *) "rel")) == NULL)
continue;
if (strcasecmp(rel, "stylesheet") != 0) {
xmlFree(rel);
@ -395,7 +395,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
xmlFree(rel);
/* 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) {
xmlFree(type);
continue;
@ -404,7 +404,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
}
/* 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 &&
strstr(media, "all") == 0) {
xmlFree(media);
@ -414,7 +414,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
}
/* href='...' */
if (!(href = (char *) xmlGetProp(node, (const xmlChar *) "href")))
if ((href = (char *) xmlGetProp(node, (const xmlChar *) "href")) == NULL)
continue;
/* 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) {
/* 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) {
xmlFree(type);
continue;
@ -456,7 +456,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
}
/* 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 &&
strstr(media, "all") == 0) {
xmlFree(media);

View File

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

View File

@ -692,7 +692,7 @@ void ro_gui_redraw_window_request(wimp_draw *redraw)
ro_gui_hotlist_redraw(redraw);
else if (redraw->w == dialog_debug)
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);
else {
error = xwimp_redraw_window(redraw, &more);
@ -760,9 +760,9 @@ void ro_gui_close_window_request(wimp_close *close)
if (close->w == dialog_debug)
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);
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);
else
ro_gui_dialog_close(close->w);
@ -823,13 +823,13 @@ void ro_gui_mouse_click(wimp_pointer *pointer)
else if (hotlist_toolbar &&
hotlist_toolbar->toolbar_handle == pointer->w)
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);
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);
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);
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);
else
ro_gui_dialog_click(pointer);
@ -915,9 +915,9 @@ void ro_gui_keypress(wimp_key *key)
if (key->w == hotlist_window)
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);
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);
else
handled = ro_gui_dialog_keypress(key);

View File

@ -51,7 +51,7 @@
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 '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
work, windows must have bit 4 of the window flag byte set and the user must be running
RISC OS 5.03 or greater.
@ -126,11 +126,11 @@ void ro_gui_interactive_help_request(wimp_message *message) {
} else if (hotlist_toolbar &&
window == hotlist_toolbar->toolbar_handle) {
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);
} else if ((g = ro_gui_toolbar_lookup(window))) {
} else if ((g = ro_gui_toolbar_lookup(window)) != NULL) {
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);
}
@ -142,7 +142,7 @@ void ro_gui_interactive_help_request(wimp_message *message) {
if ((icon >= 0) && (ro_gui_get_icon_shaded_state(window, icon))) {
strcat(message_token, "g");
}
/* Broadcast out message
*/
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;
test_menu = test_menu->entries[menu_tree.items[index]].sub_menu;
/* Continue adding the entries
*/
if (index == 0) {
@ -230,7 +230,7 @@ static void ro_gui_interactive_help_broadcast(wimp_message *message, char *token
base_token = token;
while (base_token[0] != 0x00) {
if ((base_token[0] == '-') ||
((base_token[0] >= '0') && (base_token[0] <= '9'))) {
((base_token[0] >= '0') && (base_token[0] <= '9'))) {
base_token[0] = 0x00;
} else {
++base_token;
@ -242,7 +242,7 @@ static void ro_gui_interactive_help_broadcast(wimp_message *message, char *token
translated_token = messages_get(token);
}
}
/* Copy our message string
*/