Rename macro WIN32 to _WIN32

master
Chunting Gu 6 years ago
parent 59db2ca04f
commit 78743e6a55

@ -8,7 +8,7 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
// You need to set environment variable SSL_CERT_FILE properly to enable // You need to set environment variable SSL_CERT_FILE properly to enable
// SSL verification. // SSL verification.
bool kSslVerify = false; bool kSslVerify = false;

@ -3,7 +3,7 @@
#include "webcc/client_session.h" #include "webcc/client_session.h"
#include "webcc/logger.h" #include "webcc/logger.h"
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
// You need to set environment variable SSL_CERT_FILE properly to enable // You need to set environment variable SSL_CERT_FILE properly to enable
// SSL verification. // SSL verification.
bool kSslVerify = false; bool kSslVerify = false;

@ -5,7 +5,7 @@
#include "webcc/client_session.h" #include "webcc/client_session.h"
#include "webcc/logger.h" #include "webcc/logger.h"
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
// You need to set environment variable SSL_CERT_FILE properly to enable // You need to set environment variable SSL_CERT_FILE properly to enable
// SSL verification. // SSL verification.
bool kSslVerify = false; bool kSslVerify = false;

@ -10,7 +10,7 @@
// Change to 1 to print response JSON. // Change to 1 to print response JSON.
#define PRINT_RESPONSE 0 #define PRINT_RESPONSE 0
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
// You need to set environment variable SSL_CERT_FILE properly to enable // You need to set environment variable SSL_CERT_FILE properly to enable
// SSL verification. // SSL verification.
bool kSslVerify = false; bool kSslVerify = false;

@ -9,7 +9,7 @@
#include "examples/common/book.h" #include "examples/common/book.h"
#include "examples/common/book_json.h" #include "examples/common/book_json.h"
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
#if defined(_DEBUG) && defined(WEBCC_ENABLE_VLD) #if defined(_DEBUG) && defined(WEBCC_ENABLE_VLD)
#pragma message ("< include vld.h >") #pragma message ("< include vld.h >")
#include "vld/vld.h" #include "vld/vld.h"

@ -13,7 +13,7 @@
#include "examples/common/book.h" #include "examples/common/book.h"
#include "examples/common/book_json.h" #include "examples/common/book_json.h"
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
#if defined(_DEBUG) && defined(WEBCC_ENABLE_VLD) #if defined(_DEBUG) && defined(WEBCC_ENABLE_VLD)
#pragma message ("< include vld.h >") #pragma message ("< include vld.h >")
#include "vld/vld.h" #include "vld/vld.h"

@ -12,7 +12,7 @@
#include <string> #include <string>
#include <thread> #include <thread>
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
#include <Windows.h> #include <Windows.h>
#else #else
// For getting thread ID. // For getting thread ID.
@ -75,7 +75,7 @@ static Logger g_logger;
bool g_colorlogtostderr = true; bool g_colorlogtostderr = true;
static const bool g_terminal_has_color = []() { static const bool g_terminal_has_color = []() {
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif #endif
@ -105,7 +105,7 @@ static const bool g_terminal_has_color = []() {
// Colors // Colors
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
#define VTSEQ(ID) ("\x1b[1;" #ID "m") #define VTSEQ(ID) ("\x1b[1;" #ID "m")
#else #else
#define VTSEQ(ID) ("\x1b[" #ID "m") #define VTSEQ(ID) ("\x1b[" #ID "m")
@ -166,7 +166,7 @@ namespace bfs = boost::filesystem;
// on Linux, e.g., 140219133990656. syscall(SYS_gettid) is much prefered because // on Linux, e.g., 140219133990656. syscall(SYS_gettid) is much prefered because
// it's shorter and the same as `ps -T -p <pid>` output. // it's shorter and the same as `ps -T -p <pid>` output.
static std::string DoGetThreadID() { static std::string DoGetThreadID() {
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
auto thread_id = std::this_thread::get_id(); auto thread_id = std::this_thread::get_id();
std::stringstream ss; std::stringstream ss;
ss << thread_id; ss << thread_id;

@ -47,7 +47,9 @@ void Log(int level, const char* file, int line, const char* format, ...);
// Initialize the logger with a level. // Initialize the logger with a level.
#define WEBCC_LOG_INIT(dir, modes) webcc::LogInit(dir, modes); #define WEBCC_LOG_INIT(dir, modes) webcc::LogInit(dir, modes);
#if (defined(WIN32) || defined(_WIN64)) // Definition of _WIN32 & _WIN64:
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2015
#if (defined(_WIN32) || defined(_WIN64))
// See: https://stackoverflow.com/a/8488201 // See: https://stackoverflow.com/a/8488201
// ISSUE: The last path separator of __FILE__ in a header file becomes "/" // ISSUE: The last path separator of __FILE__ in a header file becomes "/"
@ -116,13 +118,13 @@ void Log(int level, const char* file, int line, const char* format, ...);
#define LOG_ERRO(format, args...) #define LOG_ERRO(format, args...)
#endif #endif
#endif // defined(WIN32) || defined(_WIN64) #endif // defined(_WIN32) || defined(_WIN64)
#else // WEBCC_ENABLE_LOG == 0 #else // WEBCC_ENABLE_LOG == 0
#define WEBCC_LOG_INIT(dir, modes) #define WEBCC_LOG_INIT(dir, modes)
#if (defined(WIN32) || defined(_WIN64)) #if (defined(_WIN32) || defined(_WIN64))
#define LOG_VERB(format, ...) #define LOG_VERB(format, ...)
#define LOG_INFO(format, ...) #define LOG_INFO(format, ...)
#define LOG_WARN(format, ...) #define LOG_WARN(format, ...)
@ -132,7 +134,7 @@ void Log(int level, const char* file, int line, const char* format, ...);
#define LOG_INFO(format, args...) #define LOG_INFO(format, args...)
#define LOG_WARN(format, args...) #define LOG_WARN(format, args...)
#define LOG_ERRO(format, args...) #define LOG_ERRO(format, args...)
#endif // defined(WIN32) || defined(_WIN64) #endif // defined(_WIN32) || defined(_WIN64)
#endif // WEBCC_ENABLE_LOG #endif // WEBCC_ENABLE_LOG

Loading…
Cancel
Save