summaryrefslogtreecommitdiff
path: root/test/tokeniser2.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-03-21 13:20:22 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-03-21 13:20:22 +0000
commit4da6a038c15a5fa3d1c754b7278ae47627a44718 (patch)
treebd3f06540ff87963913848c6fea5cb1b7eec62e3 /test/tokeniser2.c
parenteebff1268e029fa6a31d391c175a66e159a45ecf (diff)
downloadlibhubbub-4da6a038c15a5fa3d1c754b7278ae47627a44718.tar.gz
libhubbub-4da6a038c15a5fa3d1c754b7278ae47627a44718.tar.bz2
hubbub_strings may now be either an offset into the data buffer or a pointer to constant data.
Fix up tokeniser and treebuilder to deal with this. Fix up testcases, too. The tokeniser will only ever emit strings of type HUBBUB_STRING_OFF. Anything else is a bug which should be fixed. The treebuilder may emit strings of either type. svn path=/trunk/hubbub/; revision=4014
Diffstat (limited to 'test/tokeniser2.c')
-rw-r--r--test/tokeniser2.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/tokeniser2.c b/test/tokeniser2.c
index 103a3d5..f72e0d7 100644
--- a/test/tokeniser2.c
+++ b/test/tokeniser2.c
@@ -280,7 +280,7 @@ void token_handler(const hubbub_token *token, void *pw)
bool expvalid = json_object_get_boolean((struct json_object *)
array_list_get_idx(items, 2));
char *gotname = (char *) (ctx->pbuffer +
- token->data.doctype.name.data_off);
+ token->data.doctype.name.data.off);
printf("'%.*s' (%svalid)\n",
(int) token->data.doctype.name.len,
@@ -302,7 +302,7 @@ void token_handler(const hubbub_token *token, void *pw)
(struct json_object *)
array_list_get_idx(items, 2))->head;
char *tagname = (char *) (ctx->pbuffer +
- token->data.tag.name.data_off);
+ token->data.tag.name.data.off);
printf("'%.*s' %s\n",
(int) token->data.tag.name.len,
@@ -318,11 +318,11 @@ void token_handler(const hubbub_token *token, void *pw)
char *expval = json_object_get_string(
(struct json_object *) expattrs->v);
char *gotname = (char *) (ctx->pbuffer +
- token->data.tag.attributes[i].name.data_off);
+ token->data.tag.attributes[i].name.data.off);
size_t namelen =
token->data.tag.attributes[i].name.len;
char *gotval = (char *) (ctx->pbuffer +
- token->data.tag.attributes[i].value.data_off);
+ token->data.tag.attributes[i].value.data.off);
size_t vallen =
token->data.tag.attributes[i].value.len;
@@ -347,7 +347,7 @@ void token_handler(const hubbub_token *token, void *pw)
char *expname = json_object_get_string((struct json_object *)
array_list_get_idx(items, 1));
char *tagname = (char *) (ctx->pbuffer +
- token->data.tag.name.data_off);
+ token->data.tag.name.data.off);
printf("'%.*s' %s\n",
(int) token->data.tag.name.len,
@@ -364,7 +364,7 @@ void token_handler(const hubbub_token *token, void *pw)
char *expstr = json_object_get_string((struct json_object *)
array_list_get_idx(items, 1));
char *gotstr = (char *) (ctx->pbuffer +
- token->data.comment.data_off);
+ token->data.comment.data.off);
printf("'%.*s'\n", (int) token->data.comment.len, gotstr);
@@ -377,7 +377,7 @@ void token_handler(const hubbub_token *token, void *pw)
char *expstr = json_object_get_string((struct json_object *)
array_list_get_idx(items, 1));
char *gotstr = (char *) (ctx->pbuffer +
- token->data.character.data_off);
+ token->data.character.data.off);
size_t len = min(token->data.character.len,
strlen(expstr + ctx->char_off));
@@ -392,7 +392,7 @@ void token_handler(const hubbub_token *token, void *pw)
hubbub_token t;
t.type = HUBBUB_TOKEN_CHARACTER;
- t.data.character.data_off += len;
+ t.data.character.data.off += len;
t.data.character.len -= len;
ctx->char_off = 0;