[winpr] fix various warnings

This commit is contained in:
Armin Novak 2023-07-29 14:01:33 +02:00 committed by akallabeth
parent d4b9812db2
commit 35915d3e22
3 changed files with 11 additions and 5 deletions

View File

@ -41,7 +41,7 @@ int TestClipboardFormats(int argc, char* argv[])
BOOL bSuccess;
UINT32 SrcSize;
UINT32 DstSize;
const char* pSrcData = "this is a test string";
const char pSrcData[] = "this is a test string";
char* pDstData;
if (!pSrcData)
@ -50,7 +50,7 @@ int TestClipboardFormats(int argc, char* argv[])
return -1;
}
SrcSize = (UINT32)(strnlen(pSrcData, UINT32_MAX - 1) + 1);
SrcSize = (UINT32)(strnlen(pSrcData, ARRAYSIZE(pSrcData)) + 1);
bSuccess = ClipboardSetData(clipboard, utf8StringFormatId, pSrcData, SrcSize);
fprintf(stderr, "ClipboardSetData: %" PRId32 "\n", bSuccess);
DstSize = 0;

View File

@ -190,6 +190,12 @@ static BOOL find_first_file_fail(const char* FilePath)
return FALSE;
}
static void* string_dup(const void* val)
{
const char* str = (const char*)val;
return _strdup(str);
}
static int TestFileFindFirstFileA(const char* str)
{
int rc = -1;
@ -212,7 +218,7 @@ static int TestFileFindFirstFileA(const char* str)
return -3;
wObject* obj = ArrayList_Object(files);
obj->fnObjectFree = free;
obj->fnObjectNew = _strdup;
obj->fnObjectNew = string_dup;
if (!create_layout(BasePath, files))
return -1;

View File

@ -92,11 +92,11 @@ static BOOL IniFile_BufferResize(wIniFile* ini, size_t size)
if (size > ini->buffersize)
{
const size_t diff = size - ini->buffersize;
BYTE* tmp = realloc(ini->buffer, size);
char* tmp = realloc(ini->buffer, size);
if (!tmp)
return FALSE;
memset(&tmp[ini->buffersize], 0, diff * sizeof(BYTE));
memset(&tmp[ini->buffersize], 0, diff * sizeof(char));
ini->buffer = tmp;
ini->buffersize = size;
}