From f49b648deaa648edda3bf2bef8c0b21ae8d5f780 Mon Sep 17 00:00:00 2001 From: Sorgelig Date: Sun, 9 Oct 2022 16:55:15 +0800 Subject: [PATCH] cfg: fix integer parsing. --- cfg.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cfg.cpp b/cfg.cpp index 218b338..85bca96 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -275,12 +275,12 @@ static void ini_parse_numeric(const ini_var_t *var, const char *text, void *out) switch (var->type) { case UINT8: *(uint8_t*)out = u32; break; - case INT8: *(int8_t*)out = u32; break; + case INT8: *(int8_t*)out = i32; break; case UINT16: *(uint16_t*)out = u32; break; case UINT32ARR: *(uint32_t*)out = u32; break; - case INT16: *(int16_t*)out = u32; break; + case INT16: *(int16_t*)out = i32; break; case UINT32: *(uint32_t*)out = u32; break; - case INT32: *(int32_t*)out = u32; break; + case INT32: *(int32_t*)out = i32; break; case FLOAT: *(float*)out = f32; break; default: break; } @@ -457,7 +457,7 @@ bool cfg_check_errors(char *msg, size_t max_len) msg[0] = '\0'; if (cfg_error_count == 0) return false; - + int pos = snprintf(msg, max_len, "%d INI Error%s\n---", cfg_error_count, cfg_error_count > 1 ? "s" : ""); for (int i = 0; i < cfg_error_count; i++)