From 300994d5cb81f70c4dfa5931f91ab9911876a811 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Sat, 16 Dec 2017 13:25:31 +0800 Subject: [PATCH] Fix win32 define. Change dprintf to function --- src/include/log.h | 13 ++----------- src/include/zlib_wrapper.h | 2 +- src/log.cpp | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 src/log.cpp diff --git a/src/include/log.h b/src/include/log.h index 157ce77..1167e53 100644 --- a/src/include/log.h +++ b/src/include/log.h @@ -1,13 +1,4 @@ #pragma once -#ifdef DEBUG -#ifndef dprintf -/// Debug Output API -#define dprintf(fmt,args...) printf("%s: ",__PRETTY_FUNCTION__);printf(fmt,##args) -#endif /// End of dprintf -#else -#ifndef dprintf -/// Debug Output API -#define dprintf(fmt,args...) -#endif /// End of dprintf -#endif /// End of DEBUG +/// Debug output +void dprintf(const char* fmt,...); diff --git a/src/include/zlib_wrapper.h b/src/include/zlib_wrapper.h index e1f8fcc..8da023e 100644 --- a/src/include/zlib_wrapper.h +++ b/src/include/zlib_wrapper.h @@ -1,6 +1,6 @@ #pragma once -#ifdef __WIN32 /// Windows Needs this Definition. +#ifdef _WIN32 /// Windows Needs this Definition. #define ZLIB_WINAPI #endif // __WIN32 #include "zlib/zlib.h" diff --git a/src/log.cpp b/src/log.cpp new file mode 100644 index 0000000..3a78541 --- /dev/null +++ b/src/log.cpp @@ -0,0 +1,19 @@ +#include "log.h" +#include +#include +using namespace std; + +#ifdef DEBUG +void dprintf(const char* fmt,...) +{ + va_list ap; + va_start(ap,fmt); + vprintf(fmt,ap); + va_end(ap); +} +#else +void dprintf(const char* fmt,...) +{ + +} +#endif