src/test/SDL_test_fuzzer.c
changeset 7191 75360622e65f
parent 7172 b3569dff1c6e
child 7678 286c42d7c5ed
     1.1 --- a/src/test/SDL_test_fuzzer.c	Sat May 18 12:48:50 2013 -0700
     1.2 +++ b/src/test/SDL_test_fuzzer.c	Sat May 18 14:17:52 2013 -0700
     1.3 @@ -19,10 +19,10 @@
     1.4    3. This notice may not be removed or altered from any source distribution.
     1.5  */
     1.6  
     1.7 -/* 
     1.8 +/*
     1.9  
    1.10    Data generators for fuzzing test data in a reproducible way.
    1.11 - 
    1.12 +
    1.13  */
    1.14  
    1.15  #include "SDL_config.h"
    1.16 @@ -43,7 +43,7 @@
    1.17  
    1.18  #include "SDL_test.h"
    1.19  
    1.20 -/** 
    1.21 +/**
    1.22   * Counter for fuzzer invocations
    1.23   */
    1.24  static int fuzzerInvocationCounter = 0;
    1.25 @@ -60,93 +60,93 @@
    1.26  void
    1.27  SDLTest_FuzzerInit(Uint64 execKey)
    1.28  {
    1.29 -	Uint32 a = (execKey >> 32) & 0x00000000FFFFFFFF;
    1.30 -	Uint32 b = execKey & 0x00000000FFFFFFFF;
    1.31 -	SDL_memset((void *)&rndContext, 0, sizeof(SDLTest_RandomContext));
    1.32 -	SDLTest_RandomInit(&rndContext, a, b);
    1.33 -	fuzzerInvocationCounter = 0;
    1.34 +    Uint32 a = (execKey >> 32) & 0x00000000FFFFFFFF;
    1.35 +    Uint32 b = execKey & 0x00000000FFFFFFFF;
    1.36 +    SDL_memset((void *)&rndContext, 0, sizeof(SDLTest_RandomContext));
    1.37 +    SDLTest_RandomInit(&rndContext, a, b);
    1.38 +    fuzzerInvocationCounter = 0;
    1.39  }
    1.40  
    1.41  int
    1.42  SDLTest_GetFuzzerInvocationCount()
    1.43  {
    1.44 -	return fuzzerInvocationCounter;
    1.45 +    return fuzzerInvocationCounter;
    1.46  }
    1.47  
    1.48  Uint8
    1.49  SDLTest_RandomUint8()
    1.50  {
    1.51 -	fuzzerInvocationCounter++;
    1.52 +    fuzzerInvocationCounter++;
    1.53  
    1.54 -	return (Uint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
    1.55 +    return (Uint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
    1.56  }
    1.57  
    1.58  Sint8
    1.59  SDLTest_RandomSint8()
    1.60  {
    1.61 -	fuzzerInvocationCounter++;
    1.62 +    fuzzerInvocationCounter++;
    1.63  
    1.64 -	return (Sint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
    1.65 +    return (Sint8) SDLTest_RandomInt(&rndContext) & 0x000000FF;
    1.66  }
    1.67  
    1.68  Uint16
    1.69  SDLTest_RandomUint16()
    1.70  {
    1.71 -	fuzzerInvocationCounter++;
    1.72 +    fuzzerInvocationCounter++;
    1.73  
    1.74 -	return (Uint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
    1.75 +    return (Uint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
    1.76  }
    1.77  
    1.78  Sint16
    1.79  SDLTest_RandomSint16()
    1.80  {
    1.81 -	fuzzerInvocationCounter++;
    1.82 +    fuzzerInvocationCounter++;
    1.83  
    1.84 -	return (Sint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
    1.85 +    return (Sint16) SDLTest_RandomInt(&rndContext) & 0x0000FFFF;
    1.86  }
    1.87  
    1.88  Sint32
    1.89  SDLTest_RandomSint32()
    1.90  {
    1.91 -	fuzzerInvocationCounter++;
    1.92 +    fuzzerInvocationCounter++;
    1.93  
    1.94 -	return (Sint32) SDLTest_RandomInt(&rndContext);
    1.95 +    return (Sint32) SDLTest_RandomInt(&rndContext);
    1.96  }
    1.97  
    1.98  Uint32
    1.99  SDLTest_RandomUint32()
   1.100  {
   1.101 -	fuzzerInvocationCounter++;
   1.102 +    fuzzerInvocationCounter++;
   1.103  
   1.104 -	return (Uint32) SDLTest_RandomInt(&rndContext);
   1.105 +    return (Uint32) SDLTest_RandomInt(&rndContext);
   1.106  }
   1.107  
   1.108  Uint64
   1.109  SDLTest_RandomUint64()
   1.110  {
   1.111 -	Uint64 value = 0;
   1.112 -	Uint32 *vp = (void *)&value;
   1.113 +    Uint64 value = 0;
   1.114 +    Uint32 *vp = (void *)&value;
   1.115  
   1.116 -	fuzzerInvocationCounter++;
   1.117 +    fuzzerInvocationCounter++;
   1.118  
   1.119 -	vp[0] = SDLTest_RandomSint32();
   1.120 -	vp[1] = SDLTest_RandomSint32();
   1.121 +    vp[0] = SDLTest_RandomSint32();
   1.122 +    vp[1] = SDLTest_RandomSint32();
   1.123  
   1.124 -	return value;
   1.125 +    return value;
   1.126  }
   1.127  
   1.128  Sint64
   1.129  SDLTest_RandomSint64()
   1.130  {
   1.131 -	Uint64 value = 0;
   1.132 -	Uint32 *vp = (void *)&value;
   1.133 +    Uint64 value = 0;
   1.134 +    Uint32 *vp = (void *)&value;
   1.135  
   1.136 -	fuzzerInvocationCounter++;
   1.137 +    fuzzerInvocationCounter++;
   1.138  
   1.139 -	vp[0] = SDLTest_RandomSint32();
   1.140 -	vp[1] = SDLTest_RandomSint32();
   1.141 +    vp[0] = SDLTest_RandomSint32();
   1.142 +    vp[1] = SDLTest_RandomSint32();
   1.143  
   1.144 -	return value;
   1.145 +    return value;
   1.146  }
   1.147  
   1.148  
   1.149 @@ -154,23 +154,23 @@
   1.150  Sint32
   1.151  SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
   1.152  {
   1.153 -	Sint64 min = pMin;
   1.154 -	Sint64 max = pMax;
   1.155 -	Sint64 temp;
   1.156 -	Sint64 number;
   1.157 +    Sint64 min = pMin;
   1.158 +    Sint64 max = pMax;
   1.159 +    Sint64 temp;
   1.160 +    Sint64 number;
   1.161  
   1.162 -	if(pMin > pMax) {
   1.163 -		temp = min;
   1.164 -		min = max;
   1.165 -		max = temp;
   1.166 -	} else if(pMin == pMax) {
   1.167 -		return (Sint32)min;
   1.168 -	}
   1.169 +    if(pMin > pMax) {
   1.170 +        temp = min;
   1.171 +        min = max;
   1.172 +        max = temp;
   1.173 +    } else if(pMin == pMax) {
   1.174 +        return (Sint32)min;
   1.175 +    }
   1.176  
   1.177 -	number = SDLTest_RandomUint32(); 
   1.178 -	/* invocation count increment in preceeding call */
   1.179 +    number = SDLTest_RandomUint32();
   1.180 +    /* invocation count increment in preceeding call */
   1.181  
   1.182 -	return (Sint32)((number % ((max + 1) - min)) + min);
   1.183 +    return (Sint32)((number % ((max + 1) - min)) + min);
   1.184  }
   1.185  
   1.186  /*!
   1.187 @@ -189,7 +189,7 @@
   1.188   * Generator works the same for other types of unsigned integers.
   1.189   *
   1.190   * \param maxValue The biggest value that is acceptable for this data type.
   1.191 - * 					For instance, for Uint8 -> 255, Uint16 -> 65536 etc.
   1.192 + *                  For instance, for Uint8 -> 255, Uint16 -> 65536 etc.
   1.193   * \param boundary1 defines lower boundary
   1.194   * \param boundary2 defines upper boundary
   1.195   * \param validDomain Generate only for valid domain (for the data type)
   1.196 @@ -200,107 +200,107 @@
   1.197  SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
   1.198  {
   1.199          Uint64 b1, b2;
   1.200 -	Uint64 delta;
   1.201 -	Uint64 tempBuf[4];
   1.202 -	Uint8 index;
   1.203 -	
   1.204 +    Uint64 delta;
   1.205 +    Uint64 tempBuf[4];
   1.206 +    Uint8 index;
   1.207 +
   1.208          /* Maybe swap */
   1.209 -	if (boundary1 > boundary2) {
   1.210 -		b1 = boundary2;
   1.211 -		b2 = boundary1;
   1.212 -	} else {
   1.213 -		b1 = boundary1;
   1.214 -		b2 = boundary2;
   1.215 +    if (boundary1 > boundary2) {
   1.216 +        b1 = boundary2;
   1.217 +        b2 = boundary1;
   1.218 +    } else {
   1.219 +        b1 = boundary1;
   1.220 +        b2 = boundary2;
   1.221          }
   1.222  
   1.223 -	index = 0;
   1.224 -	if (validDomain == SDL_TRUE) {
   1.225 -	        if (b1 == b2) {
   1.226 -	            return b1;
   1.227 -	        }
   1.228 -	        
   1.229 -	        /* Generate up to 4 values within bounds */
   1.230 -	        delta = b2 - b1;
   1.231 -	        if (delta < 4) {
   1.232 -	            do {
   1.233 -		        tempBuf[index] = b1 + index;
   1.234 -		        index++;
   1.235 +    index = 0;
   1.236 +    if (validDomain == SDL_TRUE) {
   1.237 +            if (b1 == b2) {
   1.238 +                return b1;
   1.239 +            }
   1.240 +
   1.241 +            /* Generate up to 4 values within bounds */
   1.242 +            delta = b2 - b1;
   1.243 +            if (delta < 4) {
   1.244 +                do {
   1.245 +                tempBuf[index] = b1 + index;
   1.246 +                index++;
   1.247                      } while (index < delta);
   1.248 -	        } else {
   1.249 -		  tempBuf[index] = b1;
   1.250 -		  index++;
   1.251 -		  tempBuf[index] = b1 + 1;
   1.252 -		  index++;
   1.253 -		  tempBuf[index] = b2 - 1;
   1.254 -		  index++;
   1.255 -		  tempBuf[index] = b2;
   1.256 -		  index++;
   1.257 -	        }
   1.258 -        } else {                
   1.259 -	        /* Generate up to 2 values outside of bounds */
   1.260 -		if (b1 > 0) {
   1.261 -			tempBuf[index] = b1 - 1;
   1.262 -			index++;
   1.263 -		}
   1.264 +            } else {
   1.265 +          tempBuf[index] = b1;
   1.266 +          index++;
   1.267 +          tempBuf[index] = b1 + 1;
   1.268 +          index++;
   1.269 +          tempBuf[index] = b2 - 1;
   1.270 +          index++;
   1.271 +          tempBuf[index] = b2;
   1.272 +          index++;
   1.273 +            }
   1.274 +        } else {
   1.275 +            /* Generate up to 2 values outside of bounds */
   1.276 +        if (b1 > 0) {
   1.277 +            tempBuf[index] = b1 - 1;
   1.278 +            index++;
   1.279 +        }
   1.280  
   1.281 -		if (b2 < maxValue) {
   1.282 -			tempBuf[index] = b2 + 1;
   1.283 -			index++;
   1.284 -		}
   1.285 -	}
   1.286 +        if (b2 < maxValue) {
   1.287 +            tempBuf[index] = b2 + 1;
   1.288 +            index++;
   1.289 +        }
   1.290 +    }
   1.291  
   1.292 -	if (index == 0) {
   1.293 -		/* There are no valid boundaries */
   1.294 -		SDL_Unsupported();
   1.295 -		return 0;
   1.296 -	}
   1.297 +    if (index == 0) {
   1.298 +        /* There are no valid boundaries */
   1.299 +        SDL_Unsupported();
   1.300 +        return 0;
   1.301 +    }
   1.302  
   1.303 -	return tempBuf[SDLTest_RandomUint8() % index];
   1.304 +    return tempBuf[SDLTest_RandomUint8() % index];
   1.305  }
   1.306  
   1.307  
   1.308  Uint8
   1.309  SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain)
   1.310  {
   1.311 -	/* max value for Uint8 */
   1.312 -	const Uint64 maxValue = UCHAR_MAX;
   1.313 -	return (Uint8)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   1.314 -				(Uint64) boundary1, (Uint64) boundary2,
   1.315 -				validDomain);
   1.316 +    /* max value for Uint8 */
   1.317 +    const Uint64 maxValue = UCHAR_MAX;
   1.318 +    return (Uint8)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   1.319 +                (Uint64) boundary1, (Uint64) boundary2,
   1.320 +                validDomain);
   1.321  }
   1.322  
   1.323  Uint16
   1.324  SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain)
   1.325  {
   1.326 -	/* max value for Uint16 */
   1.327 -	const Uint64 maxValue = USHRT_MAX;
   1.328 -	return (Uint16)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   1.329 -				(Uint64) boundary1, (Uint64) boundary2,
   1.330 -				validDomain);
   1.331 +    /* max value for Uint16 */
   1.332 +    const Uint64 maxValue = USHRT_MAX;
   1.333 +    return (Uint16)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   1.334 +                (Uint64) boundary1, (Uint64) boundary2,
   1.335 +                validDomain);
   1.336  }
   1.337  
   1.338  Uint32
   1.339  SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain)
   1.340  {
   1.341 -	/* max value for Uint32 */
   1.342 -	#if ((ULONG_MAX) == (UINT_MAX))
   1.343 -	  const Uint64 maxValue = ULONG_MAX;
   1.344 +    /* max value for Uint32 */
   1.345 +    #if ((ULONG_MAX) == (UINT_MAX))
   1.346 +      const Uint64 maxValue = ULONG_MAX;
   1.347          #else
   1.348 -	  const Uint64 maxValue = UINT_MAX;
   1.349 +      const Uint64 maxValue = UINT_MAX;
   1.350          #endif
   1.351 -	return (Uint32)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   1.352 -				(Uint64) boundary1, (Uint64) boundary2,
   1.353 -				validDomain);
   1.354 +    return (Uint32)SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   1.355 +                (Uint64) boundary1, (Uint64) boundary2,
   1.356 +                validDomain);
   1.357  }
   1.358  
   1.359  Uint64
   1.360  SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
   1.361  {
   1.362 -	/* max value for Uint64 */
   1.363 -	const Uint64 maxValue = ULLONG_MAX;
   1.364 -	return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   1.365 -				(Uint64) boundary1, (Uint64) boundary2,
   1.366 -				validDomain);
   1.367 +    /* max value for Uint64 */
   1.368 +    const Uint64 maxValue = ULLONG_MAX;
   1.369 +    return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
   1.370 +                (Uint64) boundary1, (Uint64) boundary2,
   1.371 +                validDomain);
   1.372  }
   1.373  
   1.374  /*!
   1.375 @@ -319,9 +319,9 @@
   1.376   * Generator works the same for other types of signed integers.
   1.377   *
   1.378   * \param minValue The smallest value that is acceptable for this data type.
   1.379 - * 					For instance, for Uint8 -> -127, etc.
   1.380 + *                  For instance, for Uint8 -> -127, etc.
   1.381   * \param maxValue The biggest value that is acceptable for this data type.
   1.382 - * 					For instance, for Uint8 -> 127, etc.
   1.383 + *                  For instance, for Uint8 -> 127, etc.
   1.384   * \param boundary1 defines lower boundary
   1.385   * \param boundary2 defines upper boundary
   1.386   * \param validDomain Generate only for valid domain (for the data type)
   1.387 @@ -332,118 +332,118 @@
   1.388  SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
   1.389  {
   1.390          Sint64 b1, b2;
   1.391 -	Sint64 delta;
   1.392 -	Sint64 tempBuf[4];
   1.393 -	Uint8 index;
   1.394 -	
   1.395 +    Sint64 delta;
   1.396 +    Sint64 tempBuf[4];
   1.397 +    Uint8 index;
   1.398 +
   1.399          /* Maybe swap */
   1.400 -	if (boundary1 > boundary2) {
   1.401 -		b1 = boundary2;
   1.402 -		b2 = boundary1;
   1.403 -	} else {
   1.404 -		b1 = boundary1;
   1.405 -		b2 = boundary2;
   1.406 +    if (boundary1 > boundary2) {
   1.407 +        b1 = boundary2;
   1.408 +        b2 = boundary1;
   1.409 +    } else {
   1.410 +        b1 = boundary1;
   1.411 +        b2 = boundary2;
   1.412          }
   1.413  
   1.414 -	index = 0;
   1.415 -	if (validDomain == SDL_TRUE) {
   1.416 -	        if (b1 == b2) {
   1.417 -	            return b1;
   1.418 -	        }
   1.419 -	        
   1.420 -	        /* Generate up to 4 values within bounds */
   1.421 -	        delta = b2 - b1;
   1.422 -	        if (delta < 4) {
   1.423 -	            do {
   1.424 -		        tempBuf[index] = b1 + index;
   1.425 -		        index++;
   1.426 +    index = 0;
   1.427 +    if (validDomain == SDL_TRUE) {
   1.428 +            if (b1 == b2) {
   1.429 +                return b1;
   1.430 +            }
   1.431 +
   1.432 +            /* Generate up to 4 values within bounds */
   1.433 +            delta = b2 - b1;
   1.434 +            if (delta < 4) {
   1.435 +                do {
   1.436 +                tempBuf[index] = b1 + index;
   1.437 +                index++;
   1.438                      } while (index < delta);
   1.439 -	        } else {
   1.440 -		  tempBuf[index] = b1;
   1.441 -		  index++;
   1.442 -		  tempBuf[index] = b1 + 1;
   1.443 -		  index++;
   1.444 -		  tempBuf[index] = b2 - 1;
   1.445 -		  index++;
   1.446 -		  tempBuf[index] = b2;
   1.447 -		  index++;
   1.448 -	        }
   1.449 -        } else {                
   1.450 -	        /* Generate up to 2 values outside of bounds */
   1.451 -		if (b1 > minValue) {
   1.452 -			tempBuf[index] = b1 - 1;
   1.453 -			index++;
   1.454 -		}
   1.455 +            } else {
   1.456 +          tempBuf[index] = b1;
   1.457 +          index++;
   1.458 +          tempBuf[index] = b1 + 1;
   1.459 +          index++;
   1.460 +          tempBuf[index] = b2 - 1;
   1.461 +          index++;
   1.462 +          tempBuf[index] = b2;
   1.463 +          index++;
   1.464 +            }
   1.465 +        } else {
   1.466 +            /* Generate up to 2 values outside of bounds */
   1.467 +        if (b1 > minValue) {
   1.468 +            tempBuf[index] = b1 - 1;
   1.469 +            index++;
   1.470 +        }
   1.471  
   1.472 -		if (b2 < maxValue) {
   1.473 -			tempBuf[index] = b2 + 1;
   1.474 -			index++;
   1.475 -		}
   1.476 -	}
   1.477 +        if (b2 < maxValue) {
   1.478 +            tempBuf[index] = b2 + 1;
   1.479 +            index++;
   1.480 +        }
   1.481 +    }
   1.482  
   1.483 -	if (index == 0) {
   1.484 -		/* There are no valid boundaries */
   1.485 -		SDL_Unsupported();
   1.486 -		return minValue;
   1.487 -	}
   1.488 +    if (index == 0) {
   1.489 +        /* There are no valid boundaries */
   1.490 +        SDL_Unsupported();
   1.491 +        return minValue;
   1.492 +    }
   1.493  
   1.494 -	return tempBuf[SDLTest_RandomUint8() % index];
   1.495 +    return tempBuf[SDLTest_RandomUint8() % index];
   1.496  }
   1.497  
   1.498  
   1.499  Sint8
   1.500  SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain)
   1.501  {
   1.502 -	/* min & max values for Sint8 */
   1.503 -	const Sint64 maxValue = SCHAR_MAX;
   1.504 -	const Sint64 minValue = SCHAR_MIN;
   1.505 -	return (Sint8)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   1.506 -				(Sint64) boundary1, (Sint64) boundary2,
   1.507 -				validDomain);
   1.508 +    /* min & max values for Sint8 */
   1.509 +    const Sint64 maxValue = SCHAR_MAX;
   1.510 +    const Sint64 minValue = SCHAR_MIN;
   1.511 +    return (Sint8)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   1.512 +                (Sint64) boundary1, (Sint64) boundary2,
   1.513 +                validDomain);
   1.514  }
   1.515  
   1.516  Sint16
   1.517  SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain)
   1.518  {
   1.519 -	/* min & max values for Sint16 */
   1.520 -	const Sint64 maxValue = SHRT_MAX;
   1.521 -	const Sint64 minValue = SHRT_MIN;
   1.522 -	return (Sint16)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   1.523 -				(Sint64) boundary1, (Sint64) boundary2,
   1.524 -				validDomain);
   1.525 +    /* min & max values for Sint16 */
   1.526 +    const Sint64 maxValue = SHRT_MAX;
   1.527 +    const Sint64 minValue = SHRT_MIN;
   1.528 +    return (Sint16)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   1.529 +                (Sint64) boundary1, (Sint64) boundary2,
   1.530 +                validDomain);
   1.531  }
   1.532  
   1.533  Sint32
   1.534  SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain)
   1.535  {
   1.536 -	/* min & max values for Sint32 */
   1.537 -	#if ((ULONG_MAX) == (UINT_MAX))
   1.538 -  	  const Sint64 maxValue = LONG_MAX;
   1.539 -	  const Sint64 minValue = LONG_MIN;
   1.540 +    /* min & max values for Sint32 */
   1.541 +    #if ((ULONG_MAX) == (UINT_MAX))
   1.542 +      const Sint64 maxValue = LONG_MAX;
   1.543 +      const Sint64 minValue = LONG_MIN;
   1.544          #else
   1.545 -  	  const Sint64 maxValue = INT_MAX;
   1.546 -	  const Sint64 minValue = INT_MIN;
   1.547 +      const Sint64 maxValue = INT_MAX;
   1.548 +      const Sint64 minValue = INT_MIN;
   1.549          #endif
   1.550 -	return (Sint32)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   1.551 -				(Sint64) boundary1, (Sint64) boundary2,
   1.552 -				validDomain);
   1.553 +    return (Sint32)SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   1.554 +                (Sint64) boundary1, (Sint64) boundary2,
   1.555 +                validDomain);
   1.556  }
   1.557  
   1.558  Sint64
   1.559  SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
   1.560  {
   1.561 -	/* min & max values for Sint64 */
   1.562 -	const Sint64 maxValue = LLONG_MAX;
   1.563 -	const Sint64 minValue = LLONG_MIN;
   1.564 -	return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   1.565 -				boundary1, boundary2,
   1.566 -				validDomain);
   1.567 +    /* min & max values for Sint64 */
   1.568 +    const Sint64 maxValue = LLONG_MAX;
   1.569 +    const Sint64 minValue = LLONG_MIN;
   1.570 +    return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue,
   1.571 +                boundary1, boundary2,
   1.572 +                validDomain);
   1.573  }
   1.574  
   1.575  float
   1.576  SDLTest_RandomUnitFloat()
   1.577  {
   1.578 -	return (float) SDLTest_RandomUint32() / UINT_MAX;
   1.579 +    return (float) SDLTest_RandomUint32() / UINT_MAX;
   1.580  }
   1.581  
   1.582  float
   1.583 @@ -455,70 +455,70 @@
   1.584  double
   1.585  SDLTest_RandomUnitDouble()
   1.586  {
   1.587 -	return (double) (SDLTest_RandomUint64() >> 11) * (1.0/9007199254740992.0);
   1.588 +    return (double) (SDLTest_RandomUint64() >> 11) * (1.0/9007199254740992.0);
   1.589  }
   1.590  
   1.591  double
   1.592  SDLTest_RandomDouble()
   1.593  {
   1.594 -	double r = 0.0;
   1.595 -	double s = 1.0;
   1.596 -	do {
   1.597 -	  s /= UINT_MAX + 1.0;
   1.598 -	  r += (double)SDLTest_RandomInt(&rndContext) * s;
   1.599 -	} while (s > DBL_EPSILON);
   1.600 -	  
   1.601 -	fuzzerInvocationCounter++;
   1.602 -	
   1.603 -	return r;
   1.604 +    double r = 0.0;
   1.605 +    double s = 1.0;
   1.606 +    do {
   1.607 +      s /= UINT_MAX + 1.0;
   1.608 +      r += (double)SDLTest_RandomInt(&rndContext) * s;
   1.609 +    } while (s > DBL_EPSILON);
   1.610 +
   1.611 +    fuzzerInvocationCounter++;
   1.612 +
   1.613 +    return r;
   1.614  }
   1.615  
   1.616  
   1.617  char *
   1.618  SDLTest_RandomAsciiString()
   1.619  {
   1.620 -	return SDLTest_RandomAsciiStringWithMaximumLength(255);
   1.621 +    return SDLTest_RandomAsciiStringWithMaximumLength(255);
   1.622  }
   1.623  
   1.624  char *
   1.625  SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)
   1.626  {
   1.627 -	int size;
   1.628 +    int size;
   1.629  
   1.630 -	if(maxLength < 1) {
   1.631 +    if(maxLength < 1) {
   1.632                  SDL_InvalidParamError("maxLength");
   1.633 -		return NULL;
   1.634 -	}
   1.635 +        return NULL;
   1.636 +    }
   1.637  
   1.638 -	size = (SDLTest_RandomUint32() % (maxLength + 1));
   1.639 -	
   1.640 -	return SDLTest_RandomAsciiStringOfSize(size);	
   1.641 +    size = (SDLTest_RandomUint32() % (maxLength + 1));
   1.642 +
   1.643 +    return SDLTest_RandomAsciiStringOfSize(size);
   1.644  }
   1.645  
   1.646  char *
   1.647  SDLTest_RandomAsciiStringOfSize(int size)
   1.648  {
   1.649 -	char *string;
   1.650 -	int counter;
   1.651 +    char *string;
   1.652 +    int counter;
   1.653  
   1.654  
   1.655 -	if(size < 1) {
   1.656 +    if(size < 1) {
   1.657                  SDL_InvalidParamError("size");
   1.658 -		return NULL;
   1.659 -	}
   1.660 +        return NULL;
   1.661 +    }
   1.662  
   1.663 -	string = (char *)SDL_malloc((size + 1) * sizeof(char));
   1.664 -	if (string==NULL) {
   1.665 -	  return NULL;
   1.666 +    string = (char *)SDL_malloc((size + 1) * sizeof(char));
   1.667 +    if (string==NULL) {
   1.668 +      return NULL;
   1.669          }
   1.670  
   1.671 -	for(counter = 0; counter < size; ++counter) {
   1.672 -		string[counter] = (char)SDLTest_RandomIntegerInRange(32, 126);
   1.673 -	}
   1.674 +    for(counter = 0; counter < size; ++counter) {
   1.675 +        string[counter] = (char)SDLTest_RandomIntegerInRange(32, 126);
   1.676 +    }
   1.677  
   1.678 -	string[counter] = '\0';
   1.679 +    string[counter] = '\0';
   1.680  
   1.681 -	fuzzerInvocationCounter++;
   1.682 +    fuzzerInvocationCounter++;
   1.683  
   1.684 -	return string;
   1.685 +    return string;
   1.686  }