Michael Stefaniuc : gdi32: Avoid a variable holding an ARRAY_SIZE.
Alexandre Julliard
julliard at winehq.org
Mon Oct 8 15:44:06 CDT 2018
Module: wine
Branch: master
Commit: 02b7f00a11efe365a946e2e8c815e31c36139b17
URL: https://source.winehq.org/git/wine.git/?a=commit;h=02b7f00a11efe365a946e2e8c815e31c36139b17
Author: Michael Stefaniuc <mstefani at winehq.org>
Date: Fri Oct 5 21:35:34 2018 +0200
gdi32: Avoid a variable holding an ARRAY_SIZE.
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/dibdrv/opengl.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/dibdrv/opengl.c b/dlls/gdi32/dibdrv/opengl.c
index dba5db0..7c6043c 100644
--- a/dlls/gdi32/dibdrv/opengl.c
+++ b/dlls/gdi32/dibdrv/opengl.c
@@ -94,7 +94,6 @@ static const struct
{ OSMESA_RGB_565, 16, 5, 0, 6, 5, 5, 11, 0, 0, 16, 32, 8 },
{ OSMESA_RGB_565, 16, 5, 0, 6, 5, 5, 11, 0, 0, 16, 16, 8 },
};
-static const int nb_formats = sizeof(pixel_formats) / sizeof(pixel_formats[0]);
static BOOL init_opengl(void)
{
@@ -148,7 +147,7 @@ failed:
*/
static int dibdrv_wglDescribePixelFormat( HDC hdc, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr )
{
- int ret = sizeof(pixel_formats) / sizeof(pixel_formats[0]);
+ int ret = ARRAY_SIZE( pixel_formats );
if (!descr) return ret;
if (fmt <= 0 || fmt > ret) return 0;
@@ -198,7 +197,7 @@ static struct wgl_context *dibdrv_wglCreateContext( HDC hdc )
if (!(context = HeapAlloc( GetProcessHeap(), 0, sizeof( *context )))) return NULL;
context->format = GetPixelFormat( hdc );
- if (!context->format || context->format > nb_formats) context->format = 1;
+ if (!context->format || context->format > ARRAY_SIZE( pixel_formats )) context->format = 1;
if (!(context->context = pOSMesaCreateContextExt( pixel_formats[context->format - 1].mesa,
pixel_formats[context->format - 1].depth_bits,
@@ -306,7 +305,7 @@ static BOOL dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context )
*/
static BOOL dibdrv_wglSetPixelFormat( HDC hdc, int fmt, const PIXELFORMATDESCRIPTOR *descr )
{
- if (fmt <= 0 || fmt > nb_formats) return FALSE;
+ if (fmt <= 0 || fmt > ARRAY_SIZE( pixel_formats )) return FALSE;
return GdiSetPixelFormat( hdc, fmt, descr );
}
More information about the wine-cvs
mailing list