Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Allow to cross compile for Windows with Linux/Mingw (part 1 of 3, preprocessor) (#1148)

Ivan Mahonine280ae86d61f
diff --git a/toonz/sources/common/tapptools/tcolorutils.cpp b/toonz/sources/common/tapptools/tcolorutils.cpp
index 2a620a167..1f238d2ab 100644
--- a/toonz/sources/common/tapptools/tcolorutils.cpp
+++ b/toonz/sources/common/tapptools/tcolorutils.cpp
@@ -11,7 +11,7 @@
typedef float KEYER_FLOAT;
//------------------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#define ISNAN _isnan
#else
#define ISNAN std::isnan
diff --git a/toonz/sources/common/tapptools/ttimer.cpp b/toonz/sources/common/tapptools/ttimer.cpp
index a955ee4a8..e56fcaf6c 100644
--- a/toonz/sources/common/tapptools/ttimer.cpp
+++ b/toonz/sources/common/tapptools/ttimer.cpp
@@ -122,7 +122,7 @@ void CALLBACK ElapsedTimeCB(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1,
if (imp->m_action) imp->m_action->sendCommand(imp->m_ticks);
}
};
-#elif LINUX
+#elif defined(LINUX)
#include <SDL_timer.h>
#include <SDL.h>
diff --git a/toonz/sources/common/tcontenthistory.cpp b/toonz/sources/common/tcontenthistory.cpp
index 0c339e757..ded790d46 100644
--- a/toonz/sources/common/tcontenthistory.cpp
+++ b/toonz/sources/common/tcontenthistory.cpp
@@ -7,7 +7,7 @@
#include <QProcess>
#include <QTextStream>
#ifdef _WIN32
-#include <Windows.h>
+#include <windows.h>
#endif
#include <map>
#include <QFile>
diff --git a/toonz/sources/common/tcore/tstring.cpp b/toonz/sources/common/tcore/tstring.cpp
index ba39b7b7b..b8754c2a6 100644
--- a/toonz/sources/common/tcore/tstring.cpp
+++ b/toonz/sources/common/tcore/tstring.cpp
@@ -8,8 +8,11 @@
#include <QString>
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#include "windows.h"
#endif
diff --git a/toonz/sources/common/tiio/bmp/filebmp.c b/toonz/sources/common/tiio/bmp/filebmp.c
index e9ea2ab47..de23ae78b 100644
--- a/toonz/sources/common/tiio/bmp/filebmp.c
+++ b/toonz/sources/common/tiio/bmp/filebmp.c
@@ -1,6 +1,6 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/common/tiio/movsettings.cpp b/toonz/sources/common/tiio/movsettings.cpp
index c0107bf4d..e8cb9c24e 100644
--- a/toonz/sources/common/tiio/movsettings.cpp
+++ b/toonz/sources/common/tiio/movsettings.cpp
@@ -14,7 +14,7 @@
//*******************************************************************************
#ifdef _WIN32
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/common/tiio/tiio.cpp b/toonz/sources/common/tiio/tiio.cpp
index 9c7b4f4e9..439668237 100644
--- a/toonz/sources/common/tiio/tiio.cpp
+++ b/toonz/sources/common/tiio/tiio.cpp
@@ -13,8 +13,11 @@
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4786)
+#endif
+
+#ifdef _WIN32
#include <io.h>
#endif
diff --git a/toonz/sources/common/tiio/tiio_bmp.cpp b/toonz/sources/common/tiio/tiio_bmp.cpp
index 34d360bf0..a6b4f98f3 100644
--- a/toonz/sources/common/tiio/tiio_bmp.cpp
+++ b/toonz/sources/common/tiio/tiio_bmp.cpp
@@ -1,4 +1,4 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/common/tiio/tiio_jpg.cpp b/toonz/sources/common/tiio/tiio_jpg.cpp
index c4991bf5f..108fa6927 100644
--- a/toonz/sources/common/tiio/tiio_jpg.cpp
+++ b/toonz/sources/common/tiio/tiio_jpg.cpp
@@ -1,6 +1,6 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
//#include "texception.h"
diff --git a/toonz/sources/common/tiio/tiio_jpg_util.cpp b/toonz/sources/common/tiio/tiio_jpg_util.cpp
index 599f02851..293fa3717 100644
--- a/toonz/sources/common/tiio/tiio_jpg_util.cpp
+++ b/toonz/sources/common/tiio/tiio_jpg_util.cpp
@@ -1,6 +1,6 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/common/timage_io/timage_io.cpp b/toonz/sources/common/timage_io/timage_io.cpp
index 613481723..05a7f44df 100644
--- a/toonz/sources/common/timage_io/timage_io.cpp
+++ b/toonz/sources/common/timage_io/timage_io.cpp
@@ -15,9 +15,12 @@
// boost includes
#include <boost/range.hpp>
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#endif
+
// OS-specific includes
#ifdef _WIN32
-#pragma warning(disable : 4996)
#include <io.h>
#endif
#ifdef LINUX
diff --git a/toonz/sources/common/trop/tresample.cpp b/toonz/sources/common/trop/tresample.cpp
index 6322886a0..76eac869c 100644
--- a/toonz/sources/common/trop/tresample.cpp
+++ b/toonz/sources/common/trop/tresample.cpp
@@ -782,7 +782,7 @@ inline void calcValueNoCalc(UINT &calc_value){
{ calc_value &= ~0x80U; }
template <typename PixType>
-#ifdef _WIN32
+#ifdef _MSC_VER
__forceinline
#endif
void
@@ -1349,7 +1349,7 @@ void resample_main_rgbm(TRasterPT<T> rout, const TRasterPT<T> &rin,
namespace {
-__declspec(align(16)) class TPixelFloat {
+DV_ALIGNED(16) class TPixelFloat {
public:
TPixelFloat() : b(0), g(0), r(0), m(0) {}
@@ -4593,7 +4593,7 @@ void rop_resample_rgbm_2(TRasterPT<T> rout, const TRasterCM32P &rin,
}
}
-#ifdef _WIN32
+#ifdef _MSC_VER
TRaster32P rout32 = rout;
if ((TSystem::getCPUExtensions() & TSystem::CpuSupportsSse2) && rout32)
resample_main_cm32_rgbm_SSE2<TPixel32>(
diff --git a/toonz/sources/common/trop/tropcm.cpp b/toonz/sources/common/trop/tropcm.cpp
index e9374a70e..08f8ddd7c 100644
--- a/toonz/sources/common/trop/tropcm.cpp
+++ b/toonz/sources/common/trop/tropcm.cpp
@@ -33,7 +33,7 @@ extern "C" {
namespace {
-__declspec(align(16)) class TPixelFloat {
+DV_ALIGNED(16) class TPixelFloat {
public:
TPixelFloat() : b(0), g(0), r(0), m(0) {}
diff --git a/toonz/sources/common/tsound/tsound_nt.cpp b/toonz/sources/common/tsound/tsound_nt.cpp
index 48d74e0bf..b36552cb3 100644
--- a/toonz/sources/common/tsound/tsound_nt.cpp
+++ b/toonz/sources/common/tsound/tsound_nt.cpp
@@ -862,13 +862,13 @@ TSoundTrackFormat TSoundOutputDevice::getPreferredFormat(
class WaveFormat final : public WAVEFORMATEX {
public:
WaveFormat(){};
- WaveFormat(unsigned char channelCount, unsigned TINT32 sampleRate,
+ WaveFormat(unsigned char channelCount, TUINT32 sampleRate,
unsigned char bitPerSample);
~WaveFormat(){};
};
-WaveFormat::WaveFormat(unsigned char channelCount, unsigned TINT32 sampleRate,
+WaveFormat::WaveFormat(unsigned char channelCount, TUINT32 sampleRate,
unsigned char bitPerSample) {
wFormatTag = WAVE_FORMAT_PCM;
nChannels = channelCount;
@@ -889,7 +889,7 @@ public:
void open(const WaveFormat &wf);
void close();
- void prepareHeader(char *sampleBuffer, unsigned TINT32 sampleBufferSize,
+ void prepareHeader(char *sampleBuffer, TUINT32 sampleBufferSize,
WAVEHDR &whdr);
void unprepareHeader(WAVEHDR &whdr);
@@ -949,7 +949,7 @@ void WinSoundInputDevice::close() {
//--------------------------------------------------------------------
void WinSoundInputDevice::prepareHeader(char *sampleBuffer,
- unsigned TINT32 sampleBufferSize,
+ TUINT32 sampleBufferSize,
WAVEHDR &whdr) {
whdr.lpData = sampleBuffer;
whdr.dwBufferLength = sampleBufferSize; // numero di byte
diff --git a/toonz/sources/common/tsystem/cpuextensions.cpp b/toonz/sources/common/tsystem/cpuextensions.cpp
index 33a47b459..bc71bc680 100644
--- a/toonz/sources/common/tsystem/cpuextensions.cpp
+++ b/toonz/sources/common/tsystem/cpuextensions.cpp
@@ -16,7 +16,7 @@ long TSystem::getCPUExtensions() {
}
#else
-#ifndef _WIN32
+#ifndef _MSC_VER
long TSystem::getCPUExtensions() { return TSystem::CPUExtensionsNone; }
#else
namespace {
diff --git a/toonz/sources/common/tsystem/tfilepath_io.cpp b/toonz/sources/common/tsystem/tfilepath_io.cpp
index f870fa85c..3c9d0fd85 100644
--- a/toonz/sources/common/tsystem/tfilepath_io.cpp
+++ b/toonz/sources/common/tsystem/tfilepath_io.cpp
@@ -11,7 +11,7 @@
#include <iostream>
using namespace std;
-#ifdef _WIN32
+#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
@@ -89,11 +89,7 @@ sperando che sia il nome del file => compila ma non funziona
*/
{}
-Tifstream::~Tifstream() {
-#ifdef _WIN32
- fclose(m_file);
-#endif
-}
+Tifstream::~Tifstream() {}
Tofstream::Tofstream(const TFilePath &fp, bool append_existing)
: ofstream(
diff --git a/toonz/sources/common/tsystem/tsystem.cpp b/toonz/sources/common/tsystem/tsystem.cpp
index 9713d1e3d..8e1a1413a 100644
--- a/toonz/sources/common/tsystem/tsystem.cpp
+++ b/toonz/sources/common/tsystem/tsystem.cpp
@@ -23,15 +23,13 @@ using namespace std;
#include <QCoreApplication>
#include <QUuid>
+#include <QDesktopServices>
+#include <QHostInfo>
+
#ifdef _WIN32
-#include <qdesktopservices>
-#include <qhostinfo>
#include <shlobj.h>
#include <shellapi.h>
#include <winnt.h>
-#else
-#include <QDesktopServices>
-#include <QHostInfo>
#endif
#include <QStringList>
diff --git a/toonz/sources/common/tsystem/tsystempd.cpp b/toonz/sources/common/tsystem/tsystempd.cpp
index 4edf00049..ef3f3bdc1 100644
--- a/toonz/sources/common/tsystem/tsystempd.cpp
+++ b/toonz/sources/common/tsystem/tsystempd.cpp
@@ -21,8 +21,11 @@
#undef PLATFORM
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#define PLATFORM WIN32
#include <process.h>
#include <psapi.h>
diff --git a/toonz/sources/common/tvectorimage/tl2lautocloser.h b/toonz/sources/common/tvectorimage/tl2lautocloser.h
index c4c482bcc..d4a957b30 100644
--- a/toonz/sources/common/tvectorimage/tl2lautocloser.h
+++ b/toonz/sources/common/tvectorimage/tl2lautocloser.h
@@ -17,7 +17,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/common/tvectorimage/tsegmentadjuster.h b/toonz/sources/common/tvectorimage/tsegmentadjuster.h
index 1aceb64b0..621999bd7 100644
--- a/toonz/sources/common/tvectorimage/tsegmentadjuster.h
+++ b/toonz/sources/common/tvectorimage/tsegmentadjuster.h
@@ -16,7 +16,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/common/tvectorimage/tsweepboundary.cpp b/toonz/sources/common/tvectorimage/tsweepboundary.cpp
index 8bd3bdbda..3e4e3d95f 100644
--- a/toonz/sources/common/tvectorimage/tsweepboundary.cpp
+++ b/toonz/sources/common/tvectorimage/tsweepboundary.cpp
@@ -14,7 +14,7 @@
#ifdef _WIN32
#include <crtdbg.h>
-#include <Windows.h>
+#include <windows.h>
#endif
#include "tsweepboundary.h"
diff --git a/toonz/sources/common/tvrender/tfont_nt.cpp b/toonz/sources/common/tvrender/tfont_nt.cpp
index 6098a4956..f65677899 100644
--- a/toonz/sources/common/tvrender/tfont_nt.cpp
+++ b/toonz/sources/common/tvrender/tfont_nt.cpp
@@ -427,7 +427,7 @@ struct TFontManager::Impl {
// has the @-version, the library use it.
bool m_vertical;
- TFontManager::Impl() : m_loaded(false), m_currentFont(0), m_vertical(false) {}
+ Impl() : m_loaded(false), m_currentFont(0), m_vertical(false) {}
};
//---------------------------------------------------------
diff --git a/toonz/sources/common/twain/ttwain_error.c b/toonz/sources/common/twain/ttwain_error.c
index 80aab643d..359b83b52 100644
--- a/toonz/sources/common/twain/ttwain_error.c
+++ b/toonz/sources/common/twain/ttwain_error.c
@@ -1,6 +1,6 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/common/twain/ttwain_state.c b/toonz/sources/common/twain/ttwain_state.c
index 6e5ed8ecc..a9c798483 100644
--- a/toonz/sources/common/twain/ttwain_state.c
+++ b/toonz/sources/common/twain/ttwain_state.c
@@ -1,6 +1,6 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/common/twain/ttwain_util.c b/toonz/sources/common/twain/ttwain_util.c
index 6c8ea2e63..4c16feb2d 100644
--- a/toonz/sources/common/twain/ttwain_util.c
+++ b/toonz/sources/common/twain/ttwain_util.c
@@ -1,6 +1,6 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/image/avi/tiio_avi.cpp b/toonz/sources/image/avi/tiio_avi.cpp
index a72bfac96..a43f423f8 100644
--- a/toonz/sources/image/avi/tiio_avi.cpp
+++ b/toonz/sources/image/avi/tiio_avi.cpp
@@ -1,6 +1,6 @@
-#if _MSC_VER >= 1400
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
@@ -19,6 +19,8 @@
#include "timageinfo.h"
#include "trasterimage.h"
+#include <type_traits>
+
//------------------------------------------------------------------------------
namespace {
@@ -1058,8 +1060,11 @@ LRESULT safe_ICClose(HIC hic) {
return ICERR_OK;
}
-using hic_t =
- std::unique_ptr<std::remove_pointer_t<HIC>, decltype(&safe_ICClose)>;
+#ifdef _MSC_VER
+ typedef std::unique_ptr<std::remove_pointer_t<HIC>, decltype(&safe_ICClose)> hic_t;
+#else
+ typedef std::unique_ptr<std::remove_pointer<HIC>::type, decltype(&safe_ICClose)> hic_t;
+#endif
hic_t safe_ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode) {
#ifdef _MSC_VER
diff --git a/toonz/sources/image/pli/pli_io.cpp b/toonz/sources/image/pli/pli_io.cpp
index d712b4ed6..371aa8bfb 100644
--- a/toonz/sources/image/pli/pli_io.cpp
+++ b/toonz/sources/image/pli/pli_io.cpp
@@ -432,7 +432,7 @@ void ParsedPli::setMaxThickness(double maxThickness) {
};
/* indirect inclusion of <math.h> causes 'abs' to return double on Linux */
-#ifdef LINUX
+#if defined(LINUX) || (defined(_WIN32) && defined(__GNUC__))
template <typename T>
T abs_workaround(T a) {
return (a > 0) ? a : -a;
@@ -470,7 +470,7 @@ static inline short complement2(USHORT val) {
return (val & 0x8000) ? -(val & 0x7fff) : (val & 0x7fff);
}
-#ifdef LINUX
+#if defined(LINUX) || (defined(_WIN32) && defined(__GNUC__))
#undef abs
#endif
diff --git a/toonz/sources/image/pli/pli_io.h b/toonz/sources/image/pli/pli_io.h
index ecb2134c8..d57702b10 100644
--- a/toonz/sources/image/pli/pli_io.h
+++ b/toonz/sources/image/pli/pli_io.h
@@ -3,7 +3,7 @@
#ifndef _PLI_IO_H
#define _PLI_IO_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4661)
#pragma warning(disable : 4018)
#endif
diff --git a/toonz/sources/image/pli/tags.cpp b/toonz/sources/image/pli/tags.cpp
index 944f2eec9..58fa3c68d 100644
--- a/toonz/sources/image/pli/tags.cpp
+++ b/toonz/sources/image/pli/tags.cpp
@@ -1,6 +1,6 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4661)
#endif
diff --git a/toonz/sources/image/tif/tiio_tif.cpp b/toonz/sources/image/tif/tiio_tif.cpp
index 3aff309d3..2f7086b29 100644
--- a/toonz/sources/image/tif/tiio_tif.cpp
+++ b/toonz/sources/image/tif/tiio_tif.cpp
@@ -25,8 +25,11 @@ extern "C" {
#include "tiio_tif.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#include "windows.h"
#endif
diff --git a/toonz/sources/image/tzp/avl.c b/toonz/sources/image/tzp/avl.c
index 1a7e1e78d..ba49eb31b 100644
--- a/toonz/sources/image/tzp/avl.c
+++ b/toonz/sources/image/tzp/avl.c
@@ -8,7 +8,7 @@
| |
*----------------------------------------------------------------------------*/
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4113)
#pragma warning(disable : 4996)
diff --git a/toonz/sources/image/tzp/tiio_plt.cpp b/toonz/sources/image/tzp/tiio_plt.cpp
index db0cd3610..a92c16c00 100644
--- a/toonz/sources/image/tzp/tiio_plt.cpp
+++ b/toonz/sources/image/tzp/tiio_plt.cpp
@@ -7,8 +7,11 @@
#include "tiffio.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#include "windows.h"
#endif
diff --git a/toonz/sources/image/tzp/tiio_tzp.cpp b/toonz/sources/image/tzp/tiio_tzp.cpp
index 8e638b680..6bbd5244f 100644
--- a/toonz/sources/image/tzp/tiio_tzp.cpp
+++ b/toonz/sources/image/tzp/tiio_tzp.cpp
@@ -11,8 +11,11 @@
//#include "tspecialstyleid.h"
#include <set>
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#include "windows.h"
#endif
diff --git a/toonz/sources/include/avicodecrestrictions.h b/toonz/sources/include/avicodecrestrictions.h
index ad95d4057..7212ab574 100644
--- a/toonz/sources/include/avicodecrestrictions.h
+++ b/toonz/sources/include/avicodecrestrictions.h
@@ -36,4 +36,4 @@ bool DVAPI canBeConfigured(const std::wstring &codecName);
void DVAPI openConfiguration(const std::wstring &codecName, void *winId);
}
-#endif; // AVI_CODEC_RESTRICTIONS
+#endif // AVI_CODEC_RESTRICTIONS
diff --git a/toonz/sources/include/ext/Potential.h b/toonz/sources/include/ext/Potential.h
index 19a17c8fe..bb1891648 100644
--- a/toonz/sources/include/ext/Potential.h
+++ b/toonz/sources/include/ext/Potential.h
@@ -25,7 +25,7 @@
class TStroke;
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
// to avoid annoying warning
#pragma warning(push)
#pragma warning(disable : 4290)
@@ -86,7 +86,7 @@ public:
};
}
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/ext/StrokeDeformation.h b/toonz/sources/include/ext/StrokeDeformation.h
index c28d177f3..7c87055d9 100644
--- a/toonz/sources/include/ext/StrokeDeformation.h
+++ b/toonz/sources/include/ext/StrokeDeformation.h
@@ -30,7 +30,7 @@
class TStroke;
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
// to avoid annoying warning
#pragma warning(push)
#pragma warning(disable : 4251)
@@ -170,7 +170,7 @@ public:
};
}
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/ext/StrokeDeformationImpl.h b/toonz/sources/include/ext/StrokeDeformationImpl.h
index fce172d08..052dcb80c 100644
--- a/toonz/sources/include/ext/StrokeDeformationImpl.h
+++ b/toonz/sources/include/ext/StrokeDeformationImpl.h
@@ -21,7 +21,7 @@
#include "ExtUtil.h"
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
// to avoid annoying warning
#pragma warning(push)
#pragma warning(disable : 4251)
@@ -139,7 +139,7 @@ public:
};
}
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/ext/StrokeParametricDeformer.h b/toonz/sources/include/ext/StrokeParametricDeformer.h
index dbfc757d0..824854ea1 100644
--- a/toonz/sources/include/ext/StrokeParametricDeformer.h
+++ b/toonz/sources/include/ext/StrokeParametricDeformer.h
@@ -20,7 +20,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
// to avoid annoying warning
#pragma warning(push)
#pragma warning(disable : 4290)
@@ -130,7 +130,7 @@ private:
};
}
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/ext/Types.h b/toonz/sources/include/ext/Types.h
index 088a6011d..584be4bc2 100644
--- a/toonz/sources/include/ext/Types.h
+++ b/toonz/sources/include/ext/Types.h
@@ -24,7 +24,7 @@
#include <stdexcept>
#include <iostream>
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
// to avoid annoying warning
#pragma warning(push)
#pragma warning(disable : 4290)
@@ -113,7 +113,7 @@ public:
};
}
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/ext/plasticskeleton.h b/toonz/sources/include/ext/plasticskeleton.h
index 911f23cde..a7a339f3e 100644
--- a/toonz/sources/include/ext/plasticskeleton.h
+++ b/toonz/sources/include/ext/plasticskeleton.h
@@ -169,8 +169,10 @@ private:
//===============================================================================
#ifdef _WIN32
+#ifndef TFX_EXPORTS
template class DVAPI TSmartPointerT<PlasticSkeleton>;
#endif
+#endif
typedef TSmartPointerT<PlasticSkeleton> PlasticSkeletonP;
diff --git a/toonz/sources/include/ext/plasticskeletondeformation.h b/toonz/sources/include/ext/plasticskeletondeformation.h
index fbb62ff80..215e5cbf9 100644
--- a/toonz/sources/include/ext/plasticskeletondeformation.h
+++ b/toonz/sources/include/ext/plasticskeletondeformation.h
@@ -298,8 +298,10 @@ typedef PlasticSkeletonDeformation SkD;
//===============================================================================
#ifdef _WIN32
+#ifndef TFX_EXPORTS
template class DVAPI TSmartPointerT<PlasticSkeletonDeformation>;
#endif
+#endif
typedef TSmartPointerT<PlasticSkeletonDeformation> PlasticSkeletonDeformationP;
typedef PlasticSkeletonDeformationP SkDP;
diff --git a/toonz/sources/include/tcommon.h b/toonz/sources/include/tcommon.h
index c1b506e7f..5d2775741 100644
--- a/toonz/sources/include/tcommon.h
+++ b/toonz/sources/include/tcommon.h
@@ -3,7 +3,7 @@
#ifndef T_COMMON_INCLUDED
#define T_COMMON_INCLUDED
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4786)
#pragma warning(disable : 4251)
#pragma warning(disable : 4146)
@@ -154,7 +154,7 @@ const unsigned int c_maxuint = (unsigned int)(~0U);
#define DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#define DV_ALIGNED(val) __declspec(align(val))
#else
#define DV_ALIGNED(val) __attribute__((aligned(val)))
diff --git a/toonz/sources/include/tdata.h b/toonz/sources/include/tdata.h
index 8ffb4f597..dd64885dd 100644
--- a/toonz/sources/include/tdata.h
+++ b/toonz/sources/include/tdata.h
@@ -52,7 +52,7 @@ public:
//-------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
@@ -69,7 +69,7 @@ public:
TFilePath getFilePath(int i) const;
};
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/tlevel_io.h b/toonz/sources/include/tlevel_io.h
index 63e274ed3..cfd76e10b 100644
--- a/toonz/sources/include/tlevel_io.h
+++ b/toonz/sources/include/tlevel_io.h
@@ -7,7 +7,7 @@
#include "timage_io.h"
#include "tproperty.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4290)
#pragma warning(disable : 4251)
diff --git a/toonz/sources/include/tmacrofx.h b/toonz/sources/include/tmacrofx.h
index c2a12e842..334459bab 100644
--- a/toonz/sources/include/tmacrofx.h
+++ b/toonz/sources/include/tmacrofx.h
@@ -15,7 +15,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/tnotanimatableparam.h b/toonz/sources/include/tnotanimatableparam.h
index 50943636e..b28497dea 100644
--- a/toonz/sources/include/tnotanimatableparam.h
+++ b/toonz/sources/include/tnotanimatableparam.h
@@ -28,7 +28,7 @@
// TNotAnimatableParamChange
//-----------------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
@@ -444,7 +444,7 @@ TUndo *TNotAnimatableParamChange<T>::createUndo() const {
//-----------------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/tnztypes.h b/toonz/sources/include/tnztypes.h
index 66a9fc232..58000dd35 100644
--- a/toonz/sources/include/tnztypes.h
+++ b/toonz/sources/include/tnztypes.h
@@ -3,7 +3,7 @@
#ifndef TNZTYPES_H
#define TNZTYPES_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#define TINT32 __int32
typedef unsigned __int32 TUINT32;
typedef __int64 TINT64;
@@ -34,9 +34,9 @@ typedef unsigned __int32_t TUINT32;
typedef __int64_t TINT64;
typedef unsigned __int64_t TUINT64;
-#elif defined(LINUX)
+#elif defined(LINUX) || defined(_WIN32)
#include <stdint.h>
-#define TINT32 __int32_t
+typedef int32_t TINT32;
typedef uint32_t TUINT32;
typedef int64_t TINT64;
typedef uint64_t TUINT64;
diff --git a/toonz/sources/include/toonz4.6/pixel.h b/toonz/sources/include/toonz4.6/pixel.h
index e9792cc5d..645d8063c 100644
--- a/toonz/sources/include/toonz4.6/pixel.h
+++ b/toonz/sources/include/toonz4.6/pixel.h
@@ -66,7 +66,7 @@ typedef struct { unsigned short m, b, g, r; } SPIXEL;
#define LPIXEL_B_SHIFT 16
#endif
-#elif TNZ_MACHINE_CHANNEL_ORDER_RGBM
+#elif defined(TNZ_MACHINE_CHANNEL_ORDER_RGBM)
typedef struct _LPIXEL { unsigned char r, g, b, m; } LPIXEL;
typedef struct _SPIXEL { unsigned short r, g, b, m; } SPIXEL;
@@ -94,7 +94,7 @@ typedef struct _SPIXEL { unsigned short r, g, b, m; } SPIXEL;
#define LPIXEL_G_SHIFT 16
#define LPIXEL_B_SHIFT 24
#endif
-#elif TNZ_MACHINE_CHANNEL_ORDER_MRGB
+#elif defined(TNZ_MACHINE_CHANNEL_ORDER_MRGB)
typedef struct _LPIXEL { unsigned char m, r, g, b; } LPIXEL;
typedef struct _SPIXEL { unsigned short m, r, g, b; } SPIXEL;
diff --git a/toonz/sources/include/toonz4.6/toonzproc.h b/toonz/sources/include/toonz4.6/toonzproc.h
index e9a883ae7..4b6a86c39 100644
--- a/toonz/sources/include/toonz4.6/toonzproc.h
+++ b/toonz/sources/include/toonz4.6/toonzproc.h
@@ -22,7 +22,7 @@ typedef struct T_CHAN_REC *T_CHAN;
#define TPROC_OPEN_READ_BINARY 0x4
#ifdef WIN32
-#include "Windows.h"
+#include "windows.h"
#define TPROC_LIB HMODULE
#define TPROC_FUNC FARPROC
#else
diff --git a/toonz/sources/include/toonzqt/camerasettingswidget.h b/toonz/sources/include/toonzqt/camerasettingswidget.h
index 1b2a9959a..c8dbac77a 100644
--- a/toonz/sources/include/toonzqt/camerasettingswidget.h
+++ b/toonz/sources/include/toonzqt/camerasettingswidget.h
@@ -3,7 +3,7 @@
#ifndef CAMERASETTINGSWIDGET_H
#define CAMERASETTINGSWIDGET_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/cleanupcamerasettingswidget.h b/toonz/sources/include/toonzqt/cleanupcamerasettingswidget.h
index 90c5f2979..4bdc9349d 100644
--- a/toonz/sources/include/toonzqt/cleanupcamerasettingswidget.h
+++ b/toonz/sources/include/toonzqt/cleanupcamerasettingswidget.h
@@ -3,7 +3,7 @@
#ifndef CLEANUPCAMERASETTINGSWIDGET_H
#define CLEANUPCAMERASETTINGSWIDGET_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/colorfield.h b/toonz/sources/include/toonzqt/colorfield.h
index 8bde1a190..19b9c0275 100644
--- a/toonz/sources/include/toonzqt/colorfield.h
+++ b/toonz/sources/include/toonzqt/colorfield.h
@@ -3,7 +3,7 @@
#ifndef COLORFIELD_H
#define COLORFIELD_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/combohistogram.h b/toonz/sources/include/toonzqt/combohistogram.h
index ada157a7b..e9c60ab3a 100644
--- a/toonz/sources/include/toonzqt/combohistogram.h
+++ b/toonz/sources/include/toonzqt/combohistogram.h
@@ -21,7 +21,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/dvdialog.h b/toonz/sources/include/toonzqt/dvdialog.h
index a1779701e..342296d90 100644
--- a/toonz/sources/include/toonzqt/dvdialog.h
+++ b/toonz/sources/include/toonzqt/dvdialog.h
@@ -34,7 +34,7 @@ class QLabel;
class TXsheetHandle;
class TPalette;
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/dvtextedit.h b/toonz/sources/include/toonzqt/dvtextedit.h
index 5b801d760..33edf495b 100644
--- a/toonz/sources/include/toonzqt/dvtextedit.h
+++ b/toonz/sources/include/toonzqt/dvtextedit.h
@@ -3,7 +3,7 @@
#ifndef DVTEXTEDIT_H
#define DVTEXTEDIT_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/fxsettings.h b/toonz/sources/include/toonzqt/fxsettings.h
index 6f357c9aa..64386c0a8 100644
--- a/toonz/sources/include/toonzqt/fxsettings.h
+++ b/toonz/sources/include/toonzqt/fxsettings.h
@@ -3,7 +3,7 @@
#ifndef FXSETTINGS_H
#define FXSETTINGS_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/histogram.h b/toonz/sources/include/toonzqt/histogram.h
index 1f464b6d8..307c0515f 100644
--- a/toonz/sources/include/toonzqt/histogram.h
+++ b/toonz/sources/include/toonzqt/histogram.h
@@ -21,7 +21,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/paramfield.h b/toonz/sources/include/toonzqt/paramfield.h
index 126cd18fb..c18592459 100644
--- a/toonz/sources/include/toonzqt/paramfield.h
+++ b/toonz/sources/include/toonzqt/paramfield.h
@@ -3,7 +3,7 @@
#ifndef PARAMFIELD_H
#define PARAMFIELD_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/swatchviewer.h b/toonz/sources/include/toonzqt/swatchviewer.h
index 501ccca65..d772d3698 100644
--- a/toonz/sources/include/toonzqt/swatchviewer.h
+++ b/toonz/sources/include/toonzqt/swatchviewer.h
@@ -3,7 +3,7 @@
#ifndef SWATCHVIEWER_H
#define SWATCHVIEWER_H
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/toonzqt/tabbar.h b/toonz/sources/include/toonzqt/tabbar.h
index 3ff52450b..09760b299 100644
--- a/toonz/sources/include/toonzqt/tabbar.h
+++ b/toonz/sources/include/toonzqt/tabbar.h
@@ -16,7 +16,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/tpalette.h b/toonz/sources/include/tpalette.h
index e883e6d74..63c41e708 100644
--- a/toonz/sources/include/tpalette.h
+++ b/toonz/sources/include/tpalette.h
@@ -23,7 +23,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
@@ -445,7 +445,7 @@ template class DVAPI TSmartPointerT<TPalette>;
//-------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/tparamset.h b/toonz/sources/include/tparamset.h
index d4c213e94..8f399859d 100644
--- a/toonz/sources/include/tparamset.h
+++ b/toonz/sources/include/tparamset.h
@@ -42,7 +42,7 @@ public:
//------------------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
@@ -104,7 +104,7 @@ private:
TParamSetImp *m_imp = nullptr;
};
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/tproperty.h b/toonz/sources/include/tproperty.h
index 202eced95..ae6ab1c23 100644
--- a/toonz/sources/include/tproperty.h
+++ b/toonz/sources/include/tproperty.h
@@ -18,7 +18,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
@@ -429,7 +429,7 @@ private:
//---------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/trasterfx.h b/toonz/sources/include/trasterfx.h
index 43d126db0..fa588e488 100644
--- a/toonz/sources/include/trasterfx.h
+++ b/toonz/sources/include/trasterfx.h
@@ -20,7 +20,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
@@ -432,12 +432,12 @@ void DVAPI removeRenderCache(const std::string &alias);
//-------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/tsmartpointer.h b/toonz/sources/include/tsmartpointer.h
index 7f14e23cc..750cc107e 100644
--- a/toonz/sources/include/tsmartpointer.h
+++ b/toonz/sources/include/tsmartpointer.h
@@ -101,7 +101,7 @@ public: \
//=========================================================
template <class T>
-class DVAPI TSmartPointerT {
+class TSmartPointerT {
protected:
T *m_pointer;
@@ -166,7 +166,7 @@ public:
//=========================================================
template <class DERIVED, class BASE>
-class DVAPI TDerivedSmartPointerT : public TSmartPointerT<DERIVED> {
+class TDerivedSmartPointerT : public TSmartPointerT<DERIVED> {
public:
typedef TDerivedSmartPointerT<DERIVED, BASE> DerivedSmartPointer;
diff --git a/toonz/sources/include/tsound_t.h b/toonz/sources/include/tsound_t.h
index 1735c983a..466ffb216 100644
--- a/toonz/sources/include/tsound_t.h
+++ b/toonz/sources/include/tsound_t.h
@@ -137,14 +137,7 @@ from which it's created.It hasn't reference to the object.
//! Applies a trasformation (echo, reverb, ect) to the object and returns the
//! transformed soundtrack
-#if defined(MACOSX) || defined(LINUX)
TSoundTrackP apply(TSoundTransform *transform) override;
-#else // _WIN32
- TSoundTrackP apply(TSoundTransform *transform) override {
- assert(transform);
- return transform->compute(*this);
- }
-#endif
//----------------------------------------------------------------------------
//! Returns the pressure of the sample s about the channel chan
@@ -389,11 +382,13 @@ public:
};
//==============================================================================
-#if defined(MACOSX) || defined(LINUX)
+
+#if !defined(_MSC_VER) || defined(TSOUND_EXPORTS)
template <class T>
-DVAPI TSoundTrackP TSoundTrackT<T>::apply(TSoundTransform *transform) {
+TSoundTrackP TSoundTrackT<T>::apply(TSoundTransform *transform) {
assert(transform);
return transform->compute(*this);
}
#endif
+
#endif
diff --git a/toonz/sources/include/tspectrum.h b/toonz/sources/include/tspectrum.h
index c41c44501..8c57ef048 100644
--- a/toonz/sources/include/tspectrum.h
+++ b/toonz/sources/include/tspectrum.h
@@ -16,7 +16,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
@@ -182,7 +182,7 @@ template class DVAPI TSpectrumT<TPixel64>;
typedef TSpectrumT<TPixel32> TSpectrum;
typedef TSpectrumT<TPixel64> TSpectrum64;
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(default : 4251)
#endif
diff --git a/toonz/sources/include/tstrokeoutline.h b/toonz/sources/include/tstrokeoutline.h
index 07bd70f56..9be80f929 100644
--- a/toonz/sources/include/tstrokeoutline.h
+++ b/toonz/sources/include/tstrokeoutline.h
@@ -18,7 +18,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/ttokenizer.h b/toonz/sources/include/ttokenizer.h
index ba6388af2..745b4f08d 100644
--- a/toonz/sources/include/ttokenizer.h
+++ b/toonz/sources/include/ttokenizer.h
@@ -5,7 +5,7 @@
#include "tcommon.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
@@ -90,7 +90,7 @@ public:
} // namespace TSyntax
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/include/ttonecurveparam.h b/toonz/sources/include/ttonecurveparam.h
index 94063be72..fe2013ade 100644
--- a/toonz/sources/include/ttonecurveparam.h
+++ b/toonz/sources/include/ttonecurveparam.h
@@ -10,7 +10,7 @@
#include <QList>
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/include/tunit.h b/toonz/sources/include/tunit.h
index 944c689e6..084309191 100644
--- a/toonz/sources/include/tunit.h
+++ b/toonz/sources/include/tunit.h
@@ -15,7 +15,7 @@
#define DVVAR DV_IMPORT_VAR
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
@@ -192,7 +192,7 @@ DVAPI void setCurrentDpiGetter(CurrentDpiGetter f);
//---------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/stdfx/artcontourfx.cpp b/toonz/sources/stdfx/artcontourfx.cpp
index d19f2f5e0..5d97c73f9 100644
--- a/toonz/sources/stdfx/artcontourfx.cpp
+++ b/toonz/sources/stdfx/artcontourfx.cpp
@@ -1,4 +1,4 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/stdfx/blendtzfx.cpp b/toonz/sources/stdfx/blendtzfx.cpp
index 71607599c..75f937996 100644
--- a/toonz/sources/stdfx/blendtzfx.cpp
+++ b/toonz/sources/stdfx/blendtzfx.cpp
@@ -1,4 +1,4 @@
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/stdfx/calligraphicfx.cpp b/toonz/sources/stdfx/calligraphicfx.cpp
index f1e411327..d4e1e3e49 100644
--- a/toonz/sources/stdfx/calligraphicfx.cpp
+++ b/toonz/sources/stdfx/calligraphicfx.cpp
@@ -2,8 +2,11 @@
#include "stdfx.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#include "windows.h"
#endif
#include <vector>
diff --git a/toonz/sources/stdfx/igs_line_blur.cpp b/toonz/sources/stdfx/igs_line_blur.cpp
index 9be88168d..0a9fac836 100644
--- a/toonz/sources/stdfx/igs_line_blur.cpp
+++ b/toonz/sources/stdfx/igs_line_blur.cpp
@@ -15,7 +15,7 @@ namespace {
#define _pri_h_
/* Windowsではstdint.hが見付からない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
#else
#include <stdint.h> /* for int32_t */
@@ -211,7 +211,7 @@ private:
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
typedef unsigned short uint16_t;
#else
@@ -316,7 +316,7 @@ list_node *list_root::pop(list_node *clp_old) {
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
#else
#include <stdint.h> /* for int32_t */
@@ -631,7 +631,7 @@ int brush_curve_blur::save(double d_xp, double d_yp, const char *cp_fname) {
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
typedef unsigned short uint16_t;
#else
@@ -1040,7 +1040,7 @@ private:
#include "igs_line_blur.h" // "pri.h" "calculator_geometry.h"
/* WindowsではM_PIが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
#define M_PI 3.14159265358979323846
#endif
@@ -1138,7 +1138,7 @@ void calculator_geometry::get_dd_rotate_by_pos(double d_xp1, double d_yp1,
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
typedef unsigned short uint16_t;
#else
@@ -1822,7 +1822,7 @@ void pixel_line_node::int2double_body(void) {
#include "igs_line_blur.h" // "pri.h" "pixel_line_node.h"
/* WindowsではM_PIが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
#define M_PI 3.14159265358979323846
#endif
@@ -2473,7 +2473,7 @@ private:
#include "igs_line_blur.h" // "pri.h" "pixel_line_root.h" "pixel_select_same_way.h"
/* WindowsではM_PIが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
#define M_PI 3.14159265358979323846
#endif
@@ -4012,7 +4012,7 @@ private:
#include <math.h> /* M_PI */
/* WindowsではM_PIが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
#define M_PI 3.14159265358979323846
#endif
@@ -4428,7 +4428,7 @@ int pixel_select_curve_blur_root::save(double d_xp, double d_yp,
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
typedef unsigned short uint16_t;
#else
diff --git a/toonz/sources/stdfx/igs_resource_msg_from_err_win.cpp b/toonz/sources/stdfx/igs_resource_msg_from_err_win.cpp
index b3bd5f7e2..2869abb11 100644
--- a/toonz/sources/stdfx/igs_resource_msg_from_err_win.cpp
+++ b/toonz/sources/stdfx/igs_resource_msg_from_err_win.cpp
@@ -1,4 +1,6 @@
#include "igs_resource_msg_from_err.h"
+#include <locale>
+#include <stdexcept>
/*------ localeを日本に設定し日本語を扱うことを指示
(しないと日本語文字部分のみ処理しない)
diff --git a/toonz/sources/stdfx/igs_resource_msg_from_err_win.h b/toonz/sources/stdfx/igs_resource_msg_from_err_win.h
index 331ba4a2c..fc1899417 100644
--- a/toonz/sources/stdfx/igs_resource_msg_from_err_win.h
+++ b/toonz/sources/stdfx/igs_resource_msg_from_err_win.h
@@ -60,15 +60,30 @@ const std::string msg_from_err_(/* 直によんではいけない */
}
}
/*--- ::GetLastError()値からエラーメッセージを得る ---*/
-#define igs_resource_msg_from_err(tit, error_message_id) \
- igs::resource::msg_from_err_( \
- tit, error_message_id, TEXT(__FILE__), TEXT(igs_tostr(__LINE__)), \
- TEXT(__FUNCSIG__), TEXT(igs_tostr_(_MSC_VER)), \
- TEXT(igs_tostr(_MSC_FULL_VER)), TEXT(__DATE__), TEXT(__TIME__))
-/*--- エラーメッセージを得る ---*/
-#define igs_resource_msg_from_er(tit) \
- igs::resource::msg_from_err_( \
- tit, NO_ERROR, TEXT(__FILE__), TEXT(igs_tostr(__LINE__)), \
- TEXT(__FUNCSIG__), TEXT(igs_tostr_(_MSC_VER)), \
- TEXT(igs_tostr(_MSC_FULL_VER)), TEXT(__DATE__), TEXT(__TIME__))
+#ifdef _MSC_VER
+ #define igs_resource_msg_from_err(tit, error_message_id) \
+ igs::resource::msg_from_err_( \
+ tit, error_message_id, TEXT(__FILE__), TEXT(igs_tostr(__LINE__)), \
+ TEXT(__FUNCSIG__), TEXT(igs_tostr_(_MSC_VER)), \
+ TEXT(igs_tostr(_MSC_FULL_VER)), TEXT(__DATE__), TEXT(__TIME__))
+ /*--- エラーメッセージを得る ---*/
+ #define igs_resource_msg_from_er(tit) \
+ igs::resource::msg_from_err_( \
+ tit, NO_ERROR, TEXT(__FILE__), TEXT(igs_tostr(__LINE__)), \
+ TEXT(__FUNCSIG__), TEXT(igs_tostr_(_MSC_VER)), \
+ TEXT(igs_tostr(_MSC_FULL_VER)), TEXT(__DATE__), TEXT(__TIME__))
+#else
+ #define igs_resource_msg_from_err(tit, error_message_id) \
+ igs::resource::msg_from_err_( \
+ tit, error_message_id, TEXT(__FILE__), TEXT(igs_tostr(__LINE__)), \
+ TEXT(__PRETTY_FUNCTION__), TEXT(__VERSION__), \
+ TEXT(__VERSION__), TEXT(__DATE__), TEXT(__TIME__))
+ /*--- エラーメッセージを得る ---*/
+ #define igs_resource_msg_from_er(tit) \
+ igs::resource::msg_from_err_( \
+ tit, NO_ERROR, TEXT(__FILE__), TEXT(igs_tostr(__LINE__)), \
+ TEXT(__PRETTY_FUNCTION__), TEXT(__VERSION__), \
+ TEXT(__VERSION__), TEXT(__DATE__), TEXT(__TIME__))
+#endif
+
#endif /* !igs_resource_msg_from_err_h */
diff --git a/toonz/sources/stdfx/ino_line_blur.cpp b/toonz/sources/stdfx/ino_line_blur.cpp
index dddd894df..95c87f9df 100644
--- a/toonz/sources/stdfx/ino_line_blur.cpp
+++ b/toonz/sources/stdfx/ino_line_blur.cpp
@@ -279,7 +279,7 @@ private:
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
typedef unsigned short uint16_t;
#else
@@ -384,7 +384,7 @@ list_node *list_root::pop(list_node *clp_old) {
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
#else
#include <stdint.h> /* for int32_t */
@@ -699,7 +699,7 @@ int brush_curve_blur::save(double d_xp, double d_yp, const char *cp_fname) {
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
typedef unsigned short uint16_t;
#else
@@ -1108,7 +1108,7 @@ private:
#include "igs_line_blur.h" // "pri.h" "calculator_geometry.h"
/* WindowsではM_PIが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
#define M_PI 3.14159265358979323846
#endif
@@ -1206,7 +1206,7 @@ void calculator_geometry::get_dd_rotate_by_pos(double d_xp1, double d_yp1,
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
typedef unsigned short uint16_t;
#else
@@ -1890,7 +1890,7 @@ void pixel_line_node::int2double_body(void) {
#include "igs_line_blur.h" // "pri.h" "pixel_line_node.h"
/* WindowsではM_PIが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
#define M_PI 3.14159265358979323846
#endif
@@ -2541,7 +2541,7 @@ private:
#include "igs_line_blur.h" // "pri.h" "pixel_line_root.h" "pixel_select_same_way.h"
/* WindowsではM_PIが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
#define M_PI 3.14159265358979323846
#endif
@@ -4080,7 +4080,7 @@ private:
#include <math.h> /* M_PI */
/* WindowsではM_PIが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
#define M_PI 3.14159265358979323846
#endif
@@ -4496,7 +4496,7 @@ int pixel_select_curve_blur_root::save(double d_xp, double d_yp,
#include <stdio.h>
/* Windowsではstdint.hが見つからない */
-#if defined _WIN32
+#if defined _MSC_VER
typedef int int32_t;
typedef unsigned short uint16_t;
#else
diff --git a/toonz/sources/stdfx/pins.cpp b/toonz/sources/stdfx/pins.cpp
index 1e041b773..1bf3018c4 100644
--- a/toonz/sources/stdfx/pins.cpp
+++ b/toonz/sources/stdfx/pins.cpp
@@ -9,7 +9,7 @@
#include <cmath>
//------------------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#define ISNAN _isnan
#else
#define ISNAN std::isnan
diff --git a/toonz/sources/stdfx/stdfx.cpp b/toonz/sources/stdfx/stdfx.cpp
index e78f0ccb2..343d6763f 100644
--- a/toonz/sources/stdfx/stdfx.cpp
+++ b/toonz/sources/stdfx/stdfx.cpp
@@ -13,7 +13,7 @@
#include <QCoreApplication>
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
#undef max
diff --git a/toonz/sources/tnzext/Potential.cpp b/toonz/sources/tnzext/Potential.cpp
index 37e645c65..bdee8ce6b 100644
--- a/toonz/sources/tnzext/Potential.cpp
+++ b/toonz/sources/tnzext/Potential.cpp
@@ -3,7 +3,7 @@
#include "ext/Potential.h"
#include <algorithm>
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(push)
#pragma warning(disable : 4290)
#endif
@@ -50,6 +50,6 @@ double ToonzExt::Potential::value(double at) const {
// End Of File
//-----------------------------------------------------------------------------
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(pop)
#endif
diff --git a/toonz/sources/tnzext/Types.cpp b/toonz/sources/tnzext/Types.cpp
index 6dd9ed7ca..3e4ad7015 100644
--- a/toonz/sources/tnzext/Types.cpp
+++ b/toonz/sources/tnzext/Types.cpp
@@ -5,7 +5,7 @@
#endif
#include "ext/Types.h"
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
// to avoid annoying warning
#pragma warning(push)
#pragma warning(disable : 4290)
@@ -69,7 +69,7 @@ bool ToonzExt::EvenInt::isEven() const { return (bool)(!(val_ & 1)); }
//-----------------------------------------------------------------------------
-#if defined(_WIN32) && (_MSC_VER <= 1200)
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#pragma warning(pop)
#endif
diff --git a/toonz/sources/toonz/batches.h b/toonz/sources/toonz/batches.h
index c6d6b3e88..1e4e31dda 100644
--- a/toonz/sources/toonz/batches.h
+++ b/toonz/sources/toonz/batches.h
@@ -20,7 +20,7 @@ class TFarmController;
//------------------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4786)
#endif
@@ -143,7 +143,7 @@ public:
//------------------------------------------------------------------------------
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp
index abf7dd1e8..832f2341e 100644
--- a/toonz/sources/toonz/filebrowsermodel.cpp
+++ b/toonz/sources/toonz/filebrowsermodel.cpp
@@ -18,7 +18,7 @@
#ifdef _WIN32
#include <shlobj.h>
-#include <Winnetwk.h>
+#include <winnetwk.h>
#endif
#ifdef MACOSX
#include <Cocoa/Cocoa.h>
diff --git a/toonz/sources/toonz/metnum.cpp b/toonz/sources/toonz/metnum.cpp
index c2569d2a1..9c1db7344 100644
--- a/toonz/sources/toonz/metnum.cpp
+++ b/toonz/sources/toonz/metnum.cpp
@@ -12,6 +12,10 @@
#include <stdlib.h>
#include "metnum.h"
+#ifndef DBL_EPSILON
+#define DBL_EPSILON 2.2204460492503131e-16
+#endif
+
using namespace MetNum;
/*----------------------- funzioni globali ----------------------------*/
diff --git a/toonz/sources/toonzfarm/tfarm/service.cpp b/toonz/sources/toonzfarm/tfarm/service.cpp
index aeae7ae33..631b8b89a 100644
--- a/toonz/sources/toonzfarm/tfarm/service.cpp
+++ b/toonz/sources/toonzfarm/tfarm/service.cpp
@@ -6,8 +6,11 @@
#include "tfilepath.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/toonz/sources/toonzfarm/tfarm/tlog.cpp b/toonz/sources/toonzfarm/tfarm/tlog.cpp
index 7e14b5687..7cc875e1c 100644
--- a/toonz/sources/toonzfarm/tfarm/tlog.cpp
+++ b/toonz/sources/toonzfarm/tfarm/tlog.cpp
@@ -5,8 +5,11 @@
#include "tfilepath_io.h"
#include <QDateTime>
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/toonz/sources/toonzfarm/tfarm/ttcpipclient.cpp b/toonz/sources/toonzfarm/tfarm/ttcpipclient.cpp
index db26f395c..8d096be3e 100644
--- a/toonz/sources/toonzfarm/tfarm/ttcpipclient.cpp
+++ b/toonz/sources/toonzfarm/tfarm/ttcpipclient.cpp
@@ -4,7 +4,7 @@
#include "tconvert.h"
#ifdef _WIN32
-#include <Winsock2.h>
+#include <winsock2.h>
#else
#include <errno.h> /* obligatory includes */
#include <signal.h>
diff --git a/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp b/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp
index 80fffe0d7..ac6df6ee2 100644
--- a/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp
+++ b/toonz/sources/toonzfarm/tfarm/ttcpipserver.cpp
@@ -4,7 +4,7 @@
#include "tconvert.h"
#ifdef _WIN32
-#include <Winsock2.h>
+#include <winsock2.h>
#else
#include <errno.h> /* obligatory includes */
#include <signal.h>
diff --git a/toonz/sources/toonzfarm/tnzcore_stuff/tthread.cpp b/toonz/sources/toonzfarm/tnzcore_stuff/tthread.cpp
index 62118270f..1f0006d91 100644
--- a/toonz/sources/toonzfarm/tnzcore_stuff/tthread.cpp
+++ b/toonz/sources/toonzfarm/tnzcore_stuff/tthread.cpp
@@ -40,13 +40,13 @@ public:
void join();
void cancel();
-#if defined(_WIN32) && (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#pragma warning(disable : 4290)
#endif
static void milestone() throw(TThread::Interrupt);
-#if defined(_WIN32) && (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#pragma warning(default : 4290)
#endif
@@ -240,7 +240,7 @@ void Thread::cancel() {
//------------------------------------------------------------------------------
// static member function
-#if defined(_WIN32) && (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#pragma warning(disable : 4290)
#endif
@@ -252,7 +252,7 @@ void Thread::milestone() throw(TThread::Interrupt) {
if (Thread::Imp::m_state[key.m_id]) throw TThread::Interrupt();
}
-#if defined(_WIN32) && (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#pragma warning(default : 4290)
#endif
@@ -278,13 +278,13 @@ void ThreadGroup::joinAll() { m_imp->m_boostThreadGroup.join_all(); }
//==============================================================================
-#if defined(_WIN32) && (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#pragma warning(disable : 4290)
#endif
void TThread::milestone() throw(TThread::Interrupt) { Thread::milestone(); }
-#if defined(_WIN32) && (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#pragma warning(default : 4290)
#endif
diff --git a/toonz/sources/toonzlib/cleanupparameters.cpp b/toonz/sources/toonzlib/cleanupparameters.cpp
index 2e4e0388a..b5bf9e7d5 100644
--- a/toonz/sources/toonzlib/cleanupparameters.cpp
+++ b/toonz/sources/toonzlib/cleanupparameters.cpp
@@ -12,7 +12,7 @@
#include "cleanuppalette.h"
#include "tpalette.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/toonzlib/sandor_fxs/BlurMatrix.cpp b/toonz/sources/toonzlib/sandor_fxs/BlurMatrix.cpp
index 7d615df85..7ad51968a 100644
--- a/toonz/sources/toonzlib/sandor_fxs/BlurMatrix.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/BlurMatrix.cpp
@@ -4,7 +4,7 @@
//
//////////////////////////////////////////////////////////////////////
#ifdef _WIN32
-#include "Windows.h"
+#include "windows.h"
#else
#ifdef __sgi
diff --git a/toonz/sources/toonzlib/sandor_fxs/CIL.cpp b/toonz/sources/toonzlib/sandor_fxs/CIL.cpp
index f741c2842..ce00c3081 100644
--- a/toonz/sources/toonzlib/sandor_fxs/CIL.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/CIL.cpp
@@ -3,7 +3,7 @@
// CIL.cpp: implementation of the CCIL class.
//
//////////////////////////////////////////////////////////////////////
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/toonzlib/sandor_fxs/InputParam.h b/toonz/sources/toonzlib/sandor_fxs/InputParam.h
index 408ae8a9d..f75a49efe 100644
--- a/toonz/sources/toonzlib/sandor_fxs/InputParam.h
+++ b/toonz/sources/toonzlib/sandor_fxs/InputParam.h
@@ -8,7 +8,7 @@
#define AFX_INPUTPARAM_H__41D42157_F2EE_11D5_B92D_0040F674BE6A__INCLUDED_
#ifdef _WIN32
-#include "Windows.h"
+#include "windows.h"
#endif
#include <algorithm>
#include <string>
diff --git a/toonz/sources/toonzlib/sandor_fxs/Params.h b/toonz/sources/toonzlib/sandor_fxs/Params.h
index 9f7a8eee0..7e8ad8746 100644
--- a/toonz/sources/toonzlib/sandor_fxs/Params.h
+++ b/toonz/sources/toonzlib/sandor_fxs/Params.h
@@ -8,7 +8,7 @@
#define AFX_PARAMS_H__40D9A921_F329_11D5_B92E_0040F674BE6A__INCLUDED_
#ifdef _WIN32
-#include "Windows.h"
+#include "windows.h"
#endif
#include <fstream>
#include <vector>
diff --git a/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp b/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp
index 298a2eb07..5cd088263 100644
--- a/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp
@@ -3,7 +3,7 @@
// Pattern.cpp: implementation of the CPattern class.
//
//////////////////////////////////////////////////////////////////////
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/toonzlib/sandor_fxs/PatternMapParam.cpp b/toonz/sources/toonzlib/sandor_fxs/PatternMapParam.cpp
index e48c2d044..f5029846b 100644
--- a/toonz/sources/toonzlib/sandor_fxs/PatternMapParam.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/PatternMapParam.cpp
@@ -4,7 +4,7 @@
//
//////////////////////////////////////////////////////////////////////
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
#include <math.h>
diff --git a/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp b/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp
index 8de9f566d..3aac31de9 100644
--- a/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp
@@ -4,7 +4,7 @@
//
//////////////////////////////////////////////////////////////////////
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/toonzlib/sandor_fxs/STColSelPic.h b/toonz/sources/toonzlib/sandor_fxs/STColSelPic.h
index 45dfb742e..06d126267 100644
--- a/toonz/sources/toonzlib/sandor_fxs/STColSelPic.h
+++ b/toonz/sources/toonzlib/sandor_fxs/STColSelPic.h
@@ -11,7 +11,7 @@
#if !defined(AFX_STCOLSELPIC_H__80D708B0_FCA2_11D5_B949_0040F674BE6A__INCLUDED_)
#define AFX_STCOLSELPIC_H__80D708B0_FCA2_11D5_B949_0040F674BE6A__INCLUDED_
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
#include <streambuf>
diff --git a/toonz/sources/toonzlib/sandor_fxs/YOMBInputParam.cpp b/toonz/sources/toonzlib/sandor_fxs/YOMBInputParam.cpp
index 925616c9c..b2e199546 100644
--- a/toonz/sources/toonzlib/sandor_fxs/YOMBInputParam.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/YOMBInputParam.cpp
@@ -4,7 +4,7 @@
//
//////////////////////////////////////////////////////////////////////
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
diff --git a/toonz/sources/toonzlib/sandor_fxs/YOMBParam.cpp b/toonz/sources/toonzlib/sandor_fxs/YOMBParam.cpp
index 606eb2283..4c86850d7 100644
--- a/toonz/sources/toonzlib/sandor_fxs/YOMBParam.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/YOMBParam.cpp
@@ -4,7 +4,7 @@
//
//////////////////////////////////////////////////////////////////////
#ifdef _WIN32
-#include "Windows.h"
+#include "windows.h"
#endif
#include <iostream>
#include <fstream>
diff --git a/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp b/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp
index 1b2da1206..49ecf6a4c 100644
--- a/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp
@@ -1,7 +1,9 @@
+#ifdef _MSC_VER
+#pragma warning(disable : 4996)
+#endif
#ifdef _WIN32
-#pragma warning(disable : 4996)
#include "windows.h"
#endif
#include <vector>
diff --git a/toonz/sources/toonzlib/sandor_fxs/patternmap.cpp b/toonz/sources/toonzlib/sandor_fxs/patternmap.cpp
index 486e4d396..60bc34df8 100644
--- a/toonz/sources/toonzlib/sandor_fxs/patternmap.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/patternmap.cpp
@@ -1,7 +1,7 @@
#ifdef _WIN32
-#include "Windows.h"
+#include "windows.h"
#endif
#include <vector>
diff --git a/toonz/sources/toonzlib/sandor_fxs/toonz4_6staff.cpp b/toonz/sources/toonzlib/sandor_fxs/toonz4_6staff.cpp
index a9b4508e8..a56a216d8 100644
--- a/toonz/sources/toonzlib/sandor_fxs/toonz4_6staff.cpp
+++ b/toonz/sources/toonzlib/sandor_fxs/toonz4_6staff.cpp
@@ -5,7 +5,7 @@
#include "tconvert.h"
#include "toonz4.6/toonz.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
//---------------------------------------------------------------------
diff --git a/toonz/sources/toonzlib/screensavermaker.cpp b/toonz/sources/toonzlib/screensavermaker.cpp
index 4cbd8cfe1..960699d2b 100644
--- a/toonz/sources/toonzlib/screensavermaker.cpp
+++ b/toonz/sources/toonzlib/screensavermaker.cpp
@@ -5,9 +5,11 @@
#include <memory>
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+#ifdef _WIN32
#include <windows.h>
#include <shellapi.h>
//#include <iostream.h>
diff --git a/toonz/sources/toonzlib/tlog.cpp b/toonz/sources/toonzlib/tlog.cpp
index fcbf77a28..bc6241bfa 100644
--- a/toonz/sources/toonzlib/tlog.cpp
+++ b/toonz/sources/toonzlib/tlog.cpp
@@ -6,8 +6,11 @@
#include <QDateTime>
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4996)
+#endif
+
+#ifdef _WIN32
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/toonz/sources/toonzlib/tstageobject.cpp b/toonz/sources/toonzlib/tstageobject.cpp
index dcedd0239..e51026cd1 100644
--- a/toonz/sources/toonzlib/tstageobject.cpp
+++ b/toonz/sources/toonzlib/tstageobject.cpp
@@ -43,11 +43,11 @@ using namespace std;
// il problema si verifica ruotando gli oggetti sul camera stand
//
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma optimize("", off)
#endif
static TAffine makeRotation(double ang) { return TRotation(ang); }
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma optimize("", on)
#endif
diff --git a/toonz/sources/toonzqt/keyframenavigator.cpp b/toonz/sources/toonzqt/keyframenavigator.cpp
index b8d143125..a9dae219b 100644
--- a/toonz/sources/toonzqt/keyframenavigator.cpp
+++ b/toonz/sources/toonzqt/keyframenavigator.cpp
@@ -19,7 +19,7 @@
#include <QPixmap>
#include <QIcon>
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
diff --git a/toonz/sources/toonzqt/toonz_plugin.h b/toonz/sources/toonzqt/toonz_plugin.h
index 34333f70e..d376d5862 100644
--- a/toonz/sources/toonzqt/toonz_plugin.h
+++ b/toonz/sources/toonzqt/toonz_plugin.h
@@ -5,7 +5,7 @@
#include <stdint.h>
-#ifdef _MSC_VER
+#ifdef _WIN32
#define TOONZ_EXPORT __declspec(dllexport)
#define TOONZ_PACK
#else