# SDL: Fixed warning C4701: potentially uninitialized local variable 'srcpixel' used

**URL:** <https://discourse.libsdl.org/t/sdl-fixed-warning-c4701-potentially-uninitialized-local-variable-srcpixel-used/48951>\
**Category:** SDL Commits\
**Created:** [February 2, 2024, 5:26am UTC](https://discourse.libsdl.org/t/sdl-fixed-warning-c4701-potentially-uninitialized-local-variable-srcpixel-used/48951 "2024-02-02T05:26:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [February 2, 2024, 5:26am UTC](https://discourse.libsdl.org/t/sdl-fixed-warning-c4701-potentially-uninitialized-local-variable-srcpixel-used/48951/1 "2024-02-02T05:26:02Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/f6f9468d8408604aaf6299668d1a456402cf240b>

```diff
From f6f9468d8408604aaf6299668d1a456402cf240b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 1 Feb 2024 21:24:11 -0800
Subject: [PATCH] Fixed warning C4701: potentially uninitialized local variable
 'srcpixel' used

---
 src/video/SDL_blit_slow.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c
index c863bcd74e7f..943ea84ac1ac 100644
--- a/src/video/SDL_blit_slow.c
+++ b/src/video/SDL_blit_slow.c
@@ -55,10 +55,10 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
     const Uint32 modulateG = info->g;
     const Uint32 modulateB = info->b;
     const Uint32 modulateA = info->a;
- Uint32 srcpixel;
- Uint32 srcR, srcG, srcB, srcA;
- Uint32 dstpixel;
- Uint32 dstR, dstG, dstB, dstA;
+ Uint32 srcpixel = 0;
+ Uint32 srcR = 0, srcG = 0, srcB = 0, srcA = 0;
+ Uint32 dstpixel = 0;
+ Uint32 dstR = 0, dstG = 0, dstB = 0, dstA = 0;
     Uint64 srcy, srcx;
     Uint64 posy, posx;
     Uint64 incy, incx;
@@ -114,13 +114,11 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
                     RGBA_FROM_ABGR2101010(srcpixel, srcR, srcG, srcB, srcA);
                     break;
                 default:
- srcR = srcG = srcB = srcA = 0;
                     break;
                 }
                 break;
             case SlowBlitPixelAccess_Large:
                 /* Handled in SDL_Blit_Slow_Float() */
- srcpixel = srcR = srcG = srcB = srcA = 0;
                 break;
             }
 
@@ -163,18 +161,15 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
                         RGBA_FROM_ABGR2101010(dstpixel, dstR, dstG, dstB, dstA);
                         break;
                     default:
- dstR = dstG = dstB = dstA = 0;
                         break;
                     }
                     break;
                 case SlowBlitPixelAccess_Large:
                     /* Handled in SDL_Blit_Slow_Float() */
- dstR = dstG = dstB = dstA = 0;
                     break;
                 }
             } else {
                 /* don't care */
- dstR = dstG = dstB = dstA = 0;
             }
 
             if (flags & SDL_COPY_MODULATE_COLOR) {

```
