Change WIN32 to _WIN32

This commit is contained in:
Duncan Ogilvie
2024-11-28 18:37:11 +01:00
committed by Nikias Bassen
parent dd0d0d4290
commit cdede2b53e
4 changed files with 13 additions and 14 deletions
+1 -1
View File
@@ -26,7 +26,7 @@
#include <stdint.h>
#define USBMUXD_PROTOCOL_VERSION 0
#if defined(WIN32) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__CYGWIN__)
#define USBMUXD_SOCKET_PORT 27015
#else
#define USBMUXD_SOCKET_FILE "/var/run/usbmuxd"
+6 -7
View File
@@ -51,16 +51,15 @@
#define ECONNREFUSED 107
#endif
#include <unistd.h>
#include <signal.h>
#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#ifndef HAVE_SLEEP
#define sleep(x) Sleep(x*1000)
#endif
#else
#include <unistd.h>
#include <signal.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#if defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME) && !defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME_ERRNO_H)
@@ -164,7 +163,7 @@ static int connect_usbmuxd_socket()
char *usbmuxd_socket_addr = getenv("USBMUXD_SOCKET_ADDRESS");
if (usbmuxd_socket_addr) {
if (strncmp(usbmuxd_socket_addr, "UNIX:", 5) == 0) {
#if defined(WIN32) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__CYGWIN__)
/* not supported, ignore */
#else
if (usbmuxd_socket_addr[5] != '\0') {
@@ -215,7 +214,7 @@ static int connect_usbmuxd_socket()
}
}
}
#if defined(WIN32) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__CYGWIN__)
res = socket_connect("127.0.0.1", USBMUXD_SOCKET_PORT);
#else
res = socket_connect_unix(USBMUXD_SOCKET_FILE);
@@ -660,7 +659,7 @@ static void get_prog_name()
if (pname) {
prog_name = strdup(pname);
}
#elif defined (WIN32)
#elif defined (_WIN32)
TCHAR *_pname = malloc((MAX_PATH+1) * sizeof(TCHAR));
if (GetModuleFileName(NULL, _pname, MAX_PATH+1) > 0) {
char* pname = NULL;
+3 -3
View File
@@ -36,7 +36,7 @@
#include <unistd.h>
#include <errno.h>
#include <getopt.h>
#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#else
@@ -54,7 +54,7 @@ static int debug_level = 0;
static size_t read_data_socket(int fd, uint8_t* buf, size_t bufsize)
{
#ifdef WIN32
#ifdef _WIN32
u_long bytesavailable = 0;
if (fd == STDIN_FILENO) {
bytesavailable = bufsize;
@@ -166,7 +166,7 @@ int main(int argc, char **argv)
return -EINVAL;
}
#ifndef WIN32
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
+3 -3
View File
@@ -37,7 +37,7 @@
#include <unistd.h>
#include <errno.h>
#include <getopt.h>
#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
typedef unsigned int socklen_t;
@@ -370,7 +370,7 @@ int main(int argc, char **argv)
return -1;
}
#ifndef WIN32
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
@@ -412,7 +412,7 @@ int main(int argc, char **argv)
fd_set fds;
FD_ZERO(&fds);
for (i = 0; i < num_listen; i++) {
#ifdef WIN32
#ifdef _WIN32
u_long l_yes = 1;
ioctlsocket(listen_sock[i].fd, FIONBIO, &l_yes);
#else