mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
Replace _mesa_strtod with _mesa_strtof.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
63af29bfbe
commit
346298c765
6 changed files with 20 additions and 18 deletions
|
|
@ -795,18 +795,20 @@ _mesa_strdup( const char *s )
|
|||
}
|
||||
}
|
||||
|
||||
/** Wrapper around strtod() */
|
||||
double
|
||||
_mesa_strtod( const char *s, char **end )
|
||||
/** Wrapper around strtof() */
|
||||
float
|
||||
_mesa_strtof( const char *s, char **end )
|
||||
{
|
||||
#ifdef _GNU_SOURCE
|
||||
static locale_t loc = NULL;
|
||||
if (!loc) {
|
||||
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
|
||||
}
|
||||
return strtod_l(s, end, loc);
|
||||
return strtof_l(s, end, loc);
|
||||
#elif defined(_ISOC99_SOURCE) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600)
|
||||
return strtof(s, end);
|
||||
#else
|
||||
return strtod(s, end);
|
||||
return (float)strtod(s, end);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -575,8 +575,8 @@ _mesa_getenv( const char *var );
|
|||
extern char *
|
||||
_mesa_strdup( const char *s );
|
||||
|
||||
extern double
|
||||
_mesa_strtod( const char *s, char **end );
|
||||
extern float
|
||||
_mesa_strtof( const char *s, char **end );
|
||||
|
||||
extern unsigned int
|
||||
_mesa_str_checksum(const char *str);
|
||||
|
|
|
|||
|
|
@ -2198,7 +2198,7 @@ case 142:
|
|||
YY_RULE_SETUP
|
||||
#line 326 "program_lexer.l"
|
||||
{
|
||||
yylval->real = (float) _mesa_strtod(yytext, NULL);
|
||||
yylval->real = _mesa_strtof(yytext, NULL);
|
||||
return REAL;
|
||||
}
|
||||
YY_BREAK
|
||||
|
|
@ -2210,7 +2210,7 @@ YY_DO_BEFORE_ACTION; /* set up yytext again */
|
|||
YY_RULE_SETUP
|
||||
#line 330 "program_lexer.l"
|
||||
{
|
||||
yylval->real = (float) _mesa_strtod(yytext, NULL);
|
||||
yylval->real = _mesa_strtof(yytext, NULL);
|
||||
return REAL;
|
||||
}
|
||||
YY_BREAK
|
||||
|
|
@ -2218,7 +2218,7 @@ case 144:
|
|||
YY_RULE_SETUP
|
||||
#line 334 "program_lexer.l"
|
||||
{
|
||||
yylval->real = (float) _mesa_strtod(yytext, NULL);
|
||||
yylval->real = _mesa_strtof(yytext, NULL);
|
||||
return REAL;
|
||||
}
|
||||
YY_BREAK
|
||||
|
|
@ -2226,7 +2226,7 @@ case 145:
|
|||
YY_RULE_SETUP
|
||||
#line 338 "program_lexer.l"
|
||||
{
|
||||
yylval->real = (float) _mesa_strtod(yytext, NULL);
|
||||
yylval->real = _mesa_strtof(yytext, NULL);
|
||||
return REAL;
|
||||
}
|
||||
YY_BREAK
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ Parse_ScalarConstant(struct parse_state *parseState, GLfloat *number)
|
|||
{
|
||||
char *end = NULL;
|
||||
|
||||
*number = (GLfloat) _mesa_strtod((const char *) parseState->pos, &end);
|
||||
*number = (GLfloat) _mesa_strtof((const char *) parseState->pos, &end);
|
||||
|
||||
if (end && end > (char *) parseState->pos) {
|
||||
/* got a number */
|
||||
|
|
|
|||
|
|
@ -324,19 +324,19 @@ ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require
|
|||
return INTEGER;
|
||||
}
|
||||
{num}?{frac}{exp}? {
|
||||
yylval->real = (float) _mesa_strtod(yytext, NULL);
|
||||
yylval->real = _mesa_strtof(yytext, NULL);
|
||||
return REAL;
|
||||
}
|
||||
{num}"."/[^.] {
|
||||
yylval->real = (float) _mesa_strtod(yytext, NULL);
|
||||
yylval->real = _mesa_strtof(yytext, NULL);
|
||||
return REAL;
|
||||
}
|
||||
{num}{exp} {
|
||||
yylval->real = (float) _mesa_strtod(yytext, NULL);
|
||||
yylval->real = _mesa_strtof(yytext, NULL);
|
||||
return REAL;
|
||||
}
|
||||
{num}"."{exp} {
|
||||
yylval->real = (float) _mesa_strtod(yytext, NULL);
|
||||
yylval->real = _mesa_strtof(yytext, NULL);
|
||||
return REAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ parse_general_number(slang_parse_ctx *ctx, float *number)
|
|||
if (flt[strlen(flt) - 1] == 'f' || flt[strlen(flt) - 1] == 'F') {
|
||||
flt[strlen(flt) - 1] = '\0';
|
||||
}
|
||||
*number = (float)_mesa_strtod(flt, (char **)NULL);
|
||||
*number = _mesa_strtof(flt, (char **)NULL);
|
||||
free(flt);
|
||||
|
||||
return 1;
|
||||
|
|
@ -312,7 +312,7 @@ parse_float(slang_parse_ctx * C, float *number)
|
|||
slang_string_concat(whole, "E");
|
||||
slang_string_concat(whole, exponent);
|
||||
|
||||
*number = (float) (_mesa_strtod(whole, (char **) NULL));
|
||||
*number = _mesa_strtof(whole, (char **) NULL);
|
||||
|
||||
_slang_free(whole);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue