diff options
-rw-r--r-- | docs/brc.txt | 3 | ||||
-rw-r--r-- | mbbsd/brc.c | 18 |
2 files changed, 15 insertions, 6 deletions
diff --git a/docs/brc.txt b/docs/brc.txt index d64f7918..954ea5f2 100644 --- a/docs/brc.txt +++ b/docs/brc.txt @@ -58,6 +58,9 @@ v3 ���� �ѩ� v2 v3 ��ڮt���ä��j�A�o�̪������O�d�H v2 ���D�C �·Цۤv�d svn �N���D v3 ��F����F�C + - ptt2 �� brc V3 �e�i�A MAX_BOARD ��F�W�� (42000)�A�Q��M�w���K�� brc V3 + �]�p�� brcbid_t = int32�C + BRC v2 ��@ diff --git a/mbbsd/brc.c b/mbbsd/brc.c index 0d93169b..7d35018c 100644 --- a/mbbsd/brc.c +++ b/mbbsd/brc.c @@ -20,8 +20,8 @@ please rewrite brc.c #endif -typedef unsigned short brcbid_t; -typedef unsigned short brcnbrd_t; +typedef uint32_t brcbid_t; +typedef uint16_t brcnbrd_t; typedef struct { time4_t create; @@ -261,6 +261,9 @@ read_brc2(void) size_t sz2 = 0, sz3 = 0; char *cvt = NULL, *cvthead = NULL; + // brc v2 is using 16 bit for brcbid_t and brcnbrd_t. + uint16_t bid2, num2; + brcbid_t bid; brcnbrd_t num; time4_t create; @@ -277,13 +280,16 @@ read_brc2(void) cvthead = cvt = malloc (sz3); // now calculate real sz3 - while (read(fd, &bid, sizeof(bid)) > 0) + while (read(fd, &bid2, sizeof(bid2)) > 0) { - if (read(fd, &num, sizeof(num)) < 1) + if (read(fd, &num2, sizeof(num2)) < 1) break; - *(brcbid_t*)cvt = bid; cvt += sizeof(brcbid_t); - *(brcnbrd_t*)cvt = num;cvt += sizeof(brcnbrd_t); + bid = bid2; + num = num2; + + *(brcbid_t*) cvt = bid; cvt += sizeof(brcbid_t); + *(brcnbrd_t*)cvt = num; cvt += sizeof(brcnbrd_t); for (; num > 0; num--) { |