From 621c0cdcb5efc4f7c2382031becded018ef0b62b Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 4 Sep 2011 19:29:36 -0700 Subject: Const invasion: large parts of upb made const-correct. --- upb/bytestream.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'upb/bytestream.h') diff --git a/upb/bytestream.h b/upb/bytestream.h index 0a744f6..96d840c 100644 --- a/upb/bytestream.h +++ b/upb/bytestream.h @@ -36,7 +36,7 @@ extern "C" { // data around for later use, without requiring a copy out of the input // buffers. typedef size_t upb_bytesrc_fetch_func(void*, uint64_t, upb_status*); -typedef void upb_bytesrc_read_func(void*, uint64_t, size_t, char*); +typedef void upb_bytesrc_read_func(const void*, uint64_t, size_t, char*); typedef const char *upb_bytesrc_getptr_func(void*, uint64_t, size_t*); typedef void upb_bytesrc_refregion_func(void*, uint64_t, size_t); typedef void upb_bytesrc_ref_func(void*); @@ -74,8 +74,8 @@ INLINE size_t upb_bytesrc_fetch(upb_bytesrc *src, uint64_t ofs, upb_status *s) { // Copies "len" bytes of data from offset src_ofs to "dst", which must be at // least "len" bytes long. The caller must own a ref on the given region. -INLINE void upb_bytesrc_read(upb_bytesrc *src, uint64_t src_ofs, size_t len, - char *dst) { +INLINE void upb_bytesrc_read(const upb_bytesrc *src, uint64_t src_ofs, + size_t len, char *dst) { src->vtbl->read(src, src_ofs, len, dst); } @@ -149,9 +149,9 @@ typedef struct _upb_strref { // Copies the contents of the strref into a newly-allocated, NULL-terminated // string. -char *upb_strref_dup(struct _upb_strref *r); +char *upb_strref_dup(const struct _upb_strref *r); -INLINE void upb_strref_read(struct _upb_strref *r, char *buf) { +INLINE void upb_strref_read(const struct _upb_strref *r, char *buf) { if (r->ptr) { memcpy(buf, r->ptr, r->len); } else { -- cgit v1.2.3