use profate atof that fixes up locale issues for string -> float
conversion. SVN revision: 70485
This commit is contained in:
parent
f23c33203e
commit
d76345fc8a
|
@ -1354,23 +1354,23 @@ _env_get(void)
|
|||
if (s) _elm_config->thumbscroll_threshold = atoi(s);
|
||||
// FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
|
||||
s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
|
||||
if (s) _elm_config->thumbscroll_momentum_threshold = atof(s);
|
||||
if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
|
||||
s = getenv("ELM_THUMBSCROLL_FRICTION");
|
||||
if (s) _elm_config->thumbscroll_friction = atof(s);
|
||||
if (s) _elm_config->thumbscroll_friction = _elm_atof(s);
|
||||
s = getenv("ELM_THUMBSCROLL_BOUNCE_ENABLE");
|
||||
if (s) _elm_config->thumbscroll_bounce_enable = !!atoi(s);
|
||||
s = getenv("ELM_THUMBSCROLL_BOUNCE_FRICTION");
|
||||
if (s) _elm_config->thumbscroll_bounce_friction = atof(s);
|
||||
if (s) _elm_config->thumbscroll_bounce_friction = _elm_atof(s);
|
||||
s = getenv("ELM_PAGE_SCROLL_FRICTION");
|
||||
if (s) _elm_config->page_scroll_friction = atof(s);
|
||||
if (s) _elm_config->page_scroll_friction = _elm_atof(s);
|
||||
s = getenv("ELM_BRING_IN_SCROLL_FRICTION");
|
||||
if (s) _elm_config->bring_in_scroll_friction = atof(s);
|
||||
if (s) _elm_config->bring_in_scroll_friction = _elm_atof(s);
|
||||
s = getenv("ELM_ZOOM_FRICTION");
|
||||
if (s) _elm_config->zoom_friction = atof(s);
|
||||
if (s) _elm_config->zoom_friction = _elm_atof(s);
|
||||
s = getenv("ELM_THUMBSCROLL_BORDER_FRICTION");
|
||||
if (s)
|
||||
{
|
||||
friction = atof(s);
|
||||
friction = _elm_atof(s);
|
||||
if (friction < 0.0)
|
||||
friction = 0.0;
|
||||
|
||||
|
@ -1382,7 +1382,7 @@ _env_get(void)
|
|||
s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION");
|
||||
if (s)
|
||||
{
|
||||
friction = atof(s);
|
||||
friction = _elm_atof(s);
|
||||
if (friction < 0.1)
|
||||
friction = 0.1;
|
||||
|
||||
|
@ -1392,13 +1392,13 @@ _env_get(void)
|
|||
_elm_config->thumbscroll_sensitivity_friction = friction;
|
||||
}
|
||||
s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
|
||||
if (s) _elm_config->scroll_smooth_amount = atof(s);
|
||||
if (s) _elm_config->scroll_smooth_amount = _elm_atof(s);
|
||||
s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT");
|
||||
if (s) _elm_config->scroll_smooth_history_weight = atof(s);
|
||||
if (s) _elm_config->scroll_smooth_history_weight = _elm_atof(s);
|
||||
s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
|
||||
if (s) _elm_config->scroll_smooth_future_time = atof(s);
|
||||
if (s) _elm_config->scroll_smooth_future_time = _elm_atof(s);
|
||||
s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
|
||||
if (s) _elm_config->scroll_smooth_time_window = atof(s);
|
||||
if (s) _elm_config->scroll_smooth_time_window = _elm_atof(s);
|
||||
s = getenv("ELM_THEME");
|
||||
if (s) eina_stringshare_replace(&_elm_config->theme, s);
|
||||
|
||||
|
@ -1457,7 +1457,7 @@ _env_get(void)
|
|||
if (s) _elm_config->font_cache = atoi(s);
|
||||
|
||||
s = getenv("ELM_SCALE");
|
||||
if (s) _elm_config->scale = atof(s);
|
||||
if (s) _elm_config->scale = _elm_atof(s);
|
||||
|
||||
s = getenv("ELM_FINGER_SIZE");
|
||||
if (s) _elm_config->finger_size = atoi(s);
|
||||
|
@ -1468,13 +1468,13 @@ _env_get(void)
|
|||
s = getenv("ELM_PASSWORD_SHOW_LAST_TIMEOUT");
|
||||
if (s)
|
||||
{
|
||||
double pw_show_last_timeout = atof(s);
|
||||
double pw_show_last_timeout = _elm_atof(s);
|
||||
if (pw_show_last_timeout >= 0.0)
|
||||
_elm_config->password_show_last_timeout = pw_show_last_timeout;
|
||||
}
|
||||
|
||||
s = getenv("ELM_FPS");
|
||||
if (s) _elm_config->fps = atof(s);
|
||||
if (s) _elm_config->fps = _elm_atof(s);
|
||||
if (_elm_config->fps < 1.0) _elm_config->fps = 1.0;
|
||||
|
||||
s = getenv("ELM_MODULES");
|
||||
|
@ -1488,7 +1488,7 @@ _env_get(void)
|
|||
s = getenv("ELM_TOOLTIP_DELAY");
|
||||
if (s)
|
||||
{
|
||||
double delay = atof(s);
|
||||
double delay = _elm_atof(s);
|
||||
if (delay >= 0.0)
|
||||
_elm_config->tooltip_delay = delay;
|
||||
}
|
||||
|
@ -1515,7 +1515,7 @@ _env_get(void)
|
|||
if (s) _elm_config->icon_size = atoi(s);
|
||||
|
||||
s = getenv("ELM_LONGPRESS_TIMEOUT");
|
||||
if (s) _elm_config->longpress_timeout = atof(s);
|
||||
if (s) _elm_config->longpress_timeout = _elm_atof(s);
|
||||
if (_elm_config->longpress_timeout < 0.0)
|
||||
_elm_config->longpress_timeout = 0.0;
|
||||
|
||||
|
|
|
@ -2675,8 +2675,8 @@ cb_dump_name_attrs(void *data, const char *key, const char *value)
|
|||
Name_Dump *dump = (Name_Dump*)data;
|
||||
if (!dump) return EINA_FALSE;
|
||||
|
||||
if (!strncmp(key, NOMINATIM_ATTR_LON, sizeof(NOMINATIM_ATTR_LON))) dump->lon = atof(value);
|
||||
else if (!strncmp(key, NOMINATIM_ATTR_LAT, sizeof(NOMINATIM_ATTR_LAT))) dump->lat = atof(value);
|
||||
if (!strncmp(key, NOMINATIM_ATTR_LON, sizeof(NOMINATIM_ATTR_LON))) dump->lon = _elm_atof(value);
|
||||
else if (!strncmp(key, NOMINATIM_ATTR_LAT, sizeof(NOMINATIM_ATTR_LAT))) dump->lat = _elm_atof(value);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -2709,7 +2709,7 @@ cb_route_dump(void *data, Eina_Simple_XML_Type type, const char *value, unsigned
|
|||
char *buf = malloc(length);
|
||||
if (!buf) return EINA_FALSE;
|
||||
snprintf(buf, length, "%s", value);
|
||||
if (dump->id == ROUTE_XML_DISTANCE) dump->distance = atof(buf);
|
||||
if (dump->id == ROUTE_XML_DISTANCE) dump->distance = _elm_atof(buf);
|
||||
else if (!(dump->description) && (dump->id == ROUTE_XML_DESCRIPTION)) dump->description = strdup(buf);
|
||||
else if (dump->id == ROUTE_XML_COORDINATES) dump->coordinates = strdup(buf);
|
||||
free(buf);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include "elm_widget.h"
|
||||
|
||||
#include <langinfo.h>
|
||||
|
||||
#define CRITICAL(...) EINA_LOG_DOM_CRIT(_elm_log_dom, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR (_elm_log_dom, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_elm_log_dom, __VA_ARGS__)
|
||||
|
@ -312,4 +314,6 @@ _elm_dgettext(const char *string)
|
|||
/* Used by the paste handler */
|
||||
void _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
|
||||
|
||||
double _elm_atof(const char *s);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,3 +44,20 @@ _elm_util_text_to_mkup(const char *text)
|
|||
{
|
||||
return evas_textblock_text_utf8_to_markup(NULL, text);
|
||||
}
|
||||
|
||||
double
|
||||
_elm_atof(const char *s)
|
||||
{
|
||||
char *cradix, *buf, *p;
|
||||
|
||||
if ((!s) || (!s[0])) return 0.0;
|
||||
cradix = nl_langinfo(RADIXCHAR);
|
||||
if (!cradix) return atof(s);
|
||||
buf = alloca(strlen(s) + 1);
|
||||
strcpy(buf, s);
|
||||
for (p = buf; *p; p++)
|
||||
{
|
||||
if (*p == '.') *p = *cradix;
|
||||
}
|
||||
return atof(buf);
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ _shot_delay_get(Elm_Win *win)
|
|||
*pd = *p;
|
||||
}
|
||||
*pd = 0;
|
||||
v = atof(d);
|
||||
v = _elm_atof(d);
|
||||
free(d);
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ _elm_tooltip_reconfigure(Elm_Tooltip *tt)
|
|||
str = edje_object_data_get(tt->tooltip, "hide_timeout");
|
||||
if (str)
|
||||
{
|
||||
tt->hide_timeout = atof(str);
|
||||
tt->hide_timeout = _elm_atof(str);
|
||||
if (tt->hide_timeout < 0.0) tt->hide_timeout = 0.0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue