rewrote OCIO C locale patch

Previous build was getting optimized out. This one shouldn't.
This commit is contained in:
itsmattkc
2020-05-06 00:10:10 +10:00
parent 911ef782f9
commit 17876410b5
3 changed files with 22 additions and 41 deletions
+14 -2
View File
@@ -51,7 +51,7 @@ OCIO::ConstConfigRcPtr ColorManager::GetConfig() const
OCIO::ConstConfigRcPtr ColorManager::CreateConfigFromFile(const QString &filename)
{
SetCLocale();
OCIO_SET_C_LOCALE_FOR_SCOPE;
return OCIO::Config::CreateFromFile(filename.toUtf8());
}
@@ -68,10 +68,11 @@ OCIO::ConstConfigRcPtr ColorManager::GetDefaultConfig()
void ColorManager::SetUpDefaultConfig()
{
OCIO_SET_C_LOCALE_FOR_SCOPE;
if (!qgetenv("OCIO").isEmpty()) {
// Attempt to set config from "OCIO" environment variable
try {
SetCLocale();
default_config_ = OCIO::Config::CreateFromEnv();
return;
@@ -381,4 +382,15 @@ void ColorManager::AssociateAlphaInternal(ColorManager::AlphaAction action, T *d
}
}
ColorManager::SetLocale::SetLocale(const char* new_locale)
{
old_locale_ = setlocale(LC_NUMERIC, nullptr);
setlocale(LC_NUMERIC, new_locale);
}
ColorManager::SetLocale::~SetLocale()
{
setlocale(LC_NUMERIC, old_locale_.toUtf8());
}
OLIVE_NAMESPACE_EXIT