d3dx9_36: Push down the scope of two variables. (RESEND)

Gerald Pfeifer gerald at pfeifer.com
Sun Jul 3 10:23:54 CDT 2011


I noticed this patch from February was not applied nor did I see 
any feedback on wine-devel at .

Perhaps it got lost admist the active work on d3dx9_36 in that period?

This does not fix a bug or add a feature, but it makes the coder easier
to follow.  Narrower scope tends to be a good thing for variables, both
for human readers and compilers (though modern ones should not need the
hint).

Gerald

---
 dlls/d3dx9_36/surface.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index 82e3612..4af91c1 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -677,7 +677,7 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize,
                              D3DCOLOR colorkey)
 {
     struct argb_conversion_info conv_info, ck_conv_info;
-    DWORD channels[4], pixel;
+    DWORD channels[4];
     UINT minwidth, minheight;
     UINT x, y;
 
@@ -701,6 +701,8 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize,
         DWORD val = 0;
 
         for(x = 0;x < minwidth;x++) {
+            DWORD pixel;
+
             /* extract source color components */
             pixel = dword_from_bytes(srcptr, srcformat->bytes_per_pixel);
             get_relevant_argb_components(&conv_info, pixel, channels);
@@ -743,7 +745,7 @@ static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsi
                                      D3DCOLOR colorkey)
 {
     struct argb_conversion_info conv_info, ck_conv_info;
-    DWORD channels[4], pixel;
+    DWORD channels[4];
 
     UINT x, y;
 
@@ -764,7 +766,7 @@ static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsi
 
         for(x = 0;x < destsize.x;x++) {
             const BYTE *srcptr = bufptr + (x * srcsize.x / destsize.x) * srcformat->bytes_per_pixel;
-            DWORD val = 0;
+            DWORD val = 0, pixel;
 
             /* extract source color components */
             pixel = dword_from_bytes(srcptr, srcformat->bytes_per_pixel);



More information about the wine-patches mailing list