mirror of
https://github.com/fumiama/CMoe-Counter.git
synced 2024-11-27 23:20:49 +01:00
优化显示长度
This commit is contained in:
parent
65f7583c2f
commit
5b98315589
9
cmoe.c
9
cmoe.c
@ -118,8 +118,8 @@ static void return_count(char* name, char* theme) {
|
|||||||
sprintf(cntstrbuf, "%010u", d->count);
|
sprintf(cntstrbuf, "%010u", d->count);
|
||||||
free(spb);
|
free(spb);
|
||||||
char* cntstr;
|
char* cntstr;
|
||||||
for(cntstr = cntstrbuf+9; cntstr > cntstrbuf; cntstr--) if(*cntstr == '0') break;
|
for(cntstr = (char*)cntstrbuf+9; cntstr > (char*)cntstrbuf; cntstr--) if(*cntstr == '0') break;
|
||||||
if(cntstr - cntstrbuf > 2) cntstr -= 2; // 保留 3 位 0
|
if(cntstr - (char*)cntstrbuf > 2) cntstr -= 2; // 保留 3 位 0
|
||||||
else cntstr = cntstrbuf; // 保留所有 0
|
else cntstr = cntstrbuf; // 保留所有 0
|
||||||
int isbig = 0;
|
int isbig = 0;
|
||||||
char** theme_type = mb;
|
char** theme_type = mb;
|
||||||
@ -144,15 +144,14 @@ 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+cntstrbuf-cntstr));
|
printf(head, w*(10+(char*)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';
|
||||||
fwrite(theme_type[n], len_type[n], 1, stdout);
|
fwrite(theme_type[n], len_type[n], 1, stdout);
|
||||||
printf(img_slot_rear);
|
printf(img_slot_rear);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
printf(svg_tail);
|
||||||
write(1, svg_tail, sizeof(svg_tail)-1);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user