Change atof() to strtod()

This commit is contained in:
Yamagi Burmeister 2012-06-02 10:33:28 +02:00
parent 67dbe816c9
commit 881b935b65
7 changed files with 20 additions and 20 deletions

View file

@ -216,7 +216,7 @@ void CL_PredictMovement (void) {
/* copy current state to pmove */ /* copy current state to pmove */
pm.trace = CL_PMTrace; pm.trace = CL_PMTrace;
pm.pointcontents = CL_PMpointcontents; pm.pointcontents = CL_PMpointcontents;
pm_airaccelerate = atof(cl.configstrings[CS_AIRACCEL]); pm_airaccelerate = strtod(cl.configstrings[CS_AIRACCEL], (char **)NULL);
pm.s = cl.frame.playerstate.pmove; pm.s = cl.frame.playerstate.pmove;
VectorSet (pm.mins, -16, -16, -24); VectorSet (pm.mins, -16, -16, -24);

View file

@ -312,15 +312,15 @@ void SCR_Sky_f (void) {
} }
if (Cmd_Argc() > 2) if (Cmd_Argc() > 2)
rotate = (float)atof(Cmd_Argv(2)); rotate = (float)strtod(Cmd_Argv(2), (char **)NULL);
else else
rotate = 0; rotate = 0;
if (Cmd_Argc() == 6) { if (Cmd_Argc() == 6) {
axis[0] = (float)atof(Cmd_Argv(3)); axis[0] = (float)strtod(Cmd_Argv(3), (char **)NULL);
axis[1] = (float)atof(Cmd_Argv(4)); axis[1] = (float)strtod(Cmd_Argv(4), (char **)NULL);
axis[2] = (float)atof(Cmd_Argv(5)); axis[2] = (float)strtod(Cmd_Argv(5), (char **)NULL);
} else { } else {
axis[0] = 0; axis[0] = 0;

View file

@ -286,7 +286,7 @@ void CL_PrepRefresh (void) {
/* set sky textures and speed */ /* set sky textures and speed */
Com_Printf ("sky\r", i); Com_Printf ("sky\r", i);
SCR_UpdateScreen (); SCR_UpdateScreen ();
rotate = (float)atof (cl.configstrings[CS_SKYROTATE]); rotate = (float)strtod(cl.configstrings[CS_SKYROTATE], (char **)NULL);
sscanf (cl.configstrings[CS_SKYAXIS], "%f %f %f", sscanf (cl.configstrings[CS_SKYAXIS], "%f %f %f",
&axis[0], &axis[1], &axis[2]); &axis[0], &axis[1], &axis[2]);
re.SetSky (cl.configstrings[CS_SKY], rotate, axis); re.SetSky (cl.configstrings[CS_SKY], rotate, axis);

View file

@ -2401,9 +2401,9 @@ static void StartServerActionFunc( void *self ) {
strcpy( startmap, strchr( mapnames[s_startmap_list.curvalue], '\n' ) + 1 ); strcpy( startmap, strchr( mapnames[s_startmap_list.curvalue], '\n' ) + 1 );
maxclients = (float)atof( s_maxclients_field.buffer ); maxclients = (float)strtod( s_maxclients_field.buffer, (char **)NULL );
timelimit = (float)atof( s_timelimit_field.buffer ); timelimit = (float)strtod( s_timelimit_field.buffer, (char **)NULL );
fraglimit = (float)atof( s_fraglimit_field.buffer ); fraglimit = (float)strtod( s_fraglimit_field.buffer, (char **)NULL );
Cvar_SetValue( "maxclients", ClampCvar( 0, maxclients, maxclients ) ); Cvar_SetValue( "maxclients", ClampCvar( 0, maxclients, maxclients ) );
Cvar_SetValue ("timelimit", ClampCvar( 0, timelimit, timelimit ) ); Cvar_SetValue ("timelimit", ClampCvar( 0, timelimit, timelimit ) );

View file

@ -793,13 +793,13 @@ OGG_SeekCmd ( void )
switch ( Cmd_Argv( 1 ) [ 0 ] ) switch ( Cmd_Argv( 1 ) [ 0 ] )
{ {
case '>': case '>':
OGG_Seek( REL, atof( Cmd_Argv( 1 ) + 1 ) ); OGG_Seek( REL, strtod( Cmd_Argv( 1 ) + 1 , (char **)NULL ) );
break; break;
case '<': case '<':
OGG_Seek( REL, -atof( Cmd_Argv( 1 ) + 1 ) ); OGG_Seek( REL, -strtod( Cmd_Argv( 1 ) + 1, (char **)NULL ) );
break; break;
default: default:
OGG_Seek( ABS, atof( Cmd_Argv( 1 ) ) ); OGG_Seek( ABS, strtod( Cmd_Argv( 1 ), (char **)NULL ) );
break; break;
} }
} }

View file

@ -62,7 +62,7 @@ float Cvar_VariableValue (char *var_name)
if (!var) if (!var)
return 0; return 0;
return atof (var->string); return strtod(var->string, (char **)NULL);
} }
const char *Cvar_VariableString (const char *var_name) const char *Cvar_VariableString (const char *var_name)
@ -141,7 +141,7 @@ cvar_t *Cvar_Get (char *var_name, char *var_value, int flags)
var->name = CopyString (var_name); var->name = CopyString (var_name);
var->string = CopyString (var_value); var->string = CopyString (var_value);
var->modified = true; var->modified = true;
var->value = atof (var->string); var->value = strtod(var->string, (char **)NULL);
/* link the variable in */ /* link the variable in */
var->next = cvar_vars; var->next = cvar_vars;
@ -205,7 +205,7 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force)
else else
{ {
var->string = CopyString(value); var->string = CopyString(value);
var->value = (float)atof (var->string); var->value = (float)strtod(var->string, (char **)NULL);
if (!strcmp(var->name, "game")) if (!strcmp(var->name, "game"))
{ {
@ -238,7 +238,7 @@ cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force)
Z_Free (var->string); Z_Free (var->string);
var->string = CopyString(value); var->string = CopyString(value);
var->value = atof (var->string); var->value = strtod(var->string, (char **)NULL);
return var; return var;
} }
@ -272,7 +272,7 @@ cvar_t *Cvar_FullSet (char *var_name, char *value, int flags)
Z_Free (var->string); Z_Free (var->string);
var->string = CopyString(value); var->string = CopyString(value);
var->value = (float)atof (var->string); var->value = (float)strtod(var->string, (char **)NULL);
var->flags = flags; var->flags = flags;
@ -307,7 +307,7 @@ void Cvar_GetLatchedVars (void)
Z_Free (var->string); Z_Free (var->string);
var->string = var->latched_string; var->string = var->latched_string;
var->latched_string = NULL; var->latched_string = NULL;
var->value = atof(var->string); var->value = strtod(var->string, (char **)NULL);
if (!strcmp(var->name, "game")) if (!strcmp(var->name, "game"))
{ {

View file

@ -403,10 +403,10 @@ ED_ParseField(const char *key, const char *value, edict_t *ent)
*(int *)(b + f->ofs) = (int)strtol(value, (char **)NULL, 10); *(int *)(b + f->ofs) = (int)strtol(value, (char **)NULL, 10);
break; break;
case F_FLOAT: case F_FLOAT:
*(float *)(b + f->ofs) = atof(value); *(float *)(b + f->ofs) = strtod(value, (char **)NULL);
break; break;
case F_ANGLEHACK: case F_ANGLEHACK:
v = atof(value); v = strtod(value, (char **)NULL);
((float *)(b + f->ofs))[0] = 0; ((float *)(b + f->ofs))[0] = 0;
((float *)(b + f->ofs))[1] = v; ((float *)(b + f->ofs))[1] = v;
((float *)(b + f->ofs))[2] = 0; ((float *)(b + f->ofs))[2] = 0;