summaryrefslogtreecommitdiff
path: root/src/game/bg_lib.c
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2010-04-18 15:52:59 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:35 +0000
commit00812ef4617697f15632a068439193b044c1b5cd (patch)
tree8b89f05428dffb65dfbacd77253922586678c2bd /src/game/bg_lib.c
parent2f9f1045ac6e4c33ea86429fb69e3be351dfaee0 (diff)
* (bug 4090) fix G_ClientNumbersFromString on an empty argument
* faff about with const in strtol and strtod (see bug 4598)
Diffstat (limited to 'src/game/bg_lib.c')
-rw-r--r--src/game/bg_lib.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c
index 5f242934..382d8abd 100644
--- a/src/game/bg_lib.c
+++ b/src/game/bg_lib.c
@@ -1403,7 +1403,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
==============
*/
-double strtod( const char *nptr, const char **endptr )
+double strtod( const char *nptr, char **endptr )
{
double res;
qboolean neg = qfalse;
@@ -1418,7 +1418,7 @@ double strtod( const char *nptr, const char **endptr )
floatint_t nan;
if( endptr )
- *endptr = &nptr[3];
+ *endptr = (char *)&nptr[3];
// nan can be followed by a bracketed number (in hex, octal,
// or decimal) which is then put in the mantissa
@@ -1427,7 +1427,7 @@ double strtod( const char *nptr, const char **endptr )
// note that nan(0) is infinity!
if( nptr[3] == '(' )
{
- const char *end;
+ char *end;
int mantissa = strtol( &nptr[4], &end, 0 );
if( *end == ')' )
@@ -1453,9 +1453,9 @@ double strtod( const char *nptr, const char **endptr )
return inf.f;
if( Q_stricmpn( &nptr[3], "inity", 5 ) == 0 )
- *endptr = &nptr[8];
+ *endptr = (char *)&nptr[8];
else
- *endptr = &nptr[3];
+ *endptr = (char *)&nptr[3];
return inf.f;
}
@@ -1528,12 +1528,12 @@ double strtod( const char *nptr, const char **endptr )
float res2;
// apparently (confusingly) the exponent should be
// decimal
- exp = strtol( &nptr[1], &end, 10 );
+ exp = strtol( &nptr[1], (char **)&end, 10 );
if( &nptr[1] == end )
{
// no exponent
if( endptr )
- *endptr = nptr;
+ *endptr = (char *)nptr;
return res;
}
if( exp > 0 )
@@ -1560,7 +1560,7 @@ double strtod( const char *nptr, const char **endptr )
}
}
if( endptr )
- *endptr = end;
+ *endptr = (char *)end;
return res;
}
// decimal
@@ -1592,12 +1592,12 @@ double strtod( const char *nptr, const char **endptr )
{
int exp;
float res10;
- exp = strtol( &nptr[1], &end, 10 );
+ exp = strtol( &nptr[1], (char **)&end, 10 );
if( &nptr[1] == end )
{
// no exponent
if( endptr )
- *endptr = nptr;
+ *endptr = (char *)nptr;
return res;
}
if( exp > 0 )
@@ -1626,7 +1626,7 @@ double strtod( const char *nptr, const char **endptr )
}
}
if( endptr )
- *endptr = end;
+ *endptr = (char *)end;
return res;
}
}
@@ -1720,13 +1720,13 @@ Will not overflow - returns LONG_MIN or LONG_MAX as appropriate
*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;
qboolean pos = qtrue;
if( endptr )
- *endptr = nptr;
+ *endptr = (char *)nptr;
// bases other than 0, 2, 8, 16 are very rarely used, but they're
// not much extra effort to support
@@ -1753,7 +1753,7 @@ long strtol( const char *nptr, const char **endptr, int base )
// 0 is always a valid digit
if( endptr )
- *endptr = nptr;
+ *endptr = (char *)nptr;
if( *nptr == 'x' || *nptr == 'X' )
{
@@ -1761,7 +1761,7 @@ long strtol( const char *nptr, const char **endptr, int base )
{
// can't be hex, reject x (accept 0)
if( endptr )
- *endptr = nptr;
+ *endptr = (char *)nptr;
return 0;
}
@@ -1800,7 +1800,7 @@ long strtol( const char *nptr, const char **endptr, int base )
nptr++;
if( endptr )
- *endptr = nptr;
+ *endptr = (char *)nptr;
}
if( pos )
{