summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stream/upb_decoder.c3
-rw-r--r--stream/upb_stdio.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/stream/upb_decoder.c b/stream/upb_decoder.c
index 9a3f6b0..64057c5 100644
--- a/stream/upb_decoder.c
+++ b/stream/upb_decoder.c
@@ -91,10 +91,10 @@ static bool upb_decoder_nextbuf(upb_decoder *d)
// Recycle old buffer.
if(d->buf) {
- d->buf = upb_string_tryrecycle(d->buf);
d->buf_offset -= upb_string_len(d->buf);
d->buf_stream_offset += upb_string_len(d->buf);
}
+ d->buf = upb_string_tryrecycle(d->buf);
// Pull next buffer.
if(upb_bytesrc_get(d->bytesrc, d->buf, UPB_MAX_ENCODED_SIZE)) {
@@ -569,6 +569,7 @@ void upb_decoder_reset(upb_decoder *d, upb_bytesrc *bytesrc)
// to UINT32_MAX so it doesn't equal UPB_GROUP_END_OFFSET.
d->top->end_offset = UINT32_MAX - 1;
d->bytesrc = bytesrc;
+ d->field = NULL;
d->buf = NULL;
d->buf_bytesleft = 0;
d->buf_stream_offset = 0;
diff --git a/stream/upb_stdio.c b/stream/upb_stdio.c
index 89a6621..820399b 100644
--- a/stream/upb_stdio.c
+++ b/stream/upb_stdio.c
@@ -53,7 +53,7 @@ bool upb_stdio_append(upb_bytesrc *src, upb_string *str, upb_strlen_t len) {
}
int32_t upb_stdio_put(upb_bytesink *sink, upb_string *str) {
- upb_stdio *stdio = (upb_stdio*)sink - offsetof(upb_stdio, bytesink);
+ upb_stdio *stdio = (upb_stdio*)((char*)sink - offsetof(upb_stdio, bytesink));
upb_strlen_t len = upb_string_len(str);
size_t written = fwrite(upb_string_getrobuf(str), 1, len, stdio->file);
if(written < len) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback