Merge pull request #5397 from Cacodemon345/qt-locale-changes
Set LC_NUMERIC to "C" in program startup to fix GLSL parameter parsing
This commit is contained in:
@@ -94,6 +94,8 @@ extern int qt_nvr_save(void);
|
|||||||
bool cpu_thread_running = false;
|
bool cpu_thread_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
void qt_set_sequence_auto_mnemonic(bool b);
|
void qt_set_sequence_auto_mnemonic(bool b);
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
@@ -525,6 +527,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
QLocale::setDefault(QLocale::C);
|
QLocale::setDefault(QLocale::C);
|
||||||
|
setlocale(LC_NUMERIC, "C");
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
Q_INIT_RESOURCE(darkstyle);
|
Q_INIT_RESOURCE(darkstyle);
|
||||||
|
|||||||
@@ -756,8 +756,9 @@ double
|
|||||||
ini_section_get_double(ini_section_t self, const char *name, double def)
|
ini_section_get_double(ini_section_t self, const char *name, double def)
|
||||||
{
|
{
|
||||||
section_t *section = (section_t *) self;
|
section_t *section = (section_t *) self;
|
||||||
const entry_t *entry;
|
entry_t *entry;
|
||||||
double value = 0;
|
double value = 0;
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
if (section == NULL)
|
if (section == NULL)
|
||||||
return def;
|
return def;
|
||||||
@@ -766,7 +767,17 @@ ini_section_get_double(ini_section_t self, const char *name, double def)
|
|||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
sscanf(entry->data, "%lg", &value);
|
res = sscanf(entry->data, "%lg", &value);
|
||||||
|
if (res == EOF || res <= 0) {
|
||||||
|
int i = 0;
|
||||||
|
for (i = 0; i < strlen(entry->data); i++) {
|
||||||
|
if (entry->data[i] == ',') {
|
||||||
|
entry->data[i] = '.';
|
||||||
|
entry->wdata[i] = L'.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(void)sscanf(entry->data, "%lg", &value);
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user