diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-12-23 16:51:23 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-12-23 16:51:23 -0800 |
commit | db59a5198f890ecdcac1227b0bb998160acac5c6 (patch) | |
tree | b708cdab7403bb78dbb9fb7aa82f7ba0e4379361 /upb/bytestream.c | |
parent | 02ede91eb243f514f0db1e972d1882e92fa9c8d8 (diff) |
Fixes to un-break "make descriptorgen"
Diffstat (limited to 'upb/bytestream.c')
-rw-r--r-- | upb/bytestream.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; |