Temporary local string "oldlocale".
This commit is contained in:
@ -146,7 +146,7 @@ static int parseOption(char *name, char *value,
|
|||||||
*/
|
*/
|
||||||
void PrefsParser::parse(FILE *fp)
|
void PrefsParser::parse(FILE *fp)
|
||||||
{
|
{
|
||||||
char *line, *name, *value, *oldLocale;
|
char *line, *name, *value;
|
||||||
int st, line_number = 1;
|
int st, line_number = 1;
|
||||||
|
|
||||||
/* Symbol array, sorted alphabetically */
|
/* Symbol array, sorted alphabetically */
|
||||||
@ -252,7 +252,7 @@ void PrefsParser::parse(FILE *fp)
|
|||||||
};
|
};
|
||||||
// changing the LC_NUMERIC locale (temporarily) to C
|
// changing the LC_NUMERIC locale (temporarily) to C
|
||||||
// avoids parsing problems with float numbers
|
// avoids parsing problems with float numbers
|
||||||
oldLocale = dStrdup(setlocale(LC_NUMERIC, NULL));
|
std::string oldLocale = setlocale(LC_NUMERIC, NULL);
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
|
|
||||||
// scan the file line by line
|
// scan the file line by line
|
||||||
@ -272,6 +272,5 @@ void PrefsParser::parse(FILE *fp)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
// restore the old numeric locale
|
// restore the old numeric locale
|
||||||
setlocale(LC_NUMERIC, oldLocale);
|
setlocale(LC_NUMERIC, oldLocale.c_str());
|
||||||
dFree(oldLocale);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user