mirror of
https://github.com/KjellKod/g3log.git
synced 2025-03-04 07:27:25 +01:00
Remove warning in Windows by using vsnprintf_s
This commit is contained in:
parent
e62eaec8f6
commit
c23a8e2419
@ -40,7 +40,9 @@ ELSEIF(MSVC)
|
||||
# Remember to set set target properties if using GTEST similar to done below on target "unit_test"
|
||||
# "set_target_properties(unit_test PROPERTIES COMPILE_DEFINITIONS "GTEST_USE_OWN_TR1_TUPLE=0")
|
||||
MESSAGE("")
|
||||
MESSAGE("Windows: Please run the command [cmake -DCMAKE_BUILD_TYPE=Release -G \"Visual Studio 11\" ..]")
|
||||
MESSAGE("Windows: Run cmake with the appropriate Visual Studio generator")
|
||||
MESSAGE("The generator is one number below the official version number. I.e. VS2013 -> Generator 'Visual Studio 12'")
|
||||
MESSAGE("I.e. if VS2013: Please run the command [cmake -DCMAKE_BUILD_TYPE=Release -G \"Visual Studio 12\" ..]")
|
||||
MESSAGE("if cmake finishes OK, do 'msbuild g3log.sln /p:Configuration=Release'")
|
||||
MESSAGE("then run 'Release\\g3log-FATAL-*' examples")
|
||||
MESSAGE("")
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef CRASH_HANDLER_H_
|
||||
#define CRASH_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
/** ==========================================================================
|
||||
* 2011 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
|
||||
* with no warranties. This code is yours to share, use and modify with no
|
||||
@ -39,5 +39,3 @@ void exitWithDefaultSignalHandler(int signal_number);
|
||||
SIGTERM TERMINATION (ANSI) */
|
||||
void installSignalHandler();
|
||||
}
|
||||
|
||||
#endif // CRASH_HANDLER_H_
|
||||
|
@ -61,7 +61,12 @@ struct LogCapture {
|
||||
char finished_message[kMaxMessageSize];
|
||||
va_list arglist;
|
||||
va_start(arglist, printf_like_message);
|
||||
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) && !defined(__GNUC__))
|
||||
const int nbrcharacters = vsnprintf_s(finished_message, _countof(finished_message), _TRUNCATE, printf_like_message, arglist);
|
||||
#else
|
||||
const int nbrcharacters = vsnprintf(finished_message, sizeof (finished_message), printf_like_message, arglist);
|
||||
#endif
|
||||
va_end(arglist);
|
||||
|
||||
if (nbrcharacters <= 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user