diff options
-rw-r--r-- | pttbbs/common/sys/record.c | 8 | ||||
-rw-r--r-- | pttbbs/common/sys/string.c | 14 | ||||
-rw-r--r-- | pttbbs/common/sys/vbuf.c | 2 | ||||
-rw-r--r-- | pttbbs/pttbbs.mk | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/pttbbs/common/sys/record.c b/pttbbs/common/sys/record.c index d91df1e9..df78f699 100644 --- a/pttbbs/common/sys/record.c +++ b/pttbbs/common/sys/record.c @@ -132,7 +132,7 @@ substitute_record2(const char *fpath, const void *srcptr, const void *destptr, PttLock(fd, offset, size, F_WRLCK); while(cb_can_substitue) { err = -1; - if (read(fd, p, size) != size) + if (read(fd, p, size) != (ssize_t)size) break; if (!cb_can_substitue(p, srcptr)) break; @@ -142,7 +142,7 @@ substitute_record2(const char *fpath, const void *srcptr, const void *destptr, break; } if (err == 0) { - if (write(fd, destptr, size) != size) + if (write(fd, destptr, size) != (ssize_t)size) err = -1; } PttLock(fd, offset, size, F_UNLCK); @@ -197,7 +197,7 @@ delete_record2(const char *fpath, const void *rptr, size_t size, err = -1; if (lseek(fi, offset, SEEK_SET) != offset) break; - if (read(fi, p, size) != size) + if (read(fi, p, size) != (ssize_t)size) break; if (!cb_can_delete(p, rptr)) break; @@ -297,7 +297,7 @@ apply_record(const char *fpath, int (*fptr) (void *item, void *optarg), if ((fd = open(fpath, O_RDONLY, 0)) == -1) return -1; - while (read(fd, buf, size) == size) + while (read(fd, buf, size) == (ssize_t)size) if ((ret = (*fptr) (buf, arg)) != 0) { close(fd); return ret; diff --git a/pttbbs/common/sys/string.c b/pttbbs/common/sys/string.c index da35cfea..9be5874a 100644 --- a/pttbbs/common/sys/string.c +++ b/pttbbs/common/sys/string.c @@ -523,12 +523,12 @@ char * qp_encode (char *s, size_t slen, const char *d, const char *tocode) char hex[] = "0123456789ABCDEF"; char *s0 = s; - memcpy (s, "=?", 2), s += 2; - memcpy (s, tocode, strlen (tocode)), s += strlen (tocode); - memcpy (s, "?Q?", 3), s += 3; - assert(s-s0+3<slen); + memcpy(s, "=?", 2), s += 2; + memcpy(s, tocode, strlen (tocode)), s += strlen (tocode); + memcpy(s, "?Q?", 3), s += 3; + assert(s - s0 + 3 < (int)slen); - while (*d != '\0' && s-s0+6<slen) + while (*d != '\0' && (s - s0 + 6 < (int)slen)) { unsigned char c = *d++; if (c == ' ') @@ -755,7 +755,7 @@ str_decode_M3(char *str) dst = buf; adj = 0; - while (*src && (dst - buf) < sizeof(buf) - 1) { + while (*src && (dst - buf) < (int)sizeof(buf) - 1) { if (*src != '=') { /* Thor: not coded */ unsigned char *tmp = src; while (adj && *tmp && isspace(*tmp)) @@ -773,7 +773,7 @@ str_decode_M3(char *str) tmp++; i = 0; while (*tmp && *tmp != '?') { - if (i + 1 < sizeof(charset)) { + if (i + 1 < (int)sizeof(charset)) { charset[i] = *tmp; charset[i + 1] = '\0'; i++; diff --git a/pttbbs/common/sys/vbuf.c b/pttbbs/common/sys/vbuf.c index 0fa6f24c..d65b0d70 100644 --- a/pttbbs/common/sys/vbuf.c +++ b/pttbbs/common/sys/vbuf.c @@ -121,7 +121,7 @@ VBUFPROTO int vbuf_peekat(VBUF *v, int i) { const char *s = v->head + i; - if (vbuf_is_empty(v) || i >= vbuf_capacity(v)) + if (vbuf_is_empty(v) || i >= (int)vbuf_capacity(v)) return EOF; if (s < v->tail) return (unsigned char)*s; diff --git a/pttbbs/pttbbs.mk b/pttbbs/pttbbs.mk index 0a83c607..92b1ed2e 100644 --- a/pttbbs/pttbbs.mk +++ b/pttbbs/pttbbs.mk @@ -32,7 +32,7 @@ PTT_CFLAGS:= $(PTT_WARN) -pipe -DBBSHOME='"$(BBSHOME)"' -I$(SRCROOT)/include PTT_CXXFLAGS:= $(PTT_WARN) -pipe -DBBSHOME='"$(BBSHOME)"' -I$(SRCROOT)/include PTT_LDFLAGS:= -Wl,--as-needed .if $(CLANG) -PTT_CFLAGS+= -Qunused-arguments +PTT_CFLAGS+= -Qunused-arguments -Wno-parentheses-equality .endif # enable assert() |