From 900a3a9b241698b50b0a5276198f644304085100 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Wed, 26 Jun 2002 12:19:24 +0000 Subject: [project @ 2002-06-26 12:19:24 by bursa] Make compilation with lcc work. svn path=/import/netsurf/; revision=23 --- render/box.c | 19 ++++++++++--------- render/css.c | 3 ++- render/font.c | 7 ++++--- render/layout.c | 10 +++++----- render/render.c | 14 +++++++++----- 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/render/box.c b/render/box.c index 3fc6348d9..4844be597 100644 --- a/render/box.c +++ b/render/box.c @@ -1,5 +1,5 @@ /** - * $Id: box.c,v 1.6 2002/06/21 18:16:24 bursa Exp $ + * $Id: box.c,v 1.7 2002/06/26 12:19:24 bursa Exp $ */ #include @@ -67,10 +67,10 @@ struct box * xml_to_box(xmlNode * n, struct css_style * parent_style, struct css if (n->type == XML_ELEMENT_NODE) { /* work out the style for this element */ *selector = xrealloc(*selector, (depth + 1) * sizeof(struct css_selector)); - (*selector)[depth].element = n->name; + (*selector)[depth].element = (const char *) n->name; (*selector)[depth].class = (*selector)[depth].id = 0; - if ((s = xmlGetProp(n, "class"))) - (*selector)[depth].class = s; + if ((s = xmlGetProp(n, (xmlChar *) "class"))) + (*selector)[depth].class = (char *) s; style = box_get_style(stylesheet, parent_style, n, *selector, depth + 1); } @@ -88,7 +88,7 @@ struct box * xml_to_box(xmlNode * n, struct css_style * parent_style, struct css box_add_child(inline_container, box); if (n->type == XML_TEXT_NODE) { box->type = BOX_INLINE; - box->text = squash_whitespace(n->content); + box->text = squash_whitespace((char *) n->content); box->length = strlen(box->text); } else { box->type = BOX_FLOAT; @@ -156,6 +156,7 @@ struct box * xml_to_box(xmlNode * n, struct css_style * parent_style, struct css break; case CSS_DISPLAY_NONE: default: + break; } } @@ -171,18 +172,18 @@ struct css_style * box_get_style(struct css_stylesheet * stylesheet, struct css_ xmlNode * n, struct css_selector * selector, unsigned int depth) { struct css_style * style = xcalloc(1, sizeof(struct css_style)); - xmlChar * s; + char * s; memcpy(style, parent_style, sizeof(struct css_style)); css_get_style(stylesheet, selector, depth, style); - if ((s = xmlGetProp(n, "clear"))) { + if ((s = (char *) xmlGetProp(n, (xmlChar *) "clear"))) { if (strcmp(s, "all") == 0) style->clear = CSS_CLEAR_BOTH; else if (strcmp(s, "left") == 0) style->clear = CSS_CLEAR_LEFT; else if (strcmp(s, "right") == 0) style->clear = CSS_CLEAR_RIGHT; } - if ((s = xmlGetProp(n, "width"))) { + if ((s = (char *) xmlGetProp(n, (xmlChar *) "width"))) { if (strrchr(s, '%')) style->width.width = CSS_WIDTH_PERCENT, style->width.value.percent = atof(s); @@ -192,7 +193,7 @@ struct css_style * box_get_style(struct css_stylesheet * stylesheet, struct css_ style->width.value.length.value = atof(s); } - if ((s = xmlGetProp(n, "style"))) { + if ((s = (char *) xmlGetProp(n, (xmlChar *) "style"))) { struct css_style * astyle = xcalloc(1, sizeof(struct css_style)); memcpy(astyle, &css_empty_style, sizeof(struct css_style)); css_parse_property_list(astyle, s); diff --git a/render/css.c b/render/css.c index 73af7fbb3..574273737 100644 --- a/render/css.c +++ b/render/css.c @@ -1,5 +1,5 @@ /** - * $Id: css.c,v 1.6 2002/06/21 18:16:24 bursa Exp $ + * $Id: css.c,v 1.7 2002/06/26 12:19:24 bursa Exp $ */ #include @@ -579,6 +579,7 @@ void css_cascade(struct css_style * const style, const struct css_style * const break; case CSS_FONT_SIZE_INHERIT: default: /* leave unchanged */ + break; } } diff --git a/render/font.c b/render/font.c index 01f3cde09..b180ed5d8 100644 --- a/render/font.c +++ b/render/font.c @@ -1,5 +1,5 @@ /** - * $Id: font.c,v 1.3 2002/06/18 21:24:21 bursa Exp $ + * $Id: font.c,v 1.4 2002/06/26 12:19:24 bursa Exp $ */ #include @@ -15,6 +15,7 @@ struct font_set { /* a set of font handles */ + int stop_lcc_complaining; }; /** @@ -25,7 +26,7 @@ struct font_set * font_set_create(void) { return 0; } - + font_id font_add(struct font_set * font_set, const char * name, unsigned int weight, unsigned int size) { @@ -48,7 +49,7 @@ struct font_split font_split(struct font_set * font_set, font_id id, const char struct font_split split; split.height = 30; - + if (len * 20 <= width) { split.width = len * 20; split.end = text + len; diff --git a/render/layout.c b/render/layout.c index c47211879..45a51bd88 100644 --- a/render/layout.c +++ b/render/layout.c @@ -1,5 +1,5 @@ /** - * $Id: layout.c,v 1.8 2002/06/21 18:16:24 bursa Exp $ + * $Id: layout.c,v 1.9 2002/06/26 12:19:24 bursa Exp $ */ #include @@ -51,7 +51,7 @@ signed long len(struct css_length * length, struct css_style * style) case CSS_UNIT_MM: return length->value * 3.5; case CSS_UNIT_PT: return length->value * 90.0 / 72.0; case CSS_UNIT_PC: return length->value * 90.0 / 6.0; - default: return 0; + default: break; } return 0; } @@ -170,8 +170,8 @@ unsigned long layout_block_children(struct box * box, unsigned long width, struc break; default: fprintf(stderr, "%s -> %s\n", - box->node ? box->node->name : "()", - c->node ? c->node->name : "()"); + box->node ? (const char *) box->node->name : "()", + c->node ? (const char *) c->node->name : "()"); die("block child not block, table, or inline container"); } } @@ -382,7 +382,7 @@ struct box * layout_line(struct box * first, unsigned long width, unsigned long switch (first->parent->parent->style->text_align) { case CSS_TEXT_ALIGN_RIGHT: x0 = x1 - x; break; case CSS_TEXT_ALIGN_CENTER: x0 = (x0 + (x1 - x)) / 2; break; - default: /* leave on left */ + default: break; /* leave on left */ } for (d = first; d != b; d = d->next) { if (d->type == BOX_INLINE) { diff --git a/render/render.c b/render/render.c index 7e31f4c65..6a92d45cf 100644 --- a/render/render.c +++ b/render/render.c @@ -1,5 +1,5 @@ /** - * $Id: render.c,v 1.14 2002/06/21 18:16:24 bursa Exp $ + * $Id: render.c,v 1.15 2002/06/26 12:19:24 bursa Exp $ */ #include @@ -49,13 +49,16 @@ void render_plain_element(char * g, struct box * box, unsigned long x, unsigned case BOX_TABLE_ROW: case BOX_TABLE_CELL: case BOX_BLOCK: strncpy(g + 80 * (y + box->y) + x + box->x, - box->node->name, strlen(box->node->name)); + (const char *) box->node->name, + strlen((const char *) box->node->name)); break; case BOX_INLINE: strncpy(g + 80 * (y + box->y) + x + box->x, - box->node->parent->name, strlen(box->node->parent->name)); + (const char *) box->node->parent->name, + strlen((const char *) box->node->parent->name)); break; case BOX_INLINE_CONTAINER: default: + break; } if (box->type == BOX_INLINE && box->node->content) { @@ -99,11 +102,12 @@ void render_dump(struct box * box, unsigned long x, unsigned long y) case BOX_TABLE_ROW: case BOX_TABLE_CELL: case BOX_FLOAT: - case BOX_BLOCK: name = box->node->name; + case BOX_BLOCK: name = (const char *) box->node->name; break; case BOX_INLINE: case BOX_INLINE_CONTAINER: default: + break; } printf("rect %li %li %li %li \"%s\" \"", x + box->x, y + box->y, @@ -153,7 +157,7 @@ int main(int argc, char *argv[]) for (c = doc->children; c != 0 && c->type != XML_ELEMENT_NODE; c = c->next) ; if (c == 0) die("no element in document"); - if (strcmp(c->name, "html")) die("document is not html"); + if (strcmp((const char *) c->name, "html")) die("document is not html"); fprintf(stderr, "Parsing css...\n"); f = load(argv[2]); -- cgit v1.2.3