Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed some Visual Studio analyze warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jun 15, 2013
1 parent 0540e84 commit 78fc906
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
20 changes: 10 additions & 10 deletions src/audio/winmm/SDL_winmm.c
Expand Up @@ -162,16 +162,6 @@ WINMM_CloseDevice(_THIS)
this->hidden->audio_sem = 0;
}

if (this->hidden->hin) {
waveInClose(this->hidden->hin);
this->hidden->hin = 0;
}

if (this->hidden->hout) {
waveOutClose(this->hidden->hout);
this->hidden->hout = 0;
}

/* Clean up mixing buffers */
for (i = 0; i < NUM_BUFFERS; ++i) {
if (this->hidden->wavebuf[i].dwUser != 0xFFFF) {
Expand All @@ -188,6 +178,16 @@ WINMM_CloseDevice(_THIS)
this->hidden->mixbuf = NULL;
}

if (this->hidden->hin) {
waveInClose(this->hidden->hin);
this->hidden->hin = 0;
}

if (this->hidden->hout) {
waveOutClose(this->hidden->hout);
this->hidden->hout = 0;
}

SDL_free(this->hidden);
this->hidden = NULL;
}
Expand Down
6 changes: 5 additions & 1 deletion src/render/SDL_yuv_sw.c
Expand Up @@ -1202,7 +1202,11 @@ SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
break;
}

*pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2;
if (rect) {
*pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2;
} else {
*pixels = swdata->planes[0];
}
*pitch = swdata->pitches[0];
return 0;
}
Expand Down
16 changes: 9 additions & 7 deletions src/video/windows/SDL_windowsclipboard.c
Expand Up @@ -77,15 +77,17 @@ WIN_SetClipboardText(_THIS, const char *text)
hMem = GlobalAlloc(GMEM_MOVEABLE, size);
if (hMem) {
LPTSTR dst = (LPTSTR)GlobalLock(hMem);
/* Copy the text over, adding carriage returns as necessary */
for (i = 0; tstr[i]; ++i) {
if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
*dst++ = '\r';
if (dst) {
/* Copy the text over, adding carriage returns as necessary */
for (i = 0; tstr[i]; ++i) {
if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
*dst++ = '\r';
}
*dst++ = tstr[i];
}
*dst++ = tstr[i];
*dst = 0;
GlobalUnlock(hMem);
}
*dst = 0;
GlobalUnlock(hMem);

EmptyClipboard();
if (!SetClipboardData(TEXT_FORMAT, hMem)) {
Expand Down

0 comments on commit 78fc906

Please sign in to comment.