Tossed in some SDL_asserts to make static analyzer happier.

(Most of its complaints here are that these ints can be negative, although
they wouldn't been in sane cases. Checking sanity is what assertions do, and
it placates the analyzer appropriately.)
main
Ryan C. Gordon 2014-03-23 18:56:47 -04:00
parent 46a80b04d8
commit 6ab50a5e2e
1 changed files with 5 additions and 0 deletions

View File

@ -134,6 +134,8 @@ static const char rcsid[] =
#include "math_libm.h" #include "math_libm.h"
#include "math_private.h" #include "math_private.h"
#include "SDL_assert.h"
libm_hidden_proto(scalbn) libm_hidden_proto(scalbn)
libm_hidden_proto(floor) libm_hidden_proto(floor)
#ifdef __STDC__ #ifdef __STDC__
@ -181,10 +183,13 @@ __kernel_rem_pio2(x, y, e0, nx, prec, ipio2)
double z, fw, f[20], fq[20], q[20]; double z, fw, f[20], fq[20], q[20];
/* initialize jk */ /* initialize jk */
SDL_assert((prec >= 0) && (prec < SDL_arraysize(init_jk)));
jk = init_jk[prec]; jk = init_jk[prec];
SDL_assert((jk >= 2) && (jk <= 6));
jp = jk; jp = jk;
/* determine jx,jv,q0, note that 3>q0 */ /* determine jx,jv,q0, note that 3>q0 */
SDL_assert(nx > 0);
jx = nx - 1; jx = nx - 1;
jv = (e0 - 3) / 24; jv = (e0 - 3) / 24;
if (jv < 0) if (jv < 0)