diff options
-rw-r--r-- | libs/pbd/localeguard.cc | 12 | ||||
-rw-r--r-- | libs/pbd/pbd/locale_guard.h | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/libs/pbd/localeguard.cc b/libs/pbd/localeguard.cc index 12093beeaa..edfaa8e7e8 100644 --- a/libs/pbd/localeguard.cc +++ b/libs/pbd/localeguard.cc @@ -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); } } diff --git a/libs/pbd/pbd/locale_guard.h b/libs/pbd/pbd/locale_guard.h index 8ef100f3f7..dc82ab4483 100644 --- a/libs/pbd/pbd/locale_guard.h +++ b/libs/pbd/pbd/locale_guard.h @@ -29,9 +29,11 @@ namespace PBD { struct LIBPBD_API LocaleGuard { LocaleGuard (const char*); ~LocaleGuard (); - const char* old; static std::string current; + +private: + char* old; }; } |