Fix unnecessary const violation.

This commit is contained in:
David Robillard 2015-02-27 04:52:40 -05:00
parent e77e7f1f3d
commit 933e9c2919
2 changed files with 10 additions and 6 deletions

View file

@ -10,13 +10,14 @@
std::string PBD::LocaleGuard::current;
PBD::LocaleGuard::LocaleGuard (const char* str)
: old(0)
: old(0)
{
if (current != str) {
old = strdup (setlocale (LC_NUMERIC, NULL));
if (strcmp (old, str)) {
if (setlocale (LC_NUMERIC, str))
current = str;
if (setlocale (LC_NUMERIC, str)) {
current = str;
}
}
}
}
@ -24,10 +25,11 @@ PBD::LocaleGuard::LocaleGuard (const char* str)
PBD::LocaleGuard::~LocaleGuard ()
{
if (old) {
if (setlocale (LC_NUMERIC, old))
if (setlocale (LC_NUMERIC, old)) {
current = old;
}
free ((char*)old);
free (old);
}
}

View file

@ -29,9 +29,11 @@ namespace PBD {
struct LIBPBD_API LocaleGuard {
LocaleGuard (const char*);
~LocaleGuard ();
const char* old;
static std::string current;
private:
char* old;
};
}