Cmd Flags 64bit repair + webui (#1548)

* flags 64bit cmd repair + webui

* uint32

* flags 0 webui strange char repair
This commit is contained in:
XJ
2025-03-01 06:17:38 +01:00
committed by GitHub
parent fb33459779
commit 1cc0603748
5 changed files with 40 additions and 15 deletions

View File

@ -2818,6 +2818,26 @@ const char* g_obk_flagNames[] = {
"error",
"error",
};
void uint64_to_str(uint64_t num, char* str) {
char temp[21]; // uint64_t 20 numbers + \0
int i = 0;
if (num == 0) {
temp[i++] = '0';
} else {
while (num > 0) {
temp[i++] = '0' + (num % 10);
num /= 10;
}
}
temp[i] = '\0';
int j;
for (j = 0; j < i; j++) {
str[j] = temp[i - j - 1];
}
str[j] = '\0';
}
int http_fn_cfg_generic(http_request_t* request) {
int i;
char tmpA[64];
@ -2855,9 +2875,12 @@ int http_fn_cfg_generic(http_request_t* request) {
CFG_Save_IfThereArePendingChanges();
// 32 bit type
hprintf255(request, "<h4>Flags (Current value=%i)</h4>", CFG_GetFlags());
//hprintf255(request, "<h4>Flags (Current value=%i)</h4>", CFG_GetFlags());
// 64 bit - TODO fixme
//hprintf255(request, "<h4>Flags (Current value=%lu)</h4>", CFG_GetFlags64());
//hprintf255(request, "<h4>Flags (Current value=%llu)</h4>", CFG_GetFlags64());
char buf[21];
uint64_to_str(CFG_GetFlags64(), buf);
hprintf255(request, "<h4>Flags (Current value=%s)</h4>", buf);
poststr(request, "<form action=\"/cfg_generic\">");
for (i = 0; i < OBK_TOTAL_FLAGS; i++) {