From c48a3bd349ebead5f7e3a8aa1f30d6dfddfe697c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 3 Nov 2023 13:40:19 +0100 Subject: [PATCH] opengl32: Make the GL driver function table const. --- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_private.h | 4 ++-- dlls/opengl32/unix_wgl.c | 14 +++++++------- dlls/win32u/dc.c | 2 +- include/wine/wgl_driver.h | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index b1161632f81..6ea8c2b016e 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -920,7 +920,7 @@ foreach (sort keys %norm_functions) } print HEADER "\n\n"; -print HEADER "extern struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version );\n\n"; +print HEADER "extern const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version );\n\n"; print HEADER "#endif /* __WINE_WGL_DRIVER_H */\n"; close HEADER; diff --git a/dlls/opengl32/unix_private.h b/dlls/opengl32/unix_private.h index f2a9477f990..693c916ddaa 100644 --- a/dlls/opengl32/unix_private.h +++ b/dlls/opengl32/unix_private.h @@ -43,9 +43,9 @@ extern const int extension_registry_size DECLSPEC_HIDDEN; extern struct opengl_funcs null_opengl_funcs DECLSPEC_HIDDEN; -static inline struct opengl_funcs *get_dc_funcs( HDC hdc ) +static inline const struct opengl_funcs *get_dc_funcs( HDC hdc ) { - struct opengl_funcs *funcs = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION ); + const struct opengl_funcs *funcs = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION ); if (!funcs) RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); else if (funcs == (void *)-1) funcs = &null_opengl_funcs; return funcs; diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 4cf12893541..f97e3147c15 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -77,7 +77,7 @@ struct opengl_context struct wgl_handle { UINT handle; - struct opengl_funcs *funcs; + const struct opengl_funcs *funcs; union { struct opengl_context *context; /* for HANDLE_CONTEXT */ @@ -117,7 +117,7 @@ static struct wgl_handle *get_handle_ptr( HANDLE handle, enum wgl_handle_type ty return NULL; } -static HANDLE alloc_handle( enum wgl_handle_type type, struct opengl_funcs *funcs, void *user_ptr ) +static HANDLE alloc_handle( enum wgl_handle_type type, const struct opengl_funcs *funcs, void *user_ptr ) { HANDLE handle = 0; struct wgl_handle *ptr = NULL; @@ -647,7 +647,7 @@ static HGLRC wrap_wglCreateContext( HDC hdc ) HGLRC ret = 0; struct wgl_context *drv_ctx; struct opengl_context *context; - struct opengl_funcs *funcs = get_dc_funcs( hdc ); + const struct opengl_funcs *funcs = get_dc_funcs( hdc ); if (!funcs) return 0; if (!(drv_ctx = funcs->wgl.p_wglCreateContext( hdc ))) return 0; @@ -679,7 +679,7 @@ static BOOL wrap_wglMakeCurrent( TEB *teb, HDC hdc, HGLRC hglrc ) teb->glReserved1[0] = hdc; teb->glReserved1[1] = hdc; teb->glCurrentRC = hglrc; - teb->glTable = ptr->funcs; + teb->glTable = (void *)ptr->funcs; } } else @@ -751,7 +751,7 @@ static HGLRC wrap_wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *a struct wgl_context *drv_ctx; struct wgl_handle *share_ptr = NULL; struct opengl_context *context; - struct opengl_funcs *funcs = get_dc_funcs( hdc ); + const struct opengl_funcs *funcs = get_dc_funcs( hdc ); if (!funcs) { @@ -796,7 +796,7 @@ static HPBUFFERARB wrap_wglCreatePbufferARB( HDC hdc, int format, int width, int { HPBUFFERARB ret; struct wgl_pbuffer *pbuffer; - struct opengl_funcs *funcs = get_dc_funcs( hdc ); + const struct opengl_funcs *funcs = get_dc_funcs( hdc ); if (!funcs || !funcs->ext.p_wglCreatePbufferARB) return 0; if (!(pbuffer = funcs->ext.p_wglCreatePbufferARB( hdc, format, width, height, attribs ))) return 0; @@ -842,7 +842,7 @@ static BOOL wrap_wglMakeContextCurrentARB( TEB *teb, HDC draw_hdc, HDC read_hdc, teb->glReserved1[0] = draw_hdc; teb->glReserved1[1] = read_hdc; teb->glCurrentRC = hglrc; - teb->glTable = ptr->funcs; + teb->glTable = (void *)ptr->funcs; } } else diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index 0ff624068cb..2b8a56de5bd 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -1490,7 +1490,7 @@ BOOL WINAPI __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WC /*********************************************************************** * __wine_get_wgl_driver (win32u.@) */ -struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ) +const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ) { BOOL is_display, is_memdc; DC *dc; diff --git a/include/wine/wgl_driver.h b/include/wine/wgl_driver.h index ed11d8caa0e..daaddf9567d 100644 --- a/include/wine/wgl_driver.h +++ b/include/wine/wgl_driver.h @@ -3405,6 +3405,6 @@ struct opengl_funcs USE_GL_FUNC(glVertexPointer) \ USE_GL_FUNC(glViewport) -extern struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ); +extern const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ); #endif /* __WINE_WGL_DRIVER_H */ -- 2.11.4.GIT