From 84bc01500375421bb510868890d78c549908be38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Wed, 2 Mar 2022 19:22:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=98=BE=E7=A4=BA=E9=95=BF?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmoe.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmoe.c b/cmoe.c index dcf152b..10ef3a9 100644 --- a/cmoe.c +++ b/cmoe.c @@ -85,11 +85,12 @@ static int add_user(char* name, uint32_t count, FILE* fp) { } static uint32_t get_content_len(int isbig, uint16_t* len_type, char* cntstr) { - uint32_t len = sizeof(svg_small) - + 16 + isbig + uint32_t len = sizeof(svg_small) // small & big has the same len + sizeof(svg_tail) - 1; for(int i = 0; cntstr[i]; i++) { len += len_type[cntstr[i] - '0'] + (sizeof(img_slot_front) + sizeof(img_slot_rear) - 2); + if(i > 0) len++; + if(i > 2-isbig) len++; } return len; } @@ -145,7 +146,7 @@ static void return_count(char* name, char* theme) { head = svg_small; } headers(get_content_len(isbig, len_type, cntstr), "image/svg+xml"); - printf(head, w*(10+(char*)cntstrbuf-cntstr)); + printf(head, w*(10+cntstrbuf-cntstr)); for(int i = 0; cntstr[i]; i++) { printf(img_slot_front, w * i, w, h); int n = cntstr[i] - '0';