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;
}
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) {
@ -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;
}

View file

@ -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;
}

View file

@ -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)) {