ardour/libs/pbd/localeguard.cc
Paul Davis d7707af16b move LocaleGuard "up" into libpbd; use LocaleGuard to replace utterly broken std::locale() in Gtkmm2ext::BarController handling of logarithmic values
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6598 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-01-30 18:10:50 +00:00

21 lines
340 B
C++

#include <cstring>
#include <locale.h>
#include <stdlib.h>
#include "pbd/localeguard.h"
PBD::LocaleGuard::LocaleGuard (const char* str)
{
old = strdup (setlocale (LC_NUMERIC, NULL));
if (strcmp (old, str)) {
setlocale (LC_NUMERIC, str);
}
}
PBD::LocaleGuard::~LocaleGuard ()
{
setlocale (LC_NUMERIC, old);
free ((char*)old);
}