[warnings] fixed -Wincompatible-pointer-types

This commit is contained in:
Armin Novak 2023-12-13 10:25:32 +01:00 committed by akallabeth
parent d6b7cfc1c2
commit 879e68c02b
3 changed files with 11 additions and 14 deletions

View File

@ -47,7 +47,6 @@ int int_MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
LPWSTR lpWideCharStr, int cchWideChar)
{
const BOOL isNullTerminated = cbMultiByte < 0;
LPWSTR targetStart = NULL;
WINPR_UNUSED(dwFlags);
@ -79,7 +78,6 @@ int int_MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
{
UErrorCode error = U_ZERO_ERROR;
int32_t targetLength = -1;
int32_t targetCapacity = -1;
switch (CodePage)
{
@ -93,15 +91,16 @@ int int_MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
return 0;
}
targetStart = lpWideCharStr;
targetCapacity = cchWideChar;
const int32_t targetCapacity = cchWideChar;
#if defined(UCNV_CONVERT)
char* targetStart = (char*)lpWideCharStr;
targetLength =
ucnv_convert("UTF-16LE", "UTF-8", targetStart, targetCapacity * sizeof(WCHAR),
ucnv_convert("UTF-16LE", "UTF-8", targetStart, targetCapacity * (int32_t)sizeof(WCHAR),
lpMultiByteStr, cbMultiByte, &error);
if (targetLength > 0)
targetLength /= sizeof(WCHAR);
#else
WCHAR* targetStart = lpWideCharStr;
u_strFromUTF8(targetStart, targetCapacity, &targetLength, lpMultiByteStr, cbMultiByte,
&error);
#endif
@ -148,8 +147,6 @@ int int_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr,
LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar,
LPBOOL lpUsedDefaultChar)
{
char* targetStart = NULL;
/* If cchWideChar is 0, the function fails */
if ((cchWideChar == 0) || (cchWideChar < -1))
@ -180,7 +177,6 @@ int int_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr,
{
UErrorCode error = U_ZERO_ERROR;
int32_t targetLength = -1;
int32_t targetCapacity = -1;
switch (CodePage)
{
@ -194,11 +190,12 @@ int int_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr,
return 0;
}
targetStart = lpMultiByteStr;
targetCapacity = cbMultiByte;
char* targetStart = lpMultiByteStr;
const int32_t targetCapacity = cbMultiByte;
#if defined(UCNV_CONVERT)
targetLength = ucnv_convert("UTF-8", "UTF-16LE", targetStart, targetCapacity, lpWideCharStr,
cchWideChar * sizeof(WCHAR), &error);
const char* str = (const char*)lpWideCharStr;
targetLength = ucnv_convert("UTF-8", "UTF-16LE", targetStart, targetCapacity, str,
cchWideChar * (int32_t)sizeof(WCHAR), &error);
#else
u_strToUTF8(targetStart, targetCapacity, &targetLength, lpWideCharStr, cchWideChar, &error);
#endif

View File

@ -122,7 +122,7 @@ int TestInterlockedAccess(int argc, char* argv[])
*Destination = (LONG)0xAABBCCDDL;
oldValue = InterlockedCompareExchange(Destination, 0xCCDDEEFFL, 0x66778899);
oldValue = InterlockedCompareExchange(Destination, 0xCCDDEEFFL, 0x66778899L);
if (oldValue != (LONG)0xAABBCCDDL)
{

View File

@ -1435,7 +1435,7 @@ static SECURITY_STATUS SEC_ENTRY kerberos_EncryptMessage(PCtxtHandle phContext,
#ifdef WITH_KRB5
KRB_CONTEXT* context = get_context(phContext);
PSecBuffer sig_buffer, data_buffer;
char* header;
BYTE* header;
BYTE flags = 0;
krb5glue_key key;
krb5_keyusage usage;