diff options
-rw-r--r-- | pttbbs/include/proto.h | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/assess.c | 10 | ||||
-rw-r--r-- | pttbbs/mbbsd/cal.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/captcha.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/edit.c | 10 | ||||
-rw-r--r-- | pttbbs/mbbsd/mbbsd.c | 4 | ||||
-rw-r--r-- | pttbbs/mbbsd/screen.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/timecap.c | 2 | ||||
-rw-r--r-- | pttbbs/mbbsd/vote.c | 4 | ||||
-rw-r--r-- | pttbbs/mbbsd/vtuikit.c | 6 |
10 files changed, 24 insertions, 20 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index e88d1d8d..78a03ee5 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -154,7 +154,7 @@ char *get_restriction_reason( time4_t firstlogin, unsigned int numlogindays, unsigned int numposts, unsigned int badpost, time4_t limits_regtime, unsigned int limits_logins, - int limits_posts, unsigned int limits_badpost, + unsigned int limits_posts, unsigned int limits_badpost, size_t sz_msg, char *msg); /* ccw (common chat window) */ diff --git a/pttbbs/mbbsd/assess.c b/pttbbs/mbbsd/assess.c index 10a138df..e2efc168 100644 --- a/pttbbs/mbbsd/assess.c +++ b/pttbbs/mbbsd/assess.c @@ -6,7 +6,7 @@ /* do (*num) + n, n is integer. */ inline static void inc(unsigned char *num, int n) { - if (n >= 0 && UCHAR_MAX - *num <= n) + if (n >= 0 && UCHAR_MAX - *num <= (unsigned)n) (*num) = UCHAR_MAX; else if (n < 0 && *num < -n) (*num) = 0; @@ -52,7 +52,7 @@ int assign_badpost(const char *userid, fileheader_t *fhdr, assert(tusernum > 0 && tusernum < MAX_USERS); move(b_lines - 2, 0); clrtobot(); - for (i = 0; i < DIM(badpost_reason); i++) + for (i = 0; i < (int)DIM(badpost_reason); i++) prints("%d.%s ", i + 1, badpost_reason[i]); prints("%d.%s ", i + 1, "其他"); prints("0.取消劣文 "); @@ -63,13 +63,13 @@ int assign_badpost(const char *userid, fileheader_t *fhdr, vmsg("取消設定劣文。"); return -1; } - if (i < 0 || i > DIM(badpost_reason)) + if (i < 0 || i > (int)DIM(badpost_reason)) bell(); else break; } while (1); - if (i < DIM(badpost_reason)) + if (i < (int)DIM(badpost_reason)) sprintf(genbuf,"劣%s文退回(%s)", comment ? "推" : "", badpost_reason[i]); else if(i==DIM(badpost_reason)) { @@ -88,7 +88,7 @@ int assign_badpost(const char *userid, fileheader_t *fhdr, strcat(genbuf,")"); } - assert(i >= 0 && i <= DIM(badpost_reason)); + assert(i >= 0 && i <= (int)DIM(badpost_reason)); if (fhdr) strncat(genbuf, fhdr->title, 64-strlen(genbuf)); #ifdef USE_COOLDOWN diff --git a/pttbbs/mbbsd/cal.c b/pttbbs/mbbsd/cal.c index 29e114c4..0cf34cb5 100644 --- a/pttbbs/mbbsd/cal.c +++ b/pttbbs/mbbsd/cal.c @@ -8,7 +8,7 @@ char *get_restriction_reason( time4_t firstlogin, unsigned int numlogindays, unsigned int numposts, unsigned int badpost, time4_t limits_regtime, unsigned int limits_logins, - int limits_posts, unsigned int limits_badpost, + unsigned int limits_posts, unsigned int limits_badpost, size_t sz_msg, char *msg) { syncnow(); diff --git a/pttbbs/mbbsd/captcha.c b/pttbbs/mbbsd/captcha.c index b6bffb8d..9af29bc5 100644 --- a/pttbbs/mbbsd/captcha.c +++ b/pttbbs/mbbsd/captcha.c @@ -75,7 +75,7 @@ _vgetcb_data_upper(int key, VGET_RUNTIME *prt GCC_UNUSED, void *instance GCC_UNU } static int -_vgetcb_data_change(int key, VGET_RUNTIME *prt GCC_UNUSED, void *instance GCC_UNUSED) +_vgetcb_data_change(int key GCC_UNUSED, VGET_RUNTIME *prt GCC_UNUSED, void *instance GCC_UNUSED) { char *s = prt->buf; while (*s) diff --git a/pttbbs/mbbsd/edit.c b/pttbbs/mbbsd/edit.c index f872d25a..c1c95395 100644 --- a/pttbbs/mbbsd/edit.c +++ b/pttbbs/mbbsd/edit.c @@ -1223,7 +1223,7 @@ load_file(FILE * fp, off_t offSig) while (fgets(buf, sizeof(buf), fp)) { szread += strlen(buf); - if (offSig < 0 || szread <= offSig) + if (offSig < 0 || szread <= (size_t)offSig) { insert_string(buf); } @@ -1873,8 +1873,11 @@ write_file(const char *fpath, int saveheader, int *islocal, char mytitle[STRLEN] FILE *fp = NULL; textline_t *p; char ans[TTLEN], *msg; - int aborted = 0, line = 0, checksum[3], sum = 0, po = 1; + int aborted = 0, line = 0; int entropy = 0; +#ifdef USE_POSTRECORD + int checksum[3], sum = 0, po = 1; +#endif assert(!chtitle || mytitle); vs_hdr("檔案處理"); @@ -3371,7 +3374,8 @@ static const char* phone_char(char c) { if (curr_buf->last_phone_mode > 0 && curr_buf->last_phone_mode < 20) { - if (tolower(c)<'a'||(tolower(c)-'a') >= strlen(BIG5[curr_buf->last_phone_mode - 1]) / 2) + if (tolower(c) < 'a' || + (tolower(c)-'a') >= (int)strlen(BIG5[curr_buf->last_phone_mode - 1]) / 2) return 0; return BIG5[curr_buf->last_phone_mode - 1] + (tolower(c) - 'a') * 2; } diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c index 791b063e..b7d512b5 100644 --- a/pttbbs/mbbsd/mbbsd.c +++ b/pttbbs/mbbsd/mbbsd.c @@ -1948,8 +1948,8 @@ tunnel_login(char *argv0, struct ProgramOption *option) { return 0; } - if (toread (tunnel, &dat, sizeof(dat)) < sizeof(dat) || - towrite(tunnel, &dat.ack, sizeof(dat.ack)) < sizeof(dat.ack)) + if (toread(tunnel, &dat, sizeof(dat)) < (int)sizeof(dat) || + towrite(tunnel, &dat.ack, sizeof(dat.ack)) < (int)sizeof(dat.ack)) return 0; assert(dat.cb == sizeof(dat)); diff --git a/pttbbs/mbbsd/screen.c b/pttbbs/mbbsd/screen.c index 51921b47..711103fc 100644 --- a/pttbbs/mbbsd/screen.c +++ b/pttbbs/mbbsd/screen.c @@ -758,7 +758,7 @@ grayout(int y, int end, int level) // not exceed t_columns. buffer overflow is impossible. // but to make it more robust, let's quick check here. // of course, t_columns should always be far smaller. - if (strlen((char*)slp->data) > t_columns) + if (strlen((char*)slp->data) > (size_t)t_columns) slp->data[t_columns] = 0; strcpy((char*)slp->data, level < 0 ? ANSI_COLOR(1) : ANSI_COLOR(1;30;40)); diff --git a/pttbbs/mbbsd/timecap.c b/pttbbs/mbbsd/timecap.c index 1ead40b1..5afcf877 100644 --- a/pttbbs/mbbsd/timecap.c +++ b/pttbbs/mbbsd/timecap.c @@ -166,7 +166,7 @@ timecap_add_archive(const char *capsule_index, return 0; // the blob must provide enough information to get the object name. - if (write(fd, ref_blob, ref_blob_size) != ref_blob_size) { + if (write(fd, ref_blob, ref_blob_size) != (int)ref_blob_size) { close(fd); return 0; } diff --git a/pttbbs/mbbsd/vote.c b/pttbbs/mbbsd/vote.c index 0be205e3..1a02b076 100644 --- a/pttbbs/mbbsd/vote.c +++ b/pttbbs/mbbsd/vote.c @@ -795,9 +795,9 @@ user_vote_one(const vote_buffer_t *vbuf, const char *bname) // XXX if this is a private vote (limited), I think we don't need to check limits? if (cuser.firstlogin > closetime) reason = "註冊時間"; - else if (cuser.numposts < limits_posts) + else if (cuser.numposts < (uint32_t)limits_posts) reason = "文章總數"; - else if (cuser.numlogindays < limits_logins) + else if (cuser.numlogindays < (uint32_t)limits_logins) reason = STR_LOGINDAYS; if (reason) diff --git a/pttbbs/mbbsd/vtuikit.c b/pttbbs/mbbsd/vtuikit.c index bbb2ecae..9d9d6951 100644 --- a/pttbbs/mbbsd/vtuikit.c +++ b/pttbbs/mbbsd/vtuikit.c @@ -233,7 +233,7 @@ vfill(int n, int flags, const char *s) if (flags & VFILL_RIGHT_ALIGN) { // right-align - int l = has_ansi ? strlen_noansi(s) : strlen(s); + int l = has_ansi ? strlen_noansi(s) : (int)strlen(s); if (l >= n) // '=' prevents blanks l = n; @@ -727,7 +727,7 @@ vs_footer(const char *caption, const char *msg) outs(caption); i += (*caption == ESC_CHR) ? strlen_noansi(caption) : - strlen(caption); + (int)strlen(caption); } if (!msg) msg = ""; @@ -1086,7 +1086,7 @@ vgetstring(char *_buf, int len, int flags, const char *defstr, const VGET_CALLBA // than STRLEN. Although we support large screen, // inputting huge line will just make troubles... if (len > STRLEN) len = STRLEN; - assert(len <= sizeof(buf) && len >= 2); + assert(len <= (int)sizeof(buf) && len >= 2); // adjust flags if (flags & (VGET_NOECHO | VGET_DIGITS)) |