mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[freerdp] fix argument consistency, casts
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user