diff --git a/common/libex/include/ex/ex_platform.h b/common/libex/include/ex/ex_platform.h index e64b464..3000efe 100644 --- a/common/libex/include/ex/ex_platform.h +++ b/common/libex/include/ex/ex_platform.h @@ -1,155 +1,158 @@ -#ifndef __LIB_EX_PLATFORM_H__ -#define __LIB_EX_PLATFORM_H__ - -#if defined(_WIN32) || defined(WIN32) -# define EX_OS_WIN32 -#elif defined(__linux__) -# define EX_OS_LINUX -# define EX_OS_UNIX -#elif defined(__APPLE__) -# define EX_OS_MACOS -# define EX_OS_UNIX -#else -# error unsupported platform. -#endif - -// compiler -#ifdef EX_OS_WIN32 -# ifndef _MSC_VER -# error need VisualStudio on Windows. -# endif -# if _MSC_VER < 1900 // need VisualStudio 2015 and above. -# error need VisualStudio 2015 and above. -# endif -#endif - -#ifdef EX_OS_WIN32 -# if !defined(UNICODE) && !defined(_UNICODE) -# error "Does not support `Multi-Byte Character Set` on Windows." -# endif -# ifdef _DEBUG -# ifndef EX_DEBUG -# define EX_DEBUG -# endif -# endif -#endif - -#ifdef EX_OS_MACOS -# ifdef DEBUG -# define EX_DEBUG -# endif -#endif - - -#ifdef EX_OS_WIN32 -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0502 // 0x0502 = WinServer2003 (libuv need this) 0x0501 = WinXP, 0x0500 = Win2000 -# endif -# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -# define _CRT_RAND_S // for rand_s(). -# include -# include -# include -# include -# define _CSTDIO_ -# define _CSTRING_ -# define _CWCHAR_ -# include -# include -# include -#else -# include -# include -# include -# include // free() -# include // va_start() -# include // readlink() -# include -# include -# include -# include -# include -#endif -#ifdef EX_OS_MACOS -# include // for _NSGetExecutablePath -# ifndef _T -# define _T(x) L##x -# endif -#endif - - -/* -* On Windows PATH_MAX does not exist but MAX_PATH does. -* WinAPI MAX_PATH limit is only 256. MSVCR fuctions does not have this limit. -* Redefine PATH_MAX for Windows to support longer path names. -*/ -#if defined(EX_OS_WIN32) -# ifdef PATH_MAX -# undef PATH_MAX /* On Windows override PATH_MAX if defined. */ -# endif -# define PATH_MAX 1024 -#elif defined(EX_OS_LINUX) -# ifndef PATH_MAX -# define PATH_MAX 1024 -# endif -#elif defined(EX_OS_MACOS) -# define PATH_MAX 1024 /* Recommended value for OSX. */ -#endif - -// assert -#ifdef EX_DEBUG -# define ASSERT(exp) -# define CHECK(exp) do { if (!(exp)) abort(); } while (0) -//# define DEBUG_CHECKS (0) -#else -# include -# define ASSERT(exp) assert(exp) -# define CHECK(exp) assert(exp) -//# define DEBUG_CHECKS (1) -#endif - -#define UNREACHABLE() CHECK(!"Unreachable code reached.") - -#ifndef UNUSED -# if defined(_MSC_VER) -# define UNUSED(x) (void)(x) -# elif defined(__GUNC__) -# defined UNUSED(x) UNUSED_ ## x __attribute__((unused)) -# elif defined(__LCLINT__) -# define UNUSED(x) /*@unused@*/ x -# elif defined(__cplusplus) -# define UNUSED(x) -# else -# define UNUSED(x) (void)(x) -# endif -#endif - -/* check endian */ -#if !(defined(L_ENDIAN) || defined(B_ENDIAN)) -# if !defined(__BYTE_ORDER) && defined(__linux__) -# include -# endif - -# if defined(BYTE_ORDER) -# if BYTE_ORDER == BIG_ENDIAN -# define B_ENDIAN -# else -# define L_ENDIAN -# endif -# endif - -# if !(defined(L_ENDIAN) || defined(B_ENDIAN)) -# if defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || defined(__hppa__) -# define B_ENDIAN -# else -# define L_ENDIAN -# endif -# endif -#endif - -#ifdef EX_OS_WIN32 -# pragma comment(lib, "shlwapi.lib") -#endif - - -#endif // __LIB_EX_PLATFORM_H__ +#ifndef __LIB_EX_PLATFORM_H__ +#define __LIB_EX_PLATFORM_H__ + +#if defined(_WIN32) || defined(WIN32) +# define EX_OS_WIN32 +#elif defined(__linux__) +# define EX_OS_LINUX +# define EX_OS_UNIX +#elif defined(__APPLE__) +# define EX_OS_MACOS +# define EX_OS_UNIX +#else +# error unsupported platform. +#endif + +// compiler +#ifdef EX_OS_WIN32 +# ifndef _MSC_VER +# error need VisualStudio on Windows. +# endif +# if _MSC_VER < 1900 // need VisualStudio 2015 and above. +# error need VisualStudio 2015 and above. +# endif +#endif + +#ifdef EX_OS_WIN32 +# if !defined(UNICODE) && !defined(_UNICODE) +# error "Does not support `Multi-Byte Character Set` on Windows." +# endif +# ifdef _DEBUG +# ifndef EX_DEBUG +# define EX_DEBUG +# endif +# endif +#endif + +#ifdef EX_OS_MACOS +# ifdef DEBUG +# define EX_DEBUG +# endif +#endif + + +#ifdef EX_OS_WIN32 +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0502 // 0x0502 = WinServer2003 (libuv need this) 0x0501 = WinXP, 0x0500 = Win2000 +# endif +# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +# define _CRT_RAND_S // for rand_s(). +# include +# include +# include +# include +# define _CSTDIO_ +# define _CSTRING_ +# define _CWCHAR_ +# include +# include +# include +#else +# include +# include +# include +# include // free() +# include // va_start() +# include // readlink() +# include // O_RDONLY, etc. +# include +# include +# include +# include +# include +# include +#endif + +#ifdef EX_OS_MACOS +# include // for _NSGetExecutablePath +# ifndef _T +# define _T(x) L##x +# endif +#endif + + +/* +* On Windows PATH_MAX does not exist but MAX_PATH does. +* WinAPI MAX_PATH limit is only 256. MSVCR fuctions does not have this limit. +* Redefine PATH_MAX for Windows to support longer path names. +*/ +#if defined(EX_OS_WIN32) +# ifdef PATH_MAX +# undef PATH_MAX /* On Windows override PATH_MAX if defined. */ +# endif +# define PATH_MAX 1024 +#elif defined(EX_OS_LINUX) +# ifndef PATH_MAX +# define PATH_MAX 1024 +# endif +#elif defined(EX_OS_MACOS) +# define PATH_MAX 1024 /* Recommended value for OSX. */ +#endif + +// assert +#ifdef EX_DEBUG +# define ASSERT(exp) +# define CHECK(exp) do { if (!(exp)) abort(); } while (0) +//# define DEBUG_CHECKS (0) +#else +# include +# define ASSERT(exp) assert(exp) +# define CHECK(exp) assert(exp) +//# define DEBUG_CHECKS (1) +#endif + +#define UNREACHABLE() CHECK(!"Unreachable code reached.") + +#ifndef UNUSED +# if defined(_MSC_VER) +# define UNUSED(x) (void)(x) +# elif defined(__GUNC__) +# defined UNUSED(x) UNUSED_ ## x __attribute__((unused)) +# elif defined(__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +# elif defined(__cplusplus) +# define UNUSED(x) +# else +# define UNUSED(x) (void)(x) +# endif +#endif + +/* check endian */ +#if !(defined(L_ENDIAN) || defined(B_ENDIAN)) +# if !defined(__BYTE_ORDER) && defined(__linux__) +# include +# endif + +# if defined(BYTE_ORDER) +# if BYTE_ORDER == BIG_ENDIAN +# define B_ENDIAN +# else +# define L_ENDIAN +# endif +# endif + +# if !(defined(L_ENDIAN) || defined(B_ENDIAN)) +# if defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || defined(__hppa__) +# define B_ENDIAN +# else +# define L_ENDIAN +# endif +# endif +#endif + +#ifdef EX_OS_WIN32 +# pragma comment(lib, "shlwapi.lib") +#endif + + +#endif // __LIB_EX_PLATFORM_H__ diff --git a/common/libex/src/ex_util.cpp b/common/libex/src/ex_util.cpp index 936e671..c959e66 100644 --- a/common/libex/src/ex_util.cpp +++ b/common/libex/src/ex_util.cpp @@ -190,7 +190,7 @@ FILE *ex_fopen(const ex_wstr &filename, const wchar_t *mode) { #endif } -FILE* ex_fopen(const ex_astr& filename, const char* mode) { +FILE* ex_fopen(const ex_astr& filename, const char* mode) { FILE *f = NULL; #ifdef EX_OS_WIN32 errno_t err = 0; @@ -200,10 +200,10 @@ FILE* ex_fopen(const ex_astr& filename, const char* mode) { else return NULL; #else - f = fopen(filename.c_str(), mode.c_str()); + f = fopen(filename.c_str(), mode); return f; #endif -} +} bool ex_read_text_file(const ex_wstr &strFileName, ex_astr& file_content) { diff --git a/server/tp_core/protocol/ssh/ssh_proxy.cpp b/server/tp_core/protocol/ssh/ssh_proxy.cpp index beb9ca7..4158243 100644 --- a/server/tp_core/protocol/ssh/ssh_proxy.cpp +++ b/server/tp_core/protocol/ssh/ssh_proxy.cpp @@ -69,7 +69,7 @@ bool SshProxy::init(void) } void SshProxy::timer(void) { - EXLOGV("[ssh] on-timer.\n"); + // EXLOGV("[ssh] on-timer.\n"); } void SshProxy::_thread_loop(void)