Commit 5b14a943a815303357148a2b9f0fcf9493d2277d

Sam Lantinga 2016-10-22T11:01:55

Fixed bug 3466 - Can't build 2.0.5 on ppc64 /home/fedora/SDL2-2.0.5/src/video/SDL_blit_N.c: In function 'calc_swizzle32': /home/fedora/SDL2-2.0.5/src/video/SDL_blit_N.c:127:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00, ^

diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c
index 94894a7..351ab6c 100644
--- a/src/video/SDL_blit_N.c
+++ b/src/video/SDL_blit_N.c
@@ -118,12 +118,6 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt)
         16, 8, 0, 24,
         0, NULL
     };
-    if (!srcfmt) {
-        srcfmt = &default_pixel_format;
-    }
-    if (!dstfmt) {
-        dstfmt = &default_pixel_format;
-    }
     const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00,
                                                        0x04, 0x04, 0x04, 0x04,
                                                        0x08, 0x08, 0x08, 0x08,
@@ -136,6 +130,14 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt)
     Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift);
     Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
     Uint32 amask;
+
+    if (!srcfmt) {
+        srcfmt = &default_pixel_format;
+    }
+    if (!dstfmt) {
+        dstfmt = &default_pixel_format;
+    }
+
     /* Use zero for alpha if either surface doesn't have alpha */
     if (dstfmt->Amask) {
         amask =