summaryrefslogtreecommitdiff
path: root/upb/pb
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2015-05-08 17:03:20 -0700
committerJosh Haberman <jhaberman@gmail.com>2015-05-08 17:03:20 -0700
commitfa10302a502de38a66ed921eeeacb4107e9572a2 (patch)
tree5ed1bca20a889458c431da37c701aae131e15c4a /upb/pb
parent3bd691a4975b2267ff04611507e766a7f9f87e83 (diff)
parentbd7ea8c6f1854aa37b7792c6f23334ffc0fd94ff (diff)
Merge from open-source development.
Diffstat (limited to 'upb/pb')
-rw-r--r--upb/pb/compile_decoder_x64.c3
-rw-r--r--upb/pb/decoder.c6
-rw-r--r--upb/pb/encoder.c4
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;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback