mirror of
https://git.zap.org.au/git/trader.git
synced 2024-12-04 14:46:45 -05:00
Bug fix: only remove thousands separators if present in the locale
This commit is contained in:
parent
ef83258e2b
commit
5e15e2a197
12
src/intf.c
12
src/intf.c
@ -1365,15 +1365,19 @@ int gettxdouble (WINDOW *win, double *result, double min, double max,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove thousands separators
|
// Remove thousands separators if required
|
||||||
|
if (strcmp(lc->thousands_sep, "") != 0) {
|
||||||
while ((p = strstr(buf_copy, lc->thousands_sep)) != NULL) {
|
while ((p = strstr(buf_copy, lc->thousands_sep)) != NULL) {
|
||||||
int len = strlen(lc->thousands_sep);
|
int len = strlen(lc->thousands_sep);
|
||||||
memmove(p, p + len, strlen(p) - len + 1);
|
memmove(p, p + len, strlen(p) - len + 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (strcmp(lc->mon_thousands_sep, "") != 0) {
|
||||||
while ((p = strstr(buf_copy, lc->mon_thousands_sep)) != NULL) {
|
while ((p = strstr(buf_copy, lc->mon_thousands_sep)) != NULL) {
|
||||||
int len = strlen(lc->thousands_sep);
|
int len = strlen(lc->thousands_sep);
|
||||||
memmove(p, p + len, strlen(p) - len + 1);
|
memmove(p, p + len, strlen(p) - len + 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val = strtod(buf_copy, &p);
|
val = strtod(buf_copy, &p);
|
||||||
|
|
||||||
@ -1482,15 +1486,19 @@ int gettxlong (WINDOW *win, long *result, long min, long max, long emptyval,
|
|||||||
strncpy(buf_copy, buf, BUFSIZE - 1);
|
strncpy(buf_copy, buf, BUFSIZE - 1);
|
||||||
buf_copy[BUFSIZE - 1] = '\0';
|
buf_copy[BUFSIZE - 1] = '\0';
|
||||||
|
|
||||||
// Remove thousands separators
|
// Remove thousands separators if required
|
||||||
|
if (strcmp(lc->thousands_sep, "") != 0) {
|
||||||
while ((p = strstr(buf_copy, lc->thousands_sep)) != NULL) {
|
while ((p = strstr(buf_copy, lc->thousands_sep)) != NULL) {
|
||||||
int len = strlen(lc->thousands_sep);
|
int len = strlen(lc->thousands_sep);
|
||||||
memmove(p, p + len, strlen(p) - len + 1);
|
memmove(p, p + len, strlen(p) - len + 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (strcmp(lc->mon_thousands_sep, "") != 0) {
|
||||||
while ((p = strstr(buf_copy, lc->mon_thousands_sep)) != NULL) {
|
while ((p = strstr(buf_copy, lc->mon_thousands_sep)) != NULL) {
|
||||||
int len = strlen(lc->thousands_sep);
|
int len = strlen(lc->thousands_sep);
|
||||||
memmove(p, p + len, strlen(p) - len + 1);
|
memmove(p, p + len, strlen(p) - len + 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val = strtol(buf_copy, &p, 10);
|
val = strtol(buf_copy, &p, 10);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user