mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-16 09:48:26 +00:00
Fixed Visual Studio warning 4389
This commit is contained in:
parent
d135daad5b
commit
0bd77a5b93
12 changed files with 19 additions and 18 deletions
|
@ -666,7 +666,7 @@ static int SDLCALL SDL_RunAudio(void *devicep)
|
||||||
|
|
||||||
/* Fill the current buffer with sound */
|
/* Fill the current buffer with sound */
|
||||||
if (!device->stream && SDL_AtomicGet(&device->enabled)) {
|
if (!device->stream && SDL_AtomicGet(&device->enabled)) {
|
||||||
SDL_assert(data_len == device->spec.size);
|
SDL_assert((Uint32)data_len == device->spec.size);
|
||||||
data = current_audio.impl.GetDeviceBuf(device);
|
data = current_audio.impl.GetDeviceBuf(device);
|
||||||
} else {
|
} else {
|
||||||
/* if the device isn't enabled, we still write to the
|
/* if the device isn't enabled, we still write to the
|
||||||
|
@ -700,13 +700,13 @@ static int SDLCALL SDL_RunAudio(void *devicep)
|
||||||
int got;
|
int got;
|
||||||
data = SDL_AtomicGet(&device->enabled) ? current_audio.impl.GetDeviceBuf(device) : NULL;
|
data = SDL_AtomicGet(&device->enabled) ? current_audio.impl.GetDeviceBuf(device) : NULL;
|
||||||
got = SDL_GetAudioStreamData(device->stream, data ? data : device->work_buffer, device->spec.size);
|
got = SDL_GetAudioStreamData(device->stream, data ? data : device->work_buffer, device->spec.size);
|
||||||
SDL_assert((got <= 0) || (got == device->spec.size));
|
SDL_assert((got <= 0) || ((Uint32)got == device->spec.size));
|
||||||
|
|
||||||
if (data == NULL) { /* device is having issues... */
|
if (data == NULL) { /* device is having issues... */
|
||||||
const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
|
const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq);
|
||||||
SDL_Delay(delay); /* wait for as long as this buffer would have played. Maybe device recovers later? */
|
SDL_Delay(delay); /* wait for as long as this buffer would have played. Maybe device recovers later? */
|
||||||
} else {
|
} else {
|
||||||
if (got != device->spec.size) {
|
if ((Uint32)got != device->spec.size) {
|
||||||
SDL_memset(data, device->spec.silence, device->spec.size);
|
SDL_memset(data, device->spec.silence, device->spec.size);
|
||||||
}
|
}
|
||||||
current_audio.impl.PlayDevice(device);
|
current_audio.impl.PlayDevice(device);
|
||||||
|
@ -814,8 +814,8 @@ static int SDLCALL SDL_CaptureAudio(void *devicep)
|
||||||
|
|
||||||
while (SDL_GetAudioStreamAvailable(device->stream) >= ((int)device->callbackspec.size)) {
|
while (SDL_GetAudioStreamAvailable(device->stream) >= ((int)device->callbackspec.size)) {
|
||||||
const int got = SDL_GetAudioStreamData(device->stream, device->work_buffer, device->callbackspec.size);
|
const int got = SDL_GetAudioStreamData(device->stream, device->work_buffer, device->callbackspec.size);
|
||||||
SDL_assert((got < 0) || (got == device->callbackspec.size));
|
SDL_assert((got < 0) || ((Uint32)got == device->callbackspec.size));
|
||||||
if (got != device->callbackspec.size) {
|
if ((Uint32)got != device->callbackspec.size) {
|
||||||
SDL_memset(device->work_buffer, device->spec.silence, device->callbackspec.size);
|
SDL_memset(device->work_buffer, device->spec.silence, device->callbackspec.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,7 @@ static int DSOUND_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||||
DWORD junk, cursor, ptr1len, ptr2len;
|
DWORD junk, cursor, ptr1len, ptr2len;
|
||||||
VOID *ptr1, *ptr2;
|
VOID *ptr1, *ptr2;
|
||||||
|
|
||||||
SDL_assert(buflen == this->spec.size);
|
SDL_assert((Uint32)buflen == this->spec.size);
|
||||||
|
|
||||||
while (SDL_TRUE) {
|
while (SDL_TRUE) {
|
||||||
if (SDL_AtomicGet(&this->shutdown)) { /* in case the buffer froze... */
|
if (SDL_AtomicGet(&this->shutdown)) { /* in case the buffer froze... */
|
||||||
|
|
|
@ -448,7 +448,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||||
this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in, if necessary. */
|
this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in, if necessary. */
|
||||||
#else
|
#else
|
||||||
/* favor WASAPI's resampler over our own */
|
/* favor WASAPI's resampler over our own */
|
||||||
if (this->spec.freq != waveformat->nSamplesPerSec) {
|
if ((DWORD)this->spec.freq != waveformat->nSamplesPerSec) {
|
||||||
streamflags |= (AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY);
|
streamflags |= (AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY);
|
||||||
waveformat->nSamplesPerSec = this->spec.freq;
|
waveformat->nSamplesPerSec = this->spec.freq;
|
||||||
waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8);
|
waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8);
|
||||||
|
|
|
@ -1472,14 +1472,15 @@ int SDL_AddGamepadMappingsFromRW(SDL_RWops *rw, int freerw)
|
||||||
const char *platform = SDL_GetPlatform();
|
const char *platform = SDL_GetPlatform();
|
||||||
int gamepads = 0;
|
int gamepads = 0;
|
||||||
char *buf, *line, *line_end, *tmp, *comma, line_platform[64];
|
char *buf, *line, *line_end, *tmp, *comma, line_platform[64];
|
||||||
size_t db_size, platform_len;
|
Sint64 db_size;
|
||||||
|
size_t platform_len;
|
||||||
|
|
||||||
if (rw == NULL) {
|
if (rw == NULL) {
|
||||||
return SDL_SetError("Invalid RWops");
|
return SDL_SetError("Invalid RWops");
|
||||||
}
|
}
|
||||||
db_size = (size_t)SDL_RWsize(rw);
|
db_size = SDL_RWsize(rw);
|
||||||
|
|
||||||
buf = (char *)SDL_malloc(db_size + 1);
|
buf = (char *)SDL_malloc((size_t)db_size + 1);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
if (freerw) {
|
if (freerw) {
|
||||||
SDL_RWclose(rw);
|
SDL_RWclose(rw);
|
||||||
|
|
|
@ -139,7 +139,7 @@ double attribute_hidden __ieee754_pow(double x, double y)
|
||||||
k = (iy>>20)-0x3ff; /* exponent */
|
k = (iy>>20)-0x3ff; /* exponent */
|
||||||
if(k>20) {
|
if(k>20) {
|
||||||
j = ly>>(52-k);
|
j = ly>>(52-k);
|
||||||
if((j<<(52-k))==ly) yisint = 2-(j&1);
|
if(((u_int32_t)j<<(52-k))==ly) yisint = 2-(j&1);
|
||||||
} else if(ly==0) {
|
} else if(ly==0) {
|
||||||
j = iy>>(20-k);
|
j = iy>>(20-k);
|
||||||
if((j<<(20-k))==iy) yisint = 2-(j&1);
|
if((j<<(20-k))==iy) yisint = 2-(j&1);
|
||||||
|
|
|
@ -149,7 +149,7 @@ double attribute_hidden __ieee754_sqrt(double x)
|
||||||
t = s0;
|
t = s0;
|
||||||
if((t<ix0)||((t==ix0)&&(t1<=ix1))) {
|
if((t<ix0)||((t==ix0)&&(t1<=ix1))) {
|
||||||
s1 = t1+r;
|
s1 = t1+r;
|
||||||
if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1;
|
if(((t1&sign)==(u_int32_t)sign)&&(s1&sign)==0) s0 += 1;
|
||||||
ix0 -= t;
|
ix0 -= t;
|
||||||
if (ix1 < t1) ix0 -= 1;
|
if (ix1 < t1) ix0 -= 1;
|
||||||
ix1 -= t1;
|
ix1 -= t1;
|
||||||
|
|
|
@ -1290,7 +1290,7 @@ static int D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Tex
|
||||||
src = (const Uint8 *)pixels;
|
src = (const Uint8 *)pixels;
|
||||||
dst = textureMemory.pData;
|
dst = textureMemory.pData;
|
||||||
length = w * bpp;
|
length = w * bpp;
|
||||||
if (length == pitch && length == textureMemory.RowPitch) {
|
if (length == (UINT)pitch && length == textureMemory.RowPitch) {
|
||||||
SDL_memcpy(dst, src, (size_t)length * h);
|
SDL_memcpy(dst, src, (size_t)length * h);
|
||||||
} else {
|
} else {
|
||||||
if (length > (UINT)pitch) {
|
if (length > (UINT)pitch) {
|
||||||
|
|
|
@ -1579,7 +1579,7 @@ static int GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoff
|
||||||
/* Reformat the texture data into a tightly packed array */
|
/* Reformat the texture data into a tightly packed array */
|
||||||
src_pitch = (size_t)width * bpp;
|
src_pitch = (size_t)width * bpp;
|
||||||
src = (Uint8 *)pixels;
|
src = (Uint8 *)pixels;
|
||||||
if (pitch != src_pitch) {
|
if ((size_t)pitch != src_pitch) {
|
||||||
blob = (Uint8 *)SDL_malloc(src_pitch * height);
|
blob = (Uint8 *)SDL_malloc(src_pitch * height);
|
||||||
if (blob == NULL) {
|
if (blob == NULL) {
|
||||||
return SDL_OutOfMemory();
|
return SDL_OutOfMemory();
|
||||||
|
|
|
@ -576,7 +576,7 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_
|
||||||
c = (unsigned char)src[i];
|
c = (unsigned char)src[i];
|
||||||
trailing_bytes = UTF8_GetTrailingBytes(c);
|
trailing_bytes = UTF8_GetTrailingBytes(c);
|
||||||
if (trailing_bytes) {
|
if (trailing_bytes) {
|
||||||
if (bytes - i != trailing_bytes + 1) {
|
if ((bytes - i) != ((size_t)trailing_bytes + 1)) {
|
||||||
bytes = i;
|
bytes = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4698,7 +4698,7 @@ static SDL_bool SDL_IsMessageboxValidForDriver(const SDL_MessageBoxData *message
|
||||||
if (window == NULL || SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION) < 0) {
|
if (window == NULL || SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION) < 0) {
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
} else {
|
} else {
|
||||||
return info.subsystem == drivertype;
|
return info.subsystem == (Uint32)drivertype;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1673,7 +1673,7 @@ static void IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc)
|
||||||
bottom = size.cy - listborder - listpadding - candmargin;
|
bottom = size.cy - listborder - listpadding - candmargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == videodata->ime_candsel) {
|
if ((DWORD)i == videodata->ime_candsel) {
|
||||||
SelectObject(hdc, selpen);
|
SelectObject(hdc, selpen);
|
||||||
SelectObject(hdc, selbrush);
|
SelectObject(hdc, selbrush);
|
||||||
SetTextColor(hdc, seltextcolor);
|
SetTextColor(hdc, seltextcolor);
|
||||||
|
|
|
@ -491,7 +491,7 @@ void SDL_TARGETING("sse2") SSE_FUNCTION_NAME(uint32_t width, uint32_t height,
|
||||||
|
|
||||||
/* Catch the right column, if needed */
|
/* Catch the right column, if needed */
|
||||||
{
|
{
|
||||||
int converted = (width & ~31);
|
uint32_t converted = (width & ~31);
|
||||||
if (fix_read_nv12) {
|
if (fix_read_nv12) {
|
||||||
converted -= 32;
|
converted -= 32;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue