Commit 4a3b52b0 by Marcus Winter

base_c: removed cppcheck warnings

parent 9c5df58a
...@@ -65,8 +65,6 @@ static void embb_log_write_internal( ...@@ -65,8 +65,6 @@ static void embb_log_write_internal(
char const * message, char const * message,
va_list argp) { va_list argp) {
if (log_level <= embb_log_global_log_level) { if (log_level <= embb_log_global_log_level) {
char msg_buffer[400];
char buffer[500];
char * log_level_str = " "; char * log_level_str = " ";
char const * channel_str = channel; char const * channel_str = channel;
void * log_context = embb_log_global_log_context; void * log_context = embb_log_global_log_context;
...@@ -94,11 +92,15 @@ static void embb_log_write_internal( ...@@ -94,11 +92,15 @@ static void embb_log_write_internal(
break; break;
} }
#if defined(EMBB_COMPILER_MSVC) #if defined(EMBB_COMPILER_MSVC)
char msg_buffer[400];
char buffer[500];
vsprintf_s(msg_buffer, sizeof(msg_buffer), message, argp); vsprintf_s(msg_buffer, sizeof(msg_buffer), message, argp);
sprintf_s(buffer, sizeof(buffer), "[%s] - [%s] %s", sprintf_s(buffer, sizeof(buffer), "[%s] - [%s] %s",
channel_str, log_level_str, msg_buffer); channel_str, log_level_str, msg_buffer);
embb_log_global_log_function(log_context, buffer); embb_log_global_log_function(log_context, buffer);
#elif defined(EMBB_COMPILER_GNUC) #elif defined(EMBB_COMPILER_GNUC)
char msg_buffer[400];
char buffer[500];
vsnprintf(msg_buffer, sizeof(msg_buffer), message, argp); vsnprintf(msg_buffer, sizeof(msg_buffer), message, argp);
snprintf(buffer, sizeof(buffer), "[%s] - [%s] %s", snprintf(buffer, sizeof(buffer), "[%s] - [%s] %s",
channel_str, log_level_str, msg_buffer); channel_str, log_level_str, msg_buffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment