diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-03-21 13:20:22 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-03-21 13:20:22 +0000 |
commit | 4da6a038c15a5fa3d1c754b7278ae47627a44718 (patch) | |
tree | bd3f06540ff87963913848c6fea5cb1b7eec62e3 /test/tokeniser.c | |
parent | eebff1268e029fa6a31d391c175a66e159a45ecf (diff) | |
download | libhubbub-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/tokeniser.c')
-rw-r--r-- | test/tokeniser.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/tokeniser.c b/test/tokeniser.c index 271b986..32ecdbc 100644 --- a/test/tokeniser.c +++ b/test/tokeniser.c @@ -128,44 +128,44 @@ void token_handler(const hubbub_token *token, void *pw) case HUBBUB_TOKEN_DOCTYPE: printf("'%.*s' (%svalid)\n", (int) token->data.doctype.name.len, - pbuffer + token->data.doctype.name.data_off, + pbuffer + token->data.doctype.name.data.off, token->data.doctype.correct ? "" : "in"); break; case HUBBUB_TOKEN_START_TAG: printf("'%.*s' %s\n", (int) token->data.tag.name.len, - pbuffer + token->data.tag.name.data_off, + pbuffer + token->data.tag.name.data.off, (token->data.tag.n_attributes > 0) ? "attributes:" : ""); for (i = 0; i < token->data.tag.n_attributes; i++) { printf("\t'%.*s' = '%.*s'\n", (int) token->data.tag.attributes[i].name.len, - pbuffer + token->data.tag.attributes[i].name.data_off, + pbuffer + token->data.tag.attributes[i].name.data.off, (int) token->data.tag.attributes[i].value.len, - pbuffer + token->data.tag.attributes[i].value.data_off); + pbuffer + token->data.tag.attributes[i].value.data.off); } break; case HUBBUB_TOKEN_END_TAG: printf("'%.*s' %s\n", (int) token->data.tag.name.len, - pbuffer + token->data.tag.name.data_off, + pbuffer + token->data.tag.name.data.off, (token->data.tag.n_attributes > 0) ? "attributes:" : ""); for (i = 0; i < token->data.tag.n_attributes; i++) { printf("\t'%.*s' = '%.*s'\n", (int) token->data.tag.attributes[i].name.len, - pbuffer + token->data.tag.attributes[i].name.data_off, + pbuffer + token->data.tag.attributes[i].name.data.off, (int) token->data.tag.attributes[i].value.len, - pbuffer + token->data.tag.attributes[i].value.data_off); + pbuffer + token->data.tag.attributes[i].value.data.off); } break; case HUBBUB_TOKEN_COMMENT: printf("'%.*s'\n", (int) token->data.comment.len, - pbuffer + token->data.comment.data_off); + pbuffer + token->data.comment.data.off); break; case HUBBUB_TOKEN_CHARACTER: printf("'%.*s'\n", (int) token->data.character.len, - pbuffer + token->data.character.data_off); + pbuffer + token->data.character.data.off); break; case HUBBUB_TOKEN_EOF: printf("\n"); |