diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-01-25 10:07:47 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-01-25 10:07:47 -0800 |
commit | 2c24cbb108bbda296f01e7628028b1dcb2b9516b (patch) | |
tree | daa31a93b2c7d45de2df344eb2ec6e73b635bdb7 /core/upb_stream.h | |
parent | 93381f1411def0dba5677b71cd4df859d99777f3 (diff) |
More work on decoder and stdio bytesrc/bytesink.
Diffstat (limited to 'core/upb_stream.h')
-rw-r--r-- | core/upb_stream.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/upb_stream.h b/core/upb_stream.h index bf312a8..d0045cc 100644 --- a/core/upb_stream.h +++ b/core/upb_stream.h @@ -178,12 +178,16 @@ INLINE void upb_src_run(upb_src *src, upb_status *status); INLINE upb_strlen_t upb_bytesrc_read(upb_bytesrc *src, void *buf, upb_strlen_t count, upb_status *status); -// Like upb_bytesrc_read(), but modifies "str" in-place, possibly aliasing -// existing string data (which avoids a copy). On the other hand, if -// the data was *not* already in an existing string, this copies it into -// a upb_string, and if the data needs to be put in a specific range of -// memory (because eg. you need to put it into a different kind of string -// object) then upb_bytesrc_get() could be better. +// Like upb_bytesrc_read(), but modifies "str" in-place. "str" MUST be newly +// created or just recycled. Returns "false" if no data was returned, either +// due to error or EOF (check status for details). +// +// In comparison to upb_bytesrc_read(), this call can possibly alias existing +// string data (which avoids a copy). On the other hand, if the data was *not* +// already in an existing string, this copies it into a upb_string, and if the +// data needs to be put in a specific range of memory (because eg. you need to +// put it into a different kind of string object) then upb_bytesrc_get() could +// be better. INLINE bool upb_bytesrc_getstr(upb_bytesrc *src, upb_string *str, upb_status *status); |