Fixed mac compilation warnings.

This commit is contained in:
Armin Novak 2019-02-21 17:28:49 +01:00
parent 22974ff9d8
commit 9566ae0e90
5 changed files with 22 additions and 16 deletions

View File

@ -538,7 +538,7 @@ static void drive_hotplug_fsevent_callback(ConstFSEventStreamRef streamRef,
const FSEventStreamEventId eventIds[])
{
rdpdrPlugin* rdpdr;
int i;
size_t i;
UINT error;
char** paths = (char**)eventPaths;
rdpdr = (rdpdrPlugin*) clientCallBackInfo;

View File

@ -408,9 +408,6 @@ DWORD WINAPI mac_client_thread(void* param)
if (!self.is_connected)
return;
NSPoint loc = [event locationInWindow];
int x = (int) loc.x;
int y = (int) loc.y;
float dx = [event deltaX];
float dy = [event deltaY];
/* 1 event = 120 units */

View File

@ -167,7 +167,12 @@ int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
/* If cbMultiByte is -1, the string is null-terminated */
if (cbMultiByte == -1)
cbMultiByte = strlen((char*) lpMultiByteStr) + 1;
{
size_t len = strlen((const char*) lpMultiByteStr);
if (len >= INT32_MAX)
return 0;
cbMultiByte = (int)len + 1;
}
/*
* if cchWideChar is 0, the function returns the required buffer size
@ -190,9 +195,6 @@ int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
return 0;
}
if (cbMultiByte > UINT32_MAX)
return 0;
targetStart = lpWideCharStr;
targetCapacity = cchWideChar;
error = U_ZERO_ERROR;
@ -289,7 +291,12 @@ int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int
/* If cchWideChar is -1, the string is null-terminated */
if (cchWideChar == -1)
cchWideChar = _wcslen(lpWideCharStr) + 1;
{
size_t len = _wcslen(lpWideCharStr);
if (len >= INT32_MAX)
return 0;
cchWideChar = (int)len + 1;
}
/*
* if cbMultiByte is 0, the function returns the required buffer size
@ -312,9 +319,6 @@ int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int
return 0;
}
if (cchWideChar > UINT32_MAX)
return 0;
targetStart = lpMultiByteStr;
targetCapacity = cbMultiByte;
error = U_ZERO_ERROR;
@ -384,7 +388,12 @@ int ConvertToUnicode(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
return 0;
if (cbMultiByte == -1)
cbMultiByte = (int)(strlen(lpMultiByteStr) + 1);
{
size_t len = strlen(lpMultiByteStr);
if (len >= INT_MAX)
return 0;
cbMultiByte = (int)(len + 1);
}
if (cchWideChar == 0)
{

View File

@ -251,7 +251,7 @@ DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize)
#elif defined(__MACOSX__)
int status;
int length;
size_t length;
if (!hModule)
{
@ -278,7 +278,7 @@ DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize)
{
CopyMemory(lpFilename, buffer, length);
lpFilename[length] = '\0';
return length;
return (DWORD)length;
}
CopyMemory(lpFilename, buffer, nSize - 1);

View File

@ -53,7 +53,7 @@ int TestArrayList(int argc, char* argv[])
ArrayList_RemoveAt(arrayList, 0);
if (val != index)
{
printf("ArrayList: shifted %d entries, expected value %d, got %"PRIdz"\n", index, index, val);
printf("ArrayList: shifted %"PRIdz" entries, expected value %"PRIdz", got %"PRIdz"\n", index, index, val);
return -1;
}
}