diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-01-31 13:27:11 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-01-31 13:27:11 +0800 |
commit | 718716ca8b2651626439d8a4d0c5b52f7d388130 (patch) | |
tree | 7387ac8e6aa302f593137bce7c94cc67fba2f4a9 | |
parent | ded298627c1cd513899e03c684bbe10fe3d7b435 (diff) | |
download | pttbbs-718716ca8b2651626439d8a4d0c5b52f7d388130.tar pttbbs-718716ca8b2651626439d8a4d0c5b52f7d388130.tar.gz pttbbs-718716ca8b2651626439d8a4d0c5b52f7d388130.tar.bz2 pttbbs-718716ca8b2651626439d8a4d0c5b52f7d388130.tar.lz pttbbs-718716ca8b2651626439d8a4d0c5b52f7d388130.tar.xz pttbbs-718716ca8b2651626439d8a4d0c5b52f7d388130.tar.zst pttbbs-718716ca8b2651626439d8a4d0c5b52f7d388130.zip |
- read: fix bottom articles across pages (after doing new post) will lead to incorrect display
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3892 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/read.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mbbsd/read.c b/mbbsd/read.c index 66ea613f..73cf2b90 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -1160,7 +1160,7 @@ get_records_and_bottom(char *direct, fileheader_t* headers, return rv > 0 ? rv : 0; } - // 顯示本文+置底: + //////// 顯示本文+置底: //////// // 讀取 .DIR 本文 if (n > 0) @@ -1168,17 +1168,22 @@ get_records_and_bottom(char *direct, fileheader_t* headers, n = get_records(direct, headers, sizeof(fileheader_t), recbase, n); if (n < 0) n = 0; rv += n; // rv 為有效本文數 + + recbase = 1; + } else { + // n <= 0 + recbase = 1 + (-n); } - // 讀取置底 - n = last_line - bottom_line +1; + // 讀取置底 (注意 recbase 可能超過 bottom_line, 也就是以置底第 n 個開始) + n = last_line - bottom_line +1 - (recbase-1); if (rv + n > headers_size) n = headers_size - rv; if (n > 0) { char directbottom[PATHLEN]; snprintf(directbottom, sizeof(directbottom), "%s.bottom", direct); - n = get_records(directbottom, headers+rv, sizeof(fileheader_t), 1, n); + n = get_records(directbottom, headers+rv, sizeof(fileheader_t), recbase, n); if (n < 0) n = 0; rv += n; } |