summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/mbbsd/bbs.c12
-rw-r--r--pttbbs/mbbsd/bbslua.c4
-rw-r--r--pttbbs/mbbsd/board.c4
-rw-r--r--pttbbs/mbbsd/ch_go.c4
-rw-r--r--pttbbs/mbbsd/edit.c5
-rw-r--r--pttbbs/mbbsd/friend.c2
-rw-r--r--pttbbs/mbbsd/pfterm.c2
-rw-r--r--pttbbs/mbbsd/record.c1
-rw-r--r--pttbbs/mbbsd/screen.c46
-rw-r--r--pttbbs/mbbsd/term.c1
-rw-r--r--pttbbs/mbbsd/user.c2
-rw-r--r--pttbbs/mbbsd/var.c3
12 files changed, 42 insertions, 44 deletions
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index 5cbe9615..6270ea51 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -117,7 +117,7 @@ modify_dir_lite(
// PttLock(fd, offset, size, F_UNLCK);
// prevent black holes
- if (sz < sizeof(fileheader_t) * (ent) ||
+ if (sz < (int)sizeof(fileheader_t) * (ent) ||
(fd = open(direct, O_RDWR)) < 0 )
return -1;
@@ -805,10 +805,10 @@ readdoent(int num, fileheader_t * ent)
// strip unsafe characters
if (!const_title)
- strip_nonebig5((char*)title, INT_MAX);
+ strip_nonebig5((unsigned char*)title, INT_MAX);
// print subject, bounded by w.
- if (strlen(title) > w) {
+ if ((int)strlen(title) > w) {
if (DBCS_Status(title, w-2) == DBCS_TRAILING)
w--;
outns(title, w-2);
@@ -1107,7 +1107,7 @@ log_crosspost_in_allpost(const char *brd, const fileheader_t *postfile) {
fh.modified = now;
strlcpy(fh.owner, cuser.userid, sizeof(fh.owner));
strlcpy(genbuf, title, len + 1);
- if (strlen(title) > len) {
+ if ((int)strlen(title) > len) {
genbuf[len-2] = 0;
DBCS_safe_trim(genbuf);
strcat(genbuf, "…");
@@ -1125,11 +1125,11 @@ log_crosspost_in_allpost(const char *brd, const fileheader_t *postfile) {
void
dbcs_safe_trim_title(char *output, const char *title, int len) {
- if (strlen(title) > len) {
+ if ((int)strlen(title) > len) {
snprintf(output, len + 1, "%-*.*s", len - 2, len - 2, title);
DBCS_safe_trim(output);
strlcat(output, "…", len + 1);
- while (strlen(output) < len)
+ while ((int)strlen(output) < len)
strlcat(output, " ", len + 1);
} else {
snprintf(output, len + 1, "%-*.*s", len, len, title);
diff --git a/pttbbs/mbbsd/bbslua.c b/pttbbs/mbbsd/bbslua.c
index 4ba09eec..d746a231 100644
--- a/pttbbs/mbbsd/bbslua.c
+++ b/pttbbs/mbbsd/bbslua.c
@@ -414,8 +414,8 @@ bl_getstr(lua_State* L)
if (len < 2)
len = 2;
- if (len >= sizeof(buf))
- len = sizeof(buf)-1;
+ if (len >= (int)sizeof(buf))
+ len = sizeof(buf) - 1;
/*
* this part now done in getdata_str
if (pmsg && *pmsg)
diff --git a/pttbbs/mbbsd/board.c b/pttbbs/mbbsd/board.c
index 0d020f38..4be560da 100644
--- a/pttbbs/mbbsd/board.c
+++ b/pttbbs/mbbsd/board.c
@@ -456,7 +456,7 @@ b_config(void)
{
move_ansi(ipostres++, COLPOSTRES);
i = (int)llogin * 10;
- attr = (cuser.numlogindays < i) ? 1 : 0;
+ attr = ((int)cuser.numlogindays < i) ? 1 : 0;
if (attr) outs(ANSI_COLOR(1;31) "*");
prints(STR_LOGINDAYS " %d " STR_LOGINDAYS_QTY "以上", i);
if (attr) outs(ANSI_RESET);
@@ -467,7 +467,7 @@ b_config(void)
{
move_ansi(ipostres++, COLPOSTRES);
i = (int)lpost * 10;
- attr = (cuser.numposts < i) ? 1 : 0;
+ attr = ((int)cuser.numposts < i) ? 1 : 0;
if (attr) outs(ANSI_COLOR(1;31) "*");
prints("各看板有效文章合計 %d 篇以上", i);
if (attr) outs(ANSI_RESET);
diff --git a/pttbbs/mbbsd/ch_go.c b/pttbbs/mbbsd/ch_go.c
index 473f62d8..61285cbe 100644
--- a/pttbbs/mbbsd/ch_go.c
+++ b/pttbbs/mbbsd/ch_go.c
@@ -1039,9 +1039,9 @@ gochess_replay(FILE* fp)
0, CHESS_MODE_REPLAY);
/* filling header information to info */
- if (userid[BBLANK][0]) {
+ if (userid[BBLACK][0]) {
userec_t rec;
- if (getuser(userid[BBLANK], &rec))
+ if (getuser(userid[BBLACK], &rec))
go_init_user_userec(&rec, &info->user1);
}
diff --git a/pttbbs/mbbsd/edit.c b/pttbbs/mbbsd/edit.c
index 6256094b..74112437 100644
--- a/pttbbs/mbbsd/edit.c
+++ b/pttbbs/mbbsd/edit.c
@@ -266,9 +266,10 @@ int mchar_len(unsigned char *str)
#define FC_RIGHT (0)
#define FC_LEFT (~FC_RIGHT)
-int fix_cursor(char *str, int pos, unsigned int dir)
+int fix_cursor(char *str, int pos, int dir)
{
int newpos, w;
+ assert(dir >= 0);
for(newpos = 0;
*str != '\0' &&
@@ -2871,7 +2872,7 @@ edit_outs_attr_n(const char *text, int n, int attr)
static void
edit_outs_attr(const char *text, int attr)
{
- edit_outs_attr_n(text, scr_cols, attr);
+ edit_outs_attr_n(text, SCR_COLS, attr);
}
static void
diff --git a/pttbbs/mbbsd/friend.c b/pttbbs/mbbsd/friend.c
index d7a4d10c..948de5fb 100644
--- a/pttbbs/mbbsd/friend.c
+++ b/pttbbs/mbbsd/friend.c
@@ -180,7 +180,7 @@ friend_append(int type, int count)
if (j == FRIEND_SPECIAL)
friend_special();
- if (!*friend_file[j])
+ if (!*friend_file[(int)j])
return;
setfriendfile(sfile, j);
diff --git a/pttbbs/mbbsd/pfterm.c b/pttbbs/mbbsd/pfterm.c
index 6ee864af..584e8874 100644
--- a/pttbbs/mbbsd/pfterm.c
+++ b/pttbbs/mbbsd/pfterm.c
@@ -1424,7 +1424,7 @@ inansistr (char *str, int n)
else
szTrail = 0;
- if (strlen(cmd) >= n-szTrail)
+ if ((int)strlen(cmd) >= n - szTrail)
break;
strcpy(str, cmd);
diff --git a/pttbbs/mbbsd/record.c b/pttbbs/mbbsd/record.c
index ce38935b..4b34a060 100644
--- a/pttbbs/mbbsd/record.c
+++ b/pttbbs/mbbsd/record.c
@@ -496,7 +496,6 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
{
FILE *fp;
char buf[PATHLEN];
- int n;
char address[64] = "";
char fwd_title[STRLEN] = "";
int r;
diff --git a/pttbbs/mbbsd/screen.c b/pttbbs/mbbsd/screen.c
index 606ec5e2..bf1d5d73 100644
--- a/pttbbs/mbbsd/screen.c
+++ b/pttbbs/mbbsd/screen.c
@@ -20,7 +20,7 @@ static unsigned char _typeahead = 1;
inline
screenline_t* GetLine(int i) {
- return &big_picture[(i + roll) % scr_lns];
+ return &big_picture[(i + roll) % t_lines];
}
inline
@@ -74,7 +74,7 @@ void
initscr(void)
{
if (!big_picture) {
- big_picture = (screenline_t *) calloc(scr_lns, sizeof(screenline_t));
+ big_picture = (screenline_t *) calloc(t_lines, sizeof(screenline_t));
docls = YEA;
}
}
@@ -129,7 +129,7 @@ move_ansi(int y, int x)
cur_ln = y;
cur_col = x;
- if (y >= scr_lns || x < 1)
+ if (y >= t_lines || x < 1)
return;
slp = GetLine(y);
@@ -163,7 +163,7 @@ getyx_ansi(int *py, int *px)
*py = y; *px = x;
- if (y >= scr_lns || x < 1)
+ if (y >= t_lines || x < 1)
return;
slp = GetLine(y);
@@ -235,8 +235,8 @@ redrawwin(void)
int len;
o_clear();
- for (tc_col = tc_line = i = 0, j = roll; i < scr_lns; i++, j++) {
- if (j >= scr_lns)
+ for (tc_col = tc_line = i = 0, j = roll; i < t_lines; i++, j++) {
+ if (j >= t_lines)
j = 0;
bp = &big_picture[j];
if ((len = bp->len)) {
@@ -310,7 +310,7 @@ doupdate(void)
register screenline_t *bp = big_picture;
register int i, j;
int len;
- if ((docls) || (abs(scrollcnt) >= (scr_lns - 3))) {
+ if ((docls) || (abs(scrollcnt) >= (t_lines - 3))) {
redrawwin();
return;
}
@@ -329,8 +329,8 @@ doupdate(void)
ochar('\n');
} while (--scrollcnt);
}
- for (i = 0, j = roll; i < scr_lns; i++, j++) {
- if (j >= scr_lns)
+ for (i = 0, j = roll; i < t_lines; i++, j++) {
+ if (j >= t_lines)
j = 0;
bp = &big_picture[j];
len = bp->len;
@@ -415,7 +415,7 @@ clear(void)
docls = YEA;
cur_col = cur_ln = roll = 0;
- for(i=0; i<scr_lns; i++) {
+ for(i=0; i<t_lines; i++) {
slp = &big_picture[i];
slp->mode = slp->len = slp->oldlen = 0;
}
@@ -480,12 +480,12 @@ clrtoln(int line)
register int i, j;
for (i = cur_ln, j = i + roll; i < line; i++, j++) {
- if (j >= scr_lns)
- j -= scr_lns;
+ if (j >= t_lines)
+ j -= t_lines;
slp = &big_picture[j];
slp->mode = slp->len = 0;
if (slp->oldlen)
- slp->oldlen = scr_cols;
+ slp->oldlen = SCR_COLS;
}
}
@@ -495,7 +495,7 @@ clrtoln(int line)
inline void
clrtobot(void)
{
- clrtoln(scr_lns);
+ clrtoln(t_lines);
}
void
@@ -533,7 +533,7 @@ outc(unsigned char c)
memset(&slp->data[slp->len], ' ', i + 1);
slp->len = cur_col;
cur_col = 0;
- if (cur_ln < scr_lns)
+ if (cur_ln < t_lines)
cur_ln++;
return;
}
@@ -572,7 +572,7 @@ outc(unsigned char c)
#endif
}
- if(cur_col < scr_cols)
+ if(cur_col < SCR_COLS)
cur_col++;
}
@@ -633,7 +633,7 @@ void
scroll(void)
{
scrollcnt++;
- if (++roll >= scr_lns)
+ if (++roll >= t_lines)
roll = 0;
move(b_lines, 0);
clrtoeol();
@@ -659,18 +659,18 @@ region_scroll_up(int top, int bottom)
top = bottom;
bottom = i;
}
- if (top < 0 || bottom >= scr_lns)
+ if (top < 0 || bottom >= t_lines)
return;
for (i = top; i < bottom; i++)
big_picture[i] = big_picture[i + 1];
memset(big_picture + i, 0, sizeof(*big_picture));
- memset(big_picture[i].data, ' ', scr_cols);
+ memset(big_picture[i].data, ' ', SCR_COLS);
do_save_cursor();
change_scroll_range(top, bottom);
do_move(0, bottom);
scroll_forward();
- change_scroll_range(0, scr_lns - 1);
+ change_scroll_range(0, t_lines - 1);
do_restore_cursor();
refresh();
}
@@ -737,9 +737,9 @@ grayout(int y, int end, int level)
// modify by scroll
i = y + roll;
if (i < 0)
- i += scr_lns;
- else if (i >= scr_lns)
- i %= scr_lns;
+ i += t_lines;
+ else if (i >= t_lines)
+ i %= t_lines;
slp = &big_picture[i];
diff --git a/pttbbs/mbbsd/term.c b/pttbbs/mbbsd/term.c
index 844a219f..7a168ccd 100644
--- a/pttbbs/mbbsd/term.c
+++ b/pttbbs/mbbsd/term.c
@@ -65,7 +65,6 @@ void term_resize(int w, int h)
t_columns = w;
dorefresh = 1;
}
- scr_lns = t_lines; /* XXX: scr_lns 跟 t_lines 有什麼不同, 為何分成兩個 */
b_lines = t_lines - 1;
p_lines = t_lines - 4;
diff --git a/pttbbs/mbbsd/user.c b/pttbbs/mbbsd/user.c
index 5f51b6ea..116dffae 100644
--- a/pttbbs/mbbsd/user.c
+++ b/pttbbs/mbbsd/user.c
@@ -1353,7 +1353,7 @@ showsignature(char *fname, int *j, SigInfo *si)
{
FILE *fp;
char buf[ANSILINELEN];
- int i, lines = scr_lns;
+ int i, lines = t_lines;
char ch;
clear();
diff --git a/pttbbs/mbbsd/var.c b/pttbbs/mbbsd/var.c
index 7e281afa..5d8d8bf1 100644
--- a/pttbbs/mbbsd/var.c
+++ b/pttbbs/mbbsd/var.c
@@ -403,8 +403,7 @@ int user_query_mode;
#endif /* defined(CHESSCOUNTRY) */
/* screen.c */
-#define scr_lns t_lines
-#define scr_cols ANSILINELEN
+#define SCR_COLS ANSILINELEN
screenline_t *big_picture = NULL;
char roll = 0;
char msg_occupied = 0;