OpenToonz - An open-source full-featured 2D animation creation software
C
Basic edits for Linux portability
Campbell Barton107701249b17
diff --git a/toonz/sources/common/tfx/ttzpimagefx.cpp b/toonz/sources/common/tfx/ttzpimagefx.cppindex e9c16b89a..c583bf3a3 100644--- a/toonz/sources/common/tfx/ttzpimagefx.cpp+++ b/toonz/sources/common/tfx/ttzpimagefx.cpp@@ -5,6 +5,10 @@#include "ttzpimagefx.h"+#ifdef LINUX+#define strtok_s strtok_r+#endif+//**********************************************************************************************// Global functions//**********************************************************************************************diff --git a/toonz/sources/common/tgl/tgl.cpp b/toonz/sources/common/tgl/tgl.cppindex f3455763e..807779f79 100644--- a/toonz/sources/common/tgl/tgl.cpp+++ b/toonz/sources/common/tgl/tgl.cpp@@ -11,12 +11,14 @@#ifndef __sgi#ifdef WIN32#include <GL/glut.h>+#elif defined(LINUX)+#include <GL/glut.h>#else#include <GLUT/glut.h>#endif#endif-#ifdef MACOSX+#if defined(MACOSX) || defined(LINUX)#include <QGLContext>#endifdiff --git a/toonz/sources/common/tiio/compatibility/tfile_io.h b/toonz/sources/common/tiio/compatibility/tfile_io.hindex c40ea2029..2c3fe91a7 100644--- a/toonz/sources/common/tiio/compatibility/tfile_io.h+++ b/toonz/sources/common/tiio/compatibility/tfile_io.h@@ -9,7 +9,7 @@ extern "C" {#include <stdio.h>-#ifdef MACOSX+#if defined(MACOSX) || defined(LINUX)#include <stddef.h>#endifdiff --git a/toonz/sources/common/tipc/tipc.cpp b/toonz/sources/common/tipc/tipc.cppindex 3c6f7ec4a..3fca4bfda 100644--- a/toonz/sources/common/tipc/tipc.cpp+++ b/toonz/sources/common/tipc/tipc.cpp@@ -18,6 +18,9 @@#elif MACOSX#include <sys/sysctl.h>#include <unistd.h>+#elif LINUX+#include <sys/time.h>+#include <unistd.h>#endif#include "tipc.h"diff --git a/toonz/sources/common/tsystem/tpluginmanager.cpp b/toonz/sources/common/tsystem/tpluginmanager.cppindex 0d5daef85..0e002aae0 100644--- a/toonz/sources/common/tsystem/tpluginmanager.cpp+++ b/toonz/sources/common/tsystem/tpluginmanager.cpp@@ -21,7 +21,9 @@#include <dirent.h>#include <sys/dir.h>#include <sys/param.h> // for getfsstat+#ifdef MACOSX#include <sys/ucred.h>+#endif#include <sys/mount.h>#include <pwd.h>#include <dlfcn.h>@@ -63,7 +65,7 @@ typedef const TPluginInfo *TnzLibMainProcType();namespace{const char *TnzLibMainProcName = "TLibMain";-#ifdef MACOSX+#if !defined(WIN32)const char *TnzLibMainProcName2 = "_TLibMain";#endif}diff --git a/toonz/sources/common/tsystem/tsystempd.cpp b/toonz/sources/common/tsystem/tsystempd.cppindex cb2a33249..f1db6155c 100644--- a/toonz/sources/common/tsystem/tsystempd.cpp+++ b/toonz/sources/common/tsystem/tsystempd.cpp@@ -186,6 +186,11 @@ bool TSystem::memoryShortage()// to be done...return false;+#elif defined(LINUX)++ // to be done...+ return false;+#else@ @ @ERROR : PLATFORM NOT SUPPORTEDdiff --git a/toonz/sources/common/ttest/ttest.cpp b/toonz/sources/common/ttest/ttest.cppindex 303fa41d4..0fbd6f0ab 100644--- a/toonz/sources/common/ttest/ttest.cpp+++ b/toonz/sources/common/ttest/ttest.cpp@@ -15,6 +15,10 @@#include <set>+#ifdef LINUX+#include <typeinfo>+#endif+using namespace std;namespacediff --git a/toonz/sources/common/tvrender/ttessellator.cpp b/toonz/sources/common/tvrender/ttessellator.cppindex f516003d6..ab48aaee6 100644--- a/toonz/sources/common/tvrender/ttessellator.cpp+++ b/toonz/sources/common/tvrender/ttessellator.cpp@@ -97,7 +97,7 @@ extern "C" void CALLBACK myCombine(GLdouble coords[3], GLdouble *d[4],typedef GLvoid(CALLBACK *GluCallback)(void);#endif-#ifdef MACOSX+#if defined(MACOSX) || defined(LINUX)typedef GLvoid (*GluCallback)();diff --git a/toonz/sources/common/twain/twain.h b/toonz/sources/common/twain/twain.hindex 8a27515bb..84ae0a1dc 100644--- a/toonz/sources/common/twain/twain.h+++ b/toonz/sources/common/twain/twain.h@@ -97,6 +97,11 @@* Platform Dependent Definitions and Typedefs *****************************************************************************/++#ifdef LINUX+#include <wchar.h>+#endif+/* Microsoft C/C++ Compiler */#if defined(WIN32) || defined(WIN64) || defined(_WINDOWS)#define TWH_CMP_MSCdiff --git a/toonz/sources/image/compatibility/tfile_io.h b/toonz/sources/image/compatibility/tfile_io.hindex c40ea2029..3a0c13929 100644--- a/toonz/sources/image/compatibility/tfile_io.h+++ b/toonz/sources/image/compatibility/tfile_io.h@@ -13,6 +13,10 @@ extern "C" {#include <stddef.h>#endif+#ifdef LINUX+#include <wchar.h>+#endif+char *convertWCHAR2CHAR(const wchar_t *fname);#if defined(MACOSX) || defined(LINUX)diff --git a/toonz/sources/include/tcg/hpp/triangulate.hpp b/toonz/sources/include/tcg/hpp/triangulate.hppindex 7230e8305..5b51bd926 100644--- a/toonz/sources/include/tcg/hpp/triangulate.hpp+++ b/toonz/sources/include/tcg/hpp/triangulate.hpp@@ -13,6 +13,8 @@#include <GL/glu.h>#elif MACOSX#include <GLUT/glut.h>+#elif LINUX+#include <GL/glut.h>#endif#ifndef TCG_GLU_CALLBACKdiff --git a/toonz/sources/include/tnztypes.h b/toonz/sources/include/tnztypes.hindex c37c65740..3e70dfc8d 100644--- a/toonz/sources/include/tnztypes.h+++ b/toonz/sources/include/tnztypes.h@@ -18,7 +18,7 @@ typedef uint32_t TUINT32;typedef int64_t TINT64;typedef uint64_t TUINT64;-#elif defined(__LP64__)+#elif defined(__LP64__) && (!defined(LINUX))#define TINT32 \; \diff --git a/toonz/sources/include/tpixel.h b/toonz/sources/include/tpixel.hindex 501734482..b3b398774 100644--- a/toonz/sources/include/tpixel.h+++ b/toonz/sources/include/tpixel.h@@ -154,6 +154,8 @@ public:Channel b, g, r, m;#elif TNZ_MACHINE_CHANNEL_ORDER_MRGBChannel m, r, g, b;+#elif TNZ_MACHINE_CHANNEL_ORDER_RGBM+ Channel r, g, b, m;#elseundefined machine order !!!!#endifdiff --git a/toonz/sources/include/tsound_t.h b/toonz/sources/include/tsound_t.hindex 1c1e79459..9f4690b3d 100644--- a/toonz/sources/include/tsound_t.h+++ b/toonz/sources/include/tsound_t.h@@ -162,9 +162,9 @@ public://----------------------------------------------------------------------------//!Applies a trasformation (echo, reverb, ect) to the object and returns the transformed soundtrack-#ifdef MACOSX+#if defined(MACOSX) || defined(LINUX)TSoundTrackP apply(TSoundTransform *transform);-#else+#else // WIN32TSoundTrackP apply(TSoundTransform *transform){assert(transform);diff --git a/toonz/sources/include/tthread.h b/toonz/sources/include/tthread.hindex d9209da84..4798608cf 100644--- a/toonz/sources/include/tthread.h+++ b/toonz/sources/include/tthread.h@@ -35,7 +35,7 @@ void DVAPI shutdown();class ExecutorId; //Privateclass Runnable;-#ifndef MACOSX+#if !(defined(MACOSX) || defined(LINUX))template class TSmartPointerT<Runnable>;#endiftypedef TSmartPointerT<Runnable> RunnableP;diff --git a/toonz/sources/stdfx/igs_motion_blur.cpp b/toonz/sources/stdfx/igs_motion_blur.cppindex 9daed9fb8..defd02db7 100644--- a/toonz/sources/stdfx/igs_motion_blur.cpp+++ b/toonz/sources/stdfx/igs_motion_blur.cpp@@ -2,6 +2,7 @@#include <stdexcept> /* std::domain_error(-) */#include <limits> /* std::numeric_limits */#include <cmath> /* pow(-),abs(-) */+#include <cstring> /* memmove */#include "igs_ifx_common.h" /* igs::image::rgba */#include "igs_motion_blur.h"diff --git a/toonz/sources/stdfx/igs_resource_msg_from_err_unix.cpp b/toonz/sources/stdfx/igs_resource_msg_from_err_unix.cppindex 009824525..4958feefe 100644--- a/toonz/sources/stdfx/igs_resource_msg_from_err_unix.cpp+++ b/toonz/sources/stdfx/igs_resource_msg_from_err_unix.cpp@@ -1,4 +1,5 @@#include <cerrno>+#include <cstring> /* memset */#include <vector>#include <stdexcept> // std::domain_error(-)#include <locale>diff --git a/toonz/sources/tnzbase/tscanner/tscannerutil.cpp b/toonz/sources/tnzbase/tscanner/tscannerutil.cppindex 6da313e55..6064cbd17 100644--- a/toonz/sources/tnzbase/tscanner/tscannerutil.cpp+++ b/toonz/sources/tnzbase/tscanner/tscannerutil.cpp@@ -2,6 +2,10 @@#include "tscannerutil.h"+#ifdef LINUX+#include <cstring>+#endif+#define BUFBYTE(X, Y, BUF, BYTEWRAP, BITOFFS) \(((UCHAR *)(BUF))[(((X) + (BITOFFS)) >> 3) + (Y) * (BYTEWRAP)])diff --git a/toonz/sources/tnzext/plasticdeformer.cpp b/toonz/sources/tnzext/plasticdeformer.cppindex 6ded943d0..13d24e83e 100644--- a/toonz/sources/tnzext/plasticdeformer.cpp+++ b/toonz/sources/tnzext/plasticdeformer.cpp@@ -12,6 +12,10 @@#include "ext/plasticdeformer.h"+#if defined(LINUX)+#include <cstring>+#endif+/*! \file plasticdeformer.cppThis file contains the implementation of a Mesh Deformer as specified in thediff --git a/toonz/sources/tnzext/plastichandle.cpp b/toonz/sources/tnzext/plastichandle.cppindex efe294c85..ffb3619a3 100644--- a/toonz/sources/tnzext/plastichandle.cpp+++ b/toonz/sources/tnzext/plastichandle.cpp@@ -18,6 +18,10 @@ using namespace tcg::bgl;#include "ext/plastichandle.h"+#if defined(LINUX)+#include <cstring>+#endif+//***********************************************************************************************// Distance building//***********************************************************************************************diff --git a/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp b/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cppindex 171245fc4..42e42016d 100644--- a/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp+++ b/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp@@ -4,6 +4,10 @@#include <stdlib.h>#include <memory>+#if defined(LINUX)+#include <cstring>+#endif+//blasint may either be common 4 bytes or extended 8 (long)...//Replace this and REBUILD the CBLAS with extended int if needed.typedef int blasint;diff --git a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp b/toonz/sources/toonzfarm/tfarm/tfarmtask.cppindex bf79bb861..04fb70eb7 100644--- a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp+++ b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp@@ -17,7 +17,7 @@#include <QSettings>// MACOSX includes-#ifdef MACOSX+#if defined(MACOSX) || defined(LINUX)#include <netdb.h> // gethostbyname#include <arpa/inet.h> // inet_ntoa#endifdiff --git a/toonz/sources/toonzlib/autopos.cpp b/toonz/sources/toonzlib/autopos.cppindex 18f8c34d6..9c5e403c9 100644--- a/toonz/sources/toonzlib/autopos.cpp+++ b/toonz/sources/toonzlib/autopos.cpp@@ -14,7 +14,7 @@ fare resize e realloc size dello stack a 65000 unita'*/-#ifdef MACOSX+#if defined(MACOSX) || defined(LINUX)#define TRUE 1#define FALSE 0#endifdiff --git a/toonz/sources/toonzlib/trastercentroid.cpp b/toonz/sources/toonzlib/trastercentroid.cppindex 8d0501986..7110b4e65 100644--- a/toonz/sources/toonzlib/trastercentroid.cpp+++ b/toonz/sources/toonzlib/trastercentroid.cpp@@ -15,7 +15,7 @@#include "tmsg.h"#include "copP.h"*/-#ifdef MACOSX+#if defined(MACOSX) || defined(LINUX)#define TRUE 1#define FALSE 0#endif