mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-19 14:33:16 -04:00
buffer size is now a named constant witha single source of truth
This commit is contained in:
parent
a7a7f2f106
commit
8dbdfb21ad
3 changed files with 4 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ void get_layout_abbr(char *abbr, const char *full_name) {
|
|||
// 1. 尝试在映射表中查找
|
||||
for (int32_t i = 0; layout_mappings[i].full_name != NULL; i++) {
|
||||
if (strcmp(full_name, layout_mappings[i].full_name) == 0) {
|
||||
snprintf(abbr, 32, "%s", layout_mappings[i].abbr);
|
||||
snprintf(abbr, KB_LAYOUT_ABBR_SIZE, "%s", layout_mappings[i].abbr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ void get_layout_abbr(char *abbr, const char *full_name) {
|
|||
abbr[2] = '\0';
|
||||
} else {
|
||||
// 5. 最终回退:返回 "xx"
|
||||
snprintf(abbr, 32, "xx");
|
||||
snprintf(abbr, KB_LAYOUT_ABBR_SIZE, "xx");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue