Refactored client clipboard function callbacks for const data pointers.

This commit is contained in:
Armin Novak 2019-01-23 16:22:29 +01:00
parent 65812bdbc0
commit 087390b303
7 changed files with 73 additions and 90 deletions

View File

@ -143,7 +143,7 @@ static UINT android_cliprdr_send_client_capabilities(CliprdrClientContext*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT android_cliprdr_monitor_ready(CliprdrClientContext* cliprdr,
CLIPRDR_MONITOR_READY* monitorReady)
const CLIPRDR_MONITOR_READY* monitorReady)
{
UINT rc;
androidContext* afc;
@ -172,7 +172,7 @@ static UINT android_cliprdr_monitor_ready(CliprdrClientContext* cliprdr,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT android_cliprdr_server_capabilities(CliprdrClientContext* cliprdr,
CLIPRDR_CAPABILITIES* capabilities)
const CLIPRDR_CAPABILITIES* capabilities)
{
UINT32 index;
CLIPRDR_CAPABILITY_SET* capabilitySet;
@ -209,7 +209,7 @@ static UINT android_cliprdr_server_capabilities(CliprdrClientContext* cliprdr,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr,
CLIPRDR_FORMAT_LIST* formatList)
const CLIPRDR_FORMAT_LIST* formatList)
{
UINT rc;
UINT32 index;
@ -291,7 +291,7 @@ static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr,
*/
static UINT android_cliprdr_server_format_list_response(
CliprdrClientContext* cliprdr,
CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
{
if (!cliprdr || !formatListResponse)
return ERROR_INVALID_PARAMETER;
@ -306,7 +306,7 @@ static UINT android_cliprdr_server_format_list_response(
*/
static UINT android_cliprdr_server_lock_clipboard_data(CliprdrClientContext*
cliprdr,
CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
{
if (!cliprdr || !lockClipboardData)
return ERROR_INVALID_PARAMETER;
@ -321,7 +321,7 @@ static UINT android_cliprdr_server_lock_clipboard_data(CliprdrClientContext*
*/
static UINT android_cliprdr_server_unlock_clipboard_data(
CliprdrClientContext* cliprdr,
CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
{
if (!cliprdr || !unlockClipboardData)
return ERROR_INVALID_PARAMETER;
@ -336,7 +336,7 @@ static UINT android_cliprdr_server_unlock_clipboard_data(
*/
static UINT android_cliprdr_server_format_data_request(CliprdrClientContext*
cliprdr,
CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
{
UINT rc;
BYTE* data;
@ -379,7 +379,7 @@ static UINT android_cliprdr_server_format_data_request(CliprdrClientContext*
*/
static UINT android_cliprdr_server_format_data_response(
CliprdrClientContext* cliprdr,
CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
{
BYTE* data;
UINT32 size;
@ -455,7 +455,7 @@ static UINT android_cliprdr_server_format_data_response(
*/
static UINT android_cliprdr_server_file_contents_request(
CliprdrClientContext* cliprdr,
CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
if (!cliprdr || !fileContentsRequest)
return ERROR_INVALID_PARAMETER;
@ -470,7 +470,7 @@ static UINT android_cliprdr_server_file_contents_request(
*/
static UINT android_cliprdr_server_file_contents_response(
CliprdrClientContext* cliprdr,
CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
{
if (!cliprdr || !fileContentsResponse)
return ERROR_INVALID_PARAMETER;

View File

@ -70,7 +70,7 @@ int mac_cliprdr_send_client_format_list(CliprdrClientContext* cliprdr)
return 1;
}
int mac_cliprdr_send_client_format_list_response(CliprdrClientContext* cliprdr, BOOL status)
static int mac_cliprdr_send_client_format_list_response(CliprdrClientContext* cliprdr, BOOL status)
{
CLIPRDR_FORMAT_LIST_RESPONSE formatListResponse;
@ -83,7 +83,7 @@ int mac_cliprdr_send_client_format_list_response(CliprdrClientContext* cliprdr,
return 1;
}
int mac_cliprdr_send_client_format_data_request(CliprdrClientContext* cliprdr, UINT32 formatId)
static int mac_cliprdr_send_client_format_data_request(CliprdrClientContext* cliprdr, UINT32 formatId)
{
CLIPRDR_FORMAT_DATA_REQUEST formatDataRequest;
mfContext* mfc = (mfContext*) cliprdr->custom;
@ -102,7 +102,7 @@ int mac_cliprdr_send_client_format_data_request(CliprdrClientContext* cliprdr, U
return 1;
}
int mac_cliprdr_send_client_capabilities(CliprdrClientContext* cliprdr)
static int mac_cliprdr_send_client_capabilities(CliprdrClientContext* cliprdr)
{
CLIPRDR_CAPABILITIES capabilities;
CLIPRDR_GENERAL_CAPABILITY_SET generalCapabilitySet;
@ -126,7 +126,7 @@ int mac_cliprdr_send_client_capabilities(CliprdrClientContext* cliprdr)
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_monitor_ready(CliprdrClientContext* cliprdr, CLIPRDR_MONITOR_READY* monitorReady)
static UINT mac_cliprdr_monitor_ready(CliprdrClientContext* cliprdr, const CLIPRDR_MONITOR_READY* monitorReady)
{
mfContext* mfc = (mfContext*) cliprdr->custom;
@ -142,7 +142,7 @@ UINT mac_cliprdr_monitor_ready(CliprdrClientContext* cliprdr, CLIPRDR_MONITOR_RE
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_capabilities(CliprdrClientContext* cliprdr, CLIPRDR_CAPABILITIES* capabilities)
static UINT mac_cliprdr_server_capabilities(CliprdrClientContext* cliprdr, const CLIPRDR_CAPABILITIES* capabilities)
{
UINT32 index;
CLIPRDR_CAPABILITY_SET* capabilitySet;
@ -171,7 +171,7 @@ UINT mac_cliprdr_server_capabilities(CliprdrClientContext* cliprdr, CLIPRDR_CAPA
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_format_list(CliprdrClientContext* cliprdr, CLIPRDR_FORMAT_LIST* formatList)
static UINT mac_cliprdr_server_format_list(CliprdrClientContext* cliprdr, const CLIPRDR_FORMAT_LIST* formatList)
{
UINT32 index;
CLIPRDR_FORMAT* format;
@ -238,7 +238,7 @@ UINT mac_cliprdr_server_format_list(CliprdrClientContext* cliprdr, CLIPRDR_FORMA
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_format_list_response(CliprdrClientContext* cliprdr, CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
static UINT mac_cliprdr_server_format_list_response(CliprdrClientContext* cliprdr, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
{
return CHANNEL_RC_OK;
}
@ -248,7 +248,7 @@ UINT mac_cliprdr_server_format_list_response(CliprdrClientContext* cliprdr, CLIP
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_lock_clipboard_data(CliprdrClientContext* cliprdr, CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
static UINT mac_cliprdr_server_lock_clipboard_data(CliprdrClientContext* cliprdr, const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
{
return CHANNEL_RC_OK;
}
@ -258,7 +258,7 @@ UINT mac_cliprdr_server_lock_clipboard_data(CliprdrClientContext* cliprdr, CLIPR
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_unlock_clipboard_data(CliprdrClientContext* cliprdr, CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
static UINT mac_cliprdr_server_unlock_clipboard_data(CliprdrClientContext* cliprdr, const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
{
return CHANNEL_RC_OK;
}
@ -268,7 +268,7 @@ UINT mac_cliprdr_server_unlock_clipboard_data(CliprdrClientContext* cliprdr, CLI
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_format_data_request(CliprdrClientContext* cliprdr, CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
static UINT mac_cliprdr_server_format_data_request(CliprdrClientContext* cliprdr, const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
{
BYTE* data;
UINT32 size;
@ -304,7 +304,7 @@ UINT mac_cliprdr_server_format_data_request(CliprdrClientContext* cliprdr, CLIPR
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr, CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
static UINT mac_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
{
BYTE* data;
UINT32 size;
@ -368,7 +368,7 @@ UINT mac_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr, CLIP
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_file_contents_request(CliprdrClientContext* cliprdr, CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
static UINT mac_cliprdr_server_file_contents_request(CliprdrClientContext* cliprdr, const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
return CHANNEL_RC_OK;
}
@ -378,7 +378,7 @@ UINT mac_cliprdr_server_file_contents_request(CliprdrClientContext* cliprdr, CLI
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT mac_cliprdr_server_file_contents_response(CliprdrClientContext* cliprdr, CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
static UINT mac_cliprdr_server_file_contents_response(CliprdrClientContext* cliprdr, const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
{
return CHANNEL_RC_OK;
}

View File

@ -418,7 +418,7 @@ DWORD WINAPI mac_client_thread(void* param)
if (fabsf(dy) > FLT_EPSILON)
{
flags = PTR_FLAGS_WHEEL;
flags = PTR_FLAGS_HWHEEL;
units = fabsf(dy) * 120;
if (dy < 0)
@ -426,7 +426,7 @@ DWORD WINAPI mac_client_thread(void* param)
}
else if (fabsf(dx) > FLT_EPSILON)
{
flags = PTR_FLAGS_HWHEEL;
flags = PTR_FLAGS_WHEEL;
units = fabsf(dx) * 120;
if (dx > 0)

View File

@ -148,7 +148,8 @@ void mf_scale_mouse_event(void* context, rdpInput* input, UINT16 flags,
// Convert to windows coordinates
y = [view frame].size.height - y;
mf_scale_mouse_coordinates(mfc, &x, &y);
if ((flags & (PTR_FLAGS_WHEEL | PTR_FLAGS_HWHEEL)) == 0)
mf_scale_mouse_coordinates(mfc, &x, &y);
freerdp_input_send_mouse_event(input, flags, x, y);
}

View File

@ -252,8 +252,7 @@ static void wlf_cliprdr_add_client_format(wfClipboard* clipboard, const char* mi
static UINT wlf_cliprdr_send_data_request(wfClipboard* clipboard,
UINT32 formatId)
{
CLIPRDR_FORMAT_DATA_REQUEST request;
ZeroMemory(&request, sizeof(CLIPRDR_FORMAT_DATA_REQUEST));
CLIPRDR_FORMAT_DATA_REQUEST request = { 0 };
request.requestedFormatId = formatId;
return clipboard->context->ClientFormatDataRequest(clipboard->context,
&request);
@ -267,8 +266,7 @@ static UINT wlf_cliprdr_send_data_request(wfClipboard* clipboard,
static UINT wlf_cliprdr_send_data_response(wfClipboard* clipboard, const BYTE* data,
size_t size)
{
CLIPRDR_FORMAT_DATA_RESPONSE response;
ZeroMemory(&response, sizeof(CLIPRDR_FORMAT_DATA_RESPONSE));
CLIPRDR_FORMAT_DATA_RESPONSE response = { 0 };
response.msgFlags = (data) ? CB_RESPONSE_OK : CB_RESPONSE_FAIL;
response.dataLen = size;
response.requestedFormatData = data;
@ -691,8 +689,7 @@ fail:
static UINT wlf_cliprdr_server_file_size_request(wfClipboard* clipboard,
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
wClipboardFileSizeRequest request;
ZeroMemory(&request, sizeof(request));
wClipboardFileSizeRequest request = { 0 };
request.streamId = fileContentsRequest->streamId;
request.listIndex = fileContentsRequest->listIndex;
@ -708,8 +705,7 @@ static UINT wlf_cliprdr_server_file_size_request(wfClipboard* clipboard,
static UINT wlf_cliprdr_server_file_range_request(wfClipboard* clipboard,
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
wClipboardFileRangeRequest request;
ZeroMemory(&request, sizeof(request));
wClipboardFileRangeRequest request = { 0 };
request.streamId = fileContentsRequest->streamId;
request.listIndex = fileContentsRequest->listIndex;
request.nPositionLow = fileContentsRequest->nPositionLow;
@ -721,8 +717,7 @@ static UINT wlf_cliprdr_server_file_range_request(wfClipboard* clipboard,
static UINT wlf_cliprdr_send_file_contents_failure(CliprdrClientContext* context,
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
ZeroMemory(&response, sizeof(response));
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
response.msgFlags = CB_RESPONSE_FAIL;
response.streamId = fileContentsRequest->streamId;
response.dwFlags = fileContentsRequest->dwFlags;
@ -765,9 +760,8 @@ static UINT wlf_cliprdr_server_file_contents_request(CliprdrClientContext* conte
static UINT wlf_cliprdr_clipboard_file_size_success(wClipboardDelegate* delegate,
const wClipboardFileSizeRequest* request, UINT64 fileSize)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
wfClipboard* clipboard = delegate->custom;
ZeroMemory(&response, sizeof(response));
response.msgFlags = CB_RESPONSE_OK;
response.streamId = request->streamId;
response.dwFlags = FILECONTENTS_SIZE;
@ -779,9 +773,8 @@ static UINT wlf_cliprdr_clipboard_file_size_success(wClipboardDelegate* delegate
static UINT wlf_cliprdr_clipboard_file_size_failure(wClipboardDelegate* delegate,
const wClipboardFileSizeRequest* request, UINT errorCode)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
wfClipboard* clipboard = delegate->custom;
ZeroMemory(&response, sizeof(response));
response.msgFlags = CB_RESPONSE_FAIL;
response.streamId = request->streamId;
response.dwFlags = FILECONTENTS_SIZE;
@ -791,9 +784,8 @@ static UINT wlf_cliprdr_clipboard_file_size_failure(wClipboardDelegate* delegate
static UINT wlf_cliprdr_clipboard_file_range_success(wClipboardDelegate* delegate,
const wClipboardFileRangeRequest* request, const BYTE* data, UINT32 size)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
wfClipboard* clipboard = delegate->custom;
ZeroMemory(&response, sizeof(response));
response.msgFlags = CB_RESPONSE_OK;
response.streamId = request->streamId;
response.dwFlags = FILECONTENTS_RANGE;
@ -805,9 +797,8 @@ static UINT wlf_cliprdr_clipboard_file_range_success(wClipboardDelegate* delegat
static UINT wlf_cliprdr_clipboard_file_range_failure(wClipboardDelegate* delegate,
const wClipboardFileRangeRequest* request, UINT errorCode)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
wfClipboard* clipboard = delegate->custom;
ZeroMemory(&response, sizeof(response));
response.msgFlags = CB_RESPONSE_FAIL;
response.streamId = request->streamId;
response.dwFlags = FILECONTENTS_RANGE;

View File

@ -1206,7 +1206,7 @@ static UINT cliprdr_send_tempdir(wfClipboard* clipboard)
return clipboard->context->TempDirectory(clipboard->context, &tempDirectory);
}
BOOL cliprdr_GetUpdatedClipboardFormats(wfClipboard* clipboard,
static BOOL cliprdr_GetUpdatedClipboardFormats(wfClipboard* clipboard,
PUINT lpuiFormats, UINT cFormats, PUINT pcFormatsOut)
{
UINT index = 0;
@ -1861,7 +1861,7 @@ static UINT wf_cliprdr_send_client_capabilities(wfClipboard* clipboard)
* @return 0 on success, otherwise a Win32 error code
*/
static UINT wf_cliprdr_monitor_ready(CliprdrClientContext* context,
CLIPRDR_MONITOR_READY* monitorReady)
const CLIPRDR_MONITOR_READY* monitorReady)
{
UINT rc;
wfClipboard* clipboard = (wfClipboard*) context->custom;
@ -1884,7 +1884,7 @@ static UINT wf_cliprdr_monitor_ready(CliprdrClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT wf_cliprdr_server_capabilities(CliprdrClientContext* context,
CLIPRDR_CAPABILITIES* capabilities)
const CLIPRDR_CAPABILITIES* capabilities)
{
UINT32 index;
CLIPRDR_CAPABILITY_SET* capabilitySet;
@ -1916,7 +1916,7 @@ static UINT wf_cliprdr_server_capabilities(CliprdrClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context,
CLIPRDR_FORMAT_LIST* formatList)
const CLIPRDR_FORMAT_LIST* formatList)
{
UINT rc = ERROR_INTERNAL_ERROR;
UINT32 i;
@ -1989,7 +1989,7 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context,
*/
static UINT wf_cliprdr_server_format_list_response(CliprdrClientContext*
context,
CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
{
(void)context;
(void)formatListResponse;
@ -2006,7 +2006,7 @@ static UINT wf_cliprdr_server_format_list_response(CliprdrClientContext*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT wf_cliprdr_server_lock_clipboard_data(CliprdrClientContext* context,
CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData)
{
(void)context;
(void)lockClipboardData;
@ -2020,7 +2020,7 @@ static UINT wf_cliprdr_server_lock_clipboard_data(CliprdrClientContext* context,
*/
static UINT wf_cliprdr_server_unlock_clipboard_data(CliprdrClientContext*
context,
CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData)
{
(void)context;
(void)unlockClipboardData;
@ -2067,7 +2067,7 @@ static BOOL wf_cliprdr_process_filename(wfClipboard* clipboard,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
{
UINT rc;
size_t size = 0;
@ -2214,7 +2214,7 @@ static UINT wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
*/
static UINT wf_cliprdr_server_format_data_response(CliprdrClientContext*
context,
CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
{
BYTE* data;
HANDLE hMem;
@ -2268,7 +2268,7 @@ static UINT wf_cliprdr_server_format_data_response(CliprdrClientContext*
*/
static UINT wf_cliprdr_server_file_contents_request(CliprdrClientContext*
context,
CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
DWORD uSize = 0;
BYTE* pData = NULL;
@ -2282,6 +2282,7 @@ static UINT wf_cliprdr_server_file_contents_request(CliprdrClientContext*
wfClipboard* clipboard;
UINT rc = ERROR_INTERNAL_ERROR;
UINT sRc;
UINT32 cbRequested;
if (!context || !fileContentsRequest)
return ERROR_INTERNAL_ERROR;
@ -2291,10 +2292,11 @@ static UINT wf_cliprdr_server_file_contents_request(CliprdrClientContext*
if (!clipboard)
return ERROR_INTERNAL_ERROR;
cbRequested = fileContentsRequest->cbRequested;
if (fileContentsRequest->dwFlags == FILECONTENTS_SIZE)
fileContentsRequest->cbRequested = sizeof(UINT64);
cbRequested = sizeof(UINT64);
pData = (BYTE*) calloc(1, fileContentsRequest->cbRequested);
pData = (BYTE*) calloc(1, cbRequested);
if (!pData)
goto error;
@ -2369,7 +2371,7 @@ static UINT wf_cliprdr_server_file_contents_request(CliprdrClientContext*
{
*((UINT32*) &pData[0]) = vStatStg.cbSize.LowPart;
*((UINT32*) &pData[4]) = vStatStg.cbSize.HighPart;
uSize = fileContentsRequest->cbRequested;
uSize = cbRequested;
}
}
else if (fileContentsRequest->dwFlags == FILECONTENTS_RANGE)
@ -2381,7 +2383,7 @@ static UINT wf_cliprdr_server_file_contents_request(CliprdrClientContext*
hRet = IStream_Seek(pStreamStc, dlibMove, STREAM_SEEK_SET, &dlibNewPosition);
if (SUCCEEDED(hRet))
hRet = IStream_Read(pStreamStc, pData, fileContentsRequest->cbRequested,
hRet = IStream_Read(pStreamStc, pData, cbRequested,
(PULONG) &uSize);
}
}
@ -2393,7 +2395,7 @@ static UINT wf_cliprdr_server_file_contents_request(CliprdrClientContext*
clipboard->fileDescriptor[fileContentsRequest->listIndex]->nFileSizeLow;
*((UINT32*) &pData[4]) =
clipboard->fileDescriptor[fileContentsRequest->listIndex]->nFileSizeHigh;
uSize = fileContentsRequest->cbRequested;
uSize = cbRequested;
}
else if (fileContentsRequest->dwFlags == FILECONTENTS_RANGE)
{
@ -2401,7 +2403,7 @@ static UINT wf_cliprdr_server_file_contents_request(CliprdrClientContext*
bRet = wf_cliprdr_get_file_contents(
clipboard->file_names[fileContentsRequest->listIndex], pData,
fileContentsRequest->nPositionLow, fileContentsRequest->nPositionHigh,
fileContentsRequest->cbRequested, &uSize);
cbRequested, &uSize);
if (bRet == FALSE)
{
@ -2442,7 +2444,7 @@ error:
*/
static UINT wf_cliprdr_server_file_contents_response(CliprdrClientContext*
context,
CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse)
{
wfClipboard* clipboard;

View File

@ -266,8 +266,7 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_server_format_by_atom(
static UINT xf_cliprdr_send_data_request(xfClipboard* clipboard,
UINT32 formatId)
{
CLIPRDR_FORMAT_DATA_REQUEST request;
ZeroMemory(&request, sizeof(CLIPRDR_FORMAT_DATA_REQUEST));
CLIPRDR_FORMAT_DATA_REQUEST request = { 0 };
request.requestedFormatId = formatId;
return clipboard->context->ClientFormatDataRequest(clipboard->context,
&request);
@ -281,8 +280,7 @@ static UINT xf_cliprdr_send_data_request(xfClipboard* clipboard,
static UINT xf_cliprdr_send_data_response(xfClipboard* clipboard, BYTE* data,
int size)
{
CLIPRDR_FORMAT_DATA_RESPONSE response;
ZeroMemory(&response, sizeof(CLIPRDR_FORMAT_DATA_RESPONSE));
CLIPRDR_FORMAT_DATA_RESPONSE response = { 0 };
response.msgFlags = (data) ? CB_RESPONSE_OK : CB_RESPONSE_FAIL;
response.dataLen = size;
response.requestedFormatData = data;
@ -545,9 +543,8 @@ static void xf_cliprdr_get_requested_targets(xfClipboard* clipboard)
{
UINT32 numFormats = 0;
CLIPRDR_FORMAT* formats = NULL;
CLIPRDR_FORMAT_LIST formatList;
CLIPRDR_FORMAT_LIST formatList = { 0 };
formats = xf_cliprdr_get_client_formats(clipboard, &numFormats);
ZeroMemory(&formatList, sizeof(CLIPRDR_FORMAT_LIST));
formatList.msgFlags = CB_RESPONSE_OK;
formatList.numFormats = numFormats;
formatList.formats = formats;
@ -1096,10 +1093,9 @@ static UINT xf_cliprdr_send_client_format_list(xfClipboard* clipboard)
{
UINT32 i, numFormats;
CLIPRDR_FORMAT* formats = NULL;
CLIPRDR_FORMAT_LIST formatList;
CLIPRDR_FORMAT_LIST formatList = { 0 };
xfContext* xfc = clipboard->xfc;
UINT ret;
ZeroMemory(&formatList, sizeof(CLIPRDR_FORMAT_LIST));
numFormats = clipboard->numClientFormats;
if (numFormats)
@ -1155,7 +1151,7 @@ static UINT xf_cliprdr_send_client_format_list_response(xfClipboard* clipboard,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT xf_cliprdr_monitor_ready(CliprdrClientContext* context,
CLIPRDR_MONITOR_READY* monitorReady)
const CLIPRDR_MONITOR_READY* monitorReady)
{
xfClipboard* clipboard = (xfClipboard*) context->custom;
UINT ret;
@ -1176,7 +1172,7 @@ static UINT xf_cliprdr_monitor_ready(CliprdrClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT xf_cliprdr_server_capabilities(CliprdrClientContext* context,
CLIPRDR_CAPABILITIES* capabilities)
const CLIPRDR_CAPABILITIES* capabilities)
{
UINT32 i;
const CLIPRDR_CAPABILITY_SET* caps;
@ -1211,7 +1207,7 @@ static UINT xf_cliprdr_server_capabilities(CliprdrClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
CLIPRDR_FORMAT_LIST* formatList)
const CLIPRDR_FORMAT_LIST* formatList)
{
UINT32 i;
int j;
@ -1301,7 +1297,7 @@ static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT xf_cliprdr_server_format_list_response(CliprdrClientContext*
context, CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
context, const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse)
{
//xfClipboard* clipboard = (xfClipboard*) context->custom;
return CHANNEL_RC_OK;
@ -1313,7 +1309,7 @@ static UINT xf_cliprdr_server_format_list_response(CliprdrClientContext*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT xf_cliprdr_server_format_data_request(CliprdrClientContext* context,
CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest)
{
BOOL rawTransfer;
xfCliprdrFormat* format = NULL;
@ -1348,7 +1344,7 @@ static UINT xf_cliprdr_server_format_data_request(CliprdrClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT xf_cliprdr_server_format_data_response(CliprdrClientContext*
context, CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
context, const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse)
{
BOOL bSuccess;
BYTE* pDstData;
@ -1477,8 +1473,7 @@ static UINT xf_cliprdr_server_format_data_response(CliprdrClientContext*
static UINT xf_cliprdr_server_file_size_request(xfClipboard* clipboard,
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
wClipboardFileSizeRequest request;
ZeroMemory(&request, sizeof(request));
wClipboardFileSizeRequest request = { 0 };
request.streamId = fileContentsRequest->streamId;
request.listIndex = fileContentsRequest->listIndex;
@ -1494,8 +1489,7 @@ static UINT xf_cliprdr_server_file_size_request(xfClipboard* clipboard,
static UINT xf_cliprdr_server_file_range_request(xfClipboard* clipboard,
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
wClipboardFileRangeRequest request;
ZeroMemory(&request, sizeof(request));
wClipboardFileRangeRequest request = { 0 };
request.streamId = fileContentsRequest->streamId;
request.listIndex = fileContentsRequest->listIndex;
request.nPositionLow = fileContentsRequest->nPositionLow;
@ -1507,8 +1501,7 @@ static UINT xf_cliprdr_server_file_range_request(xfClipboard* clipboard,
static UINT xf_cliprdr_send_file_contents_failure(CliprdrClientContext* context,
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
ZeroMemory(&response, sizeof(response));
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
response.msgFlags = CB_RESPONSE_FAIL;
response.streamId = fileContentsRequest->streamId;
response.dwFlags = fileContentsRequest->dwFlags;
@ -1516,7 +1509,7 @@ static UINT xf_cliprdr_send_file_contents_failure(CliprdrClientContext* context,
}
static UINT xf_cliprdr_server_file_contents_request(CliprdrClientContext* context,
CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest)
{
UINT error = NO_ERROR;
xfClipboard* clipboard = context->custom;
@ -1550,9 +1543,8 @@ static UINT xf_cliprdr_server_file_contents_request(CliprdrClientContext* contex
static UINT xf_cliprdr_clipboard_file_size_success(wClipboardDelegate* delegate,
const wClipboardFileSizeRequest* request, UINT64 fileSize)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
xfClipboard* clipboard = delegate->custom;
ZeroMemory(&response, sizeof(response));
response.msgFlags = CB_RESPONSE_OK;
response.streamId = request->streamId;
response.dwFlags = FILECONTENTS_SIZE;
@ -1564,9 +1556,8 @@ static UINT xf_cliprdr_clipboard_file_size_success(wClipboardDelegate* delegate,
static UINT xf_cliprdr_clipboard_file_size_failure(wClipboardDelegate* delegate,
const wClipboardFileSizeRequest* request, UINT errorCode)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
xfClipboard* clipboard = delegate->custom;
ZeroMemory(&response, sizeof(response));
response.msgFlags = CB_RESPONSE_FAIL;
response.streamId = request->streamId;
response.dwFlags = FILECONTENTS_SIZE;
@ -1576,9 +1567,8 @@ static UINT xf_cliprdr_clipboard_file_size_failure(wClipboardDelegate* delegate,
static UINT xf_cliprdr_clipboard_file_range_success(wClipboardDelegate* delegate,
const wClipboardFileRangeRequest* request, const BYTE* data, UINT32 size)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
xfClipboard* clipboard = delegate->custom;
ZeroMemory(&response, sizeof(response));
response.msgFlags = CB_RESPONSE_OK;
response.streamId = request->streamId;
response.dwFlags = FILECONTENTS_RANGE;
@ -1590,9 +1580,8 @@ static UINT xf_cliprdr_clipboard_file_range_success(wClipboardDelegate* delegate
static UINT xf_cliprdr_clipboard_file_range_failure(wClipboardDelegate* delegate,
const wClipboardFileRangeRequest* request, UINT errorCode)
{
CLIPRDR_FILE_CONTENTS_RESPONSE response;
CLIPRDR_FILE_CONTENTS_RESPONSE response = { 0 };
xfClipboard* clipboard = delegate->custom;
ZeroMemory(&response, sizeof(response));
response.msgFlags = CB_RESPONSE_FAIL;
response.streamId = request->streamId;
response.dwFlags = FILECONTENTS_RANGE;