[PATCH 2/5] wined3d: Make some lookup tables const.

Henri Verbeet hverbeet at codeweavers.com
Sun Aug 22 16:35:38 CDT 2010


---
 dlls/wined3d/context.c   |    7 +++++--
 dlls/wined3d/swapchain.c |    2 +-
 dlls/wined3d/utils.c     |    5 +++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index f80ab4f..a893348 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1114,11 +1114,14 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
     short redBits, greenBits, blueBits, alphaBits, colorBits;
     short depthBits=0, stencilBits=0;
 
-    struct match_type {
+    static const struct
+    {
         BOOL require_aux;
         BOOL exact_alpha;
         BOOL exact_color;
-    } matches[] = {
+    }
+    matches[] =
+    {
         /* First, try without alpha match buffers. MacOS supports aux buffers only
          * on A8R8G8B8, and we prefer better offscreen rendering over an alpha match.
          * Then try without aux buffers - this is the most common cause for not
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index c376cbf..5b8a659 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -771,7 +771,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
 
     if (surface_type == SURFACE_OPENGL)
     {
-        WINED3DFORMAT formats[] =
+        static const WINED3DFORMAT formats[] =
         {
             WINED3DFMT_D24_UNORM_S8_UINT,
             WINED3DFMT_D32_UNORM,
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 086350f..e3a0cb6 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -1192,8 +1192,8 @@ static BOOL color_match(DWORD c1, DWORD c2, BYTE max_diff)
 /* A context is provided by the caller */
 static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal)
 {
+    static const DWORD data[] = {0x00000000, 0xffffffff};
     GLuint tex, fbo, buffer;
-    const DWORD data[] = {0x00000000, 0xffffffff};
     DWORD readback[16 * 1];
     BOOL ret = FALSE;
 
@@ -1291,7 +1291,8 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3
 {
     struct wined3d_format_desc *desc;
     unsigned int fmt_idx, i;
-    WINED3DFORMAT fmts16[] = {
+    static const WINED3DFORMAT fmts16[] =
+    {
         WINED3DFMT_R16_FLOAT,
         WINED3DFMT_R16G16_FLOAT,
         WINED3DFMT_R16G16B16A16_FLOAT,
-- 
1.7.1




More information about the wine-patches mailing list