[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs/libqhtml Makefile css.c cssparse.c cssto...
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs/libqhtml Makefile css.c cssparse.c cssto... |
Date: |
Thu, 28 Dec 2006 11:27:31 +0000 |
CVSROOT: /cvsroot/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 06/12/28 11:27:31
Modified files:
libqhtml : Makefile css.c cssparse.c csstoqe.c xmlparse.c
Log message:
include cflags.mk for extra gcc warnings if present
utf8_encode now returns the number of characters copied
simplified code accordingly
made local functions static
fixed shadowing issues
added __attr_printf() attributes for gcc to check printf arguments
use snprintf() instead of sprintf()
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/libqhtml/Makefile?cvsroot=qemacs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/qemacs/libqhtml/css.c?cvsroot=qemacs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/qemacs/libqhtml/cssparse.c?cvsroot=qemacs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/qemacs/libqhtml/csstoqe.c?cvsroot=qemacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/qemacs/libqhtml/xmlparse.c?cvsroot=qemacs&r1=1.6&r2=1.7
Patches:
Index: Makefile
===================================================================
RCS file: /cvsroot/qemacs/qemacs/libqhtml/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Makefile 4 May 2005 19:40:26 -0000 1.2
+++ Makefile 28 Dec 2006 11:27:30 -0000 1.3
@@ -1,10 +1,14 @@
include ../config.mak
-CFLAGS:=-Wall -g $(CFLAGS)
+CFLAGS:= -Wall -g $(CFLAGS) -funsigned-char
+
+-include ../cflags.mk
+
ifdef TARGET_GPROF
CFLAGS+= -p
LDFLAGS+= -p
endif
+
ifdef TARGET_ARCH_X86
#CFLAGS+=-fomit-frame-pointer
ifeq ($(GCC_MAJOR),2)
@@ -13,6 +17,7 @@
CFLAGS+=-march=i386 -falign-functions=0
endif
endif
+
CFLAGS+=-I..
OBJS=css.o xmlparse.o cssparse.o html_style.o docbook_style.o
Index: css.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/libqhtml/css.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- css.c 9 Dec 2006 19:04:15 -0000 1.6
+++ css.c 28 Dec 2006 11:27:30 -0000 1.7
@@ -198,7 +198,7 @@
/* XXX: use unicode */
typedef int (*NextCharFunc)(EditBuffer *b, unsigned long *offset);
-int eb_nextc1(EditBuffer *b, unsigned long *offset_ptr)
+static int eb_nextc1(EditBuffer *b, unsigned long *offset_ptr)
{
unsigned long offset1;
int ch, ch1;
@@ -230,11 +230,12 @@
return ch;
}
-int str_nextc(EditBuffer *b, unsigned long *offset_ptr)
+static int str_nextc(__unused__ EditBuffer *b, unsigned long *offset_ptr)
{
const unsigned char *ptr;
int ch;
+ /* CG: Achtung! 32/64 bit portability issue */
ptr = *(const unsigned char **)offset_ptr;
ch = *ptr;
if (ch >= 128) {
@@ -424,7 +425,7 @@
CSSState *state,
CSSProperty *p,
CSSState *state_parent,
- CSSBox *box)
+ __unused__ CSSBox *box)
{
int *ptr, val;
const CSSPropertyDef *def;
@@ -891,7 +892,7 @@
char buf1[17], *q;
if (n <= 0 || n >= 4000) {
- sprintf(buf, "%d", n);
+ snprintf(buf, sizeof(buf), "%d", n);
return;
}
@@ -2061,7 +2062,7 @@
/* split the box containing the start of the word,
if needed */
box_bow = s->line_boxes[s->index_bow].box;
- if (s->offset_bow > box_bow->u.buffer.start) {
+ if ((unsigned long)s->offset_bow > box_bow->u.buffer.start) {
/* split the box containing the start of the word */
css_box_split(box_bow, s->offset_bow);
/* include the start of the splitted box */
@@ -3968,7 +3969,7 @@
}
static void css_display_block(CSSContext *s,
- CSSBox *box, CSSState *props_parent,
+ CSSBox *box, __unused__ CSSState *props_parent,
CSSRect *clip_box, int dx, int dy)
{
CSSState *props;
@@ -4120,12 +4121,12 @@
return 0;
eol = (box->content_eol != 0);
- if (!(s->offset >= box->u.buffer.start &&
- s->offset < (box->u.buffer.end + eol)))
+ if (!((unsigned long)s->offset >= box->u.buffer.start &&
+ (unsigned long)s->offset < (box->u.buffer.end + eol)))
return 0;
/* special case for eol */
- if (s->offset == box->u.buffer.end) {
+ if ((unsigned long)s->offset == box->u.buffer.end) {
/* get eol width */
font = css_select_font(s->ctx->screen, props);
w = glyph_width(s->ctx->screen, font, '$');
@@ -4283,7 +4284,7 @@
/* compute offset */
for (i = 0; i < len; i++) {
- if (posc == char_to_glyph_pos[i]) {
+ if ((unsigned)posc == char_to_glyph_pos[i]) {
return offsets[i];
}
}
Index: cssparse.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/libqhtml/cssparse.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cssparse.c 9 Dec 2006 19:04:15 -0000 1.6
+++ cssparse.c 28 Dec 2006 11:27:30 -0000 1.7
@@ -33,6 +33,9 @@
#include <assert.h>
static void css_error1(CSSParseState *b, const char *fmt, ...)
+ __attr_printf(2,3);
+
+static void css_error1(CSSParseState *b, const char *fmt, ...)
{
char buf[1024];
va_list ap;
Index: csstoqe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/libqhtml/csstoqe.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- csstoqe.c 9 Dec 2006 19:04:15 -0000 1.3
+++ csstoqe.c 28 Dec 2006 11:27:30 -0000 1.4
@@ -8,6 +8,11 @@
{
int c, n, last_c, got_space, in_string;
+ if (argc < 2) {
+ fprintf(stderr, "usage: csstoqe array_name\n");
+ exit(1);
+ }
+
printf("/* Automatically generated file - do not edit */\n");
printf("const char %s[] =\n", argv[1]);
n = 0;
Index: xmlparse.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/libqhtml/xmlparse.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- xmlparse.c 8 Jul 2005 09:30:44 -0000 1.6
+++ xmlparse.c 28 Dec 2006 11:27:30 -0000 1.7
@@ -159,7 +159,6 @@
static void strbuf_addch1(StringBuffer *b, int ch)
{
- const char *p;
int size1;
unsigned char *ptr;
@@ -174,18 +173,15 @@
b->buf = ptr;
b->allocated_size = size1;
- p = utf8_encode((char*)b->buf + b->size, ch);
- b->size = p - (char *)b->buf;
+ b->size += utf8_encode((char*)b->buf + b->size, ch);
}
}
static inline void strbuf_addch(StringBuffer *b, int ch)
{
- const char *p;
if (b->size < b->allocated_size) {
/* fast case */
- p = utf8_encode((char*)b->buf + b->size, ch);
- b->size = p - (char *)b->buf;
+ b->size += utf8_encode((char*)b->buf + b->size, ch);
} else {
strbuf_addch1(b, ch);
}
@@ -354,7 +350,7 @@
/* simplistic HTML table border handling */
-void html_table_borders(CSSBox *box, int border, int padding)
+static void html_table_borders(CSSBox *box, int border, int padding)
{
CSSProperty **last_prop;
CSSBox *box1;
@@ -494,7 +490,7 @@
if (value && !css_get_color(&color, value)) {
CSSStyleSheetEntry *e;
CSSSimpleSelector ss1, *ss = &ss1;
- CSSProperty **last_prop;
+ CSSProperty **last_prop1;
CSSStyleSheetAttributeEntry **plast_attr;
/* specific to <a href="xxx"> tag */
@@ -506,8 +502,8 @@
e = add_style_entry(s->style_sheet, ss, CSS_MEDIA_ALL);
/* add color property */
- last_prop = &e->props;
- css_add_prop_int(&last_prop, CSS_color, color);
+ last_prop1 = &e->props;
+ css_add_prop_int(&last_prop1, CSS_color, color);
}
break;
case CSS_ID_font:
@@ -774,6 +770,9 @@
}
static void xml_error(XMLState *s, const char *fmt, ...)
+ __attr_printf(2,3);
+
+static void xml_error(XMLState *s, const char *fmt, ...)
{
char buf[1024];
va_list ap;
@@ -901,7 +900,6 @@
/* close some tags (correct HTML mistakes) */
if (s->html_syntax) {
- CSSBox *box1;
const HTMLClosedTags *ct;
ct = html_closed_tags;
for (;;) {
@@ -1167,12 +1165,12 @@
if (!xml_tagcmp(s->pretag, "style")) {
if (s->style_sheet) {
- CSSParseState b1, *b = &b1;
- b->ptr = (char *)s->str.buf;
- b->line_num = s->line_num; /* XXX: incorrect */
- b->filename = s->filename;
- b->ignore_case = s->ignore_case;
- css_parse_style_sheet(s->style_sheet, b);
+ CSSParseState b1, *bp = &b1;
+ bp->ptr = (char *)s->str.buf;
+ bp->line_num = s->line_num; /* XXX: incorrect */
+ bp->filename = s->filename;
+ bp->ignore_case = s->ignore_case;
+ css_parse_style_sheet(s->style_sheet, bp);
}
} else if (!xml_tagcmp(s->pretag, "script")) {
/* XXX: handle script */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs/libqhtml Makefile css.c cssparse.c cssto...,
Charlie Gordon <=