[build,mingw] fix build issues found

This commit is contained in:
akallabeth 2024-04-03 11:39:52 +02:00 committed by akallabeth
parent 0712d0c899
commit 1956fffd3d
4 changed files with 18 additions and 14 deletions

View File

@ -35,8 +35,8 @@
#include "../resource/resource.h" #include "../resource/resource.h"
#include "wf_client.h" #include <wf_client.h>
#include "wf_defaults.h" #include <wf_defaults.h>
#include <shellapi.h> #include <shellapi.h>

View File

@ -775,7 +775,6 @@ static CliprdrDataObject* CliprdrDataObject_New(FORMATETC* fmtetc, STGMEDIUM* st
if (count > 0) if (count > 0)
{ {
ULONG i;
instance->m_pFormatEtc = (FORMATETC*)calloc(count, sizeof(FORMATETC)); instance->m_pFormatEtc = (FORMATETC*)calloc(count, sizeof(FORMATETC));
if (!instance->m_pFormatEtc) if (!instance->m_pFormatEtc)
@ -1247,7 +1246,7 @@ static UINT cliprdr_send_format_list(wfClipboard* clipboard)
} }
else else
{ {
while (formatId = EnumClipboardFormats(formatId)) while ((formatId = EnumClipboardFormats(formatId)) != 0)
formats[index++].formatId = formatId; formats[index++].formatId = formatId;
} }
@ -1755,9 +1754,9 @@ static BOOL wf_cliprdr_traverse_directory(wfClipboard* clipboard, WCHAR* Dir, si
while (FindNextFile(hFind, &FindFileData)) while (FindNextFile(hFind, &FindFileData))
{ {
if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 && if ((((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) &&
wcscmp(FindFileData.cFileName, _T(".")) == 0 || (wcscmp(FindFileData.cFileName, _T(".")) == 0)) ||
wcscmp(FindFileData.cFileName, _T("..")) == 0) (wcscmp(FindFileData.cFileName, _T("..")) == 0))
{ {
continue; continue;
} }
@ -2006,7 +2005,7 @@ static BOOL wf_cliprdr_process_filename(wfClipboard* clipboard, WCHAR* wFileName
return TRUE; return TRUE;
} }
static SSIZE_T wf_cliprdr_tryopen(wfClipboard* clipboard, UINT32 requestedFormatId, void** pData) static SSIZE_T wf_cliprdr_tryopen(wfClipboard* clipboard, UINT32 requestedFormatId, BYTE** pData)
{ {
SSIZE_T rc = -1; SSIZE_T rc = -1;
WINPR_ASSERT(clipboard); WINPR_ASSERT(clipboard);
@ -2044,7 +2043,7 @@ fail:
return rc; return rc;
} }
static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, void** pData) static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, BYTE** pData)
{ {
WINPR_ASSERT(clipboard); WINPR_ASSERT(clipboard);
WINPR_ASSERT(pData); WINPR_ASSERT(pData);
@ -2111,7 +2110,8 @@ static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, void** pDat
GlobalUnlock(stg_medium.hGlobal); GlobalUnlock(stg_medium.hGlobal);
ReleaseStgMedium(&stg_medium); ReleaseStgMedium(&stg_medium);
exit: exit:
const size_t size = 4 + clipboard->nFiles * sizeof(FILEDESCRIPTORW); {
const size_t size = 4ull + clipboard->nFiles * sizeof(FILEDESCRIPTORW);
FILEGROUPDESCRIPTORW* groupDsc = (FILEGROUPDESCRIPTORW*)calloc(size, 1); FILEGROUPDESCRIPTORW* groupDsc = (FILEGROUPDESCRIPTORW*)calloc(size, 1);
if (groupDsc) if (groupDsc)
@ -2124,9 +2124,10 @@ exit:
groupDsc->fgd[i] = *clipboard->fileDescriptor[i]; groupDsc->fgd[i] = *clipboard->fileDescriptor[i];
} }
*pData = groupDsc; *pData = (BYTE*)groupDsc;
rc = size; rc = size;
} }
}
IDataObject_Release(dataObj); IDataObject_Release(dataObj);
return rc; return rc;
@ -2155,8 +2156,7 @@ wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
if (requestedFormatId == RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW)) if (requestedFormatId == RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW))
{ {
const SSIZE_T res = wf_cliprdr_get_filedescriptor(clipboard, requestedFormatId, const SSIZE_T res = wf_cliprdr_get_filedescriptor(clipboard, &response.requestedFormatData);
&response.requestedFormatData);
if (res > 0) if (res > 0)
response.common.dataLen = (UINT32)res; response.common.dataLen = (UINT32)res;
} }

View File

@ -22,6 +22,8 @@
#include <malloc.h> #include <malloc.h>
#include <freerdp/settings.h> #include <freerdp/settings.h>
#include "wf_defaults.h"
static PCWSTR ValidateString(const BYTE* pb, ULONG cb) static PCWSTR ValidateString(const BYTE* pb, ULONG cb)
{ {
if (!pb || !cb) if (!pb || !cb)

View File

@ -19,8 +19,10 @@
#ifndef FREERDP_CLIENT_WIN_DEFAULTS_H #ifndef FREERDP_CLIENT_WIN_DEFAULTS_H
#define FREERDP_CLIENT_WIN_DEFAULTS_H #define FREERDP_CLIENT_WIN_DEFAULTS_H
#include <winpr/wtypes.h>
#include <freerdp/api.h>
#include <freerdp/settings.h> #include <freerdp/settings.h>
void WINAPI AddDefaultSettings(_Inout_ rdpSettings* settings); FREERDP_API void WINAPI AddDefaultSettings(_Inout_ rdpSettings* settings);
#endif /* FREERDP_CLIENT_WIN_DEFAULTS_H */ #endif /* FREERDP_CLIENT_WIN_DEFAULTS_H */