diff --git a/src/audio/playback/decklink.cpp b/src/audio/playback/decklink.cpp index b84bb4043..d9cbd397a 100644 --- a/src/audio/playback/decklink.cpp +++ b/src/audio/playback/decklink.cpp @@ -57,7 +57,7 @@ #include "video_codec.h" #include "video_capture.h" -#ifndef WIN32 +#ifndef _WIN32 #define STDMETHODCALLTYPE #endif diff --git a/src/blackmagic_common.cpp b/src/blackmagic_common.cpp index 9b8019656..a2e558945 100644 --- a/src/blackmagic_common.cpp +++ b/src/blackmagic_common.cpp @@ -107,7 +107,7 @@ char *get_cstr_from_bmd_api_str(BMD_STR bmd_string) size_t len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(bmd_string), kCFStringEncodingUTF8) + 1; cstr = (char *) malloc(len); CFStringGetCString(bmd_string, (char *) cstr, len, kCFStringEncodingUTF8); -#elif defined WIN32 +#elif defined _WIN32 size_t len = SysStringLen(bmd_string) * 4 + 1; cstr = (char *) malloc(len); wcstombs((char *) cstr, bmd_string, len); @@ -141,7 +141,7 @@ void release_bmd_api_str(BMD_STR string) } #ifdef HAVE_MACOSX CFRelease(string); -#elif defined WIN32 +#elif defined _WIN32 SysFreeString(string); #else free(const_cast(string)); @@ -165,7 +165,7 @@ std::string get_str_from_bmd_api_str(BMD_STR string) IDeckLinkIterator *create_decklink_iterator(bool *com_initialized, bool verbose, bool coinit) { IDeckLinkIterator *deckLinkIterator = nullptr; -#ifdef WIN32 +#ifdef _WIN32 if (coinit) { com_initialize(com_initialized, "[BMD] "); } @@ -206,7 +206,7 @@ bool blackmagic_api_version_check() if (!com_initialize(&com_initialized, "[BMD] ")) { goto cleanup; } -#ifdef WIN32 +#ifdef _WIN32 result = CoCreateInstance(CLSID_CDeckLinkAPIInformation, NULL, CLSCTX_ALL, IID_IDeckLinkAPIInformation, (void **) &APIInformation); if(FAILED(result)) { @@ -249,7 +249,7 @@ void print_decklink_version() IDeckLinkAPIInformation *APIInformation = NULL; HRESULT result; -#ifdef WIN32 +#ifdef _WIN32 bool com_initialized = false; if (!com_initialize(&com_initialized, "[BMD] ")) { goto cleanup; @@ -282,7 +282,7 @@ cleanup: if (APIInformation) { APIInformation->Release(); } -#ifdef WIN32 +#ifdef _WIN32 com_uninitialize(&com_initialized); #endif } diff --git a/src/blackmagic_common.hpp b/src/blackmagic_common.hpp index 740793451..21d881f87 100644 --- a/src/blackmagic_common.hpp +++ b/src/blackmagic_common.hpp @@ -68,7 +68,7 @@ static std::vector> uv_to_bmd_codec_map = { { UYVY, bmdFormat8BitYUV }, }; -#ifdef WIN32 +#ifdef _WIN32 #define BMD_BOOL BOOL #define BMD_TRUE TRUE #define BMD_FALSE FALSE diff --git a/src/bluefish444_common.h b/src/bluefish444_common.h index 2f872c0e7..1ae333bf3 100644 --- a/src/bluefish444_common.h +++ b/src/bluefish444_common.h @@ -46,7 +46,7 @@ #include "debug.h" -#ifdef WIN32 +#ifdef _WIN32 #include #include #else diff --git a/src/compat/alarm.h b/src/compat/alarm.h index 49601a948..d65146ea9 100644 --- a/src/compat/alarm.h +++ b/src/compat/alarm.h @@ -38,7 +38,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifdef WIN32 +#ifdef _WIN32 #ifndef COMPAT_ALARM_H #define COMPAT_ALARM_H @@ -49,4 +49,4 @@ EXTERN_C void alarm(unsigned int sec); #endif // defined COMPAT_ALARM_H -#endif /* WIN32 */ +#endif /* _WIN32 */ diff --git a/src/compat/platform_pipe.cpp b/src/compat/platform_pipe.cpp index 75b789285..ba81637e0 100644 --- a/src/compat/platform_pipe.cpp +++ b/src/compat/platform_pipe.cpp @@ -154,7 +154,7 @@ static int system_pipe(fd_t p[2]) int platform_pipe_init(fd_t p[2]) { -#ifdef WIN32 +#ifdef _WIN32 // This needs to be called twice, indeed, since WSACleanup will be run // on both ends. This call is also required because not all pipes are // destroyed before common_cleanup which calls WSACleanup @@ -227,7 +227,7 @@ int platform_pipe_init(fd_t p[2]) void platform_pipe_close(fd_t pipe) { CLOSESOCKET(pipe); -#ifdef WIN32 +#ifdef _WIN32 WSACleanup(); #endif } diff --git a/src/config_unix.h b/src/config_unix.h index f76adeba3..5f4186c3c 100644 --- a/src/config_unix.h +++ b/src/config_unix.h @@ -208,4 +208,4 @@ CONF_NIX_EXT_C int __xpg_strerror_r(int errcode, char *buffer, size_t length); #endif // ! defined __STDC_LIB_EXT1__ #endif /* _CONFIG_UNIX_H */ -#endif /* NDEF WIN32 */ +#endif /* NDEF _WIN32 */ diff --git a/src/control_socket.cpp b/src/control_socket.cpp index 0336993f6..2c8856801 100644 --- a/src/control_socket.cpp +++ b/src/control_socket.cpp @@ -61,11 +61,11 @@ #define MAX_CLIENTS 16 -#ifdef WIN32 +#ifdef _WIN32 typedef const char *sso_val_type; #else typedef void *sso_val_type; -#endif /* WIN32 */ +#endif // defined _WIN32 using namespace std; diff --git a/src/debug.cpp b/src/debug.cpp index d33f439af..5897d420b 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -70,7 +70,7 @@ static void _dprintf(const char *format, ...) return; } -#ifdef WIN32 +#ifdef _WIN32 char msg[65535]; va_list ap; @@ -84,7 +84,7 @@ static void _dprintf(const char *format, ...) va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); -#endif /* WIN32 */ +#endif /* _WIN32 */ } static void diff --git a/src/gl_context.c b/src/gl_context.c index d2186da1e..b5c8df3c6 100644 --- a/src/gl_context.c +++ b/src/gl_context.c @@ -41,8 +41,6 @@ #include "config_win32.h" #endif -#if defined HAVE_MACOSX || (defined HAVE_LINUX && defined HAVE_LIBGL) || defined WIN32 - #include #ifdef HAVE_MACOSX @@ -50,7 +48,7 @@ #elif defined HAVE_LINUX #include "x11_common.h" #include "glx_common.h" -#else // WIN32 +#else // _WIN32 #include "win32_gl_common.h" #endif @@ -103,7 +101,7 @@ bool init_gl_context(struct gl_context *context, int which) { context->context = mac_gl_init(MAC_GL_PROFILE_LEGACY); context->legacy = TRUE; } -#else // WIN32 +#else // _WIN32 if(which == GL_CONTEXT_ANY) { context->context = win32_context_init(OPENGL_VERSION_UNSPECIFIED); } else if(which == GL_CONTEXT_LEGACY) { @@ -250,4 +248,3 @@ void gl_context_make_current(struct gl_context *context) #endif } -#endif /* defined HAVE_MACOSX || (defined HAVE_LINUX && defined HAVE_LIBGLEW) */ diff --git a/src/host.cpp b/src/host.cpp index 4139d05e1..ee18d7e5f 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -47,7 +47,7 @@ #ifndef _WIN32 #include #include -#endif // defined WIN32 +#endif // defined _WIN32 #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 27 #include @@ -192,7 +192,7 @@ void common_cleanup(struct init_data *init) muntrace(); #endif -#ifdef WIN32 +#ifdef _WIN32 WSACleanup(); #endif } @@ -205,7 +205,7 @@ ADD_TO_PARAM("stderr-buf", " Buffering for stderr\n"); static bool set_output_buffering() { const unordered_map> outs = { // pair -#ifdef WIN32 +#ifdef _WIN32 { "stdout-buf", pair{stdout, _IONBF} }, #else { "stdout-buf", pair{stdout, _IOLBF} }, @@ -268,7 +268,7 @@ static int x11_error_handler(Display *d, XErrorEvent *e) { */ static void load_libgcc() { -#ifndef WIN32 +#ifndef _WIN32 array addresses{}; backtrace(addresses.data(), addresses.size()); #endif @@ -441,7 +441,7 @@ struct init_data *common_preinit(int argc, char *argv[]) #endif struct init_data init{}; -#ifdef WIN32 +#ifdef _WIN32 WSADATA wsaData; int err = WSAStartup(MAKEWORD(2, 2), &wsaData); if(err != 0) { @@ -1200,7 +1200,7 @@ print_backtrace() } } close(fd); -#endif // defined WIN32 +#endif // defined _WIN32 } void crash_signal_handler(int sig) @@ -1229,12 +1229,12 @@ void crash_signal_handler(int sig) void hang_signal_handler(int sig) { UNUSED(sig); -#ifndef WIN32 +#ifndef _WIN32 assert(sig == SIGALRM); char msg[] = "Hang detected - you may continue waiting or kill UltraGrid. Please report if UltraGrid doesn't exit after reasonable amount of time.\n"; write_all(STDERR_FILENO, sizeof msg - 1, msg); signal(SIGALRM, SIG_DFL); -#endif // ! defined WIN32 +#endif // ! defined _WIN32 } // some common parameters used within multiple modules diff --git a/src/ihdtv/ihdtv.c b/src/ihdtv/ihdtv.c index 014d305a9..8a66ba2b8 100644 --- a/src/ihdtv/ihdtv.c +++ b/src/ihdtv/ihdtv.c @@ -52,7 +52,7 @@ #include "config_win32.h" #endif // HAVE_CONFIG_H -#ifndef WIN32 +#ifndef _WIN32 #include #include @@ -513,5 +513,5 @@ ihdtv_receive(ihdtv_connection * connection, char *buffer, return 0; } -#endif // WIN32 +#endif // _WIN32 diff --git a/src/ihdtv/ihdtv.h b/src/ihdtv/ihdtv.h index 7803dac6a..7eb1dec95 100644 --- a/src/ihdtv/ihdtv.h +++ b/src/ihdtv/ihdtv.h @@ -52,7 +52,7 @@ #include "config_win32.h" #endif // HAVE_CONFIG_H -#ifndef WIN32 +#ifndef _WIN32 #ifndef _IHDTV_H_ #define _IHDTV_H_ @@ -130,5 +130,5 @@ ihdtv_send(ihdtv_connection *tx_connection, struct video_frame *tx_frame, unsign #endif -#endif // WIN32 +#endif // _WIN32 diff --git a/src/keyboard_control.cpp b/src/keyboard_control.cpp index 314d0e3e8..5829e43d9 100644 --- a/src/keyboard_control.cpp +++ b/src/keyboard_control.cpp @@ -346,7 +346,7 @@ static int64_t get_ansi_code() { return c; } -#ifndef WIN32 +#ifndef _WIN32 /* * Input must be 0x80-0xff */ @@ -381,7 +381,7 @@ static int64_t get_utf8_code(int c) { } #endif -#ifdef WIN32 +#ifdef _WIN32 static int64_t convert_win_to_ansi_keycode(int c) { switch (c) { case 0xe048: return K_UP; @@ -397,7 +397,7 @@ static int64_t convert_win_to_ansi_keycode(int c) { #endif static bool is_utf8(int64_t ch) { -#ifdef WIN32 +#ifdef _WIN32 return false; #endif @@ -502,7 +502,7 @@ int64_t keyboard_control::impl::get_next_key() if ((c = get_ansi_code()) < 0) { continue; } -#ifdef WIN32 +#ifdef _WIN32 } else if (c == 0x0 || c == 0xe0) { // Win keycodes int tmp = GETCH(); debug_msg(MOD_NAME "Pressed %d\n", tmp); diff --git a/src/main.cpp b/src/main.cpp index e68a41c00..c2a3f5725 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -67,7 +67,7 @@ #include #ifndef _WIN32 #include -#endif // defined WIN32 +#endif // defined _WIN32 #include #include #include @@ -1253,7 +1253,7 @@ int main(int argc, char *argv[]) struct ug_nat_traverse *nat_traverse = nullptr; -#ifndef WIN32 +#ifndef _WIN32 signal(SIGQUIT, crash_signal_handler); #endif signal(SIGABRT, crash_signal_handler); @@ -1361,7 +1361,7 @@ int main(int argc, char *argv[]) signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); -#ifndef WIN32 +#ifndef _WIN32 signal(SIGHUP, signal_handler); signal(SIGPIPE, signal_handler); #endif @@ -1535,7 +1535,7 @@ cleanup: signal(SIGINT, SIG_DFL); signal(SIGTERM, SIG_DFL); -#ifndef WIN32 +#ifndef _WIN32 signal(SIGHUP, SIG_DFL); signal(SIGALRM, hang_signal_handler); #endif diff --git a/src/rtp/ldgm.cpp b/src/rtp/ldgm.cpp index 9830046f9..3b6fc85fb 100644 --- a/src/rtp/ldgm.cpp +++ b/src/rtp/ldgm.cpp @@ -172,7 +172,7 @@ void ldgm::set_params(unsigned int k, unsigned int m, unsigned int c, unsigned i int res; -#ifdef WIN32 +#ifdef _WIN32 TCHAR tmpPath[MAX_PATH]; UINT ret = GetTempPath(MAX_PATH, tmpPath); if(ret == 0 || ret > MAX_PATH) { diff --git a/src/rtp/net_udp.c b/src/rtp/net_udp.c index 49474dc93..7744aa62d 100644 --- a/src/rtp/net_udp.c +++ b/src/rtp/net_udp.c @@ -84,7 +84,7 @@ static void *udp_reader(void *arg); const struct in6_addr in6addr_any = { IN6ADDR_ANY_INIT }; #endif -#ifdef WIN32 +#ifdef _WIN32 typedef char *sockopt_t; #else typedef void *sockopt_t; @@ -145,7 +145,7 @@ struct socket_udp_local { fd_t rx_fd; fd_t tx_fd; bool multithreaded; -#ifdef WIN32 +#ifdef _WIN32 bool is_wsa_overlapped; #endif @@ -172,7 +172,7 @@ struct _socket_udp { struct socket_udp_local *local; bool local_is_slave; // whether is the local -#ifdef WIN32 +#ifdef _WIN32 WSAOVERLAPPED *overlapped; WSAEVENT *overlapped_events; void **dispose_udata; @@ -184,7 +184,7 @@ struct _socket_udp { static void udp_clean_async_state(socket_udp *s); -#ifdef WIN32 +#ifdef _WIN32 /* Want to use both Winsock 1 and 2 socket options, but since * IPv6 support requires Winsock 2 we have to add own backwards * compatibility for Winsock 1. @@ -192,7 +192,7 @@ static void udp_clean_async_state(socket_udp *s); #define SETSOCKOPT winsock_versions_setsockopt #else #define SETSOCKOPT setsockopt -#endif /* WIN32 */ +#endif /* _WIN32 */ #define GETSOCKOPT getsockopt @@ -205,7 +205,7 @@ void socket_error(const char *msg, ...) va_list ap; char buffer[ERRBUF_SIZE] = ""; -#ifdef WIN32 +#ifdef _WIN32 #define WSERR(x) {#x,x} struct wse { char errname[20]; @@ -254,7 +254,7 @@ void socket_error(const char *msg, ...) #endif } -#ifdef WIN32 +#ifdef _WIN32 #define socket_herror socket_error #else static void socket_herror(const char *msg, ...) @@ -270,7 +270,7 @@ static void socket_herror(const char *msg, ...) } #endif -#ifdef WIN32 +#ifdef _WIN32 /* ws2tcpip.h defines these constants with different values from * winsock.h so files that use winsock 2 values but try to use * winsock 1 fail. So what was the motivation in changing the @@ -367,7 +367,7 @@ static bool udp_addr_valid4(const char *dst) static bool udp_join_mcast_grp4(unsigned long addr, int rx_fd, int tx_fd, int ttl, unsigned int ifindex) { if (IN_MULTICAST(ntohl(addr))) { -#ifndef WIN32 +#ifndef _WIN32 char loop = 1; #endif struct ip_mreq imr; @@ -381,7 +381,7 @@ static bool udp_join_mcast_grp4(unsigned long addr, int rx_fd, int tx_fd, int tt socket_error("setsockopt IP_ADD_MEMBERSHIP"); return false; } -#ifndef WIN32 +#ifndef _WIN32 if (SETSOCKOPT (tx_fd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)) != 0) { @@ -750,7 +750,7 @@ static bool set_sock_opts_and_bind(fd_t fd, bool ipv6, uint16_t rx_port, int ttl } if (bind(fd, (struct sockaddr *)&s_in, sin_len) != 0) { socket_error("bind"); -#ifdef WIN32 +#ifdef _WIN32 log_msg(LOG_LEVEL_ERROR, "Check if there is no service running on UDP port %d. ", rx_port); if (rx_port == 5004 || rx_port == 5005) log_msg(LOG_LEVEL_ERROR, "Windows Media Services is usually a good candidate to check and disable.\n"); @@ -764,7 +764,7 @@ static bool set_sock_opts_and_bind(fd_t fd, bool ipv6, uint16_t rx_port, int ttl ADD_TO_PARAM("udp-queue-len", "* udp-queue-len=\n" " Use different queue size than default DEFAULT_MAX_UDP_READER_QUEUE_LEN\n"); -#ifdef WIN32 +#ifdef _WIN32 ADD_TO_PARAM("udp-disable-multi-socket", "* udp-disable-multi-socket\n" " Disable separate sockets for RX and TX (Win only). Separated RX/TX is a workaround\n" @@ -818,7 +818,7 @@ socket_udp *udp_init_if(const char *addr, const char *iface, uint16_t rx_port, } else { s->ifindex = 0; } -#ifdef WIN32 +#ifdef _WIN32 if (!is_host_loopback(addr)) { s->local->is_wsa_overlapped = true; } @@ -1040,7 +1040,7 @@ int udp_sendto(socket_udp * s, char *buffer, int buflen, struct sockaddr *dst_ad return sendto(s->local->tx_fd, buffer, buflen, 0, dst_addr, addrlen); } -#ifdef WIN32 +#ifdef _WIN32 int udp_sendv(socket_udp * s, LPWSABUF vector, int count, void *d) { assert(s != NULL); @@ -1083,7 +1083,7 @@ int udp_sendv(socket_udp * s, struct iovec *vector, int count, void *d) free(d); return ret; } -#endif // WIN32 +#endif // _WIN32 /** * When receiving data in separate thread, this function fetches data @@ -1282,7 +1282,7 @@ int udp_recv_data(socket_udp * s, char **buffer){ return udp_recvfrom_data(s, buffer, NULL, NULL); } -#ifndef WIN32 +#ifndef _WIN32 int udp_recvv(socket_udp * s, struct msghdr *m) { if (recvmsg(s->local->rx_fd, m, 0) == -1) { @@ -1291,7 +1291,7 @@ int udp_recvv(socket_udp * s, struct msghdr *m) } return 0; } -#endif // WIN32 +#endif // _WIN32 /** * udp_fd_set: @@ -1529,7 +1529,7 @@ void udp_flush_recv_buf(socket_udp *s) */ void udp_async_start(socket_udp *s, int nr_packets) { -#ifdef WIN32 +#ifdef _WIN32 if (!s->local->is_wsa_overlapped) { return; } @@ -1556,7 +1556,7 @@ void udp_async_start(socket_udp *s, int nr_packets) void udp_async_wait(socket_udp *s) { -#ifdef WIN32 +#ifdef _WIN32 if (!s->overlapping_active) return; for(int i = 0; i < s->overlapped_count; i += WSA_MAXIMUM_WAIT_EVENTS) @@ -1583,7 +1583,7 @@ void udp_async_wait(socket_udp *s) static void udp_clean_async_state(socket_udp *s) { -#ifdef WIN32 +#ifdef _WIN32 for (int i = 0; i < s->overlapped_max; i++) { WSACloseEvent(s->overlapped[i].hEvent); } @@ -1679,7 +1679,7 @@ int udp_port_pair_is_free(int force_ip_version, int even_port) return 0; } -#ifdef WIN32 +#ifdef _WIN32 /** * This function sends buffer asynchronously with provided Winsock parameters. * diff --git a/src/rtp/net_udp.h b/src/rtp/net_udp.h index ac1e506b1..7898ab527 100644 --- a/src/rtp/net_udp.h +++ b/src/rtp/net_udp.h @@ -78,7 +78,7 @@ int udp_sendto(socket_udp *s, char *buffer, int buflen, struct sockaddr int udp_recvv(socket_udp *s, struct msghdr *m); void udp_async_start(socket_udp *s, int nr_packets); void udp_async_wait(socket_udp *s); -#ifdef WIN32 +#ifdef _WIN32 int udp_sendv(socket_udp *s, LPWSABUF vector, int count, void *d); #else int udp_sendv(socket_udp *s, struct iovec *vector, int count, void *d); @@ -116,7 +116,7 @@ bool udp_is_ipv6(socket_udp *s); void socket_error(const char *msg, ...); -#ifdef WIN32 +#ifdef _WIN32 int udp_send_wsa_async(socket_udp *s, char *buffer, int buflen, LPWSAOVERLAPPED_COMPLETION_ROUTINE, LPWSAOVERLAPPED); int udp_sendto_wsa_async(socket_udp *s, char *buffer, int buflen, LPWSAOVERLAPPED_COMPLETION_ROUTINE l, LPWSAOVERLAPPED o, struct sockaddr *addr, socklen_t addrlen); #endif diff --git a/src/rtp/rtp.c b/src/rtp/rtp.c index 913939bf6..685f90b4f 100644 --- a/src/rtp/rtp.c +++ b/src/rtp/rtp.c @@ -914,7 +914,7 @@ static char *get_cname(socket_udp * s) char *hname; char *uname; char *cname; -#ifndef WIN32 +#ifndef _WIN32 struct passwd *pwent; #else char *name; @@ -925,7 +925,7 @@ static char *get_cname(socket_udp * s) cname[0] = '\0'; /* First, fill in the username... */ -#ifdef WIN32 +#ifdef _WIN32 name = NULL; namelen = 0; GetUserName(NULL, &namelen); @@ -1046,7 +1046,7 @@ struct rtp *rtp_init_if(const char *addr, const char *iface, char *cname; char *hname; -#ifdef WIN32 +#ifdef _WIN32 if (multithreaded) { log_msg(LOG_LEVEL_WARNING, "Multithreaded RTP is not recommended for MSW due to internal locking within Winsock implementation.\n"); } @@ -2766,7 +2766,7 @@ rtp_send_data_hdr(struct rtp *session, uint8_t *buffer = NULL; rtp_packet *packet = NULL; uint8_t initVec[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -#ifdef WIN32 +#ifdef _WIN32 WSABUF *send_vector = NULL; #else struct iovec send_vector[3]; @@ -2818,7 +2818,7 @@ rtp_send_data_hdr(struct rtp *session, /* Allocate memory for the packet... */ assert(buffer_len < RTP_MAX_PACKET_LEN); /* we dont always need 20 (12|16) but this seems to work. LG */ -#ifdef WIN32 +#ifdef _WIN32 d = (uint8_t *) malloc(3 * sizeof(WSABUF) + 20 + RTP_PACKET_HEADER_SIZE); send_vector = d; buffer = (uint8_t *) d + 3 * sizeof(WSABUF); @@ -2827,7 +2827,7 @@ rtp_send_data_hdr(struct rtp *session, #endif packet = (rtp_packet *)(void *) buffer; -#ifdef WIN32 +#ifdef _WIN32 send_vector[0].buf = (char *) (buffer + RTP_PACKET_HEADER_SIZE); send_vector[0].len = buffer_len; #else @@ -2883,7 +2883,7 @@ rtp_send_data_hdr(struct rtp *session, } /* ...the payload header... */ if (phdr != NULL) { -#ifdef WIN32 +#ifdef _WIN32 send_vector[send_vector_len].buf = phdr; send_vector[send_vector_len].len = phdr_len; #else @@ -2894,7 +2894,7 @@ rtp_send_data_hdr(struct rtp *session, } /* ...and the media data... */ if (data_len > 0) { -#ifdef WIN32 +#ifdef _WIN32 send_vector[send_vector_len].buf = (void *) data; send_vector[send_vector_len].len = data_len; #else diff --git a/src/utils/fs.c b/src/utils/fs.c index 384b00db9..eaffdc266 100644 --- a/src/utils/fs.c +++ b/src/utils/fs.c @@ -61,7 +61,7 @@ const char *get_temp_dir(void) return temp_dir; } -#ifdef WIN32 +#ifdef _WIN32 if (GetTempPathA(sizeof temp_dir, temp_dir) == 0) { return NULL; } diff --git a/src/utils/misc.cpp b/src/utils/misc.cpp index 0642f101a..999108d12 100644 --- a/src/utils/misc.cpp +++ b/src/utils/misc.cpp @@ -168,7 +168,7 @@ const char *format_in_si_units(unsigned long long int val) { bool is_wine() { -#ifdef WIN32 +#ifdef _WIN32 HMODULE hntdll = GetModuleHandle("ntdll.dll"); if(!hntdll) { return false; diff --git a/src/utils/nat.c b/src/utils/nat.c index db10436f6..751e637a4 100644 --- a/src/utils/nat.c +++ b/src/utils/nat.c @@ -160,7 +160,7 @@ static const char* decode_fresult(pcp_fstate_e s) } } -#ifdef WIN32 +#ifdef _WIN32 static char *ctime_r(const time_t *timep, char *buf) { ctime_s(buf, 26, timep); diff --git a/src/utils/net.c b/src/utils/net.c index 923c876fa..81897e084 100644 --- a/src/utils/net.c +++ b/src/utils/net.c @@ -308,7 +308,7 @@ bool get_local_addresses(struct sockaddr_storage *addrs, size_t *len, int ip_ver } return true; -#else // ! defined WIN32 +#else // ! defined _WIN32 size_t available_len = *len; *len = 0; struct ifaddrs* a = NULL; diff --git a/src/utils/net.h b/src/utils/net.h index cf2162a5e..dffe59822 100644 --- a/src/utils/net.h +++ b/src/utils/net.h @@ -71,7 +71,7 @@ unsigned get_sockaddr_addr_port(struct sockaddr *sa); const char *get_sockaddr_str(struct sockaddr *sa); const char *ug_gai_strerror(int errcode); -#ifdef WIN32 +#ifdef _WIN32 #define CLOSESOCKET closesocket #else #define CLOSESOCKET close diff --git a/src/utils/thread.c b/src/utils/thread.c index e4a917324..6f2f0aaca 100644 --- a/src/utils/thread.c +++ b/src/utils/thread.c @@ -53,7 +53,7 @@ #include "host.h" #include "utils/thread.h" -#if ! defined WIN32 || defined HAVE_SETTHREADDESCRIPTION +#if ! defined _WIN32 || defined HAVE_SETTHREADDESCRIPTION static inline char *get_argv_program_name(void) { #ifdef HAVE_CONFIG_H if (uv_argv != NULL && uv_argv[0] != NULL) { diff --git a/src/video_capture/bluefish444.cpp b/src/video_capture/bluefish444.cpp index e17805821..7b863f7a6 100644 --- a/src/video_capture/bluefish444.cpp +++ b/src/video_capture/bluefish444.cpp @@ -73,7 +73,7 @@ static void *worker(void *arg); static void show_help(void); static void WaitForMajorInterrupt(struct vidcap_bluefish444_state *s); static void SyncForSignal(struct vidcap_bluefish444_state *s); -#ifdef WIN32 +#ifdef _WIN32 static int CompleteBlueAsyncReq(HANDLE hDevice, LPOVERLAPPED pOverlap); #endif static bool should_exit_worker = false; @@ -162,7 +162,7 @@ struct vidcap_bluefish444_state { uint32_t MemoryFormat; uint32_t UpdateFormat; bool SubField; -#ifdef WIN32 +#ifdef _WIN32 blue_video_sync_struct *pIrqInfo; #endif @@ -173,7 +173,7 @@ struct vidcap_bluefish444_state { struct audio_frame audio; unsigned int *hanc_buffer; -#ifdef WIN32 +#ifdef _WIN32 OVERLAPPED OverlapChA; #endif @@ -262,7 +262,7 @@ bool UpdateVideoMode(struct vidcap_bluefish444_state *s, uint32_t VideoMode) return false; } -#ifdef WIN32 +#ifdef _WIN32 static int CompleteBlueAsyncReq(HANDLE hDevice, LPOVERLAPPED pOverlap) { DWORD bytesReturned; @@ -275,7 +275,7 @@ static int CompleteBlueAsyncReq(HANDLE hDevice, LPOVERLAPPED pOverlap) static void WaitForMajorInterrupt(struct vidcap_bluefish444_state *s) { -#ifdef WIN32 +#ifdef _WIN32 assert(s->attachedDevices == 1); BOOL bWaitForField = TRUE; @@ -505,7 +505,7 @@ static void *worker(void *arg) } } else { -#ifdef WIN32 +#ifdef _WIN32 DWORD IrqReturn = 0; UINT VideoMsc = 0; // we do not allow mode change when in subfield mode @@ -608,7 +608,7 @@ static void *worker(void *arg) pthread_mutex_unlock(&s->lock); if(s->VideoEngine == VIDEO_ENGINE_DUPLEX) { -#ifdef WIN32 +#ifdef _WIN32 unsigned int FifoSize = 0; if(BLUE_FAIL(bfcGetCaptureVideoFrameInfoEx(s->pSDK[0], &s->OverlapChA, FrameInfo, 0, &FifoSize))) { @@ -656,7 +656,7 @@ static void *worker(void *arg) //DMA the frame from the card to our buffer for(int i = 0; i < s->attachedDevices; ++i) { -#ifdef WIN32 +#ifdef _WIN32 bfcSystemBufferReadAsync(s->pSDK[i], (unsigned char *) current_frame->video->tiles[i].data, ChunkSize, NULL, @@ -675,7 +675,7 @@ static void *worker(void *arg) } if(s->grab_audio && hanc_buffer_id != -1) { -#ifdef WIN32 +#ifdef _WIN32 bfcSystemBufferReadAsync(s->pSDK[0], (unsigned char *) s->hanc_buffer, MAX_HANC_SIZE, NULL, BlueImage_HANC_DMABuffer(BufferId, BLUE_DATA_HANC)); #else bfcSystemBufferRead(s->pSDK[0], (unsigned char *) s->hanc_buffer, MAX_HANC_SIZE, BlueImage_HANC_DMABuffer(BufferId, BLUE_DATA_HANC), 0); @@ -815,7 +815,7 @@ vidcap_bluefish444_init(struct vidcap_params *params, void **state) parse_fmt(s, tmp_fmt); free(tmp_fmt); -#ifdef WIN32 +#ifdef _WIN32 memset(&s->OverlapChA, 0, sizeof(s->OverlapChA)); s->OverlapChA.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); #endif @@ -824,7 +824,7 @@ vidcap_bluefish444_init(struct vidcap_params *params, void **state) s->SavedVideoMode = VID_FMT_INVALID; if(s->SubField) { -#ifdef WIN32 +#ifdef _WIN32 s->VideoEngine = VIDEO_ENGINE_FRAMESTORE; s->pIrqInfo = bfcNewVideoSyncStruct(s->pSDK); #else @@ -991,7 +991,7 @@ static void vidcap_bluefish444_done(void *state) pthread_mutex_unlock(&s->lock); pthread_join(s->worker_id, NULL); -#ifdef WIN32 +#ifdef _WIN32 CloseHandle(s->OverlapChA.hEvent); #endif diff --git a/src/video_capture/decklink.cpp b/src/video_capture/decklink.cpp index a01b8f17e..2409875a5 100644 --- a/src/video_capture/decklink.cpp +++ b/src/video_capture/decklink.cpp @@ -83,7 +83,7 @@ constexpr const int DEFAULT_AUDIO_BPS = 4; constexpr const size_t MAX_AUDIO_PACKETS = 10; #define MOD_NAME "[DeckLink capture] " -#ifndef WIN32 +#ifndef _WIN32 #define STDMETHODCALLTYPE #endif diff --git a/src/video_capture/deltacast.cpp b/src/video_capture/deltacast.cpp index 1c037c2b8..1a20ff927 100644 --- a/src/video_capture/deltacast.cpp +++ b/src/video_capture/deltacast.cpp @@ -45,7 +45,7 @@ #include #include #include -#ifndef WIN32 +#ifndef _WIN32 #include #include #endif diff --git a/src/video_capture/deltacast_dvi.cpp b/src/video_capture/deltacast_dvi.cpp index 5908be30e..c5ab22e7d 100644 --- a/src/video_capture/deltacast_dvi.cpp +++ b/src/video_capture/deltacast_dvi.cpp @@ -46,7 +46,7 @@ #include #include #include -#ifndef WIN32 +#ifndef _WIN32 #include #include #endif diff --git a/src/video_capture/import.c b/src/video_capture/import.c index eeeaa7255..348e7a355 100644 --- a/src/video_capture/import.c +++ b/src/video_capture/import.c @@ -859,7 +859,7 @@ static void *video_reader_callback(void *arg) struct stat sb; int flags = O_RDONLY; -#ifdef WIN32 +#ifdef _WIN32 flags |= O_BINARY; #endif if (data->o_direct) { diff --git a/src/video_display/bluefish444.cpp b/src/video_display/bluefish444.cpp index 0329052df..45cb93cc5 100644 --- a/src/video_display/bluefish444.cpp +++ b/src/video_display/bluefish444.cpp @@ -264,7 +264,7 @@ void *display_bluefish444_state::playback_loop() noexcept gettimeofday(&t0, NULL); -#ifdef WIN32 +#ifdef _WIN32 OVERLAPPED Overlapped[MAX_BLUE_OUT_CHANNELS]; for (int i = 0;i < MAX_BLUE_OUT_CHANNELS; ++ i) { Overlapped[i].hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); @@ -303,7 +303,7 @@ void *display_bluefish444_state::playback_loop() noexcept for(int i = 0; i < m_AttachedDevicesCount; ++i) { unsigned char *videoBuffer; -#ifdef WIN32 +#ifdef _WIN32 OVERLAPPED *OverlapCh = &Overlapped[i]; #endif if(m_TileCount == m_AttachedDevicesCount) { @@ -311,13 +311,13 @@ void *display_bluefish444_state::playback_loop() noexcept } else { // untiled 4K videoBuffer = (unsigned char *) frame->pVideoBuffer[0]; } -#ifdef WIN32 +#ifdef _WIN32 int err = bfcSystemBufferWriteAsync( #else int err = bfcSystemBufferWrite( #endif m_pSDK[i], videoBuffer + m_Offset[i], m_GoldenSize, -#ifdef WIN32 +#ifdef _WIN32 OverlapCh, #endif (m_PlayAudio && i == 0 ? @@ -329,7 +329,7 @@ void *display_bluefish444_state::playback_loop() noexcept WaitResult = false; } } -#ifdef WIN32 +#ifdef _WIN32 if(WaitResult) { for(int i = 0; i < m_AttachedDevicesCount; ++i) { DWORD BytesReturned = 0; @@ -396,7 +396,7 @@ void *display_bluefish444_state::playback_loop() noexcept //ResetEvent(OverlapChA.hEvent); //now we can DMA the HANC frame -#ifdef WIN32 +#ifdef _WIN32 bfcSystemBufferWriteAsync(m_pSDK[0], (unsigned char *) m_HancInfo.hanc_data_ptr, MAX_HANC_SIZE, NULL, BlueImage_HANC_DMABuffer(frame->BufferId, BLUE_DATA_HANC)); @@ -441,7 +441,7 @@ void *display_bluefish444_state::playback_loop() noexcept m_pPlayingBuffer = frame; } -#ifdef WIN32 +#ifdef _WIN32 for(int i = 0; i < m_AttachedDevicesCount; ++i) { CloseHandle(Overlapped[i].hEvent); } diff --git a/src/video_display/decklink.cpp b/src/video_display/decklink.cpp index 2646e9796..fd4faf0a5 100644 --- a/src/video_display/decklink.cpp +++ b/src/video_display/decklink.cpp @@ -80,7 +80,7 @@ #include "video_display.h" #include "video_display/decklink_drift_fix.hpp" -#ifndef WIN32 +#ifndef _WIN32 #define STDMETHODCALLTYPE #endif @@ -1742,7 +1742,7 @@ static bool display_decklink_reconfigure_audio(void *state, int quant_samples, i return true; } -#ifndef WIN32 +#ifndef _WIN32 static bool operator==(const REFIID & first, const REFIID & second){ return (first.byte0 == second.byte0) && (first.byte1 == second.byte1) && diff --git a/src/video_display/opengl_utils.hpp b/src/video_display/opengl_utils.hpp index 88ef02723..1298d6aea 100644 --- a/src/video_display/opengl_utils.hpp +++ b/src/video_display/opengl_utils.hpp @@ -49,7 +49,7 @@ # include # include # include -#else // WIN32 +#else // _WIN32 # include #endif //HAVE_MACOSX diff --git a/src/video_display/openxr_gl.cpp b/src/video_display/openxr_gl.cpp index 7f7c3d71f..abc0dfd4a 100644 --- a/src/video_display/openxr_gl.cpp +++ b/src/video_display/openxr_gl.cpp @@ -53,7 +53,7 @@ # include # define XR_USE_PLATFORM_XLIB # define XR_USE_GRAPHICS_API_OPENGL -#elif defined WIN32 +#elif defined _WIN32 # define XR_USE_PLATFORM_WIN32 # define XR_USE_GRAPHICS_API_OPENGL #endif @@ -629,7 +629,7 @@ static void display_xrgl_run(void *state){ Openxr_session session(s->xr_state.instance.get(), s->xr_state.system_id, &graphics_binding_gl); -#elif defined WIN32 +#elif defined _WIN32 XrGraphicsBindingOpenGLWin32KHR graphics_binding_gl = {}; graphics_binding_gl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR; graphics_binding_gl.next = nullptr; diff --git a/src/video_display/sdl_window.hpp b/src/video_display/sdl_window.hpp index c94909d55..9641197bb 100644 --- a/src/video_display/sdl_window.hpp +++ b/src/video_display/sdl_window.hpp @@ -49,7 +49,7 @@ # include # include # include -#else // WIN32 +#else // _WIN32 # include #endif //HAVE_MACOSX diff --git a/src/video_rxtx/rtp.cpp b/src/video_rxtx/rtp.cpp index adb0a0378..9ecd9bc9c 100644 --- a/src/video_rxtx/rtp.cpp +++ b/src/video_rxtx/rtp.cpp @@ -242,7 +242,7 @@ void rtp_video_rxtx::display_buf_increase_warning(int size) { log_msg(LOG_LEVEL_INFO, "\n***\n" "Unable to set buffer size to %d B.\n" -#if defined WIN32 +#if defined _WIN32 "See https://github.com/CESNET/UltraGrid/wiki/Extending-Network-Buffers-%%28Windows%%29 for details.\n", #else "Please set net.core.rmem_max value to %d or greater (see also\n" @@ -259,7 +259,7 @@ void rtp_video_rxtx::display_buf_increase_warning(int size) #ifdef HAVE_MACOSX size * 4, #endif /* HAVE_MACOSX */ -#endif /* ! defined WIN32 */ +#endif /* ! defined _WIN32 */ size); } @@ -270,7 +270,7 @@ struct rtp *rtp_video_rxtx::initialize_network(const char *addr, int recv_port, { double rtcp_bw = 5 * 1024 * 1024; /* FIXME */ -#if !defined WIN32 +#if !defined _WIN32 const bool multithreaded = true; #else const bool multithreaded = false;