mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-28 06:52:35 +00:00
Ben Millwood fixing his own stuff (#4598)
This commit is contained in:
parent
e66abb3237
commit
91f3c1596f
2 changed files with 18 additions and 18 deletions
|
@ -904,7 +904,7 @@ The variable pointed to by endptr will hold the location of the first character
|
||||||
in the nptr string that was not used in the conversion
|
in the nptr string that was not used in the conversion
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
double strtod( const char *nptr, const char **endptr )
|
double strtod( const char *nptr, char **endptr )
|
||||||
{
|
{
|
||||||
double res;
|
double res;
|
||||||
qboolean neg = qfalse;
|
qboolean neg = qfalse;
|
||||||
|
@ -919,7 +919,7 @@ double strtod( const char *nptr, const char **endptr )
|
||||||
floatint_t nan;
|
floatint_t nan;
|
||||||
|
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = &nptr[3];
|
*endptr = (char *)&nptr[3];
|
||||||
|
|
||||||
// nan can be followed by a bracketed number (in hex, octal,
|
// nan can be followed by a bracketed number (in hex, octal,
|
||||||
// or decimal) which is then put in the mantissa
|
// or decimal) which is then put in the mantissa
|
||||||
|
@ -928,7 +928,7 @@ double strtod( const char *nptr, const char **endptr )
|
||||||
// note that nan(0) is infinity!
|
// note that nan(0) is infinity!
|
||||||
if( nptr[3] == '(' )
|
if( nptr[3] == '(' )
|
||||||
{
|
{
|
||||||
const char *end;
|
char *end;
|
||||||
int mantissa = strtol( &nptr[4], &end, 0 );
|
int mantissa = strtol( &nptr[4], &end, 0 );
|
||||||
if( *end == ')' )
|
if( *end == ')' )
|
||||||
{
|
{
|
||||||
|
@ -948,9 +948,9 @@ double strtod( const char *nptr, const char **endptr )
|
||||||
if( endptr == NULL )
|
if( endptr == NULL )
|
||||||
return inf.f;
|
return inf.f;
|
||||||
if( Q_stricmpn( &nptr[3], "inity", 5 ) == 0 )
|
if( Q_stricmpn( &nptr[3], "inity", 5 ) == 0 )
|
||||||
*endptr = &nptr[8];
|
*endptr = (char *)&nptr[8];
|
||||||
else
|
else
|
||||||
*endptr = &nptr[3];
|
*endptr = (char *)&nptr[3];
|
||||||
return inf.f;
|
return inf.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,12 +1016,12 @@ double strtod( const char *nptr, const char **endptr )
|
||||||
float res2;
|
float res2;
|
||||||
// apparently (confusingly) the exponent should be
|
// apparently (confusingly) the exponent should be
|
||||||
// decimal
|
// decimal
|
||||||
exp = strtol( &nptr[1], &end, 10 );
|
exp = strtol( &nptr[1], (char **)&end, 10 );
|
||||||
if( &nptr[1] == end )
|
if( &nptr[1] == end )
|
||||||
{
|
{
|
||||||
// no exponent
|
// no exponent
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = nptr;
|
*endptr = (char *)nptr;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if( exp > 0 )
|
if( exp > 0 )
|
||||||
|
@ -1048,7 +1048,7 @@ double strtod( const char *nptr, const char **endptr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = end;
|
*endptr = (char *)end;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
// decimal
|
// decimal
|
||||||
|
@ -1080,12 +1080,12 @@ double strtod( const char *nptr, const char **endptr )
|
||||||
{
|
{
|
||||||
int exp;
|
int exp;
|
||||||
float res10;
|
float res10;
|
||||||
exp = strtol( &nptr[1], &end, 10 );
|
exp = strtol( &nptr[1], (char **)&end, 10 );
|
||||||
if( &nptr[1] == end )
|
if( &nptr[1] == end )
|
||||||
{
|
{
|
||||||
// no exponent
|
// no exponent
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = nptr;
|
*endptr = (char *)nptr;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if( exp > 0 )
|
if( exp > 0 )
|
||||||
|
@ -1114,7 +1114,7 @@ double strtod( const char *nptr, const char **endptr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = end;
|
*endptr = (char *)end;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1224,13 +1224,13 @@ Will not overflow - returns LONG_MIN or LONG_MAX as appropriate
|
||||||
*endptr is set to the location of the first character not used
|
*endptr is set to the location of the first character not used
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
long strtol( const char *nptr, const char **endptr, int base )
|
long strtol( const char *nptr, char **endptr, int base )
|
||||||
{
|
{
|
||||||
long res;
|
long res;
|
||||||
qboolean pos = qtrue;
|
qboolean pos = qtrue;
|
||||||
|
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = nptr;
|
*endptr = (char *)nptr;
|
||||||
// bases other than 0, 2, 8, 16 are very rarely used, but they're
|
// bases other than 0, 2, 8, 16 are very rarely used, but they're
|
||||||
// not much extra effort to support
|
// not much extra effort to support
|
||||||
if( base < 0 || base == 1 || base > 36 )
|
if( base < 0 || base == 1 || base > 36 )
|
||||||
|
@ -1252,14 +1252,14 @@ long strtol( const char *nptr, const char **endptr, int base )
|
||||||
nptr++;
|
nptr++;
|
||||||
// 0 is always a valid digit
|
// 0 is always a valid digit
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = nptr;
|
*endptr = (char *)nptr;
|
||||||
if( *nptr == 'x' || *nptr == 'X' )
|
if( *nptr == 'x' || *nptr == 'X' )
|
||||||
{
|
{
|
||||||
if( base != 0 && base != 16 )
|
if( base != 0 && base != 16 )
|
||||||
{
|
{
|
||||||
// can't be hex, reject x (accept 0)
|
// can't be hex, reject x (accept 0)
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = nptr;
|
*endptr = (char *)nptr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
nptr++;
|
nptr++;
|
||||||
|
@ -1292,7 +1292,7 @@ long strtol( const char *nptr, const char **endptr, int base )
|
||||||
res = res * base - val;
|
res = res * base - val;
|
||||||
nptr++;
|
nptr++;
|
||||||
if( endptr )
|
if( endptr )
|
||||||
*endptr = nptr;
|
*endptr = (char *)nptr;
|
||||||
}
|
}
|
||||||
if( pos )
|
if( pos )
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,10 +95,10 @@ int toupper( int c );
|
||||||
|
|
||||||
double atof( const char *string );
|
double atof( const char *string );
|
||||||
double _atof( const char **stringPtr );
|
double _atof( const char **stringPtr );
|
||||||
double strtod( const char *nptr, const char **endptr );
|
double strtod( const char *nptr, char **endptr );
|
||||||
int atoi( const char *string );
|
int atoi( const char *string );
|
||||||
int _atoi( const char **stringPtr );
|
int _atoi( const char **stringPtr );
|
||||||
long strtol( const char *nptr, const char **endptr, int base );
|
long strtol( const char *nptr, char **endptr, int base );
|
||||||
|
|
||||||
int Q_vsnprintf( char *buffer, size_t length, const char *fmt, va_list argptr );
|
int Q_vsnprintf( char *buffer, size_t length, const char *fmt, va_list argptr );
|
||||||
int Q_snprintf( char *buffer, size_t length, const char *fmt, ... ) __attribute__ ((format (printf, 3, 4)));
|
int Q_snprintf( char *buffer, size_t length, const char *fmt, ... ) __attribute__ ((format (printf, 3, 4)));
|
||||||
|
|
Loading…
Reference in a new issue