From 612a981824f3b5b4d4136ad0a8a1ed3a0f691a24 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Fri, 26 Oct 2007 09:12:33 +0000 Subject: [PATCH] fix signedness warnings in code --- src/admin.c | 4 ++-- src/mbuf.h | 2 +- src/proto.c | 3 +-- src/varcache.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/admin.c b/src/admin.c index 65d0e5f..715604d 100644 --- a/src/admin.c +++ b/src/admin.c @@ -198,7 +198,7 @@ static bool send_one_fd(PgSocket *admin, if (res < 0) { log_error("send_one_fd: sendmsg error: %s", strerror(errno)); return false; - } else if (res != iovec.iov_len) { + } else if ((size_t)res != iovec.iov_len) { log_error("send_one_fd: partial sendmsg"); return false; } @@ -738,7 +738,7 @@ static bool admin_cmd_pause(PgSocket *admin, const char *arg) /* extract substring from regex group */ static void copy_arg(const char *src, regmatch_t *glist, - int gnum, char *dst, int dstmax) + int gnum, char *dst, unsigned dstmax) { regmatch_t *g = &glist[gnum]; unsigned len = g->rm_eo - g->rm_so; diff --git a/src/mbuf.h b/src/mbuf.h index 3142fea..bc18540 100644 --- a/src/mbuf.h +++ b/src/mbuf.h @@ -80,7 +80,7 @@ static inline unsigned mbuf_get_uint64(MBuf *buf) static inline const uint8 * mbuf_get_bytes(MBuf *buf, unsigned len) { const uint8 *res = buf->pos; - if (len > buf->end - buf->pos) + if (buf->pos + len > buf->end) fatal("buffer overflow"); buf->pos += len; return res; diff --git a/src/proto.c b/src/proto.c index 6a8106c..fe0c53e 100644 --- a/src/proto.c +++ b/src/proto.c @@ -317,9 +317,8 @@ int scan_text_result(MBuf *pkt, const char *tupdesc, ...) { char *val = NULL; int len; - unsigned ncol, i; + unsigned ncol, i, asked; va_list ap; - int asked; int *int_p; uint64 *long_p; char **str_p; diff --git a/src/varcache.c b/src/varcache.c index acf6001..6276d82 100644 --- a/src/varcache.c +++ b/src/varcache.c @@ -101,7 +101,7 @@ static int apply_var(PktBuf *pkt, const char *key, { char buf[128]; char qbuf[128]; - int len; + unsigned len; if (strcasecmp(cval, sval) == 0) return 0; -- 2.40.0