Skip to content

Commit 0effd20

Browse files
feliwirFighter19
andcommitted
[Compat] Fix GEN WWDebug compilation
Co-authored-by: Patrick Zacharias <1475802+Fighter19@users.noreply.github.com>
1 parent 6b74684 commit 0effd20

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

Generals/Code/Libraries/Source/WWVegas/WWDebug/wwdebug.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@
4343

4444

4545
#include "wwdebug.h"
46+
#ifdef _WIN32
4647
#include <windows.h>
48+
#else
49+
#include <errno.h>
50+
#endif
4751
//#include "win.h" can use this if allowed to see wwlib
4852
#include <stdlib.h>
4953
#include <stdarg.h>
@@ -77,7 +81,11 @@ void Convert_System_Error_To_String(int id, char* buffer, int buf_len)
7781

7882
int Get_Last_System_Error()
7983
{
84+
#ifndef _UNIX
8085
return GetLastError();
86+
#else
87+
return errno;
88+
#endif
8189
}
8290

8391
/***********************************************************************************************

Generals/Code/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@
3838
* WWMemoryLogClass::Release_Memory -- frees memory *
3939
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
4040

41-
41+
#include "always.h"
4242
#include "wwmemlog.h"
4343
#include "wwdebug.h"
4444
#include "Vector.H"
45+
#ifdef _WIN32
4546
#include <windows.h>
47+
#endif
4648

4749
#if (STEVES_NEW_CATCHER || PARAM_EDITING_ON)
4850
#define DISABLE_MEMLOG 1
@@ -214,33 +216,41 @@ static bool _MemLogAllocated = false;
214216
*/
215217
void * Get_Mem_Log_Mutex(void)
216218
{
219+
#ifdef _WIN32
217220
if (_MemLogMutex == NULL) {
218221
_MemLogMutex=CreateMutex(NULL,false,NULL);
219222
WWASSERT(_MemLogMutex);
220223
}
221224
return _MemLogMutex;
225+
#else
226+
return NULL;
227+
#endif
222228
}
223229

224230
void Lock_Mem_Log_Mutex(void)
225231
{
232+
#ifdef _WIN32
226233
void * mutex = Get_Mem_Log_Mutex();
227234
#ifdef DEBUG_CRASHING
228235
int res =
229236
#endif
230237
WaitForSingleObject(mutex,INFINITE);
231238
WWASSERT(res==WAIT_OBJECT_0);
232239
_MemLogLockCounter++;
240+
#endif
233241
}
234242

235243
void Unlock_Mem_Log_Mutex(void)
236244
{
245+
#ifdef _WIN32
237246
void * mutex = Get_Mem_Log_Mutex();
238247
_MemLogLockCounter--;
239248
#ifdef DEBUG_CRASHING
240249
int res=
241250
#endif
242251
ReleaseMutex(mutex);
243252
WWASSERT(res);
253+
#endif
244254
}
245255

246256
class MemLogMutexLockClass

Generals/Code/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@
5353
#include "always.h"
5454
#include "wwprofile.h"
5555
#include "wwdebug.h"
56+
#ifdef _WIN32
5657
#include <windows.h>
57-
58+
#endif
5859

5960

6061
/***********************************************************************************************

0 commit comments

Comments
 (0)