aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-05-13 00:34:55 +0200
committerDavid Robillard <d@drobilla.net>2018-05-27 21:10:21 +0200
commit655e6429d10091da033973027b4a1c5393e53a1c (patch)
tree157fceeef962f20ce87150a4bafb70695a7cab9c /src
parentb260af75f48f3824d6fbcb634ddc285f2be4665e (diff)
downloadserd-655e6429d10091da033973027b4a1c5393e53a1c.tar.gz
serd-655e6429d10091da033973027b4a1c5393e53a1c.tar.bz2
serd-655e6429d10091da033973027b4a1c5393e53a1c.zip
Fix UTF-8 round tripping
Diffstat (limited to 'src')
-rw-r--r--src/byte_source.c4
-rw-r--r--src/byte_source.h6
-rw-r--r--src/reader.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/byte_source.c b/src/byte_source.c
index 42f7e557..309a0ca6 100644
--- a/src/byte_source.c
+++ b/src/byte_source.c
@@ -63,7 +63,7 @@ serd_byte_source_open_source(SerdByteSource* source,
source->from_stream = true;
if (page_size > 1) {
- source->file_buf = (char*)serd_allocate_buffer(page_size);
+ source->file_buf = (uint8_t*)serd_allocate_buffer(page_size);
source->read_buf = source->file_buf;
memset(source->file_buf, '\0', page_size);
} else {
@@ -94,7 +94,7 @@ serd_byte_source_open_string(SerdByteSource* source, const char* utf8)
memset(source, '\0', sizeof(*source));
source->cur = cur;
- source->read_buf = utf8;
+ source->read_buf = (const uint8_t*)utf8;
return SERD_SUCCESS;
}
diff --git a/src/byte_source.h b/src/byte_source.h
index 028add77..50c4c2c9 100644
--- a/src/byte_source.h
+++ b/src/byte_source.h
@@ -40,10 +40,10 @@ typedef struct {
void* stream; ///< Stream (e.g. FILE)
size_t page_size; ///< Number of bytes to read at a time
Cursor cur; ///< Cursor for error reporting
- char* file_buf; ///< Buffer iff reading pages from a file
- const char* read_buf; ///< Pointer to file_buf or read_byte
+ uint8_t* file_buf; ///< Buffer iff reading pages from a file
+ const uint8_t* read_buf; ///< Pointer to file_buf or read_byte
size_t read_head; ///< Offset into read_buf
- char read_byte; ///< 1-byte 'buffer' used when not paging
+ uint8_t read_byte; ///< 1-byte 'buffer' used when not paging
bool from_stream; ///< True iff reading from `stream`
bool prepared; ///< True iff prepared for reading
bool eof; ///< True iff end of file reached
diff --git a/src/reader.h b/src/reader.h
index 53662289..5ce98482 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -143,7 +143,7 @@ static inline SerdStatus
push_byte(SerdReader* reader, SerdNode* node, const uint8_t c)
{
SERD_STACK_ASSERT_TOP(reader, node);
- char* const s = (char*)serd_stack_push(&reader->stack, 1);
+ uint8_t* const s = (uint8_t*)serd_stack_push(&reader->stack, 1);
if (!s) {
return SERD_ERR_OVERFLOW;
}