diff options
author | David Robillard <d@drobilla.net> | 2011-12-11 19:55:45 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-12-11 19:55:45 +0000 |
commit | 4f2be9d332594f1fdd494437e6f7d5468c1c6022 (patch) | |
tree | e2d033d788d8968e7760ec7ee887ca9eb4b498fb | |
parent | 5f7fed94b3ff74ede85ab9189221808543c4054b (diff) | |
download | serd-4f2be9d332594f1fdd494437e6f7d5468c1c6022.tar.gz serd-4f2be9d332594f1fdd494437e6f7d5468c1c6022.tar.bz2 serd-4f2be9d332594f1fdd494437e6f7d5468c1c6022.zip |
Fix string length calculation.
git-svn-id: http://svn.drobilla.net/serd/trunk@241 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r-- | src/reader.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/reader.c b/src/reader.c index 7c083dd6..d718d255 100644 --- a/src/reader.c +++ b/src/reader.c @@ -236,8 +236,7 @@ push_byte(SerdReader* reader, Ref ref, const uint8_t c) serd_stack_push(&reader->stack, 1); SerdNode* const node = deref(reader, ref); ++node->n_bytes; - if ((c & 0xC0) != 0x80) { - // Does not start with `10', start of a new character + if (!(c & 0x80)) { // Starts with 0 bit, start of new character ++node->n_chars; } assert(node->n_bytes >= node->n_chars); @@ -464,7 +463,7 @@ read_character(SerdReader* reader, Ref dest) assert(c != '\\'); // Only called from methods that handle escapes first switch (c) { case '\0': - error(reader, "unexpected end of file\n", peek_byte(reader)); + error(reader, "unexpected end of file\n", c); return SERD_ERR_BAD_SYNTAX; default: if (c < 0x20) { // ASCII control character |