From 84bab08585dec858807a6130bd2d71f304b889f0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 16 Mar 2016 16:21:20 -0400 Subject: Use char* for strings in public API The constant casting just makes user code a mess, for no benefit. --- src/reader.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/reader.h') 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; } -- cgit v1.2.1