Skip to content

Commit

Permalink
Avoid conflicting macros with cximage
Browse files Browse the repository at this point in the history
  • Loading branch information
Zegeri committed Sep 16, 2018
1 parent d0989ff commit facb9a6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Externals/cximage/ximadef.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@ typedef struct tagcomplex {
#include <string.h>
#include <ctype.h>

#ifndef CXIMAGE_NO_WIN32_DEFINES
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned int UINT;
typedef const char* LPCTSTR;

typedef DWORD COLORREF;
typedef unsigned int HANDLE;
#endif
typedef DWORD COLORREF;
typedef void* HRGN;
typedef void* HDC;

Expand All @@ -125,7 +126,7 @@ typedef int boolean;
#define TCHAR char
#define _T
#endif

#ifndef CXIMAGE_NO_WIN32_DEFINES
typedef struct tagRECT
{
long left;
Expand All @@ -139,7 +140,7 @@ typedef struct tagPOINT
long x;
long y;
} POINT;

#endif
typedef struct tagRGBQUAD {
BYTE rgbBlue;
BYTE rgbGreen;
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../xrServerEntities
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/cximage
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/GameSpy/src
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/ode/include
Expand Down
6 changes: 6 additions & 0 deletions src/xrGame/screenshot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
#define CXIMAGE_AS_SHARED_LIBRARY
#endif

#ifdef WINDOWS
#include <ddraw.h>
#endif

#ifdef LINUX // Avoid conflicting macros
#define CXIMAGE_NO_WIN32_DEFINES
#endif
#include "ximage.h"
#include "xmemfile.h"

Expand Down
5 changes: 4 additions & 1 deletion src/xrGame/ui/UIServerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "UIGameCustom.h"
#include "Level.h"
#include "game_cl_mp.h"
#ifdef LINUX // Avoid conflicting macros
#define CXIMAGE_NO_WIN32_DEFINES
#endif
#include "ximage.h"
#include "xmemfile.h"

Expand Down Expand Up @@ -118,7 +121,7 @@ void CUIServerInfo::SetServerRules(u8 const* data_ptr, u32 const data_size)
if (new_size > (sizeof(tmp_string) - 1))
new_size = (sizeof(tmp_string) - 1);

strncpy_s(tmp_string, reinterpret_cast<char const*>(data_ptr), new_size);
strncpy_s(tmp_string, sizeof(tmp_string), reinterpret_cast<char const*>(data_ptr), new_size);
tmp_string[new_size] = 0;

// std::replace(tmp_string, tmp_string + new_size, '\r', '\\');
Expand Down

0 comments on commit facb9a6

Please sign in to comment.