mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-17 06:11:03 +00:00
Fix various MSVC warnings
This commit is contained in:
+1
-1
@@ -256,7 +256,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
Limelog("Received first audio packet after %d ms\n", waitingForAudioMs);
|
Limelog("Received first audio packet after %d ms\n", waitingForAudioMs);
|
||||||
|
|
||||||
if (firstReceiveTime != 0) {
|
if (firstReceiveTime != 0) {
|
||||||
packetsToDrop = (PltGetMillis() - firstReceiveTime) / AudioPacketDuration;
|
packetsToDrop = (uint32_t)(PltGetMillis() - firstReceiveTime) / AudioPacketDuration;
|
||||||
Limelog("Initial audio resync period: %d milliseconds\n", packetsToDrop * AudioPacketDuration);
|
Limelog("Initial audio resync period: %d milliseconds\n", packetsToDrop * AudioPacketDuration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -742,12 +742,12 @@ static void controlReceiveThreadFunc(void* context) {
|
|||||||
else {
|
else {
|
||||||
// What do we do here???
|
// What do we do here???
|
||||||
LC_ASSERT(false);
|
LC_ASSERT(false);
|
||||||
packetLength = event.packet->dataLength;
|
packetLength = (int)event.packet->dataLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Take ownership of the packet data directly for the non-encrypted case
|
// 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;
|
event.packet->data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
// Prevent bogus definitions of error codes
|
// Prevent bogus definitions of error codes
|
||||||
// that are incompatible with Winsock errors.
|
// that are incompatible with Winsock errors.
|
||||||
#define _CRT_NO_POSIX_ERROR_CODES
|
#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
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -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
|
// 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))) {
|
if (tcpTestPort != 0 && (res->ai_next != NULL || (tcpTestPort & TCP_PORT_FLAG_ALWAYS_TEST))) {
|
||||||
SOCKET testSocket = connectTcpSocket((struct sockaddr_storage*)currentAddr->ai_addr,
|
SOCKET testSocket = connectTcpSocket((struct sockaddr_storage*)currentAddr->ai_addr,
|
||||||
currentAddr->ai_addrlen,
|
(SOCKADDR_LEN)currentAddr->ai_addrlen,
|
||||||
tcpTestPort & TCP_PORT_MASK,
|
tcpTestPort & TCP_PORT_MASK,
|
||||||
TEST_PORT_TIMEOUT_SEC);
|
TEST_PORT_TIMEOUT_SEC);
|
||||||
if (testSocket == INVALID_SOCKET) {
|
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);
|
memcpy(addr, currentAddr->ai_addr, currentAddr->ai_addrlen);
|
||||||
*addrLen = currentAddr->ai_addrlen;
|
*addrLen = (SOCKADDR_LEN)currentAddr->ai_addrlen;
|
||||||
|
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -612,11 +612,11 @@ void enterLowLatencyMode(void) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pfnWlanOpenHandle = GetProcAddress(WlanApiLibraryHandle, "WlanOpenHandle");
|
pfnWlanOpenHandle = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanOpenHandle");
|
||||||
pfnWlanCloseHandle = GetProcAddress(WlanApiLibraryHandle, "WlanCloseHandle");
|
pfnWlanCloseHandle = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanCloseHandle");
|
||||||
pfnWlanFreeMemory = GetProcAddress(WlanApiLibraryHandle, "WlanFreeMemory");
|
pfnWlanFreeMemory = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanFreeMemory");
|
||||||
pfnWlanEnumInterfaces = GetProcAddress(WlanApiLibraryHandle, "WlanEnumInterfaces");
|
pfnWlanEnumInterfaces = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanEnumInterfaces");
|
||||||
pfnWlanSetInterface = GetProcAddress(WlanApiLibraryHandle, "WlanSetInterface");
|
pfnWlanSetInterface = (void*)GetProcAddress(WlanApiLibraryHandle, "WlanSetInterface");
|
||||||
|
|
||||||
if (pfnWlanOpenHandle == NULL || pfnWlanCloseHandle == NULL ||
|
if (pfnWlanOpenHandle == NULL || pfnWlanCloseHandle == NULL ||
|
||||||
pfnWlanFreeMemory == NULL || pfnWlanEnumInterfaces == NULL || pfnWlanSetInterface == NULL) {
|
pfnWlanFreeMemory == NULL || pfnWlanEnumInterfaces == NULL || pfnWlanSetInterface == NULL) {
|
||||||
|
|||||||
+10
-2
@@ -13,10 +13,18 @@
|
|||||||
|
|
||||||
#define SHUT_RDWR SD_BOTH
|
#define SHUT_RDWR SD_BOTH
|
||||||
|
|
||||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
#ifdef EAGAIN
|
||||||
|
#undef EAGAIN
|
||||||
|
#endif
|
||||||
#define EAGAIN WSAEWOULDBLOCK
|
#define EAGAIN WSAEWOULDBLOCK
|
||||||
#define EINPROGRESS WSAEINPROGRESS
|
|
||||||
|
#ifdef EINTR
|
||||||
|
#undef EINTR
|
||||||
|
#endif
|
||||||
#define EINTR WSAEINTR
|
#define EINTR WSAEINTR
|
||||||
|
|
||||||
|
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||||
|
#define EINPROGRESS WSAEINPROGRESS
|
||||||
#define ETIMEDOUT WSAETIMEDOUT
|
#define ETIMEDOUT WSAETIMEDOUT
|
||||||
#define ECONNREFUSED WSAECONNREFUSED
|
#define ECONNREFUSED WSAECONNREFUSED
|
||||||
|
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ Exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send RTSP message and get response over TCP
|
// 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;
|
SOCK_RET err;
|
||||||
bool ret;
|
bool ret;
|
||||||
int offset;
|
int offset;
|
||||||
@@ -330,7 +330,7 @@ static bool transactRtspMessage(PRTSP_MESSAGE request, PRTSP_MESSAGE response, b
|
|||||||
return transactRtspMessageEnet(request, response, expectingPayload, error);
|
return transactRtspMessageEnet(request, response, expectingPayload, error);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return transactRtspMessageTcp(request, response, expectingPayload, error);
|
return transactRtspMessageTcp(request, response, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "Platform.h"
|
||||||
#include "Rtsp.h"
|
#include "Rtsp.h"
|
||||||
|
|
||||||
// Check if String s begins with the given prefix
|
// Check if String s begins with the given prefix
|
||||||
|
|||||||
+1
-1
@@ -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
|
// 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) {
|
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) {
|
if (err == SOCKET_ERROR) {
|
||||||
err = LastSocketFail();
|
err = LastSocketFail();
|
||||||
Limelog("Failed to send STUN binding request: %d\n", err);
|
Limelog("Failed to send STUN binding request: %d\n", err);
|
||||||
|
|||||||
Reference in New Issue
Block a user