summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-06-10 22:39:56 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-06-10 22:39:56 +0000
commitbd6ec2519044d166b7f2f5e8f949667a3d4c3317 (patch)
tree4cdd29c0fc62186cc3cfbc2e69835839e7c024d2
parentfb4e2fc476e4095fca175a61a8bffe8e79fc6eb5 (diff)
downloadnetsurf-bd6ec2519044d166b7f2f5e8f949667a3d4c3317.tar.gz
netsurf-bd6ec2519044d166b7f2f5e8f949667a3d4c3317.tar.bz2
[project @ 2004-06-10 22:39:56 by jmb]
Compiler warning purge svn path=/import/netsurf/; revision=954
-rw-r--r--content/content.c2
-rw-r--r--desktop/netsurf.c4
-rw-r--r--desktop/save_text.c2
-rw-r--r--render/html.c2
-rw-r--r--riscos/gui.c10
-rw-r--r--riscos/plugin.c57
-rw-r--r--riscos/plugin.h15
-rw-r--r--riscos/toolbar.c1
-rw-r--r--riscos/url_protocol.c1
9 files changed, 58 insertions, 36 deletions
diff --git a/content/content.c b/content/content.c
index 268b36433..3974e90fd 100644
--- a/content/content.c
+++ b/content/content.c
@@ -328,7 +328,7 @@ void content_set_status(struct content *c, const char *status_message, ...)
va_start(ap, status_message);
if ((len = vsnprintf(c->status_message, sizeof(c->status_message), status_message, ap)) < 0
- || len >= sizeof(c->status_message))
+ || len >= (int)sizeof(c->status_message))
c->status_message[sizeof(c->status_message) - 1] = '\0';
va_end(ap);
}
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index 21f01177e..e38659e43 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -28,6 +28,10 @@ static void netsurf_init(int argc, char** argv);
static void netsurf_poll(void);
static void netsurf_exit(void);
+#ifndef curl_memdebug
+extern void curl_memdebug(const char *logname);
+#endif
+
/**
* Gui NetSurf main().
*/
diff --git a/desktop/save_text.c b/desktop/save_text.c
index 3214713bb..98c0a8a88 100644
--- a/desktop/save_text.c
+++ b/desktop/save_text.c
@@ -64,7 +64,7 @@ void extract_text(xmlDoc *doc)
void extract_text_from_tree(xmlNode *n)
{
xmlNode *this_node;
- const char *text;
+ char *text;
int need_nl = 0;
if (n->type == XML_ELEMENT_NODE) {
diff --git a/render/html.c b/render/html.c
index d39dd32da..0f8a87a8a 100644
--- a/render/html.c
+++ b/render/html.c
@@ -420,7 +420,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
c->data.html.stylesheet_content[1] =
content_create(c->data.html.base_url);
if (!c->data.html.stylesheet_content[1])
- return false;
+ return;
content_set_type(c->data.html.stylesheet_content[1],
CONTENT_CSS, "text/css", params);
}
diff --git a/riscos/gui.c b/riscos/gui.c
index dc36dd1bf..333e28ee9 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -162,7 +162,7 @@ void gui_init(int argc, char** argv)
NETSURF_DIR = getenv("NetSurf$Dir");
if ((length = snprintf(path, sizeof(path),
"<NetSurf$Dir>.Resources.%s.Messages",
- option_language)) < 0 || length >= sizeof(path))
+ option_language)) < 0 || length >= (int)sizeof(path))
die("Failed to locate Messages resource.");
messages_load(path);
messages_load("<NetSurf$Dir>.Resources.LangNames");
@@ -185,7 +185,7 @@ void gui_init(int argc, char** argv)
if (option_theme != NULL) {
if ((length = snprintf(theme_fname, sizeof(theme_fname),
"<NetSurf$Dir>.Themes.%s", option_theme)) >= 0
- && length < sizeof(theme_fname)
+ && length < (int)sizeof(theme_fname)
/* check if theme directory exists */
&& !is_dir(theme_fname)) {
free(option_theme);
@@ -198,7 +198,7 @@ void gui_init(int argc, char** argv)
if ((length = snprintf(path, sizeof(path),
"<NetSurf$Dir>.Resources.%s.Templates",
- option_language)) < 0 || length >= sizeof(path))
+ option_language)) < 0 || length >= (int)sizeof(path))
die("Failed to locate Templates resource.");
error = xwimp_open_template(path);
if (error) {
@@ -724,7 +724,7 @@ void ro_gui_icon_bar_click(wimp_pointer *pointer)
if ((length = snprintf(url, sizeof(url),
"file:///%%3CNetSurf$Dir%%3E/Docs/intro_%s",
- option_language)) >= 0 && length < sizeof(url))
+ option_language)) >= 0 && length < (int)sizeof(url))
browser_window_create(url, NULL);
} else if (pointer->buttons == wimp_CLICK_ADJUST) {
ro_gui_debugwin_open();
@@ -1287,7 +1287,7 @@ void ro_gui_open_help_page(const char *page)
if ((length = snprintf(url, sizeof url,
"file:///%%3CNetSurf$Dir%%3E/Docs/%s_%s",
- page, option_language)) >= 0 && length < sizeof(url))
+ page, option_language)) >= 0 && length < (int)sizeof(url))
browser_window_create(url, NULL);
}
diff --git a/riscos/plugin.c b/riscos/plugin.c
index 6baa41c4f..ad102f440 100644
--- a/riscos/plugin.c
+++ b/riscos/plugin.c
@@ -33,6 +33,7 @@
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/plugin.h"
#include "netsurf/utils/log.h"
+#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
#include "oslib/mimemap.h"
@@ -113,12 +114,21 @@ static int need_reformat = 0;
/**
* Initialises plugin system in readiness for receiving object data
*/
-void plugin_create(struct content *c, const char *params[])
+bool plugin_create(struct content *c, const char *params[])
{
- c->data.plugin.data = xcalloc(0, 1);
+ union content_msg_data msg_data;
+
+ c->data.plugin.data = calloc(0, 1);
+ if (!c->data.plugin.data) {
+ msg_data.error = messages_get("NoMemory");
+ content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ warn_user("NoMemory", 0);
+ return false;
+ }
c->data.plugin.length = 0;
/* we can't create the plugin here, because this is only called
* once, even if the object appears several times */
+ return true;
}
/**
@@ -396,19 +406,19 @@ void plugin_reshape_instance(struct content *c, struct browser_window *bw,
wimp_message m;
plugin_message_reshape *pmr;
os_box bbox;
- unsigned long x, y;
+ int x, y;
if (params == 0) {
return;
}
- box_coords(box, (unsigned long*)&x, (unsigned long*)&y);
- bbox.x0 = ((int)x << 1);
- bbox.y1 = -(((int)y << 1));
+ box_coords(box, (int*)&x, (int*)&y);
+ bbox.x0 = (x << 1);
+ bbox.y1 = -(y << 1);
bbox.x1 = (bbox.x0 + (box->width << 1));
bbox.y0 = (bbox.y1 - (box->height << 1));
- LOG(("Box w, h: %ld %ld", box->width, box->height));
+ LOG(("Box w, h: %d %d", box->width, box->height));
LOG(("BBox: [(%d,%d),(%d,%d)]", bbox.x0, bbox.y0, bbox.x1, bbox.y1));
pmr = (plugin_message_reshape*)&m.data;
@@ -471,7 +481,7 @@ bool plugin_handleable(const char *mime_type)
/**
* processes data retrieved by the fetch process
*/
-void plugin_process_data(struct content *c, char *data, unsigned long size)
+bool plugin_process_data(struct content *c, char *data, unsigned int size)
{
/* If the plugin requests, we send the data to it via the
@@ -486,27 +496,34 @@ void plugin_process_data(struct content *c, char *data, unsigned long size)
/* I think we should just buffer the data here, in case the
* plugin requests it sometime in the future. - James */
- c->data.plugin.data = xrealloc(c->data.plugin.data, c->data.plugin.length + size);
+ char *plugin_data;
+ union content_msg_data msg_data;
+
+ plugin_data = realloc(c->data.plugin.data, c->data.plugin.length + size);
+ if (!plugin_data) {
+ msg_data.error = messages_get("NoMemory");
+ content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ warn_user("NoMemory", 0);
+ return false;
+ }
+ c->data.plugin.data = plugin_data;
memcpy(c->data.plugin.data + c->data.plugin.length, data, size);
c->data.plugin.length += size;
c->size += size;
+ return true;
}
/**
* This isn't needed by the plugin system as all the data processing is done
* externally. Therefore, just tell NetSurf that everything's OK.
*/
-int plugin_convert(struct content *c, unsigned int width, unsigned int height)
+bool plugin_convert(struct content *c, int width, int height)
{
c->status=CONTENT_STATUS_DONE;
- return 0;
-}
-
-void plugin_revive(struct content *c, unsigned int width, unsigned int height)
-{
+ return true;
}
-void plugin_reformat(struct content *c, unsigned int width, unsigned int height)
+void plugin_reformat(struct content *c, int width, int height)
{
}
@@ -517,15 +534,15 @@ void plugin_reformat(struct content *c, unsigned int width, unsigned int height)
void plugin_destroy(struct content *c)
{
/* simply free buffered data */
- xfree(c->data.plugin.data);
+ free(c->data.plugin.data);
}
/**
* Redraw plugin on page.
*/
-void plugin_redraw(struct content *c, long x, long y,
- unsigned long width, unsigned long height,
- long clip_x0, long clip_y0, long clip_x1, long clip_y1,
+void plugin_redraw(struct content *c, int x, int y,
+ int width, int height,
+ int clip_x0, int clip_y0, int clip_x1, int clip_y1,
float scale)
{
struct plugin_list *npl;
diff --git a/riscos/plugin.h b/riscos/plugin.h
index b996b977f..fafc89862 100644
--- a/riscos/plugin.h
+++ b/riscos/plugin.h
@@ -70,15 +70,14 @@ struct plugin_param_item {
/* function definitions */
bool plugin_handleable(const char *mime_type);
void plugin_msg_parse(wimp_message *message, int ack);
-void plugin_create(struct content *c, const char *params[]);
-void plugin_process_data(struct content *c, char *data, unsigned long size);
-int plugin_convert(struct content *c, unsigned int width, unsigned int height);
-void plugin_revive(struct content *c, unsigned int width, unsigned int height);
-void plugin_reformat(struct content *c, unsigned int width, unsigned int height);
+bool plugin_create(struct content *c, const char *params[]);
+bool plugin_process_data(struct content *c, char *data, unsigned int size);
+bool plugin_convert(struct content *c, int width, int height);
+void plugin_reformat(struct content *c, int width, int height);
void plugin_destroy(struct content *c);
-void plugin_redraw(struct content *c, long x, long y,
- unsigned long width, unsigned long height,
- long clip_x0, long clip_y0, long clip_x1, long clip_y1,
+void plugin_redraw(struct content *c, int x, int y,
+ int width, int height,
+ int clip_x0, int clip_y0, int clip_x1, int clip_y1,
float scale);
void plugin_add_instance(struct content *c, struct browser_window *bw,
struct content *page, struct box *box,
diff --git a/riscos/toolbar.c b/riscos/toolbar.c
index d6f3afed9..8423c7d6c 100644
--- a/riscos/toolbar.c
+++ b/riscos/toolbar.c
@@ -20,6 +20,7 @@
#include "netsurf/riscos/toolbar.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/utils/log.h"
+#include "netsurf/utils/utils.h"
struct toolbar_icon {
diff --git a/riscos/url_protocol.c b/riscos/url_protocol.c
index 286f0dae6..7a95b1753 100644
--- a/riscos/url_protocol.c
+++ b/riscos/url_protocol.c
@@ -26,6 +26,7 @@
#include "netsurf/riscos/uri.h"
#include "netsurf/riscos/url_protocol.h"
#include "netsurf/utils/log.h"
+#include "netsurf/utils/utils.h"
/**