mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-27 06:32:27 +00:00
Work around broken libs that call setlocale(LC_ALL, "");
Because that can fuck up parsing floats if your locale uses ',' as a radix. LADSPA plugins that may be used by ALSA do this. A PITA to debug.
This commit is contained in:
parent
45a73e2dcd
commit
6a23b17509
1 changed files with 11 additions and 0 deletions
|
@ -42,6 +42,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "sys/linux/local.h"
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
static idStr basepath;
|
||||
static idStr savepath;
|
||||
|
||||
|
@ -285,8 +287,16 @@ main
|
|||
===============
|
||||
*/
|
||||
int main(int argc, char **argv) {
|
||||
setlocale(LC_ALL, "C");
|
||||
Posix_EarlyInit( );
|
||||
|
||||
// some ladspa-plugins (that may be indirectly loaded by doom3 if they're
|
||||
// used by alsa) call setlocale(LC_ALL, ""); This sets LC_ALL to $LANG or
|
||||
// $LC_ALL which usually is not "C" and will fuck up scanf, strtod
|
||||
// etc when using a locale that uses ',' as a float radix.
|
||||
// so set $LC_ALL to "C".
|
||||
setenv("LC_ALL", "C", 1);
|
||||
|
||||
if ( argc > 1 ) {
|
||||
common->Init( argc-1, &argv[1] );
|
||||
} else {
|
||||
|
@ -298,4 +308,5 @@ int main(int argc, char **argv) {
|
|||
while (1) {
|
||||
common->Frame();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue