Fixed some Visual Studio analyze warnings
authorSam Lantinga <slouken@libsdl.org>
Sat, 15 Jun 2013 02:46:32 -0700
changeset 7332b53acf6ab70b
parent 7308 728e5f22a82f
child 7333 b74f920d964e
Fixed some Visual Studio analyze warnings
src/audio/winmm/SDL_winmm.c
src/render/SDL_yuv_sw.c
src/video/windows/SDL_windowsclipboard.c
     1.1 --- a/src/audio/winmm/SDL_winmm.c	Thu Jun 13 22:30:02 2013 -0700
     1.2 +++ b/src/audio/winmm/SDL_winmm.c	Sat Jun 15 02:46:32 2013 -0700
     1.3 @@ -162,16 +162,6 @@
     1.4              this->hidden->audio_sem = 0;
     1.5          }
     1.6  
     1.7 -        if (this->hidden->hin) {
     1.8 -            waveInClose(this->hidden->hin);
     1.9 -            this->hidden->hin = 0;
    1.10 -        }
    1.11 -
    1.12 -        if (this->hidden->hout) {
    1.13 -            waveOutClose(this->hidden->hout);
    1.14 -            this->hidden->hout = 0;
    1.15 -        }
    1.16 -
    1.17          /* Clean up mixing buffers */
    1.18          for (i = 0; i < NUM_BUFFERS; ++i) {
    1.19              if (this->hidden->wavebuf[i].dwUser != 0xFFFF) {
    1.20 @@ -188,6 +178,16 @@
    1.21              this->hidden->mixbuf = NULL;
    1.22          }
    1.23  
    1.24 +        if (this->hidden->hin) {
    1.25 +            waveInClose(this->hidden->hin);
    1.26 +            this->hidden->hin = 0;
    1.27 +        }
    1.28 +
    1.29 +        if (this->hidden->hout) {
    1.30 +            waveOutClose(this->hidden->hout);
    1.31 +            this->hidden->hout = 0;
    1.32 +        }
    1.33 +
    1.34          SDL_free(this->hidden);
    1.35          this->hidden = NULL;
    1.36      }
     2.1 --- a/src/render/SDL_yuv_sw.c	Thu Jun 13 22:30:02 2013 -0700
     2.2 +++ b/src/render/SDL_yuv_sw.c	Sat Jun 15 02:46:32 2013 -0700
     2.3 @@ -1202,7 +1202,11 @@
     2.4          break;
     2.5      }
     2.6  
     2.7 -    *pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2;
     2.8 +    if (rect) {
     2.9 +        *pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2;
    2.10 +    } else {
    2.11 +        *pixels = swdata->planes[0];
    2.12 +    }
    2.13      *pitch = swdata->pitches[0];
    2.14      return 0;
    2.15  }
     3.1 --- a/src/video/windows/SDL_windowsclipboard.c	Thu Jun 13 22:30:02 2013 -0700
     3.2 +++ b/src/video/windows/SDL_windowsclipboard.c	Sat Jun 15 02:46:32 2013 -0700
     3.3 @@ -77,15 +77,17 @@
     3.4          hMem = GlobalAlloc(GMEM_MOVEABLE, size);
     3.5          if (hMem) {
     3.6              LPTSTR dst = (LPTSTR)GlobalLock(hMem);
     3.7 -            /* Copy the text over, adding carriage returns as necessary */
     3.8 -            for (i = 0; tstr[i]; ++i) {
     3.9 -                if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
    3.10 -                    *dst++ = '\r';
    3.11 +            if (dst) {
    3.12 +                /* Copy the text over, adding carriage returns as necessary */
    3.13 +                for (i = 0; tstr[i]; ++i) {
    3.14 +                    if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
    3.15 +                        *dst++ = '\r';
    3.16 +                    }
    3.17 +                    *dst++ = tstr[i];
    3.18                  }
    3.19 -                *dst++ = tstr[i];
    3.20 +                *dst = 0;
    3.21 +                GlobalUnlock(hMem);
    3.22              }
    3.23 -            *dst = 0;
    3.24 -            GlobalUnlock(hMem);
    3.25  
    3.26              EmptyClipboard();
    3.27              if (!SetClipboardData(TEXT_FORMAT, hMem)) {