diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-24 14:29:02 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-24 14:29:02 +0800 |
commit | 1be86131c5e07815d694bc436ef903da8d58afef (patch) | |
tree | 846af45130f6f9ac8884331ab27ac6041881f516 /mbbsd | |
parent | d13ca369037c5cec62c5f2af1f71b764438849a0 (diff) | |
download | pttbbs-1be86131c5e07815d694bc436ef903da8d58afef.tar pttbbs-1be86131c5e07815d694bc436ef903da8d58afef.tar.gz pttbbs-1be86131c5e07815d694bc436ef903da8d58afef.tar.bz2 pttbbs-1be86131c5e07815d694bc436ef903da8d58afef.tar.lz pttbbs-1be86131c5e07815d694bc436ef903da8d58afef.tar.xz pttbbs-1be86131c5e07815d694bc436ef903da8d58afef.tar.zst pttbbs-1be86131c5e07815d694bc436ef903da8d58afef.zip |
missing type checking
fix mis-calculated fav_number
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3078 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/fav.c | 6 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 1 |
2 files changed, 5 insertions, 2 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 5c3ee44a..bd414ddf 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -308,7 +308,7 @@ static void rebuild_fav(fav_t *fp, int clean_invisible) int i, j, nData; fav_type_t *ft; - fav_number = 0; + fav_number -= get_data_number(fp); fp->lineID = fp->folderID = 0; fp->nLines = fp->nFolders = fp->nBoards = 0; nData = fp->DataTail; @@ -455,6 +455,7 @@ static void read_favrec(FILE *frp, fav_t *fp) fp->nAllocs = fp->DataTail + FAV_PRE_ALLOC; fp->lineID = fp->folderID = 0; fp->favh = (fav_type_t *)fav_malloc(sizeof(fav_type_t) * fp->nAllocs); + fav_number += get_data_number(fp); for(i = 0; i < fp->DataTail; i++){ ft = &fp->favh[i]; @@ -518,6 +519,7 @@ int fav_load(void) if ((frp = fopen(buf, "r")) == NULL) return -1; fp = (fav_t *)fav_malloc(sizeof(fav_t)); + fav_number = 0; read_favrec(frp, fp); fav_stack_push_fav(fp); fclose(frp); @@ -696,7 +698,7 @@ fav_type_t *getadmtag(short bid) fav_type_t *ft; for (i = 0; i < fp->DataTail; i++) { ft = &fp->favh[i]; - if (cast_board(ft)->bid == bid && is_set_attr(ft, FAVH_ADM_TAG)) + if (get_item_type(ft) == FAVT_BOARD && cast_board(ft)->bid == bid && is_set_attr(ft, FAVH_ADM_TAG)) return ft; } return NULL; diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index cd8250c8..de9e42a4 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -817,6 +817,7 @@ setup_utmp(int mode) getnewutmpent(&uinfo); SHM->UTMPneedsort = 1; + // XXX 不用每 20 才檢查吧 if (!(cuser.numlogins % 20) && cuser.userlevel & PERM_BM) check_BM(); /* Ptt 自動取下離職板主權力 */ #ifndef _BBS_UTIL_C_ |