From ce591a73e5bafcf08b93da768b8c76c5e824f599 Mon Sep 17 00:00:00 2001 From: in2 Date: Tue, 31 Dec 2002 17:40:52 +0000 Subject: make gcc33 happy git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@592 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/board.c | 6 +++--- mbbsd/cache.c | 4 ++-- mbbsd/calendar.c | 4 ++-- mbbsd/chat.c | 6 +++--- mbbsd/chc_draw.c | 4 ++-- mbbsd/edit.c | 16 +++++++++------- mbbsd/friend.c | 6 +++--- mbbsd/more.c | 8 +++++--- mbbsd/record.c | 4 ++-- mbbsd/talk.c | 4 ++-- mbbsd/user.c | 6 +++--- mbbsd/var.c | 5 +++-- mbbsd/vote.c | 4 ++-- 13 files changed, 41 insertions(+), 36 deletions(-) diff --git a/mbbsd/board.c b/mbbsd/board.c index ddeef92e..87ebbeb2 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -1,4 +1,4 @@ -/* $Id: board.c,v 1.65 2002/12/29 08:18:29 in2 Exp $ */ +/* $Id: board.c,v 1.66 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" #define BRC_STRLEN 15 /* Length of board name */ #define BRC_MAXSIZE 24576 @@ -324,7 +324,7 @@ save_brdbuf() if ( zapbuf != NULL ){ if( ( #ifdef MEM_CHECK - zapbuf[-1] == MEM_CHECK && + (unsigned)zapbuf[-1] == (unsigned)MEM_CHECK && #endif zapchange && (fd = open(fname, O_WRONLY | O_CREAT, 0600)) != -1) ){ @@ -343,7 +343,7 @@ save_brdbuf() if ( favbuf != NULL ){ if( ( #ifdef MEM_CHECK - ((int*)favbuf)[-1] == MEM_CHECK && + (unsigned)((int*)favbuf)[-1] == (unsigned)MEM_CHECK && #endif favchange && (fd = open(fname, O_WRONLY | O_CREAT, 0600)) != -1) ){ diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 1289dd51..f8cc453f 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.53 2002/11/16 13:41:07 kcwu Exp $ */ +/* $Id: cache.c,v 1.54 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" #ifndef __FreeBSD__ @@ -324,7 +324,7 @@ u_namearray(char buf[][IDLEN + 1], int *pnum, char *tag) /*-------------------------------------------------------*/ #if !defined(_BBS_UTIL_C_) void -setutmpmode(int mode) +setutmpmode(unsigned int mode) { if (currstat != mode) currutmp->mode = currstat = mode; diff --git a/mbbsd/calendar.c b/mbbsd/calendar.c index 03cd84d6..c4b86e89 100644 --- a/mbbsd/calendar.c +++ b/mbbsd/calendar.c @@ -1,4 +1,4 @@ -/* $Id: calendar.c,v 1.6 2002/07/21 09:26:02 in2 Exp $ */ +/* $Id: calendar.c,v 1.7 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" typedef struct event_t { @@ -93,7 +93,7 @@ ParseColor(char *color) }; int i; - for (i = 0; i < sizeof(c) / sizeof(c[0]); i++) + for (i = 0; (unsigned)i < sizeof(c) / sizeof(c[0]); i++) if (strcasecmp(color, c[i].str) == 0) return c[i].val; return 7; diff --git a/mbbsd/chat.c b/mbbsd/chat.c index 4c58b290..66954248 100644 --- a/mbbsd/chat.c +++ b/mbbsd/chat.c @@ -1,4 +1,4 @@ -/* $Id: chat.c,v 1.9 2002/07/22 19:02:00 in2 Exp $ */ +/* $Id: chat.c,v 1.10 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" static int chatline, stop_line; @@ -75,7 +75,7 @@ chat_recv(int fd, char *chatid) bptr = buf; while (c > 0) { len = strlen(bptr) + 1; - if (len > c && len < (sizeof buf / 2)) + if (len > c && (unsigned)len < (sizeof(buf)/ 2) ) break; if (*bptr == '/') { @@ -538,7 +538,7 @@ t_chat() break; } if (ch == Ctrl('D')) { - if (currchar < strlen(inbuf)) { + if ((size_t)currchar < strlen(inbuf)) { inbuf[69] = '\0'; memcpy(&inbuf[currchar], &inbuf[currchar + 1], 69 - currchar); move(b_lines - 1, currchar + chatid_len); diff --git a/mbbsd/chc_draw.c b/mbbsd/chc_draw.c index 8c7e556b..a3cda935 100644 --- a/mbbsd/chc_draw.c +++ b/mbbsd/chc_draw.c @@ -1,4 +1,4 @@ -/* $Id: chc_draw.c,v 1.4 2002/07/21 09:26:02 in2 Exp $ */ +/* $Id: chc_draw.c,v 1.5 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" #define SIDE_ROW 10 @@ -131,7 +131,7 @@ chc_drawline(board_t board, int line) } outs(" "); - if (line >= 3 && line < 3 + dim(hint_str)) { + if (line >= 3 && line < 3 + (int)dim(hint_str)) { outs(hint_str[line - 3]); } else if (line == SIDE_ROW) { prints("\033[1m你是%s%s\033[m", diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 1107a6f1..ec20e7c1 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1,4 +1,4 @@ -/* $Id: edit.c,v 1.23 2002/12/26 09:46:04 kcwu Exp $ */ +/* $Id: edit.c,v 1.24 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" typedef struct textline_t { struct textline_t *prev; @@ -1244,14 +1244,14 @@ match_paren() for (lino = currln, p = currline; p; p = p->next, lino++) { lino = lino; for (i = (lino == currln) ? currpnt + 1 : 0; - i < strlen(p->data); i++) + (size_t)i < strlen(p->data); i++) if (p->data[i] == '/' && p->data[++i] == '*') { ++i; while (1) { - while (i < strlen(p->data) - 1 && + while ((size_t)i < strlen(p->data) - 1 && !(p->data[i] == '*' && p->data[i + 1] == '/')) i++; - if (i >= strlen(p->data) - 1 && p->next) { + if ((size_t)i >= strlen(p->data) - 1 && p->next) { p = p->next; ++lino; i = 0; @@ -1261,11 +1261,11 @@ match_paren() } else if ((c = p->data[i]) == '\'' || c == '"') { while (1) { while (i < (int)(strlen(p->data) - 1)) - if (p->data[++i] == '\\' && i < strlen(p->data) - 2) + if (p->data[++i] == '\\' && (size_t)i < strlen(p->data) - 2) ++i; else if (p->data[i] == c) goto end_quote; - if (i >= strlen(p->data) - 1 && p->next) { + if ((size_t)i >= strlen(p->data) - 1 && p->next) { p = p->next; ++lino; i = -1; @@ -1281,7 +1281,9 @@ match_paren() } } else { for (lino = currln, p = currline; p; p = p->prev, lino--) - for (i = (lino == currln) ? currpnt - 1 : strlen(p->data) - 1; + for (i = ((lino == currln) ? + currpnt - 1 : + (int)strlen(p->data) - 1); i >= 0; i--) if (p->data[i] == '/' && p->data[--i] == '*' && i > 0) { --i; diff --git a/mbbsd/friend.c b/mbbsd/friend.c index 6becc8f9..15a00c50 100644 --- a/mbbsd/friend.c +++ b/mbbsd/friend.c @@ -1,4 +1,4 @@ -/* $Id: friend.c,v 1.13 2002/07/27 17:23:09 kcwu Exp $ */ +/* $Id: friend.c,v 1.14 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" /* ------------------------------------- */ @@ -56,7 +56,7 @@ setfriendfile(char *fpath, int type) setbfile(fpath, currboard, friend_file[type]); } -static int +static unsigned int friend_count(char *fname) { FILE *fp; @@ -185,7 +185,7 @@ friend_append(int type, int count) setfriendfile(sfile, j); if ((fp = fopen(sfile, "r")) != NULL) { - while (fgets(buf, 80, fp) && count <= friend_max[type]) { + while (fgets(buf, 80, fp) && (unsigned)count <= friend_max[type]) { char the_id[15]; sscanf(buf, "%s", the_id); diff --git a/mbbsd/more.c b/mbbsd/more.c index 3afc6ca9..a1d82e42 100644 --- a/mbbsd/more.c +++ b/mbbsd/more.c @@ -1,4 +1,4 @@ -/* $Id: more.c,v 1.21 2002/09/11 07:16:49 kcwu Exp $ */ +/* $Id: more.c,v 1.22 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" #define MORE_BUFSIZE 4096 #define MORE_WINSIZE 4096 @@ -293,7 +293,9 @@ more(char *fpath, int promptend) else pos++; - if (!scrollup && ++lino >= b_lines && pageno < MAX_PAGES - 1) { + if (!scrollup && + ++lino >= (unsigned)b_lines && + pageno < MAX_PAGES - 1 ) { pagebreak[++pageno] = viewed; lino = 1; } @@ -553,7 +555,7 @@ more(char *fpath, int promptend) clear(); } } - if (pageno && lino > 1 + local) { + if (pageno && (int)lino > 1 + local) { line = (lino - 2) - local; if (pageno > 1 && viewed == fsize) line += local; diff --git a/mbbsd/record.c b/mbbsd/record.c index 13db0da6..cc82cde8 100644 --- a/mbbsd/record.c +++ b/mbbsd/record.c @@ -1,4 +1,4 @@ -/* $Id: record.c,v 1.11 2002/11/06 16:25:15 in2 Exp $ */ +/* $Id: record.c,v 1.12 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" #undef HAVE_MMAP @@ -444,7 +444,7 @@ int apply_record(char *fpath, int (*fptr) (), int size){ if (!(fp = fopen(fpath, "r"))) return -1; - while (fread(abuf, 1, size, fp) == size) + while (fread(abuf, 1, size, fp) == (size_t)size) if ((*fptr) (abuf) == QUIT) { fclose(fp); return QUIT; diff --git a/mbbsd/talk.c b/mbbsd/talk.c index af88bc01..c7f6e7a7 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1,4 +1,4 @@ -/* $Id: talk.c,v 1.96 2002/12/04 10:14:07 in2 Exp $ */ +/* $Id: talk.c,v 1.97 2002/12/31 17:40:51 in2 Exp $ */ #include "bbs.h" #define QCAST int (*)(const void *, const void *) @@ -389,7 +389,7 @@ my_query(char *uident) Cdate(&muser.lastlogin), (muser.lasthost[0] ? muser.lasthost : "(不詳)")); if ((uentp && fri_stat & HFM && !uentp->invisible)) - prints("《 性 別 》%-28.28s《私有財產》%ld 銀兩\n", + prints("《 性 別 》%-28.28s《私有財產》%d 銀兩\n", sex[muser.sex % 8], muser.money); prints("《五子棋戰績》%3d 勝 %3d 敗 %3d 和 " diff --git a/mbbsd/user.c b/mbbsd/user.c index 5de29e36..e3bb1f89 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -1,4 +1,4 @@ -/* $Id: user.c,v 1.43 2002/12/26 09:46:04 kcwu Exp $ */ +/* $Id: user.c,v 1.44 2002/12/31 17:40:52 in2 Exp $ */ #include "bbs.h" static char *sex[8] = { @@ -295,7 +295,7 @@ uinfo_query(userec_t * u, int real, int unum) snprintf(genbuf, sizeof(genbuf), "%d", x.money); if (getdata_str(i++, 0, "銀行帳戶:", buf, 10, DOECHO, genbuf)) if ((l = atol(buf)) != 0) { - if (l != x.money) { + if (l != (unsigned)x.money) { money_change = 1; money = x.money; x.money = l; @@ -425,7 +425,7 @@ uinfo_query(userec_t * u, int real, int unum) case '3': i = setperms(x.userlevel, str_permid); - if (i == x.userlevel) + if ((unsigned)i == x.userlevel) fail++; else { flag = 1; diff --git a/mbbsd/var.c b/mbbsd/var.c index e7f6996f..68c0abdc 100644 --- a/mbbsd/var.c +++ b/mbbsd/var.c @@ -1,4 +1,4 @@ -/* $Id: var.c,v 1.14 2002/11/07 09:13:24 in2 Exp $ */ +/* $Id: var.c,v 1.15 2002/12/31 17:40:52 in2 Exp $ */ #define INCLUDE_VAR_H #include "bbs.h" @@ -344,7 +344,8 @@ int chc_hiswin, chc_hislose, chc_histie; /* screen.c */ screenline_t *big_picture = NULL; -unsigned char scr_lns, scr_cols; +unsigned char scr_lns; +unsigned short scr_cols; char roll; /* gomo.c */ diff --git a/mbbsd/vote.c b/mbbsd/vote.c index 48afafd1..8a8faa63 100644 --- a/mbbsd/vote.c +++ b/mbbsd/vote.c @@ -1,4 +1,4 @@ -/* $Id: vote.c,v 1.15 2002/07/22 19:02:01 in2 Exp $ */ +/* $Id: vote.c,v 1.16 2002/12/31 17:40:52 in2 Exp $ */ #include "bbs.h" static int total; @@ -406,7 +406,7 @@ vote_view(char *bname, int index) fscanf(fp, "%lu\n", &closetime); prints("\n◆ 預知投票紀事: 每人最多可投 %d 票,目前共有 %d 票,\n" - "本次投票將結束於 %s", atoi(inbuf), stbuf.st_size, + "本次投票將結束於 %s", atoi(inbuf), (int)stbuf.st_size, ctime(&closetime)); /* Thor: 開放 票數 預知 */ -- cgit v1.2.3