summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
Diffstat (limited to 'upb')
-rw-r--r--upb/bytestream.c4
-rw-r--r--upb/bytestream.h3
-rw-r--r--upb/handlers.c1
-rw-r--r--upb/pb/decoder.c6
-rw-r--r--upb/pb/decoder_x64.dasc3
-rw-r--r--upb/upb.c3
-rw-r--r--upb/upb.h2
7 files changed, 15 insertions, 7 deletions
diff --git a/upb/bytestream.c b/upb/bytestream.c
index 8feb678..4f6e4b1 100644
--- a/upb/bytestream.c
+++ b/upb/bytestream.c
@@ -91,10 +91,10 @@ static upb_stdio_buf *upb_stdio_findbuf(const upb_stdio *s, uint64_t ofs) {
static upb_stdio_buf *upb_stdio_rotatebufs(upb_stdio *s) {
upb_stdio_buf **reuse = NULL; // XXX
- int num_reused = 0, num_inuse = 0;
+ uint32_t num_reused = 0, num_inuse = 0;
// Could sweep only a subset of bufs if this was a hotspot.
- for (int i = 0; i < s->nbuf; i++) {
+ for (uint32_t i = 0; i < s->nbuf; i++) {
upb_stdio_buf *buf = s->bufs[i];
if (buf->refcount > 0) {
s->bufs[num_inuse++] = buf;
diff --git a/upb/bytestream.h b/upb/bytestream.h
index 409ae80..fe049d2 100644
--- a/upb/bytestream.h
+++ b/upb/bytestream.h
@@ -372,7 +372,8 @@ INLINE int upb_bytesink_putc(upb_bytesink *sink, char ch) {
}
INLINE int upb_bytesink_putrepeated(upb_bytesink *sink, char ch, int len) {
- for (int i = 0; i < len; i++)
+ int i;
+ for (i = 0; i < len; i++)
if (upb_bytesink_write(sink, &ch, 1) < 0)
return -1;
return len;
diff --git a/upb/handlers.c b/upb/handlers.c
index d1b68ad..1ccaf8d 100644
--- a/upb/handlers.c
+++ b/upb/handlers.c
@@ -187,6 +187,7 @@ upb_dispatcher_frame *upb_dispatcher_reset(upb_dispatcher *d, void *closure,
}
void upb_dispatcher_uninit(upb_dispatcher *d) {
+ (void)d;
}
void upb_dispatch_startmsg(upb_dispatcher *d) {
diff --git a/upb/pb/decoder.c b/upb/pb/decoder.c
index 1b5fc17..06125dd 100644
--- a/upb/pb/decoder.c
+++ b/upb/pb/decoder.c
@@ -96,7 +96,12 @@ void upb_decoderplan_unref(upb_decoderplan *p) {
}
bool upb_decoderplan_hasjitcode(upb_decoderplan *p) {
+#ifdef UPB_USE_JIT_X64
return p->jit_code != NULL;
+#else
+ (void)p;
+ return false;
+#endif
}
@@ -537,6 +542,7 @@ void upb_decoder_resetplan(upb_decoder *d, upb_decoderplan *p, int msg_offset) {
void upb_decoder_resetinput(upb_decoder *d, upb_byteregion *input,
void *closure) {
assert(d->plan);
+ assert(upb_byteregion_discardofs(input) == upb_byteregion_startofs(input));
upb_dispatcher_frame *f =
upb_dispatcher_reset(&d->dispatcher, closure, d->plan->handlers->msgs[0]);
upb_status_clear(&d->status);
diff --git a/upb/pb/decoder_x64.dasc b/upb/pb/decoder_x64.dasc
index 807191b..fa984ef 100644
--- a/upb/pb/decoder_x64.dasc
+++ b/upb/pb/decoder_x64.dasc
@@ -308,7 +308,6 @@ static void upb_assert_notnull(void *addr) { assert(addr != NULL); }
// Decodes the next val into ARG3, advances PTR.
static void upb_decoderplan_jit_decodefield(upb_decoderplan *plan,
- upb_mhandlers *m,
uint8_t type, size_t tag_size) {
// Decode the value into arg 3 for the callback.
switch (type) {
@@ -559,7 +558,7 @@ static void upb_decoderplan_jit_field(upb_decoderplan *plan, uint64_t tag,
return;
}
- upb_decoderplan_jit_decodefield(plan, m, f->type, tag_size);
+ upb_decoderplan_jit_decodefield(plan, f->type, tag_size);
upb_decoderplan_jit_callcb(plan, f);
// Epilogue: load next tag, check for repeated field.
diff --git a/upb/upb.c b/upb/upb.c
index a3e07e4..3af9b75 100644
--- a/upb/upb.c
+++ b/upb/upb.c
@@ -142,7 +142,8 @@ bool upb_errno_is_wouldblock() {
bool upb_posix_codetostr(int code, char *buf, size_t len) {
if (strerror_r(code, buf, len) == -1) {
if (errno == EINVAL) {
- return snprintf(buf, len, "Invalid POSIX error number %d\n", code) >= len;
+ int n = snprintf(buf, len, "Invalid POSIX error number %d\n", code);
+ return n >= (int)len;
} else if (errno == ERANGE) {
return false;
}
diff --git a/upb/upb.h b/upb/upb.h
index d11c7cb..01970ca 100644
--- a/upb/upb.h
+++ b/upb/upb.h
@@ -262,7 +262,7 @@ void upb_status_copy(upb_status *to, const upb_status *from);
extern upb_errorspace upb_posix_errorspace;
void upb_status_fromerrno(upb_status *status);
-bool upb_errno_is_wouldblock();
+bool upb_errno_is_wouldblock(void);
// Like vasprintf (which allocates a string large enough for the result), but
// uses *buf (which can be NULL) as a starting point and reallocates it only if
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback