Skip to content

Commit facb9a6

Browse files
committed
Avoid conflicting macros with cximage
1 parent d0989ff commit facb9a6

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

Externals/cximage/ximadef.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,15 @@ typedef struct tagcomplex {
9494
#include <string.h>
9595
#include <ctype.h>
9696

97+
#ifndef CXIMAGE_NO_WIN32_DEFINES
9798
typedef unsigned char BYTE;
9899
typedef unsigned short WORD;
99100
typedef unsigned long DWORD;
100101
typedef unsigned int UINT;
101102
typedef const char* LPCTSTR;
102-
103-
typedef DWORD COLORREF;
104103
typedef unsigned int HANDLE;
104+
#endif
105+
typedef DWORD COLORREF;
105106
typedef void* HRGN;
106107
typedef void* HDC;
107108

@@ -125,7 +126,7 @@ typedef int boolean;
125126
#define TCHAR char
126127
#define _T
127128
#endif
128-
129+
#ifndef CXIMAGE_NO_WIN32_DEFINES
129130
typedef struct tagRECT
130131
{
131132
long left;
@@ -139,7 +140,7 @@ typedef struct tagPOINT
139140
long x;
140141
long y;
141142
} POINT;
142-
143+
#endif
143144
typedef struct tagRGBQUAD {
144145
BYTE rgbBlue;
145146
BYTE rgbGreen;

src/xrGame/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ include_directories(
4040
${CMAKE_CURRENT_SOURCE_DIR}/..
4141
${CMAKE_CURRENT_SOURCE_DIR}/../xrServerEntities
4242
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
43+
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/cximage
4344
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/GameSpy/src
4445
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
4546
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/ode/include

src/xrGame/screenshot_manager.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99
#define CXIMAGE_AS_SHARED_LIBRARY
1010
#endif
1111

12+
#ifdef WINDOWS
1213
#include <ddraw.h>
14+
#endif
15+
16+
#ifdef LINUX // Avoid conflicting macros
17+
#define CXIMAGE_NO_WIN32_DEFINES
18+
#endif
1319
#include "ximage.h"
1420
#include "xmemfile.h"
1521

src/xrGame/ui/UIServerInfo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include "UIGameCustom.h"
99
#include "Level.h"
1010
#include "game_cl_mp.h"
11+
#ifdef LINUX // Avoid conflicting macros
12+
#define CXIMAGE_NO_WIN32_DEFINES
13+
#endif
1114
#include "ximage.h"
1215
#include "xmemfile.h"
1316

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

121-
strncpy_s(tmp_string, reinterpret_cast<char const*>(data_ptr), new_size);
124+
strncpy_s(tmp_string, sizeof(tmp_string), reinterpret_cast<char const*>(data_ptr), new_size);
122125
tmp_string[new_size] = 0;
123126

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

0 commit comments

Comments
 (0)