Fix various MSVC warnings

This commit is contained in:
Cameron Gutman
2021-04-29 17:21:12 -05:00
parent 77ed77b93b
commit da68e64d9b
8 changed files with 28 additions and 15 deletions

View File

@@ -256,7 +256,7 @@ static void ReceiveThreadProc(void* context) {
Limelog("Received first audio packet after %d ms\n", waitingForAudioMs);
if (firstReceiveTime != 0) {
packetsToDrop = (PltGetMillis() - firstReceiveTime) / AudioPacketDuration;
packetsToDrop = (uint32_t)(PltGetMillis() - firstReceiveTime) / AudioPacketDuration;
Limelog("Initial audio resync period: %d milliseconds\n", packetsToDrop * AudioPacketDuration);
}
}

View File

@@ -742,12 +742,12 @@ static void controlReceiveThreadFunc(void* context) {
else {
// What do we do here???
LC_ASSERT(false);
packetLength = event.packet->dataLength;
packetLength = (int)event.packet->dataLength;
}
}
else {
// Take ownership of the packet data directly for the non-encrypted case
packetLength = event.packet->dataLength;
packetLength = (int)event.packet->dataLength;
event.packet->data = NULL;
}

View File

@@ -4,6 +4,10 @@
// Prevent bogus definitions of error codes
// that are incompatible with Winsock errors.
#define _CRT_NO_POSIX_ERROR_CODES
// Ignore CRT warnings about sprintf(), memcpy(), etc.
#define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif
#include <stdlib.h>

View File

@@ -505,7 +505,7 @@ int resolveHostName(const char* host, int family, int tcpTestPort, struct sockad
// b) The caller asked us to test even with a single address
if (tcpTestPort != 0 && (res->ai_next != NULL || (tcpTestPort & TCP_PORT_FLAG_ALWAYS_TEST))) {
SOCKET testSocket = connectTcpSocket((struct sockaddr_storage*)currentAddr->ai_addr,
currentAddr->ai_addrlen,
(SOCKADDR_LEN)currentAddr->ai_addrlen,
tcpTestPort & TCP_PORT_MASK,
TEST_PORT_TIMEOUT_SEC);
if (testSocket == INVALID_SOCKET) {
@@ -518,7 +518,7 @@ int resolveHostName(const char* host, int family, int tcpTestPort, struct sockad
}
memcpy(addr, currentAddr->ai_addr, currentAddr->ai_addrlen);
*addrLen = currentAddr->ai_addrlen;
*addrLen = (SOCKADDR_LEN)currentAddr->ai_addrlen;
freeaddrinfo(res);
return 0;
@@ -612,11 +612,11 @@ void enterLowLatencyMode(void) {
return;
}
pfnWlanOpenHandle = GetProcAddress(WlanApiLibraryHandle, "WlanOpenHandle");
pfnWlanCloseHandle = GetProcAddress(WlanApiLibraryHandle, "WlanCloseHandle");
pfnWlanFreeMemory = GetProcAddress(WlanApiLibraryHandle, "WlanFreeMemory");
pfnWlanEnumInterfaces = GetProcAddress(WlanApiLibraryHandle, "WlanEnumInterfaces");
pfnWlanSetInterface = GetProcAddress(WlanApiLibraryHandle, "WlanSetInterface");
pfnWlanOpenHandle = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanOpenHandle");
pfnWlanCloseHandle = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanCloseHandle");
pfnWlanFreeMemory = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanFreeMemory");
pfnWlanEnumInterfaces = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanEnumInterfaces");
pfnWlanSetInterface = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanSetInterface");
if (pfnWlanOpenHandle == NULL || pfnWlanCloseHandle == NULL ||
pfnWlanFreeMemory == NULL || pfnWlanEnumInterfaces == NULL || pfnWlanSetInterface == NULL) {

View File

@@ -13,10 +13,18 @@
#define SHUT_RDWR SD_BOTH
#define EWOULDBLOCK WSAEWOULDBLOCK
#ifdef EAGAIN
#undef EAGAIN
#endif
#define EAGAIN WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS
#ifdef EINTR
#undef EINTR
#endif
#define EINTR WSAEINTR
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS
#define ETIMEDOUT WSAETIMEDOUT
#define ECONNREFUSED WSAECONNREFUSED

View File

@@ -210,7 +210,7 @@ Exit:
}
// Send RTSP message and get response over TCP
static bool transactRtspMessageTcp(PRTSP_MESSAGE request, PRTSP_MESSAGE response, bool expectingPayload, int* error) {
static bool transactRtspMessageTcp(PRTSP_MESSAGE request, PRTSP_MESSAGE response, int* error) {
SOCK_RET err;
bool ret;
int offset;
@@ -330,7 +330,7 @@ static bool transactRtspMessage(PRTSP_MESSAGE request, PRTSP_MESSAGE response, b
return transactRtspMessageEnet(request, response, expectingPayload, error);
}
else {
return transactRtspMessageTcp(request, response, expectingPayload, error);
return transactRtspMessageTcp(request, response, error);
}
}

View File

@@ -1,3 +1,4 @@
#include "Platform.h"
#include "Rtsp.h"
// Check if String s begins with the given prefix

View File

@@ -93,7 +93,7 @@ int LiFindExternalAddressIP4(const char* stunServer, unsigned short stunPort, un
// Send a request to each resolved address but stop if we get a response
for (current = stunAddrs; current != NULL && bytesRead <= 0; current = current->ai_next) {
err = (int)sendto(sock, (char *)&reqMsg, sizeof(reqMsg), 0, current->ai_addr, current->ai_addrlen);
err = (int)sendto(sock, (char *)&reqMsg, sizeof(reqMsg), 0, current->ai_addr, (SOCKADDR_LEN)current->ai_addrlen);
if (err == SOCKET_ERROR) {
err = LastSocketFail();
Limelog("Failed to send STUN binding request: %d\n", err);