From e4df43a37a3ca2a9be0adbc053e6f9519fdb262e Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 19 Mar 2025 16:36:37 +0100 Subject: [PATCH] [freerdp] fix argument consistency, casts --- include/freerdp/channels/wtsvc.h | 7 ++-- include/freerdp/gdi/gdi.h | 4 +-- include/freerdp/gdi/region.h | 20 +++++------ include/freerdp/gdi/shape.h | 2 +- include/freerdp/svc.h | 1 - libfreerdp/core/server.c | 6 ++-- libfreerdp/gdi/clipping.c | 2 +- libfreerdp/gdi/clipping.h | 2 +- libfreerdp/gdi/dc.c | 2 +- libfreerdp/gdi/gdi.c | 4 +-- libfreerdp/gdi/gdi.h | 4 +-- libfreerdp/gdi/region.c | 52 ++++++++++++++------------- libfreerdp/gdi/shape.c | 2 +- libfreerdp/gdi/test/TestGdiCreate.c | 2 +- libfreerdp/gdi/test/TestGdiRect.c | 4 +-- libfreerdp/gdi/test/TestGdiRegion.c | 4 +-- libfreerdp/primitives/prim_internal.h | 18 +++++----- winpr/include/winpr/bitstream.h | 32 ++++++++--------- winpr/libwinpr/timezone/timezone.c | 6 ++-- winpr/libwinpr/utils/windows/debug.c | 4 +-- 20 files changed, 89 insertions(+), 89 deletions(-) diff --git a/include/freerdp/channels/wtsvc.h b/include/freerdp/channels/wtsvc.h index 14832c75b..e8011a2f3 100644 --- a/include/freerdp/channels/wtsvc.h +++ b/include/freerdp/channels/wtsvc.h @@ -78,13 +78,12 @@ extern "C" */ FREERDP_API UINT16 WTSChannelGetId(freerdp_peer* client, const char* channel_name); FREERDP_API BOOL WTSIsChannelJoinedByName(freerdp_peer* client, const char* channel_name); - FREERDP_API BOOL WTSIsChannelJoinedById(freerdp_peer* client, const UINT16 channel_id); + FREERDP_API BOOL WTSIsChannelJoinedById(freerdp_peer* client, UINT16 channel_id); FREERDP_API BOOL WTSChannelSetHandleByName(freerdp_peer* client, const char* channel_name, void* handle); - FREERDP_API BOOL WTSChannelSetHandleById(freerdp_peer* client, const UINT16 channel_id, - void* handle); + FREERDP_API BOOL WTSChannelSetHandleById(freerdp_peer* client, UINT16 channel_id, void* handle); FREERDP_API void* WTSChannelGetHandleByName(freerdp_peer* client, const char* channel_name); - FREERDP_API void* WTSChannelGetHandleById(freerdp_peer* client, const UINT16 channel_id); + FREERDP_API void* WTSChannelGetHandleById(freerdp_peer* client, UINT16 channel_id); FREERDP_API const char* WTSChannelGetName(freerdp_peer* client, UINT16 channel_id); FREERDP_API char** WTSGetAcceptedChannelNames(freerdp_peer* client, size_t* count); FREERDP_API INT64 WTSChannelGetOptions(freerdp_peer* client, UINT16 channel_id); diff --git a/include/freerdp/gdi/gdi.h b/include/freerdp/gdi/gdi.h index ab6f172e0..7e67ea5ea 100644 --- a/include/freerdp/gdi/gdi.h +++ b/include/freerdp/gdi/gdi.h @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -529,8 +528,7 @@ extern "C" FREERDP_API const char* gdi_rop3_string(DWORD rop); FREERDP_API UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel); - FREERDP_API BOOL gdi_decode_color(rdpGdi* gdi, const UINT32 srcColor, UINT32* color, - UINT32* format); + FREERDP_API BOOL gdi_decode_color(rdpGdi* gdi, UINT32 srcColor, UINT32* color, UINT32* format); FREERDP_API BOOL gdi_resize(rdpGdi* gdi, UINT32 width, UINT32 height); FREERDP_API BOOL gdi_resize_ex(rdpGdi* gdi, UINT32 width, UINT32 height, UINT32 stride, UINT32 format, BYTE* buffer, void (*pfree)(void*)); diff --git a/include/freerdp/gdi/region.h b/include/freerdp/gdi/region.h index d515b7bca..9a53fe157 100644 --- a/include/freerdp/gdi/region.h +++ b/include/freerdp/gdi/region.h @@ -32,29 +32,29 @@ extern "C" FREERDP_API HGDI_RGN gdi_CreateRectRgn(INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, INT32 nBottomRect); - FREERDP_API HGDI_RECT gdi_CreateRect(INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom); - FREERDP_API BOOL gdi_RectToRgn(const HGDI_RECT rect, HGDI_RGN rgn); + FREERDP_API GDI_RECT* gdi_CreateRect(INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom); + FREERDP_API BOOL gdi_RectToRgn(const GDI_RECT* rect, HGDI_RGN rgn); FREERDP_API BOOL gdi_CRectToRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, HGDI_RGN rgn); - FREERDP_API BOOL gdi_RectToCRgn(const HGDI_RECT rect, INT32* x, INT32* y, INT32* w, INT32* h); + FREERDP_API BOOL gdi_RectToCRgn(const GDI_RECT* rect, INT32* x, INT32* y, INT32* w, INT32* h); FREERDP_API BOOL gdi_CRectToCRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, INT32* x, INT32* y, INT32* w, INT32* h); - FREERDP_API BOOL gdi_RgnToRect(const HGDI_RGN rgn, HGDI_RECT rect); - FREERDP_API BOOL gdi_CRgnToRect(INT64 x, INT64 y, INT32 w, INT32 h, HGDI_RECT rect); - FREERDP_API BOOL gdi_RgnToCRect(const HGDI_RGN rgn, INT32* left, INT32* top, INT32* right, + FREERDP_API BOOL gdi_RgnToRect(const GDI_RGN* rgn, GDI_RECT* rect); + FREERDP_API BOOL gdi_CRgnToRect(INT64 x, INT64 y, INT32 w, INT32 h, GDI_RECT* rect); + FREERDP_API BOOL gdi_RgnToCRect(const GDI_RGN* rgn, INT32* left, INT32* top, INT32* right, INT32* bottom); FREERDP_API BOOL gdi_CRgnToCRect(INT32 x, INT32 y, INT32 w, INT32 h, INT32* left, INT32* top, INT32* right, INT32* bottom); FREERDP_API BOOL gdi_CopyOverlap(INT32 x, INT32 y, INT32 width, INT32 height, INT32 srcx, INT32 srcy); - FREERDP_API BOOL gdi_SetRect(HGDI_RECT rc, INT32 xLeft, INT32 yTop, INT32 xRight, + FREERDP_API BOOL gdi_SetRect(GDI_RECT* rc, INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom); FREERDP_API BOOL gdi_SetRgn(HGDI_RGN hRgn, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, INT32 nHeight); FREERDP_API BOOL gdi_SetRectRgn(HGDI_RGN hRgn, INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, INT32 nBottomRect); - FREERDP_API BOOL gdi_EqualRgn(const HGDI_RGN hSrcRgn1, const HGDI_RGN hSrcRgn2); - FREERDP_API BOOL gdi_CopyRect(HGDI_RECT dst, const HGDI_RECT src); - FREERDP_API BOOL gdi_PtInRect(const HGDI_RECT rc, INT32 x, INT32 y); + FREERDP_API BOOL gdi_EqualRgn(const GDI_RGN* hSrcRgn1, const GDI_RGN* hSrcRgn2); + FREERDP_API BOOL gdi_CopyRect(GDI_RECT* dst, const GDI_RECT* src); + FREERDP_API BOOL gdi_PtInRect(const GDI_RECT* rc, INT32 x, INT32 y); FREERDP_API BOOL gdi_InvalidateRegion(HGDI_DC hdc, INT32 x, INT32 y, INT32 w, INT32 h); #ifdef __cplusplus diff --git a/include/freerdp/gdi/shape.h b/include/freerdp/gdi/shape.h index d4a183e85..9b3c041c1 100644 --- a/include/freerdp/gdi/shape.h +++ b/include/freerdp/gdi/shape.h @@ -30,7 +30,7 @@ extern "C" FREERDP_API BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); - FREERDP_API BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr); + FREERDP_API BOOL gdi_FillRect(HGDI_DC hdc, const GDI_RECT* rect, HGDI_BRUSH hbr); FREERDP_API BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT* lpPoints, int nCount); FREERDP_API BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT* lpPoints, int* lpPolyCounts, int nCount); diff --git a/include/freerdp/svc.h b/include/freerdp/svc.h index e7154a2ae..fa62462b5 100644 --- a/include/freerdp/svc.h +++ b/include/freerdp/svc.h @@ -26,7 +26,6 @@ #include #include -#include #define CHANNEL_EVENT_USER 1000 diff --git a/libfreerdp/core/server.c b/libfreerdp/core/server.c index 71abd4cc2..48b2072a6 100644 --- a/libfreerdp/core/server.c +++ b/libfreerdp/core/server.c @@ -696,7 +696,7 @@ BOOL WTSIsChannelJoinedByName(freerdp_peer* client, const char* channel_name) : TRUE; } -BOOL WTSIsChannelJoinedById(freerdp_peer* client, const UINT16 channel_id) +BOOL WTSIsChannelJoinedById(freerdp_peer* client, UINT16 channel_id) { if (!client || !client->context || !client->context->rdp) return FALSE; @@ -775,7 +775,7 @@ BOOL WTSChannelSetHandleByName(freerdp_peer* client, const char* channel_name, v return TRUE; } -BOOL WTSChannelSetHandleById(freerdp_peer* client, const UINT16 channel_id, void* handle) +BOOL WTSChannelSetHandleById(freerdp_peer* client, UINT16 channel_id, void* handle) { rdpMcsChannel* channel = NULL; @@ -807,7 +807,7 @@ void* WTSChannelGetHandleByName(freerdp_peer* client, const char* channel_name) return channel->handle; } -void* WTSChannelGetHandleById(freerdp_peer* client, const UINT16 channel_id) +void* WTSChannelGetHandleById(freerdp_peer* client, UINT16 channel_id) { rdpMcsChannel* channel = NULL; diff --git a/libfreerdp/gdi/clipping.c b/libfreerdp/gdi/clipping.c index 45774b659..9481c5924 100644 --- a/libfreerdp/gdi/clipping.c +++ b/libfreerdp/gdi/clipping.c @@ -45,7 +45,7 @@ BOOL gdi_SetClipRgn(HGDI_DC hdc, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, INT32 * @return clipping region */ -HGDI_RGN gdi_GetClipRgn(HGDI_DC hdc) +GDI_RGN* gdi_GetClipRgn(HGDI_DC hdc) { return hdc->clip; } diff --git a/libfreerdp/gdi/clipping.h b/libfreerdp/gdi/clipping.h index d4546fb64..8c40fc5f4 100644 --- a/libfreerdp/gdi/clipping.h +++ b/libfreerdp/gdi/clipping.h @@ -32,7 +32,7 @@ extern "C" FREERDP_LOCAL BOOL gdi_SetClipRgn(HGDI_DC hdc, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, INT32 nHeight); - FREERDP_LOCAL HGDI_RGN gdi_GetClipRgn(HGDI_DC hdc); + FREERDP_LOCAL GDI_RGN* gdi_GetClipRgn(HGDI_DC hdc); FREERDP_LOCAL BOOL gdi_SetNullClipRgn(HGDI_DC hdc); FREERDP_LOCAL BOOL gdi_ClipCoords(HGDI_DC hdc, INT32* x, INT32* y, INT32* w, INT32* h, INT32* srcx, INT32* srcy); diff --git a/libfreerdp/gdi/dc.c b/libfreerdp/gdi/dc.c index 94562b1f7..10dc9883b 100644 --- a/libfreerdp/gdi/dc.c +++ b/libfreerdp/gdi/dc.c @@ -94,7 +94,7 @@ HGDI_DC gdi_CreateDC(UINT32 format) hDC->hwnd->invalid->null = TRUE; hDC->hwnd->count = 32; - if (!(hDC->hwnd->cinvalid = (HGDI_RGN)calloc(hDC->hwnd->count, sizeof(GDI_RGN)))) + if (!(hDC->hwnd->cinvalid = (GDI_RGN*)calloc(hDC->hwnd->count, sizeof(GDI_RGN)))) goto fail; hDC->hwnd->ninvalid = 0; diff --git a/libfreerdp/gdi/gdi.c b/libfreerdp/gdi/gdi.c index eb6cda54d..1b15c7ffe 100644 --- a/libfreerdp/gdi/gdi.c +++ b/libfreerdp/gdi/gdi.c @@ -333,7 +333,7 @@ static inline DWORD gdi_rop3_code_checked_int(UINT32 code, WINPR_ATTR_UNUSED con return gdi_rop3_code((UINT8)code); } -BOOL gdi_decode_color(rdpGdi* gdi, const UINT32 srcColor, UINT32* color, UINT32* format) +BOOL gdi_decode_color(rdpGdi* gdi, UINT32 srcColor, UINT32* color, UINT32* format) { UINT32 SrcFormat = 0; @@ -1278,7 +1278,7 @@ static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, UINT32 format, BYTE* bu gdi->primary->hdc->hwnd->count = 32; if (!(gdi->primary->hdc->hwnd->cinvalid = - (HGDI_RGN)calloc(gdi->primary->hdc->hwnd->count, sizeof(GDI_RGN)))) + (GDI_RGN*)calloc(gdi->primary->hdc->hwnd->count, sizeof(GDI_RGN)))) goto fail_hwnd; gdi->primary->hdc->hwnd->ninvalid = 0; diff --git a/libfreerdp/gdi/gdi.h b/libfreerdp/gdi/gdi.h index 5ffda0e50..e1c86d3c8 100644 --- a/libfreerdp/gdi/gdi.h +++ b/libfreerdp/gdi/gdi.h @@ -81,8 +81,8 @@ static INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, UINT32 x, UINT32 y) WINPR_ASSERT(h > 0); x = (x + w - (WINPR_ASSERTING_INT_CAST(UINT32, hdcBrush->brush->nXOrg) % w)) % w; y = (y + h - (WINPR_ASSERTING_INT_CAST(UINT32, hdcBrush->brush->nYOrg) % h)) % h; - p = hBmpBrush->data + (y * hBmpBrush->scanline) + - (x * FreeRDPGetBytesPerPixel(hBmpBrush->format)); + p = hBmpBrush->data + (1ULL * y * hBmpBrush->scanline) + + (1ULL * x * FreeRDPGetBytesPerPixel(hBmpBrush->format)); return p; } diff --git a/libfreerdp/gdi/region.c b/libfreerdp/gdi/region.c index d7da38a08..91fbb8d84 100644 --- a/libfreerdp/gdi/region.c +++ b/libfreerdp/gdi/region.c @@ -37,7 +37,7 @@ #define TAG FREERDP_TAG("gdi.region") -static char* gdi_rect_str(char* buffer, size_t size, const HGDI_RECT rect) +static char* gdi_rect_str(char* buffer, size_t size, const GDI_RECT* rect) { if (!buffer || (size < 1) || !rect) return NULL; @@ -50,7 +50,7 @@ static char* gdi_rect_str(char* buffer, size_t size, const HGDI_RECT rect) return buffer; } -static char* gdi_regn_str(char* buffer, size_t size, const HGDI_RGN rgn) +static char* gdi_regn_str(char* buffer, size_t size, const GDI_RGN* rgn) { if (!buffer || (size < 1) || !rgn) return NULL; @@ -74,11 +74,11 @@ static char* gdi_regn_str(char* buffer, size_t size, const HGDI_RGN rgn) * @return new region */ -HGDI_RGN gdi_CreateRectRgn(INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, INT32 nBottomRect) +GDI_RGN* gdi_CreateRectRgn(INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, INT32 nBottomRect) { INT64 w = 0; INT64 h = 0; - HGDI_RGN hRgn = NULL; + GDI_RGN* hRgn = NULL; w = nRightRect - nLeftRect + 1ll; h = nBottomRect - nTopRect + 1ll; @@ -90,7 +90,7 @@ HGDI_RGN gdi_CreateRectRgn(INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, IN nTopRect, nLeftRect, nBottomRect, nRightRect); return NULL; } - hRgn = (HGDI_RGN)calloc(1, sizeof(GDI_RGN)); + hRgn = (GDI_RGN*)calloc(1, sizeof(GDI_RGN)); if (!hRgn) return NULL; @@ -113,16 +113,16 @@ HGDI_RGN gdi_CreateRectRgn(INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, IN * @return new rectangle */ -HGDI_RECT gdi_CreateRect(INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom) +GDI_RECT* gdi_CreateRect(INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom) { - HGDI_RECT hRect = NULL; + GDI_RECT* hRect = NULL; if (xLeft > xRight) return NULL; if (yTop > yBottom) return NULL; - hRect = (HGDI_RECT)calloc(1, sizeof(GDI_RECT)); + hRect = (GDI_RECT*)calloc(1, sizeof(GDI_RECT)); if (!hRect) return NULL; @@ -141,7 +141,7 @@ HGDI_RECT gdi_CreateRect(INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom) * @param rgn destination region */ -BOOL gdi_RectToRgn(const HGDI_RECT rect, HGDI_RGN rgn) +BOOL gdi_RectToRgn(const GDI_RECT* rect, GDI_RGN* rgn) { BOOL rc = TRUE; INT64 w = 0; @@ -177,7 +177,7 @@ BOOL gdi_RectToRgn(const HGDI_RECT rect, HGDI_RGN rgn) * @param rgn destination region */ -BOOL gdi_CRectToRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, HGDI_RGN rgn) +BOOL gdi_CRectToRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, GDI_RGN* rgn) { BOOL rc = TRUE; INT64 w = 0; @@ -215,7 +215,7 @@ BOOL gdi_CRectToRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, HGDI_RGN r * @param h height */ -BOOL gdi_RectToCRgn(const HGDI_RECT rect, INT32* x, INT32* y, INT32* w, INT32* h) +BOOL gdi_RectToCRgn(const GDI_RECT* rect, INT32* x, INT32* y, INT32* w, INT32* h) { BOOL rc = TRUE; *x = rect->left; @@ -289,7 +289,7 @@ BOOL gdi_CRectToCRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, INT32* x, * @param rect destination rectangle */ -BOOL gdi_RgnToRect(const HGDI_RGN rgn, HGDI_RECT rect) +BOOL gdi_RgnToRect(const GDI_RGN* rgn, GDI_RECT* rect) { INT64 r = 0; INT64 b = 0; @@ -322,7 +322,7 @@ BOOL gdi_RgnToRect(const HGDI_RGN rgn, HGDI_RECT rect) * @param rect destination rectangle */ -BOOL gdi_CRgnToRect(INT64 x, INT64 y, INT32 w, INT32 h, HGDI_RECT rect) +BOOL gdi_CRgnToRect(INT64 x, INT64 y, INT32 w, INT32 h, GDI_RECT* rect) { BOOL invalid = FALSE; const INT64 r = x + w - 1; @@ -368,9 +368,11 @@ BOOL gdi_CRgnToRect(INT64 x, INT64 y, INT32 w, INT32 h, HGDI_RECT rect) * @param bottom y2 */ -BOOL gdi_RgnToCRect(const HGDI_RGN rgn, INT32* left, INT32* top, INT32* right, INT32* bottom) +BOOL gdi_RgnToCRect(const GDI_RGN* rgn, INT32* left, INT32* top, INT32* right, INT32* bottom) { BOOL rc = TRUE; + + WINPR_ASSERT(rgn); if ((rgn->w < 0) || (rgn->h < 0)) { char buffer[256]; @@ -469,7 +471,7 @@ INLINE BOOL gdi_CopyOverlap(INT32 x, INT32 y, INT32 width, INT32 height, INT32 s * @return nonzero if successful, 0 otherwise */ -INLINE BOOL gdi_SetRect(HGDI_RECT rc, INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom) +INLINE BOOL gdi_SetRect(GDI_RECT* rc, INT32 xLeft, INT32 yTop, INT32 xRight, INT32 yBottom) { if (!rc) return FALSE; @@ -495,7 +497,7 @@ INLINE BOOL gdi_SetRect(HGDI_RECT rc, INT32 xLeft, INT32 yTop, INT32 xRight, INT * @return nonzero if successful, 0 otherwise */ -INLINE BOOL gdi_SetRgn(HGDI_RGN hRgn, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, INT32 nHeight) +INLINE BOOL gdi_SetRgn(GDI_RGN* hRgn, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, INT32 nHeight) { if (!hRgn) return FALSE; @@ -521,7 +523,7 @@ INLINE BOOL gdi_SetRgn(HGDI_RGN hRgn, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, * @return nonzero if successful, 0 otherwise */ -INLINE BOOL gdi_SetRectRgn(HGDI_RGN hRgn, INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, +INLINE BOOL gdi_SetRectRgn(GDI_RGN* hRgn, INT32 nLeftRect, INT32 nTopRect, INT32 nRightRect, INT32 nBottomRect) { if (!gdi_CRectToRgn(nLeftRect, nTopRect, nRightRect, nBottomRect, hRgn)) @@ -539,8 +541,10 @@ INLINE BOOL gdi_SetRectRgn(HGDI_RGN hRgn, INT32 nLeftRect, INT32 nTopRect, INT32 * @return nonzero if both regions are equal, 0 otherwise */ -INLINE BOOL gdi_EqualRgn(const HGDI_RGN hSrcRgn1, const HGDI_RGN hSrcRgn2) +INLINE BOOL gdi_EqualRgn(const GDI_RGN* hSrcRgn1, const GDI_RGN* hSrcRgn2) { + WINPR_ASSERT(hSrcRgn1); + WINPR_ASSERT(hSrcRgn2); if ((hSrcRgn1->x == hSrcRgn2->x) && (hSrcRgn1->y == hSrcRgn2->y) && (hSrcRgn1->w == hSrcRgn2->w) && (hSrcRgn1->h == hSrcRgn2->h)) { @@ -559,7 +563,7 @@ INLINE BOOL gdi_EqualRgn(const HGDI_RGN hSrcRgn1, const HGDI_RGN hSrcRgn2) * @return nonzero if successful, 0 otherwise */ -INLINE BOOL gdi_CopyRect(HGDI_RECT dst, const HGDI_RECT src) +INLINE BOOL gdi_CopyRect(GDI_RECT* dst, const GDI_RECT* src) { if (!dst || !src) return FALSE; @@ -580,7 +584,7 @@ INLINE BOOL gdi_CopyRect(HGDI_RECT dst, const HGDI_RECT src) * @return nonzero if the point is inside, 0 otherwise */ -INLINE BOOL gdi_PtInRect(const HGDI_RECT rc, INT32 x, INT32 y) +INLINE BOOL gdi_PtInRect(const GDI_RECT* rc, INT32 x, INT32 y) { /* * points on the left and top sides are considered in, @@ -612,8 +616,8 @@ INLINE BOOL gdi_InvalidateRegion(HGDI_DC hdc, INT32 x, INT32 y, INT32 w, INT32 h { GDI_RECT inv; GDI_RECT rgn; - HGDI_RGN invalid = NULL; - HGDI_RGN cinvalid = NULL; + GDI_RGN* invalid = NULL; + GDI_RGN* cinvalid = NULL; if (!hdc->hwnd) return TRUE; @@ -628,12 +632,12 @@ INLINE BOOL gdi_InvalidateRegion(HGDI_DC hdc, INT32 x, INT32 y, INT32 w, INT32 h if ((hdc->hwnd->ninvalid + 1) > (INT64)hdc->hwnd->count) { - HGDI_RGN new_rgn = NULL; + GDI_RGN* new_rgn = NULL; size_t new_cnt = 2ULL * hdc->hwnd->count; if (new_cnt > UINT32_MAX) return FALSE; - new_rgn = (HGDI_RGN)realloc(cinvalid, sizeof(GDI_RGN) * new_cnt); + new_rgn = (GDI_RGN*)realloc(cinvalid, sizeof(GDI_RGN) * new_cnt); if (!new_rgn) return FALSE; diff --git a/libfreerdp/gdi/shape.c b/libfreerdp/gdi/shape.c index 848fe0801..1b55aeb7b 100644 --- a/libfreerdp/gdi/shape.c +++ b/libfreerdp/gdi/shape.c @@ -137,7 +137,7 @@ BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int n * @return nonzero if successful, 0 otherwise */ -BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr) +BOOL gdi_FillRect(HGDI_DC hdc, const GDI_RECT* rect, HGDI_BRUSH hbr) { UINT32 color = 0; UINT32 dstColor = 0; diff --git a/libfreerdp/gdi/test/TestGdiCreate.c b/libfreerdp/gdi/test/TestGdiCreate.c index 4b042b561..ea85ea92d 100644 --- a/libfreerdp/gdi/test/TestGdiCreate.c +++ b/libfreerdp/gdi/test/TestGdiCreate.c @@ -292,7 +292,7 @@ fail: static int test_gdi_CreateRect(void) { int rc = -1; - HGDI_RECT hRect = NULL; + GDI_RECT* hRect = NULL; INT32 x1 = 32; INT32 y1 = 64; INT32 x2 = 128; diff --git a/libfreerdp/gdi/test/TestGdiRect.c b/libfreerdp/gdi/test/TestGdiRect.c index 444aed1e4..67a37f393 100644 --- a/libfreerdp/gdi/test/TestGdiRect.c +++ b/libfreerdp/gdi/test/TestGdiRect.c @@ -17,7 +17,7 @@ static int test_gdi_PtInRect(void) { int rc = -1; - HGDI_RECT hRect = NULL; + GDI_RECT* hRect = NULL; UINT32 left = 20; UINT32 top = 40; UINT32 right = 60; @@ -70,7 +70,7 @@ static int test_gdi_FillRect(void) { int rc = -1; HGDI_DC hdc = NULL; - HGDI_RECT hRect = NULL; + GDI_RECT* hRect = NULL; HGDI_BRUSH hBrush = NULL; HGDI_BITMAP hBitmap = NULL; UINT32 color = 0; diff --git a/libfreerdp/gdi/test/TestGdiRegion.c b/libfreerdp/gdi/test/TestGdiRegion.c index 3f7ed93ec..f5d2aa700 100644 --- a/libfreerdp/gdi/test/TestGdiRegion.c +++ b/libfreerdp/gdi/test/TestGdiRegion.c @@ -24,8 +24,8 @@ int TestGdiRegion(int argc, char* argv[]) INT32 b = 0; HGDI_RGN rgn1 = NULL; HGDI_RGN rgn2 = NULL; - HGDI_RECT rect1 = NULL; - HGDI_RECT rect2 = NULL; + GDI_RECT* rect1 = NULL; + GDI_RECT* rect2 = NULL; WINPR_UNUSED(argc); WINPR_UNUSED(argv); diff --git a/libfreerdp/primitives/prim_internal.h b/libfreerdp/primitives/prim_internal.h index 23f07cca9..3e5bbf62d 100644 --- a/libfreerdp/primitives/prim_internal.h +++ b/libfreerdp/primitives/prim_internal.h @@ -229,37 +229,37 @@ static INLINE BYTE CONDITIONAL_CLIP(INT32 in, BYTE original) */ static INLINE INT32 C(INT32 Y) { - return (Y)-0L; + return (Y)-0; } static INLINE INT32 D(INT32 U) { - return (U)-128L; + return (U)-128; } static INLINE INT32 E(INT32 V) { - return (V)-128L; + return (V)-128; } static INLINE BYTE YUV2R(INT32 Y, INT32 U, INT32 V) { - const INT32 r = (256L * C(Y) + 0L * D(U) + 403L * E(V)); - const INT32 r8 = r >> 8L; + const INT32 r = (256 * C(Y) + 0 * D(U) + 403 * E(V)); + const INT32 r8 = r >> 8; return CLIP(r8); } static INLINE BYTE YUV2G(INT32 Y, INT32 U, INT32 V) { - const INT32 g = (256L * C(Y) - 48L * D(U) - 120L * E(V)); - const INT32 g8 = g >> 8L; + const INT32 g = (256 * C(Y) - 48 * D(U) - 120 * E(V)); + const INT32 g8 = g >> 8; return CLIP(g8); } static INLINE BYTE YUV2B(INT32 Y, INT32 U, INT32 V) { - const INT32 b = (256L * C(Y) + 475L * D(U) + 0L * E(V)); - const INT32 b8 = b >> 8L; + const INT32 b = (256 * C(Y) + 475 * D(U) + 0 * E(V)); + const INT32 b8 = b >> 8; return CLIP(b8); } diff --git a/winpr/include/winpr/bitstream.h b/winpr/include/winpr/bitstream.h index b8e8d1fb9..283794c92 100644 --- a/winpr/include/winpr/bitstream.h +++ b/winpr/include/winpr/bitstream.h @@ -55,13 +55,13 @@ extern "C" (_bs->prefetch) = 0; const intptr_t diff = _bs->pointer - _bs->buffer; - if ((diff + 4) < _bs->capacity) + if ((diff + 4) < (intptr_t)_bs->capacity) (_bs->prefetch) |= ((UINT32)_bs->pointer[4] << 24); - if ((diff + 5) < _bs->capacity) + if ((diff + 5) < (intptr_t)_bs->capacity) (_bs->prefetch) |= ((UINT32)_bs->pointer[5] << 16); - if ((diff + 6) < _bs->capacity) + if ((diff + 6) < (intptr_t)_bs->capacity) (_bs->prefetch) |= ((UINT32)_bs->pointer[6] << 8); - if ((diff + 7) < _bs->capacity) + if ((diff + 7) < (intptr_t)_bs->capacity) (_bs->prefetch) |= ((UINT32)_bs->pointer[7] << 0); } @@ -71,13 +71,13 @@ extern "C" (_bs->accumulator) = 0; const intptr_t diff = _bs->pointer - _bs->buffer; - if ((diff + 0) < _bs->capacity) + if ((diff + 0) < (intptr_t)_bs->capacity) (_bs->accumulator) |= ((UINT32)_bs->pointer[0] << 24); - if ((diff + 1) < _bs->capacity) + if ((diff + 1) < (intptr_t)_bs->capacity) (_bs->accumulator) |= ((UINT32)_bs->pointer[1] << 16); - if ((diff + 2) < _bs->capacity) + if ((diff + 2) < (intptr_t)_bs->capacity) (_bs->accumulator) |= ((UINT32)_bs->pointer[2] << 8); - if ((diff + 3) < _bs->capacity) + if ((diff + 3) < (intptr_t)_bs->capacity) (_bs->accumulator) |= ((UINT32)_bs->pointer[3] << 0); BitStream_Prefetch(_bs); } @@ -86,14 +86,14 @@ extern "C" { WINPR_ASSERT(_bs); const intptr_t diff = _bs->pointer - _bs->buffer; - if ((diff + 0) < _bs->capacity) - _bs->pointer[0] = (BYTE)((UINT32)_bs->accumulator >> 24); - if ((diff + 1) < _bs->capacity) - _bs->pointer[1] = (BYTE)((UINT32)_bs->accumulator >> 16); - if ((diff + 2) < _bs->capacity) - _bs->pointer[2] = (BYTE)((UINT32)_bs->accumulator >> 8); - if ((diff + 3) < _bs->capacity) - _bs->pointer[3] = (BYTE)((UINT32)_bs->accumulator >> 0); + if ((diff + 0) < (intptr_t)_bs->capacity) + _bs->pointer[0] = ((UINT32)_bs->accumulator >> 24) & 0xFF; + if ((diff + 1) < (intptr_t)_bs->capacity) + _bs->pointer[1] = ((UINT32)_bs->accumulator >> 16) & 0xFF; + if ((diff + 2) < (intptr_t)_bs->capacity) + _bs->pointer[2] = ((UINT32)_bs->accumulator >> 8) & 0xFF; + if ((diff + 3) < (intptr_t)_bs->capacity) + _bs->pointer[3] = ((UINT32)_bs->accumulator >> 0) & 0xFF; } static INLINE void BitStream_Shift(wBitStream* _bs, UINT32 _nbits) diff --git a/winpr/libwinpr/timezone/timezone.c b/winpr/libwinpr/timezone/timezone.c index 0123a76be..aec5fd0b3 100644 --- a/winpr/libwinpr/timezone/timezone.c +++ b/winpr/libwinpr/timezone/timezone.c @@ -842,7 +842,7 @@ BOOL TzSpecificLocalTimeToSystemTimeEx(const DYNAMIC_TIME_ZONE_INFORMATION* lpTi #if !defined(_WIN32) -DWORD EnumDynamicTimeZoneInformation(const DWORD dwIndex, +DWORD EnumDynamicTimeZoneInformation(DWORD dwIndex, PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation) { if (!lpTimeZoneInformation) @@ -892,7 +892,7 @@ DWORD GetDynamicTimeZoneInformationEffectiveYears( } #elif _WIN32_WINNT < 0x0602 /* Windows 8 */ -DWORD EnumDynamicTimeZoneInformation(const DWORD dwIndex, +DWORD EnumDynamicTimeZoneInformation(DWORD dwIndex, PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation) { WINPR_UNUSED(dwIndex); @@ -901,7 +901,7 @@ DWORD EnumDynamicTimeZoneInformation(const DWORD dwIndex, } DWORD GetDynamicTimeZoneInformationEffectiveYears( - const PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation, LPDWORD FirstYear, LPDWORD LastYear) + const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation, LPDWORD FirstYear, LPDWORD LastYear) { WINPR_UNUSED(lpTimeZoneInformation); WINPR_UNUSED(FirstYear); diff --git a/winpr/libwinpr/utils/windows/debug.c b/winpr/libwinpr/utils/windows/debug.c index 79cccded4..2c3e27ca1 100644 --- a/winpr/libwinpr/utils/windows/debug.c +++ b/winpr/libwinpr/utils/windows/debug.c @@ -147,8 +147,8 @@ char* winpr_win_strerror(DWORD dw, char* dmsg, size_t size) if (rc > 0) { #if defined(UNICODE) - (void)WideCharToMultiByte(CP_ACP, 0, msg, (int)rc, dmsg, (int)MIN(size - 1, INT_MAX), NULL, - NULL); + (void)WideCharToMultiByte(CP_ACP, 0, msg, (int)rc, dmsg, (int)(MIN(size - 1, INT_MAX)), + NULL, NULL); #else /* defined(UNICODE) */ memcpy(dmsg, msg, MIN(rc, size - 1)); #endif /* defined(UNICODE) */