From db59a5198f890ecdcac1227b0bb998160acac5c6 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 23 Dec 2011 16:51:23 -0800 Subject: Fixes to un-break "make descriptorgen" --- upb/bytestream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'upb/bytestream.c') diff --git a/upb/bytestream.c b/upb/bytestream.c index 4f6e4b1..812e552 100644 --- a/upb/bytestream.c +++ b/upb/bytestream.c @@ -32,6 +32,8 @@ upb_byteregion *upb_byteregion_newl(const void *str, size_t len) { memcpy(ptr, str, len); ptr[len] = '\0'; upb_stringsrc_reset(src, ptr, len); + upb_byteregion_fetch(upb_stringsrc_allbytes(src)); + assert(len == upb_byteregion_available(upb_stringsrc_allbytes(src), 0)); return upb_stringsrc_allbytes(src); } @@ -241,9 +243,10 @@ upb_bytesink* upb_stdio_bytesink(upb_stdio *stdio) { return &stdio->sink; } upb_bytesuccess_t upb_stringsrc_fetch(void *_src, uint64_t ofs, size_t *read) { upb_stringsrc *src = _src; - assert(ofs < src->len); + assert(ofs <= src->len); if (ofs == src->len) { upb_status_seteof(&src->bytesrc.status); + *read = 0; return UPB_BYTE_EOF; } *read = src->len - ofs; -- cgit v1.2.3