summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Tytgat <joty@netsurf-browser.org>2004-08-14 12:57:02 +0000
committerJohn Tytgat <joty@netsurf-browser.org>2004-08-14 12:57:02 +0000
commit7d3a242132eedadbcb96bead6dbed64729d11aaf (patch)
tree80df3d742a1707264ffd3c0a9fe69c067b867157 /render
parent44c418dc7308b9eabec103f86c612e83cb71347e (diff)
downloadnetsurf-7d3a242132eedadbcb96bead6dbed64729d11aaf.tar.gz
netsurf-7d3a242132eedadbcb96bead6dbed64729d11aaf.tar.bz2
[project @ 2004-08-14 12:57:00 by joty]
Using more stddef.h types. svn path=/import/netsurf/; revision=1230
Diffstat (limited to 'render')
-rw-r--r--render/box.c65
-rw-r--r--render/box.h7
-rw-r--r--render/font.h15
-rw-r--r--render/html.c4
-rw-r--r--render/html.h2
-rw-r--r--render/layout.c6
6 files changed, 54 insertions, 45 deletions
diff --git a/render/box.c b/render/box.c
index 95224ec2a..f248f3d62 100644
--- a/render/box.c
+++ b/render/box.c
@@ -195,46 +195,51 @@ void box_add_child(struct box * parent, struct box * child)
*/
struct box * box_create(struct css_style * style,
- char *href, char *title, char *id, pool box_pool)
+ const char *href, const char *title, const char *id,
+ pool box_pool)
{
unsigned int i;
- struct box *box = pool_alloc(box_pool, sizeof (struct box));
- assert(box);
+ struct box *box;
+
+ if ((box = pool_alloc(box_pool, sizeof (struct box))) == NULL)
+ return NULL;
box->type = BOX_INLINE;
box->style = style;
+ box->x = box->y = 0;
box->width = UNKNOWN_WIDTH;
+ box->height = 0;
+ box->descendant_x0 = box->descendant_y0 = 0;
+ box->descendant_x1 = box->descendant_y1 = 0;
+ for (i = 0; i != 4; i++)
+ box->margin[i] = box->padding[i] = box->border[i] = 0;
+ box->min_width = 0;
box->max_width = UNKNOWN_MAX_WIDTH;
- box->href = href ? xstrdup(href) : 0;
- box->title = title ? xstrdup(title) : 0;
- box->columns = 1;
- box->rows = 1;
- box->text = 0;
+ box->text = NULL;
+ box->length = 0;
box->space = 0;
box->clone = 0;
box->style_clone = 0;
- box->length = 0;
+ box->href = href ? xstrdup(href) : NULL;
+ box->title = title ? xstrdup(title) : NULL;
+ box->columns = 1;
+ box->rows = 1;
box->start_column = 0;
- box->next = 0;
- box->prev = 0;
- box->children = 0;
- box->last = 0;
- box->parent = 0;
- box->float_children = 0;
- box->next_float = 0;
- box->col = 0;
- box->font = 0;
- box->gadget = 0;
- box->usemap = 0;
- box->id = id ? xstrdup(id) : 0;
- box->background = 0;
- box->object = 0;
- box->object_params = 0;
- box->x = box->y = 0;
- box->height = 0;
- for (i = 0; i != 4; i++)
- box->margin[i] = box->padding[i] = box->border[i] = 0;
- box->descendant_x0 = box->descendant_y0 = 0;
- box->descendant_x1 = box->descendant_y1 = 0;
+ box->next = NULL;
+ box->prev = NULL;
+ box->children = NULL;
+ box->last = NULL;
+ box->parent = NULL;
+ box->float_children = NULL;
+ box->next_float = NULL;
+ box->col = NULL;
+ box->font = NULL;
+ box->gadget = NULL;
+ box->usemap = NULL;
+ box->id = id ? xstrdup(id) : NULL;
+ box->background = NULL;
+ box->object = NULL;
+ box->object_params = NULL;
+
return box;
}
diff --git a/render/box.h b/render/box.h
index bb493a323..5b6427bc6 100644
--- a/render/box.h
+++ b/render/box.h
@@ -159,8 +159,8 @@ struct box {
int min_width;
int max_width; /**< Width that would be taken with no line breaks. */
- char *text; /**< Text, or 0 if none. Unterminated. */
- unsigned int length; /**< Length of text. */
+ char *text; /**< Text, or 0 if none. Unterminated. */
+ size_t length; /**< Length of text. */
/** Text is followed by a space. */
unsigned int space : 1;
@@ -234,7 +234,8 @@ 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,
- char *href, char *title, char *id, pool box_pool);
+ const char *href, const char *title,
+ const char *id, pool box_pool);
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);
diff --git a/render/font.h b/render/font.h
index 667b177e0..fdc63f9a5 100644
--- a/render/font.h
+++ b/render/font.h
@@ -10,6 +10,7 @@
#ifndef _NETSURF_RENDER_FONT_H_
#define _NETSURF_RENDER_FONT_H_
+#include <stddef.h>
#include "netsurf/css/css.h"
typedef enum {
@@ -31,21 +32,21 @@ struct font_set *nsfont_new_set(void);
struct font_data *nsfont_open(struct font_set *set, struct css_style *style);
void nsfont_free_set(struct font_set *set);
unsigned long nsfont_width(struct font_data *font, const char *text,
- unsigned int length);
+ size_t length);
void nsfont_position_in_string(struct font_data *font, const char *text,
- unsigned int length, unsigned long x, int *char_offset,
+ size_t length, unsigned long x, int *char_offset,
int *pixel_offset);
char *nsfont_split(struct font_data *font, const char *text,
- unsigned int length,
+ size_t length,
unsigned int width, unsigned int *used_width);
void nsfont_paint(struct font_data *font, const char *str,
- int xpos, int ypos, void *trfm, int length);
+ size_t length, int xpos, int ypos, void *trfm);
void nsfont_txtenum(struct font_data *font, const char *text,
- unsigned int length,
+ size_t length,
unsigned int *width,
const char **rofontname,
const char **rotext,
- unsigned int *rolength,
- unsigned int *consumed);
+ size_t *rolength,
+ size_t *consumed);
#endif
diff --git a/render/html.c b/render/html.c
index 8bf03c4bf..f71182079 100644
--- a/render/html.c
+++ b/render/html.c
@@ -90,11 +90,11 @@ bool html_create(struct content *c, const char *params[])
html->getenc = false;
} else {
LOG(("xmlSwitchToEncoding failed for <%s>\n", encStr));
- free(encStr);
+ free((void *)encStr);
}
} else {
LOG(("xmlFindCharEncodingHandler() failed for <%s>\n", encStr));
- free(encStr);
+ free((void *)encStr);
}
}
html->base_url = xstrdup(c->url);
diff --git a/render/html.h b/render/html.h
index be84d9efd..ef22c0d1a 100644
--- a/render/html.h
+++ b/render/html.h
@@ -36,7 +36,7 @@ struct imagemap;
struct content_html_data {
htmlParserCtxt *parser; /**< HTML parser context. */
- xmlChar *encoding; /**< Encoding of source. */
+ const char *encoding; /**< Encoding of source. */
bool getenc; /**< Need to get the encoding from the document, as it
* wasn't specified in the Content-Type header. */
diff --git a/render/layout.c b/render/layout.c
index a4e688f42..5b08a11d5 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -749,7 +749,8 @@ bool layout_line(struct box *first, int width, int *y,
if (b->text) {
if (b->width == UNKNOWN_WIDTH)
- b->width = nsfont_width(b->font, b->text,
+ b->width = nsfont_width(b->font,
+ b->text,
b->length);
x += b->width + b->space ?
b->font->space_width : 0;
@@ -998,7 +999,8 @@ bool layout_line(struct box *first, int width, int *y,
} else {
/* fit as many words as possible */
assert(space != 0);
- space = nsfont_split(split_box->font, split_box->text,
+ space = nsfont_split(split_box->font,
+ split_box->text,
split_box->length,
x1 - x0 - x - space_before, &w)
- split_box->text;