From 68f24477f6fb2ff00d321d898b9285d58b685a2a Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 26 Aug 2021 11:23:32 +0200 Subject: [PATCH] Fixed compilation warnings on mac --- include/freerdp/channels/channels.h | 2 +- include/freerdp/crypto/per.h | 3 ++- libfreerdp/core/channels.c | 2 +- libfreerdp/crypto/per.c | 2 +- libfreerdp/gdi/graphics.c | 2 +- libfreerdp/locale/locale.c | 4 ++-- winpr/libwinpr/clipboard/posix.c | 4 ++-- winpr/libwinpr/clipboard/synthetic.c | 6 +++--- winpr/libwinpr/sspi/sspi_winpr.c | 18 +++++++++--------- winpr/libwinpr/thread/argv.c | 4 ++-- winpr/libwinpr/utils/wlog/Layout.c | 4 ++-- winpr/libwinpr/utils/wlog/wlog.c | 2 +- winpr/libwinpr/winsock/winsock.c | 2 +- 13 files changed, 28 insertions(+), 27 deletions(-) diff --git a/include/freerdp/channels/channels.h b/include/freerdp/channels/channels.h index b841db604..0f72bd278 100644 --- a/include/freerdp/channels/channels.h +++ b/include/freerdp/channels/channels.h @@ -56,7 +56,7 @@ extern "C" FREERDP_API UINT16 freerdp_channels_get_id_by_name(freerdp* instance, const char* channel_name); FREERDP_API const char* freerdp_channels_get_name_by_id(freerdp* instance, UINT16 channelId); - FREERDP_API const PWtsApiFunctionTable FreeRDP_InitWtsApi(void); + FREERDP_API const WtsApiFunctionTable* FreeRDP_InitWtsApi(void); #ifdef __cplusplus } diff --git a/include/freerdp/crypto/per.h b/include/freerdp/crypto/per.h index 35d5462ae..d6067a4be 100644 --- a/include/freerdp/crypto/per.h +++ b/include/freerdp/crypto/per.h @@ -47,7 +47,8 @@ extern "C" FREERDP_API BOOL per_write_enumerated(wStream* s, BYTE enumerated, BYTE count); FREERDP_API BOOL per_write_object_identifier(wStream* s, const BYTE oid[6]); FREERDP_API BOOL per_read_object_identifier(wStream* s, const BYTE oid[6]); - FREERDP_API BOOL per_read_octet_string(wStream* s, BYTE* oct_str, UINT16 length, UINT16 min); + FREERDP_API BOOL per_read_octet_string(wStream* s, const BYTE* oct_str, UINT16 length, + UINT16 min); FREERDP_API BOOL per_write_octet_string(wStream* s, const BYTE* oct_str, UINT16 length, UINT16 min); FREERDP_API BOOL per_read_numeric_string(wStream* s, int min); diff --git a/libfreerdp/core/channels.c b/libfreerdp/core/channels.c index f4e568483..6beb706a6 100644 --- a/libfreerdp/core/channels.c +++ b/libfreerdp/core/channels.c @@ -295,7 +295,7 @@ static const WtsApiFunctionTable FreeRDP_WtsApiFunctionTable = { FreeRDP_WTSStartRemoteControlSessionExA }; -const PWtsApiFunctionTable FreeRDP_InitWtsApi(void) +const WtsApiFunctionTable* FreeRDP_InitWtsApi(void) { return &FreeRDP_WtsApiFunctionTable; } diff --git a/libfreerdp/crypto/per.c b/libfreerdp/crypto/per.c index 2a8a4fc91..fd7608f55 100644 --- a/libfreerdp/crypto/per.c +++ b/libfreerdp/crypto/per.c @@ -427,7 +427,7 @@ static void per_write_string(wStream* s, BYTE* str, int length) * @return */ -BOOL per_read_octet_string(wStream* s, BYTE* oct_str, UINT16 length, UINT16 min) +BOOL per_read_octet_string(wStream* s, const BYTE* oct_str, UINT16 length, UINT16 min) { UINT16 i; UINT16 mlength; diff --git a/libfreerdp/gdi/graphics.c b/libfreerdp/gdi/graphics.c index e50cce424..fa529af97 100644 --- a/libfreerdp/gdi/graphics.c +++ b/libfreerdp/gdi/graphics.c @@ -215,7 +215,7 @@ static BOOL gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL p } /* Glyph Class */ -static BOOL gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph) +static BOOL gdi_Glyph_New(rdpContext* context, const rdpGlyph* glyph) { BYTE* data; gdiGlyph* gdi_glyph; diff --git a/libfreerdp/locale/locale.c b/libfreerdp/locale/locale.c index 063795fbc..167e0bc37 100644 --- a/libfreerdp/locale/locale.c +++ b/libfreerdp/locale/locale.c @@ -759,7 +759,7 @@ static const SYSTEM_LOCALE* freerdp_detect_system_locale(void) DWORD freerdp_get_system_locale_id(void) { - SYSTEM_LOCALE* locale; + const SYSTEM_LOCALE* locale; locale = freerdp_detect_system_locale(); if (locale != NULL) @@ -786,7 +786,7 @@ int freerdp_detect_keyboard_layout_from_system_locale(DWORD* keyboardLayoutId) size_t i, j; char language[LOCALE_LANGUAGE_LEN] = { 0 }; char country[LOCALE_COUNTRY_LEN] = { 0 }; - SYSTEM_LOCALE* locale; + const SYSTEM_LOCALE* locale; freerdp_get_system_language_and_country_codes(language, country); if ((strcmp(language, "C") == 0) || (strcmp(language, "POSIX") == 0)) diff --git a/winpr/libwinpr/clipboard/posix.c b/winpr/libwinpr/clipboard/posix.c index f5ba8ea06..635f7c2f2 100644 --- a/winpr/libwinpr/clipboard/posix.c +++ b/winpr/libwinpr/clipboard/posix.c @@ -690,8 +690,8 @@ static void* convert_filedescriptors_to_file_list(wClipboard* clipboard, UINT32 const FILEDESCRIPTORW* cur = &descriptors[x]; size_t curLen = _wcsnlen(cur->cFileName, ARRAYSIZE(cur->cFileName)); char* curName = NULL; - char* stop_at = NULL; - char* previous_at = NULL; + const char* stop_at = NULL; + const char* previous_at = NULL; rc = ConvertFromUnicode(CP_UTF8, 0, cur->cFileName, (int)curLen, &curName, 0, NULL, NULL); rc = _snprintf(&dst[pos], alloc - pos, "%s%s/", lineprefix, clipboard->delegate.basePath); diff --git a/winpr/libwinpr/clipboard/synthetic.c b/winpr/libwinpr/clipboard/synthetic.c index e3543ff5b..b37ea7bfa 100644 --- a/winpr/libwinpr/clipboard/synthetic.c +++ b/winpr/libwinpr/clipboard/synthetic.c @@ -229,7 +229,7 @@ static void* clipboard_synthesize_cf_dib(wClipboard* clipboard, UINT32 formatId, } else if (formatId == ClipboardGetFormatId(clipboard, "image/bmp")) { - BITMAPFILEHEADER* pFileHeader; + const BITMAPFILEHEADER* pFileHeader; if (SrcSize < (sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER))) return NULL; @@ -290,7 +290,7 @@ static void* clipboard_synthesize_image_bmp(wClipboard* clipboard, UINT32 format if (formatId == CF_DIB) { BYTE* pDst; - BITMAPINFOHEADER* pInfoHeader; + const BITMAPINFOHEADER* pInfoHeader; BITMAPFILEHEADER* pFileHeader; if (SrcSize < sizeof(BITMAPINFOHEADER)) @@ -353,7 +353,7 @@ static void* clipboard_synthesize_html_format(wClipboard* clipboard, UINT32 form if ((bom[0] == 0xFE) && (bom[1] == 0xFF)) { - ByteSwapUnicode((const WCHAR*)data, (int)(SrcSize / 2)); + ByteSwapUnicode((WCHAR*)data, (int)(SrcSize / 2)); } if ((bom[0] == 0xFF) && (bom[1] == 0xFE)) diff --git a/winpr/libwinpr/sspi/sspi_winpr.c b/winpr/libwinpr/sspi/sspi_winpr.c index deed4da90..94be2c2d8 100644 --- a/winpr/libwinpr/sspi/sspi_winpr.c +++ b/winpr/libwinpr/sspi/sspi_winpr.c @@ -526,7 +526,7 @@ static const SecurityFunctionTableW* sspi_GetSecurityFunctionTableWByNameW(const return NULL; } -static SecurityFunctionTableW* sspi_GetSecurityFunctionTableWByNameA(const SEC_CHAR* Name) +static const SecurityFunctionTableW* sspi_GetSecurityFunctionTableWByNameA(const SEC_CHAR* Name) { int status; SEC_WCHAR* NameW = NULL; @@ -829,7 +829,7 @@ static SECURITY_STATUS SEC_ENTRY winpr_ExportSecurityContext(PCtxtHandle phConte { SEC_CHAR* Name; SECURITY_STATUS status; - SecurityFunctionTableW* table; + const SecurityFunctionTableW* table; Name = (SEC_CHAR*)sspi_SecureHandleGetUpperPointer(phContext); if (!Name) @@ -895,7 +895,7 @@ static SECURITY_STATUS SEC_ENTRY winpr_ImportSecurityContextW(SEC_WCHAR* pszPack { SEC_CHAR* Name; SECURITY_STATUS status; - SecurityFunctionTableW* table; + const SecurityFunctionTableW* table; Name = (SEC_CHAR*)sspi_SecureHandleGetUpperPointer(phContext); if (!Name) @@ -1173,7 +1173,7 @@ static SECURITY_STATUS SEC_ENTRY winpr_ImpersonateSecurityContext(PCtxtHandle ph { SEC_CHAR* Name; SECURITY_STATUS status; - SecurityFunctionTableW* table; + const SecurityFunctionTableW* table; Name = (SEC_CHAR*)sspi_SecureHandleGetUpperPointer(phContext); if (!Name) @@ -1208,7 +1208,7 @@ static SECURITY_STATUS SEC_ENTRY winpr_InitializeSecurityContextW( { SEC_CHAR* Name; SECURITY_STATUS status; - SecurityFunctionTableW* table; + const SecurityFunctionTableW* table; Name = (SEC_CHAR*)sspi_SecureHandleGetUpperPointer(phCredential); if (!Name) @@ -1280,7 +1280,7 @@ static SECURITY_STATUS SEC_ENTRY winpr_QueryContextAttributesW(PCtxtHandle phCon { SEC_CHAR* Name; SECURITY_STATUS status; - SecurityFunctionTableW* table; + const SecurityFunctionTableW* table; Name = (SEC_CHAR*)sspi_SecureHandleGetUpperPointer(phContext); if (!Name) @@ -1346,7 +1346,7 @@ static SECURITY_STATUS SEC_ENTRY winpr_QuerySecurityContextToken(PCtxtHandle phC { SEC_CHAR* Name; SECURITY_STATUS status; - SecurityFunctionTableW* table; + const SecurityFunctionTableW* table; Name = (SEC_CHAR*)sspi_SecureHandleGetUpperPointer(phContext); if (!Name) @@ -1380,7 +1380,7 @@ static SECURITY_STATUS SEC_ENTRY winpr_SetContextAttributesW(PCtxtHandle phConte { SEC_CHAR* Name; SECURITY_STATUS status; - SecurityFunctionTableW* table; + const SecurityFunctionTableW* table; Name = (SEC_CHAR*)sspi_SecureHandleGetUpperPointer(phContext); if (!Name) @@ -1446,7 +1446,7 @@ static SECURITY_STATUS SEC_ENTRY winpr_RevertSecurityContext(PCtxtHandle phConte { SEC_CHAR* Name; SECURITY_STATUS status; - SecurityFunctionTableW* table; + const SecurityFunctionTableW* table; Name = (SEC_CHAR*)sspi_SecureHandleGetUpperPointer(phContext); if (!Name) diff --git a/winpr/libwinpr/thread/argv.c b/winpr/libwinpr/thread/argv.c index 674b3e6c0..5fd3b6c91 100644 --- a/winpr/libwinpr/thread/argv.c +++ b/winpr/libwinpr/thread/argv.c @@ -93,8 +93,8 @@ LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs) { const char* p; size_t length; - char* pBeg; - char* pEnd; + const char* pBeg; + const char* pEnd; char* buffer; char* pOutput; int numArgs = 0; diff --git a/winpr/libwinpr/utils/wlog/Layout.c b/winpr/libwinpr/utils/wlog/Layout.c index 0996e7b69..1aa5b1875 100644 --- a/winpr/libwinpr/utils/wlog/Layout.c +++ b/winpr/libwinpr/utils/wlog/Layout.c @@ -88,7 +88,7 @@ BOOL WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* me { if ((p[0] == 'l') && (p[1] == 'v')) /* log level */ { - args[argc++] = (const void*)WLOG_LEVELS[message->Level]; + args[argc++] = (void*)WLOG_LEVELS[message->Level]; format[index++] = '%'; format[index++] = 's'; p++; @@ -120,7 +120,7 @@ BOOL WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* me } else if ((p[0] == 'f') && (p[1] == 'n')) /* function */ { - args[argc++] = (const void*)message->FunctionName; + args[argc++] = (void*)message->FunctionName; format[index++] = '%'; format[index++] = 's'; p++; diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index 24953bd31..b5afed25a 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -791,7 +791,7 @@ LONG WLog_GetFilterLogLevel(wLog* log) return log->FilterLevel; } -static BOOL WLog_ParseName(wLog* log, LPSTR name) +static BOOL WLog_ParseName(wLog* log, LPCSTR name) { char* p; size_t count; diff --git a/winpr/libwinpr/winsock/winsock.c b/winpr/libwinpr/winsock/winsock.c index 1cc3d5b0e..c097d53f8 100644 --- a/winpr/libwinpr/winsock/winsock.c +++ b/winpr/libwinpr/winsock/winsock.c @@ -1161,7 +1161,7 @@ int _select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, do { - status = select(nfds, readfds, writefds, exceptfds, (const struct timeval*)timeout); + status = select(nfds, readfds, writefds, exceptfds, (struct timeval*)timeout); } while ((status < 0) && (errno == EINTR)); return status;