Fixed some Visual Studio analyze warnings

This commit is contained in:
Sam Lantinga 2013-06-15 02:46:32 -07:00
parent 6971a5dd1c
commit de9566518f
3 changed files with 24 additions and 18 deletions

View file

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

View file

@ -1202,7 +1202,11 @@ SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect,
break; break;
} }
if (rect) {
*pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2; *pixels = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2;
} else {
*pixels = swdata->planes[0];
}
*pitch = swdata->pitches[0]; *pitch = swdata->pitches[0];
return 0; return 0;
} }

View file

@ -77,6 +77,7 @@ WIN_SetClipboardText(_THIS, const char *text)
hMem = GlobalAlloc(GMEM_MOVEABLE, size); hMem = GlobalAlloc(GMEM_MOVEABLE, size);
if (hMem) { if (hMem) {
LPTSTR dst = (LPTSTR)GlobalLock(hMem); LPTSTR dst = (LPTSTR)GlobalLock(hMem);
if (dst) {
/* Copy the text over, adding carriage returns as necessary */ /* Copy the text over, adding carriage returns as necessary */
for (i = 0; tstr[i]; ++i) { for (i = 0; tstr[i]; ++i) {
if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) { if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) {
@ -86,6 +87,7 @@ WIN_SetClipboardText(_THIS, const char *text)
} }
*dst = 0; *dst = 0;
GlobalUnlock(hMem); GlobalUnlock(hMem);
}
EmptyClipboard(); EmptyClipboard();
if (!SetClipboardData(TEXT_FORMAT, hMem)) { if (!SetClipboardData(TEXT_FORMAT, hMem)) {