Mingw parse error (#293)

* fix 'Failure to successfully parse the message' on mingw

* removed redundant checks
This commit is contained in:
Aleksey Dobrunov 2019-01-16 00:27:53 +05:00 committed by Kjell Hedström
parent 502bf318a4
commit 1a010de2f6
3 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@
#include "g3log/logcapture.hpp"
#include "g3log/loglevels.hpp"
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) && !defined(__GNUC__))
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
#error "crashhandler_unix.cpp used but it's a windows system"
#endif

View File

@ -80,7 +80,7 @@ void LogCapture::capturef(const char *printf_like_message, ...) {
#else
static const int kMaxMessageSize = 2048;
char finished_message[kMaxMessageSize];
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) && !defined(__GNUC__))
#if ((defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(__GNUC__))
auto finished_message_len = _countof(finished_message);
#else
int finished_message_len = sizeof(finished_message);
@ -90,7 +90,7 @@ void LogCapture::capturef(const char *printf_like_message, ...) {
va_list arglist;
va_start(arglist, printf_like_message);
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) && !defined(__GNUC__))
#if ((defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(__GNUC__))
const int nbrcharacters = vsnprintf_s(finished_message, finished_message_len, _TRUNCATE, printf_like_message, arglist);
#else
const int nbrcharacters = vsnprintf(finished_message, finished_message_len, printf_like_message, arglist);

View File

@ -131,7 +131,7 @@ namespace g3 {
tm localtime(const std::time_t& ts) {
struct tm tm_snapshot;
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) && !defined(__GNUC__))
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
localtime_s(&tm_snapshot, &ts); // windsows
#else
localtime_r(&ts, &tm_snapshot); // POSIX