mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
Fixed bug with *nix LANG var region parsing.
This commit is contained in:
parent
5b830343ba
commit
706f9d91ad
@ -471,8 +471,8 @@ Locale getLocale() {
|
|||||||
if (!LANG || strcmp(LANG, "C") == 0) return fallback;
|
if (!LANG || strcmp(LANG, "C") == 0) return fallback;
|
||||||
|
|
||||||
int len = strlen(LANG);
|
int len = strlen(LANG);
|
||||||
char buf[len];
|
char buf[len + 1]; // + 1 for the '\0' char
|
||||||
memcpy(buf, LANG, len);
|
memcpy(buf, LANG, len + 1);
|
||||||
|
|
||||||
char* tracer = buf;
|
char* tracer = buf;
|
||||||
const char* reg;
|
const char* reg;
|
||||||
@ -480,7 +480,7 @@ Locale getLocale() {
|
|||||||
while (*tracer && *tracer != '_') ++tracer;
|
while (*tracer && *tracer != '_') ++tracer;
|
||||||
if (!*tracer) return fallback;
|
if (!*tracer) return fallback;
|
||||||
*tracer = '\0';
|
*tracer = '\0';
|
||||||
reg = tracer++ + 1;
|
reg = ++tracer;
|
||||||
|
|
||||||
while (*tracer && *tracer != '.') ++tracer;
|
while (*tracer && *tracer != '.') ++tracer;
|
||||||
if (tracer == reg) return fallback;
|
if (tracer == reg) return fallback;
|
||||||
|
Loading…
Reference in New Issue
Block a user