diff options
author | John Emmas <johne53@tiscali.co.uk> | 2015-02-28 12:59:00 +0000 |
---|---|---|
committer | John Emmas <johne53@tiscali.co.uk> | 2015-02-28 12:59:00 +0000 |
commit | 32e23db6652fbbe54957872a96953b3eed7dad66 (patch) | |
tree | 46b1d6c9b2ccd1e4b012ac57b9c9f11ac0c6ea73 | |
parent | 3c3586a4e1d362e0ce3b0c877e83911cd89383a9 (diff) |
In libpbd the sources 'localeguard.cc/.h' and 'locale_guard.cc/.h' are essentially identical now - so let's remove the former pair which were only ever needed when building with MSVC
(should hopefully avoid future confusion !!)
-rw-r--r-- | libs/pbd/MSVCpbd/pbd.vcproj | 4 | ||||
-rw-r--r-- | libs/pbd/locale_guard.cc | 13 | ||||
-rw-r--r-- | libs/pbd/localeguard.cc | 36 | ||||
-rw-r--r-- | libs/pbd/pbd/localeguard.h | 37 |
4 files changed, 9 insertions, 81 deletions
diff --git a/libs/pbd/MSVCpbd/pbd.vcproj b/libs/pbd/MSVCpbd/pbd.vcproj index 4e3866d01b..72d525d0b7 100644 --- a/libs/pbd/MSVCpbd/pbd.vcproj +++ b/libs/pbd/MSVCpbd/pbd.vcproj @@ -355,7 +355,7 @@ > </File> <File - RelativePath="..\localeguard.cc" + RelativePath="..\locale_guard.cc" > </File> <File @@ -705,7 +705,7 @@ > </File> <File - RelativePath="..\pbd\localeguard.h" + RelativePath="..\pbd\locale_guard.h" > </File> <File diff --git a/libs/pbd/locale_guard.cc b/libs/pbd/locale_guard.cc index b8493cf176..aa5a575521 100644 --- a/libs/pbd/locale_guard.cc +++ b/libs/pbd/locale_guard.cc @@ -29,13 +29,14 @@ using namespace PBD; std::string PBD::LocaleGuard::current; 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; + } } } } @@ -43,11 +44,11 @@ LocaleGuard::LocaleGuard (const char* str) 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/localeguard.cc b/libs/pbd/localeguard.cc deleted file mode 100644 index edfaa8e7e8..0000000000 --- a/libs/pbd/localeguard.cc +++ /dev/null @@ -1,36 +0,0 @@ -#include <cstring> -#include <locale.h> -#include <stdlib.h> - -#include "pbd/localeguard.h" - -// JE - added temporarily, to reduce the delay effects when calling -// setlocale() recursively in a Windows GUI thread (we should think -// about moving the caller(s) into a dedicated worker thread). -std::string PBD::LocaleGuard::current; - -PBD::LocaleGuard::LocaleGuard (const char* str) - : old(0) -{ - if (current != str) { - old = strdup (setlocale (LC_NUMERIC, NULL)); - if (strcmp (old, str)) { - if (setlocale (LC_NUMERIC, str)) { - current = str; - } - } - } -} - -PBD::LocaleGuard::~LocaleGuard () -{ - if (old) { - if (setlocale (LC_NUMERIC, old)) { - current = old; - } - - free (old); - } -} - - diff --git a/libs/pbd/pbd/localeguard.h b/libs/pbd/pbd/localeguard.h deleted file mode 100644 index 21ea5380fa..0000000000 --- a/libs/pbd/pbd/localeguard.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 1999-2010 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __pbd_localeguard_h__ -#define __pbd_localeguard_h__ - -#include <string> - -namespace PBD { - -struct LIBPBD_API /* Added by JE - */ LocaleGuard { - LocaleGuard (const char*); - ~LocaleGuard (); - const char* old; - - /* JE - temporary !!!! */static std::string current; -}; - -}; // namespace - -#endif /* __pbd_localeguard_h__ */ |