From 16208cb2e2f872676f7313832cabec2fc6c46253 Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Mon, 26 Feb 2024 09:10:27 +0100 Subject: [PATCH] +chg: Ini-Filereader: allow long suffix comments for numeric values --- src/Config/SimpleIni.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Config/SimpleIni.h b/src/Config/SimpleIni.h index 2b22e7739..f297090ff 100644 --- a/src/Config/SimpleIni.h +++ b/src/Config/SimpleIni.h @@ -299,6 +299,8 @@ enum class SI_Error : int { #define IS_VALID_HANDLE(HNDL) ((HNDL) && ((HNDL) != INVALID_HANDLE_VALUE)) #endif +#define DEFAULT_BUFFER_SIZE (1025) + // --------------------------------------------------------------------------- // MAIN TEMPLATE CLASS // --------------------------------------------------------------------------- @@ -468,7 +470,7 @@ public: class Converter : private SI_CONVERTER { public: explicit Converter(bool a_bStoreIsUtf8) : SI_CONVERTER(a_bStoreIsUtf8) { - m_scratch.resize(1024); + m_scratch.resize(DEFAULT_BUFFER_SIZE); } Converter(const Converter & rhs) { operator=(rhs); } Converter & operator=(const Converter & rhs) { @@ -2342,7 +2344,7 @@ CSimpleIniTempl::GetLongValue( if (!pszValue || !*pszValue) return a_nDefault; // convert to UTF-8/MBCS which for a numeric value will be the same as ASCII - char szValue[64] = { 0 }; + char szValue[DEFAULT_BUFFER_SIZE] = { 0 }; SI_CONVERTER c(m_bStoreIsUtf8); if (!c.ConvertToStore(pszValue, szValue, sizeof(szValue))) { return a_nDefault; @@ -2415,7 +2417,7 @@ CSimpleIniTempl::GetLongLongValue( return a_nDefault; // convert to UTF-8/MBCS which for a numeric value will be the same as ASCII - char szValue[128] = { 0 }; + char szValue[DEFAULT_BUFFER_SIZE] = { 0 }; SI_CONVERTER c(m_bStoreIsUtf8); if (!c.ConvertToStore(pszValue, szValue, sizeof(szValue))) { return a_nDefault; @@ -2489,7 +2491,7 @@ CSimpleIniTempl::GetDoubleValue( if (!pszValue || !*pszValue) return a_nDefault; // convert to UTF-8/MBCS which for a numeric value will be the same as ASCII - char szValue[64] = { 0 }; + char szValue[DEFAULT_BUFFER_SIZE] = { 0 }; SI_CONVERTER c(m_bStoreIsUtf8); if (!c.ConvertToStore(pszValue, szValue, sizeof(szValue))) { return a_nDefault;