mirror of
https://github.com/fumiama/CMoe-Counter.git
synced 2025-02-25 14:04:52 +01:00
优化显示长度
This commit is contained in:
parent
f8ada3eaa9
commit
84bc015003
7
cmoe.c
7
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) {
|
static uint32_t get_content_len(int isbig, uint16_t* len_type, char* cntstr) {
|
||||||
uint32_t len = sizeof(svg_small)
|
uint32_t len = sizeof(svg_small) // small & big has the same len
|
||||||
+ 16 + isbig
|
|
||||||
+ sizeof(svg_tail) - 1;
|
+ sizeof(svg_tail) - 1;
|
||||||
for(int i = 0; cntstr[i]; i++) {
|
for(int i = 0; cntstr[i]; i++) {
|
||||||
len += len_type[cntstr[i] - '0'] + (sizeof(img_slot_front) + sizeof(img_slot_rear) - 2);
|
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;
|
return len;
|
||||||
}
|
}
|
||||||
@ -145,7 +146,7 @@ static void return_count(char* name, char* theme) {
|
|||||||
head = svg_small;
|
head = svg_small;
|
||||||
}
|
}
|
||||||
headers(get_content_len(isbig, len_type, cntstr), "image/svg+xml");
|
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++) {
|
for(int i = 0; cntstr[i]; i++) {
|
||||||
printf(img_slot_front, w * i, w, h);
|
printf(img_slot_front, w * i, w, h);
|
||||||
int n = cntstr[i] - '0';
|
int n = cntstr[i] - '0';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user