mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
replace pa_atof() by pa_atod() because floats are lame
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2506 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
ca36968e0f
commit
67fde59fed
3 changed files with 8 additions and 12 deletions
|
|
@ -511,7 +511,7 @@ int pa__init(pa_module*m) {
|
||||||
p = 0;
|
p = 0;
|
||||||
|
|
||||||
while ((k = pa_split(cdata, ",", &state)) && p < n_control) {
|
while ((k = pa_split(cdata, ",", &state)) && p < n_control) {
|
||||||
float f;
|
double f;
|
||||||
|
|
||||||
if (*k == 0) {
|
if (*k == 0) {
|
||||||
use_default[p++] = TRUE;
|
use_default[p++] = TRUE;
|
||||||
|
|
@ -519,7 +519,7 @@ int pa__init(pa_module*m) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pa_atof(k, &f) < 0) {
|
if (pa_atod(k, &f) < 0) {
|
||||||
pa_log("Failed to parse control value '%s'", k);
|
pa_log("Failed to parse control value '%s'", k);
|
||||||
pa_xfree(k);
|
pa_xfree(k);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
||||||
|
|
@ -1574,13 +1574,13 @@ static void c_locale_destroy(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int pa_atof(const char *s, float *ret_f) {
|
int pa_atod(const char *s, double *ret_d) {
|
||||||
char *x = NULL;
|
char *x = NULL;
|
||||||
float f;
|
double f;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
pa_assert(s);
|
pa_assert(s);
|
||||||
pa_assert(ret_f);
|
pa_assert(ret_d);
|
||||||
|
|
||||||
/* This should be locale independent */
|
/* This should be locale independent */
|
||||||
|
|
||||||
|
|
@ -1595,22 +1595,18 @@ int pa_atof(const char *s, float *ret_f) {
|
||||||
|
|
||||||
if (c_locale) {
|
if (c_locale) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
f = strtof_l(s, &x, c_locale);
|
f = strtod_l(s, &x, c_locale);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
#ifdef HAVE_STRTOF
|
|
||||||
f = strtof(s, &x);
|
|
||||||
#else
|
|
||||||
f = strtod(s, &x);
|
f = strtod(s, &x);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!x || *x || errno != 0)
|
if (!x || *x || errno != 0)
|
||||||
r = -1;
|
r = -1;
|
||||||
else
|
else
|
||||||
*ret_f = f;
|
*ret_d = f;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ char *pa_state_path(const char *fn);
|
||||||
|
|
||||||
int pa_atoi(const char *s, int32_t *ret_i);
|
int pa_atoi(const char *s, int32_t *ret_i);
|
||||||
int pa_atou(const char *s, uint32_t *ret_u);
|
int pa_atou(const char *s, uint32_t *ret_u);
|
||||||
int pa_atof(const char *s, float *ret_f);
|
int pa_atod(const char *s, double *ret_d);
|
||||||
|
|
||||||
int pa_snprintf(char *str, size_t size, const char *format, ...);
|
int pa_snprintf(char *str, size_t size, const char *format, ...);
|
||||||
int pa_vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
int pa_vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue