summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-07 14:02:58 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-07 14:02:58 +0800
commitd77c783d22d1051e63504a6fecd678319cc1ebca (patch)
tree50cdb193a82f29388604e22d56a06833876f9fd9
parent6d2c21c4eb53964be68892a738e103c85421cf89 (diff)
downloadpttbbs-d77c783d22d1051e63504a6fecd678319cc1ebca.tar
pttbbs-d77c783d22d1051e63504a6fecd678319cc1ebca.tar.gz
pttbbs-d77c783d22d1051e63504a6fecd678319cc1ebca.tar.bz2
pttbbs-d77c783d22d1051e63504a6fecd678319cc1ebca.tar.lz
pttbbs-d77c783d22d1051e63504a6fecd678319cc1ebca.tar.xz
pttbbs-d77c783d22d1051e63504a6fecd678319cc1ebca.tar.zst
pttbbs-d77c783d22d1051e63504a6fecd678319cc1ebca.zip
Since we declared ANSILINELEN as a value which is
larger than an unsigned byte, we should increase counters then they can match its value. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2782 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/pttstruct.h12
-rw-r--r--mbbsd/screen.c8
2 files changed, 11 insertions, 9 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 5bcf81f3..c282d972 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -587,13 +587,13 @@ typedef struct {
#endif
typedef struct {
- unsigned char oldlen; /* previous line length */
- unsigned char len; /* current length of line */
+ unsigned short oldlen; /* previous line length */
+ unsigned short len; /* current length of line */
+ unsigned short smod; /* start of modified data */
+ unsigned short emod; /* end of modified data */
+ unsigned short sso; /* start stand out */
+ unsigned short eso; /* end stand out */
unsigned char mode; /* status of line, as far as update */
- unsigned char smod; /* start of modified data */
- unsigned char emod; /* end of modified data */
- unsigned char sso; /* start stand out */
- unsigned char eso; /* end stand out */
/* data 必需是最後一個欄位, see screen_backup() */
unsigned char data[ANSILINELEN + 1];
} screenline_t;
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index c9a0ee79..aee1319d 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -7,7 +7,7 @@
#define o_standup() output(strtstandout,strtstandoutlen)
#define o_standdown() output(endstandout,endstandoutlen)
-static unsigned char cur_ln = 0, cur_col = 0;
+static unsigned short cur_ln = 0, cur_col = 0;
static unsigned char docls;
static unsigned char standing = NA;
static int scrollcnt, tc_col, tc_line;
@@ -286,7 +286,7 @@ clrtoline(int line)
slp = &big_picture[j];
slp->mode = slp->len = 0;
if (slp->oldlen)
- slp->oldlen = 255;
+ slp->oldlen = scr_cols;
}
}
@@ -339,8 +339,10 @@ outc(unsigned char c)
slp->smod = cur_col;
}
#if 1
- ++cur_col;
+ if(cur_col < scr_cols)
+ cur_col++;
#else
+ /* vvv commented by piaip: but SCR_COLS is 511 > unsigned char! */
/* this comparison is always false (cur_col is unsigned char and scr_cols
* is 511). */
if (++cur_col >= scr_cols) {