Skip to content

Commit

Permalink
Fix checking Windows platform for non-msvc toolchain
Browse files Browse the repository at this point in the history
This changes _MSC_VER with PLATFORM_WINDOWS macro to check Windows
platform. _MSC_VER is specific for MSVC toolchain and not defined
in mingw based toolchain. So, this fixes compilation in later one.

bd4c56c introduces the issue.
  • Loading branch information
Biswa96 authored and jonas-ott committed Mar 24, 2023
1 parent 166bf45 commit 2cee8bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions libs/lensfun/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ lfError lfDatabase::Load (const char *errcontext, const char *data, size_t data_
};

/* Temporarily drop numeric format to "C" */
#if defined(_MSC_VER)
#if defined(PLATFORM_WINDOWS)
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
setlocale (LC_NUMERIC, "C");
#else
Expand Down Expand Up @@ -851,7 +851,7 @@ lfError lfDatabase::Load (const char *errcontext, const char *data, size_t data_
g_markup_parse_context_free (mpc);

/* Restore numeric format */
#if defined(_MSC_VER)
#if defined(PLATFORM_WINDOWS)
_configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
#else
uselocale(loc);
Expand Down Expand Up @@ -894,7 +894,7 @@ char *lfDatabase::Save () const
lfError lfDatabase::Save (char*& xml, size_t& data_size) const
{
/* Temporarily drop numeric format to "C" */
#if defined(_MSC_VER)
#if defined(PLATFORM_WINDOWS)
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
setlocale (LC_NUMERIC, "C");
#else
Expand Down Expand Up @@ -1137,7 +1137,7 @@ lfError lfDatabase::Save (char*& xml, size_t& data_size) const
g_string_append (output, "</lensdatabase>\n");

/* Restore numeric format */
#if defined(_MSC_VER)
#if defined(PLATFORM_WINDOWS)
_configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
#else
uselocale(loc);
Expand Down
4 changes: 2 additions & 2 deletions libs/lensfun/lens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void lfLens::GuessParameters ()
float minf = float (INT_MAX), maxf = float (INT_MIN);
float mina = float (INT_MAX), maxa = float (INT_MIN);

#if defined(_MSC_VER)
#if defined(PLATFORM_WINDOWS)
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
setlocale (LC_NUMERIC, "C");
#else
Expand Down Expand Up @@ -264,7 +264,7 @@ void lfLens::GuessParameters ()

if (!MaxFocal) MaxFocal = MinFocal;

#if defined(_MSC_VER)
#if defined(PLATFORM_WINDOWS)
_configthreadlocale(_DISABLE_PER_THREAD_LOCALE);
#else
uselocale(loc);
Expand Down

0 comments on commit 2cee8bf

Please sign in to comment.