[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

@ -108,9 +108,10 @@ void ro_gui_buffer_open(wimp_draw *redraw) {
/* 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);

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

@ -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);
}