Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this... if (Failed) { SDL_SetError("We failed"); return -1; } ...into this... if (Failed) { return SDL_SetError("We failed"); } Fixes Bugzilla #1778.
This commit is contained in:
parent
8c6b9f4743
commit
4f438b70a2
106 changed files with 616 additions and 1189 deletions
|
@ -970,28 +970,23 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
|
|||
|
||||
/* Sanity check target pointer */
|
||||
if (cvt == NULL) {
|
||||
SDL_InvalidParamError("cvt");
|
||||
return -1;
|
||||
return SDL_InvalidParamError("cvt");
|
||||
}
|
||||
|
||||
/* there are no unsigned types over 16 bits, so catch this up front. */
|
||||
if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) {
|
||||
SDL_SetError("Invalid source format");
|
||||
return -1;
|
||||
return SDL_SetError("Invalid source format");
|
||||
}
|
||||
if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) {
|
||||
SDL_SetError("Invalid destination format");
|
||||
return -1;
|
||||
return SDL_SetError("Invalid destination format");
|
||||
}
|
||||
|
||||
/* prevent possible divisions by zero, etc. */
|
||||
if ((src_channels == 0) || (dst_channels == 0)) {
|
||||
SDL_SetError("Source or destination channels is zero");
|
||||
return -1;
|
||||
return SDL_SetError("Source or destination channels is zero");
|
||||
}
|
||||
if ((src_rate == 0) || (dst_rate == 0)) {
|
||||
SDL_SetError("Source or destination rate is zero");
|
||||
return -1;
|
||||
return SDL_SetError("Source or destination rate is zero");
|
||||
}
|
||||
#ifdef DEBUG_CONVERT
|
||||
printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue