Fix the bug of wrong length in xy_log()

This commit is contained in:
Aoran Zeng 2023-08-31 21:58:05 +08:00
parent f1df0ffb06
commit 22553fe751
2 changed files with 3 additions and 3 deletions

View File

@ -609,7 +609,7 @@ call_cmd (void* cmdptr, const char* arg)
void
print_available_mirrors ()
{
xy_info ("chsrc: 可用以下镜像站,所有的致谢属于这些站点以及它们的开发/维护者们");
xy_info ("chsrc: 支持以下镜像站,荣耀与感恩均归于这些站点,以及它们的开发/维护者们");
for (int i=0; i<xy_arylen(available_mirrors); i++)
{
mirror_info* mir = available_mirrors[i];

View File

@ -81,8 +81,8 @@ xy_log (int level, const char* str)
//xy_assert ("CAN'T REACH!");
}
// -2 把中间%s减掉-1 把末尾nul减掉
size_t len = sizeof(color_fmt_str) -2 -1;
// -2 把中间%s减掉
size_t len = strlen(color_fmt_str) -2;
char* buf = malloc(strlen(str) + len + 1);
sprintf (buf, color_fmt_str, str);