From 1be86131c5e07815d694bc436ef903da8d58afef Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 24 Aug 2005 06:29:02 +0000 Subject: missing type checking fix mis-calculated fav_number git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3078 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/fav.c | 6 ++++-- 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_ -- cgit v1.2.3