Merge pull request #5273 from akallabeth/mac_compile_warning_fix

Fixed mac compilation warnings.
This commit is contained in:
David Fort 2019-04-04 18:03:50 +02:00 committed by GitHub
commit 058ae0db57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -409,9 +409,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;
}
}