diff --git a/CMakeLists.txt b/CMakeLists.txt index 754bcc17f..f0cb8f1eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,7 @@ endif() # Set some compiler options -if(UNIX) +if(UNIX OR MINGW) add_definitions(-Wall) endif() @@ -181,6 +181,9 @@ if(WIN32) # And shut up about unsafe stuff add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif() + +if(MSVC) # VS will automatically add NDEBUG for release mode, but only _DEBUG in debug mode. # Since STK uses DEBUG, this is added for debug compilation only: set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG) diff --git a/data/gfx/droplet.xml b/data/gfx/droplet.xml index 5639d8652..e558cafd5 100644 --- a/data/gfx/droplet.xml +++ b/data/gfx/droplet.xml @@ -1,7 +1,7 @@ - + - + - diff --git a/data/gfx/waterfall.xml b/data/gfx/waterfall.xml index c08fec91e..048348f10 100644 --- a/data/gfx/waterfall.xml +++ b/data/gfx/waterfall.xml @@ -1,17 +1,17 @@ - + - + - + -#if defined(WIN32) && !defined(__MINGW32__) +#if defined(WIN32) # include "Ws2tcpip.h" -# define inet_ntop InetNtop - -// TODO: It's very ugly hack which allows to compile STK on windows using gcc. -// Solution would be nice seen. -#elif defined(__MINGW32__) -# include "Ws2tcpip.h" -# define inet_ntop - +# if defined(InetNtop) +# define inet_ntop InetNtop +# endif #else # include # include @@ -42,6 +37,27 @@ #include #include +#if !defined(inet_ntop) +const char* inet_ntop(int af, const void* src, char* dst, int cnt) +{ + struct sockaddr_in srcaddr; + + memset(&srcaddr, 0, sizeof(struct sockaddr_in)); + memcpy(&(srcaddr.sin_addr), src, sizeof(srcaddr.sin_addr)); + + srcaddr.sin_family = af; + if (WSAAddressToString((struct sockaddr*) &srcaddr, + sizeof(struct sockaddr_in), 0, dst, (LPDWORD) &cnt) != 0) + { + DWORD rv = WSAGetLastError(); + printf("WSAAddressToString() : %d\n",rv); + return NULL; + } + return dst; +} +#endif + + FILE* STKHost::m_log_file = NULL; pthread_mutex_t STKHost::m_log_mutex; @@ -98,7 +114,7 @@ STKHost::STKHost() pthread_mutex_init(&m_log_mutex, NULL); if (UserConfigParams::m_packets_log_filename.toString() != "") { - std::string s = + std::string s = file_manager->getUserConfigFile(UserConfigParams::m_packets_log_filename); m_log_file = fopen(s.c_str(), "w+"); }