diff options
author | David Robillard <d@drobilla.net> | 2016-03-16 16:21:20 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 16:27:02 -0500 |
commit | 84bab08585dec858807a6130bd2d71f304b889f0 (patch) | |
tree | ea78338414095c2c871944a0135028e1399b12fe /src/reader.h | |
parent | caa74939cba8b1cd357e553efca9bec5074b1c53 (diff) | |
download | serd-84bab08585dec858807a6130bd2d71f304b889f0.tar.gz serd-84bab08585dec858807a6130bd2d71f304b889f0.tar.bz2 serd-84bab08585dec858807a6130bd2d71f304b889f0.zip |
Use char* for strings in public API
The constant casting just makes user code a mess, for no benefit.
Diffstat (limited to 'src/reader.h')
-rw-r--r-- | src/reader.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/reader.h b/src/reader.h index 81edbc09..05774abe 100644 --- a/src/reader.h +++ b/src/reader.h @@ -55,7 +55,7 @@ struct SerdReaderImpl { SerdSyntax syntax; unsigned next_id; uint8_t* buf; - uint8_t* bprefix; + char* bprefix; size_t bprefix_len; bool strict; ///< True iff strict parsing bool seen_genid; @@ -153,7 +153,7 @@ static inline SerdStatus eat_string(SerdReader* reader, const char* str, unsigned n) { for (unsigned i = 0; i < n; ++i) { - if (!eat_byte_check(reader, ((const uint8_t*)str)[i])) { + if (!eat_byte_check(reader, str[i])) { return SERD_ERR_BAD_SYNTAX; } } @@ -166,11 +166,13 @@ push_byte(SerdReader* reader, Ref ref, const int c) assert(c != EOF); SERD_STACK_ASSERT_TOP(reader, ref); - uint8_t* const s = (uint8_t*)serd_stack_push(&reader->stack, 1); + char* const s = (char*)serd_stack_push(&reader->stack, 1); SerdNode* const node = (SerdNode*)(reader->stack.buf + ref); - ++node->n_bytes; - *(s - 1) = (uint8_t)c; + + *(s - 1) = (char)c; *s = '\0'; + + ++node->n_bytes; return SERD_SUCCESS; } |