aboutsummaryrefslogtreecommitdiffstats
path: root/fake-w32-gdi.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-03-08 00:21:02 +0100
committerMattias Andrée <maandree@kth.se>2021-03-08 00:21:02 +0100
commitb058098fdcc5d4ed9b81fdb17f64820c0360ad48 (patch)
treee39e5f547b900922775d466507c29b352f046a53 /fake-w32-gdi.c
parentmisc (diff)
downloadlibgamma-b058098fdcc5d4ed9b81fdb17f64820c0360ad48.tar.gz
libgamma-b058098fdcc5d4ed9b81fdb17f64820c0360ad48.tar.bz2
libgamma-b058098fdcc5d4ed9b81fdb17f64820c0360ad48.tar.xz
m + style fix + check memory allocation overflows
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'fake-w32-gdi.c')
-rw-r--r--fake-w32-gdi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fake-w32-gdi.c b/fake-w32-gdi.c
index e5978a2..5e425f7 100644
--- a/fake-w32-gdi.c
+++ b/fake-w32-gdi.c
@@ -6,7 +6,8 @@
* It should by no means be used, without additional modification, as a
* part of a compatibility layer. The purpose of this file is only to make
* it possible to test for logical errors in Windows specific code on
- * a GNU/Linux system under X. */
+ * a Linux system under X.
+ */
@@ -291,11 +292,10 @@ SetDeviceGammaRamp(HDC hDC, LPVOID restrict lpRamp)
{
/* We assume that our gamma ramps are of the same size
* as used by Windows GDI (we are so sloppy) */
- xcb_void_cookie_t gamma_cookie =
- xcb_randr_set_crtc_gamma_checked(connection, *(xcb_randr_crtc_t *)hDC, GAMMA_RAMP_SIZE,
- &((uint16_t *)lpRamp)[0 * GAMMA_RAMP_SIZE],
- &((uint16_t *)lpRamp)[1 * GAMMA_RAMP_SIZE],
- &((uint16_t *)lpRamp)[2 * GAMMA_RAMP_SIZE]);
+ uint16_t *ramp = lpRamp;
+ xcb_void_cookie_t gamma_cookie = xcb_randr_set_crtc_gamma_checked(connection, *(xcb_randr_crtc_t *)hDC, GAMMA_RAMP_SIZE,
+ &ramp[0 * GAMMA_RAMP_SIZE], &ramp[1 * GAMMA_RAMP_SIZE],
+ &ramp[2 * GAMMA_RAMP_SIZE]);
xcb_generic_error_t *error = xcb_request_check(connection, gamma_cookie);
return !error ? TRUE : FALSE;
}
@@ -386,8 +386,8 @@ CreateDC(LPCTSTR restrict lpszDriver, LPCTSTR restrict lpszDevice, LPCTSTR restr
/* Was the index too high */
if (crtc_index >= crtc_count) {
/* Disconnect and release resouces and mark that
- we do not know the number of available CRTC:s
- if we have not opened any monitors yet */
+ * we do not know the number of available CRTC:s
+ * if we have not opened any monitors yet */
if (!dc_count) {
xcb_disconnect(connection);
free(res_reply);