Skip to content

Commit 61f69fc

Browse files
authored
refactor: Replace preprocessor condition _WINDOWS with _WIN32 (#1911)
1 parent 395558a commit 61f69fc

File tree

48 files changed

+151
-151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+151
-151
lines changed

Core/GameEngine/Include/GameNetwork/udp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <errno.h>
2929
#endif
3030

31-
#ifdef _WINDOWS
31+
#ifdef _WIN32
3232
#include <winsock.h>
3333
#include <io.h>
3434
//#define close _close

Core/GameEngine/Source/GameNetwork/udp.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Int UDP::Bind(UnsignedInt IP,UnsignedShort Port)
154154
addr.sin_port=Port;
155155
addr.sin_addr.s_addr=IP;
156156
fd=socket(AF_INET,SOCK_DGRAM,DEFAULT_PROTOCOL);
157-
#ifdef _WINDOWS
157+
#ifdef _WIN32
158158
if (fd==SOCKET_ERROR)
159159
fd=-1;
160160
#endif
@@ -163,7 +163,7 @@ Int UDP::Bind(UnsignedInt IP,UnsignedShort Port)
163163

164164
retval=bind(fd,(struct sockaddr *)&addr,sizeof(addr));
165165

166-
#ifdef _WINDOWS
166+
#ifdef _WIN32
167167
if (retval==SOCKET_ERROR)
168168
{
169169
retval=-1;
@@ -201,7 +201,7 @@ Int UDP::getLocalAddr(UnsignedInt &ip, UnsignedShort &port)
201201
// private function
202202
Int UDP::SetBlocking(Int block)
203203
{
204-
#ifdef _WINDOWS
204+
#ifdef _WIN32
205205
unsigned long flag=1;
206206
if (block)
207207
flag=0;
@@ -244,7 +244,7 @@ Int UDP::Write(const unsigned char *msg,UnsignedInt len,UnsignedInt IP,UnsignedS
244244

245245
ClearStatus();
246246
retval=sendto(fd,(const char *)msg,len,0,(struct sockaddr *)&to,sizeof(to));
247-
#ifdef _WINDOWS
247+
#ifdef _WIN32
248248
if (retval==SOCKET_ERROR)
249249
{
250250
retval=-1;
@@ -267,7 +267,7 @@ Int UDP::Read(unsigned char *msg,UnsignedInt len,sockaddr_in *from)
267267
if (from!=NULL)
268268
{
269269
retval=recvfrom(fd,(char *)msg,len,0,(struct sockaddr *)from,&alen);
270-
#ifdef _WINDOWS
270+
#ifdef _WIN32
271271
if (retval == SOCKET_ERROR)
272272
{
273273
if (WSAGetLastError() != WSAEWOULDBLOCK)
@@ -288,7 +288,7 @@ Int UDP::Read(unsigned char *msg,UnsignedInt len,sockaddr_in *from)
288288
else
289289
{
290290
retval=recvfrom(fd,(char *)msg,len,0,NULL,NULL);
291-
#ifdef _WINDOWS
291+
#ifdef _WIN32
292292
if (retval==SOCKET_ERROR)
293293
{
294294
if (WSAGetLastError() != WSAEWOULDBLOCK)
@@ -312,7 +312,7 @@ Int UDP::Read(unsigned char *msg,UnsignedInt len,sockaddr_in *from)
312312

313313
void UDP::ClearStatus(void)
314314
{
315-
#ifndef _WINDOWS
315+
#ifndef _WIN32
316316
errno=0;
317317
#endif
318318

@@ -322,7 +322,7 @@ void UDP::ClearStatus(void)
322322
UDP::sockStat UDP::GetStatus(void)
323323
{
324324
Int status = m_lastError;
325-
#ifdef _WINDOWS
325+
#ifdef _WIN32
326326
//int status=WSAGetLastError();
327327
switch (status) {
328328
case NO_ERROR:

Core/Libraries/Source/WWVegas/WWLib/ini.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ void INIClass::DuplicateCRCError(const char *message, const char *section, const
22852285
assert(0);
22862286

22872287
#ifdef RTS_RELEASE
2288-
#ifdef _WINDOWS
2288+
#ifdef _WIN32
22892289
MessageBox(0, buffer, "Duplicate CRC in INI file.", MB_ICONSTOP | MB_OK);
22902290
#endif
22912291
#endif

Core/Tools/WW3D/pluglib/win.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#pragma warning(pop)
6666
#endif
6767

68-
#ifdef _WINDOWS
68+
#ifdef _WIN32
6969
extern HINSTANCE ProgramInstance;
7070
extern HWND MainWindow;
7171
extern bool GameInFocus;
@@ -80,6 +80,6 @@ void __cdecl Print_Win32Error(unsigned long win32Error);
8080

8181
#endif // RTS_DEBUG
8282

83-
#else // _WINDOWS
83+
#else // _WIN32
8484
#include <unistd.h>
85-
#endif // _WINDOWS
85+
#endif // _WIN32

Core/Tools/mangler/crc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
#include <signal.h>
21-
#ifdef _WINDOWS
21+
#ifdef _WIN32
2222
#include <process.h> // *MUST* be included before ANY Wnet/Wlib headers if _REENTRANT is defined
2323
#endif
2424

Core/Tools/mangler/mangler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <Utility/iostream_adapter.h>
2121

2222
#include <signal.h>
23-
#ifdef _WINDOWS
23+
#ifdef _WIN32
2424
#include <process.h> // *MUST* be included before ANY Wnet/Wlib headers if _REENTRANT is defined
2525
#endif
2626

@@ -97,7 +97,7 @@ int main(int argc, char **argv)
9797

9898

9999
// ----- Initialize Winsock -----
100-
#ifdef _WINDOWS
100+
#ifdef _WIN32
101101
WORD verReq = MAKEWORD(2, 2);
102102
WSADATA wsadata;
103103

Core/Tools/mangler/manglertest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <Utility/iostream_adapter.h>
2121

2222
#include <signal.h>
23-
#ifdef _WINDOWS
23+
#ifdef _WIN32
2424
#include <process.h> // *MUST* be included before ANY Wnet/Wlib headers if _REENTRANT is defined
2525
#endif
2626

@@ -128,7 +128,7 @@ int main(int argc, char **argv)
128128

129129

130130
// ----- Initialize Winsock -----
131-
#ifdef _WINDOWS
131+
#ifdef _WIN32
132132
WORD verReq = MAKEWORD(2, 2);
133133
WSADATA wsadata;
134134

Core/Tools/mangler/wlib/sem4.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This is useful because the constructor will automatically call sem_init
3131

3232
Sem4::Sem4()
3333
{
34-
#ifndef _WINDOWS
34+
#ifndef _WIN32
3535
sem_init(&sem,1,1);
3636
#else
3737
sem = CreateSemaphore(NULL, 1, 1, NULL);
@@ -40,7 +40,7 @@ Sem4::Sem4()
4040

4141
Sem4::Sem4(uint32 value)
4242
{
43-
#ifndef _WINDOWS
43+
#ifndef _WIN32
4444
sem_init(&sem,1,value);
4545
#else
4646
sem = CreateSemaphore(NULL, value, value, NULL);
@@ -49,7 +49,7 @@ Sem4::Sem4(uint32 value)
4949

5050
Sem4::~Sem4()
5151
{
52-
#ifndef _WINDOWS
52+
#ifndef _WIN32
5353
sem_destroy(&sem);
5454
#else
5555
if (sem) CloseHandle(sem);
@@ -58,7 +58,7 @@ Sem4::~Sem4()
5858

5959
sint32 Sem4::Wait(void) const
6060
{
61-
#ifndef _WINDOWS
61+
#ifndef _WIN32
6262
return(sem_wait((sem_t *)&sem));
6363
#else
6464
if (!sem)
@@ -79,7 +79,7 @@ sint32 Sem4::Wait(void) const
7979

8080
sint32 Sem4::Post(void) const
8181
{
82-
#ifndef _WINDOWS
82+
#ifndef _WIN32
8383
return(sem_post((sem_t *)&sem));
8484
#else
8585
if (!sem)
@@ -92,7 +92,7 @@ sint32 Sem4::Post(void) const
9292

9393
sint32 Sem4::TryWait(void) const
9494
{
95-
#ifndef _WINDOWS
95+
#ifndef _WIN32
9696
return(sem_trywait((sem_t *)&sem));
9797
#else
9898
if (!sem)
@@ -112,7 +112,7 @@ sint32 Sem4::TryWait(void) const
112112

113113
sint32 Sem4::GetValue(int *sval) const
114114
{
115-
#ifndef _WINDOWS
115+
#ifndef _WIN32
116116
return(sem_getvalue((sem_t *)&sem,sval));
117117
#else
118118
if (!sem)
@@ -128,7 +128,7 @@ sint32 Sem4::GetValue(int *sval) const
128128

129129
sint32 Sem4::Destroy(void)
130130
{
131-
#ifndef _WINDOWS
131+
#ifndef _WIN32
132132
return(sem_destroy(&sem));
133133
#else
134134
return CloseHandle(sem);

Core/Tools/mangler/wlib/sem4.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
#pragma once
2020

2121
#include <limits.h>
22-
#ifndef _WINDOWS
22+
#ifndef _WIN32
2323
#include <unistd.h>
2424
#endif
2525
#include "wstypes.h"
2626

2727
#ifdef _REENTRANT
28-
#ifndef _WINDOWS
28+
#ifndef _WIN32
2929
#include <semaphore.h>
3030
#else
3131
#include <windows.h>
32-
#endif // _WINDOWS
32+
#endif // _WIN32
3333
#endif // _REENTRANT
3434

3535
// Windows headers have a tendency to redefine IN
@@ -42,7 +42,7 @@ class Sem4
4242
{
4343
private:
4444
#ifdef _REENTRANT
45-
#ifndef _WINDOWS
45+
#ifndef _WIN32
4646
sem_t sem;
4747
#else
4848
HANDLE sem;

Core/Tools/mangler/wlib/syslogd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121
SyslogD::SyslogD(char *ident,int logopt,int facility,int _priority)
2222
{
23-
#ifndef _WINDOWS
23+
#ifndef _WIN32
2424
openlog(ident,logopt,facility);
2525
priority=_priority;
2626
#endif
2727
}
2828

2929
int SyslogD::print(const char *str, int len)
3030
{
31-
#ifndef _WINDOWS
31+
#ifndef _WIN32
3232
char *temp_str=new char[len+1];
3333
memset(temp_str,0,len+1);
3434
strncpy(temp_str,str,len);

0 commit comments

Comments
 (0)