diff options
Diffstat (limited to 'upb/pb')
-rw-r--r-- | upb/pb/compile_decoder_x64.c | 3 | ||||
-rw-r--r-- | upb/pb/decoder.c | 6 | ||||
-rw-r--r-- | upb/pb/encoder.c | 4 |
3 files changed, 8 insertions, 5 deletions
diff --git a/upb/pb/compile_decoder_x64.c b/upb/pb/compile_decoder_x64.c index b4086c7..a0cb3c9 100644 --- a/upb/pb/compile_decoder_x64.c +++ b/upb/pb/compile_decoder_x64.c @@ -7,6 +7,9 @@ * Driver code for the x64 JIT compiler. */ +// Needed to ensure we get defines like MAP_ANON. +#define _GNU_SOURCE + #include <dlfcn.h> #include <stdio.h> #include <sys/mman.h> diff --git a/upb/pb/decoder.c b/upb/pb/decoder.c index f371bce..f23645d 100644 --- a/upb/pb/decoder.c +++ b/upb/pb/decoder.c @@ -120,7 +120,7 @@ static bool in_residual_buf(const upb_pbdecoder *d, const char *p) { // and the parsing stack, so must be called whenever either is updated. static void set_delim_end(upb_pbdecoder *d) { size_t delim_ofs = d->top->end_ofs - d->bufstart_ofs; - if (delim_ofs <= (d->end - d->buf)) { + if (delim_ofs <= (size_t)(d->end - d->buf)) { d->delim_end = d->buf + delim_ofs; d->data_end = d->delim_end; } else { @@ -265,7 +265,7 @@ UPB_NOINLINE static int32_t getbytes_slow(upb_pbdecoder *d, void *buf, advancetobuf(d, d->buf_param, d->size_param); } if (curbufleft(d) >= bytes) { - consumebytes(d, buf + avail, bytes); + consumebytes(d, (char *)buf + avail, bytes); return DECODE_OK; } else if (d->data_end == d->delim_end) { seterr(d, "Submessage ended in the middle of a value or group"); @@ -294,7 +294,7 @@ UPB_NOINLINE static size_t peekbytes_slow(upb_pbdecoder *d, void *buf, memcpy(buf, d->ptr, ret); if (in_residual_buf(d, d->ptr)) { size_t copy = UPB_MIN(bytes - ret, d->size_param); - memcpy(buf + ret, d->buf_param, copy); + memcpy((char *)buf + ret, d->buf_param, copy); ret += copy; } return ret; diff --git a/upb/pb/encoder.c b/upb/pb/encoder.c index 7a50996..ca5ebc1 100644 --- a/upb/pb/encoder.c +++ b/upb/pb/encoder.c @@ -141,7 +141,7 @@ static upb_pb_encoder_segment *top(upb_pb_encoder *e) { // Call to ensure that at least "bytes" bytes are available for writing at // e->ptr. Returns false if the bytes could not be allocated. static bool reserve(upb_pb_encoder *e, size_t bytes) { - if ((e->limit - e->ptr) < bytes) { + if ((size_t)(e->limit - e->ptr) < bytes) { // Grow buffer. size_t needed = bytes + (e->ptr - e->buf); size_t old_size = e->limit - e->buf; @@ -170,7 +170,7 @@ static bool reserve(upb_pb_encoder *e, size_t bytes) { // Call when "bytes" bytes have been writte at e->ptr. The caller *must* have // previously called reserve() with at least this many bytes. static void encoder_advance(upb_pb_encoder *e, size_t bytes) { - assert((e->limit - e->ptr) >= bytes); + assert((size_t)(e->limit - e->ptr) >= bytes); e->ptr += bytes; } |