Skip to content

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

C

Allow to cross compile for Windows with Linux/Mingw (part 2 of 3, bugfixes) (#1149)

Ivan Mahonin2fc36cb8414e
diff --git a/toonz/sources/common/tcore/tstopwatch.cpp b/toonz/sources/common/tcore/tstopwatch.cpp
index 5a993a8ad..1ba956090 100644
--- a/toonz/sources/common/tcore/tstopwatch.cpp
+++ b/toonz/sources/common/tcore/tstopwatch.cpp
@@ -369,7 +369,7 @@ void TStopWatch::printGlobals() { printGlobals(cout); }
//-----------------------------------------------------------
#ifdef _WIN32
-void dummyFunction() {
+static void dummyFunction() {
// It's used just to calculate the overhead
return;
}
diff --git a/toonz/sources/common/tiio/compatibility/tfile_io.c b/toonz/sources/common/tiio/compatibility/tfile_io.c
index 20ca6b8a3..8fabd3bc1 100644
--- a/toonz/sources/common/tiio/compatibility/tfile_io.c
+++ b/toonz/sources/common/tiio/compatibility/tfile_io.c
@@ -7,7 +7,7 @@
#include <windows.h>
#include <assert.h>
-LPSTR AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp) {
+static LPSTR AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp) {
assert(lpw != NULL);
assert(lpa != NULL);
/*
diff --git a/toonz/sources/common/tmeshimage/tmeshimage.cpp b/toonz/sources/common/tmeshimage/tmeshimage.cpp
index a5cd6625f..e82e83042 100644
--- a/toonz/sources/common/tmeshimage/tmeshimage.cpp
+++ b/toonz/sources/common/tmeshimage/tmeshimage.cpp
@@ -15,12 +15,6 @@
// Explicit instantiations
//******************************************************************************
-template class DV_EXPORT_API tcg::Vertex<TPointD>;
-template class DV_EXPORT_API
- tcg::Mesh<TTextureVertex, tcg::Edge, tcg::FaceN<3>>;
-template class DV_EXPORT_API
- tcg::TriMesh<TTextureVertex, tcg::Edge, tcg::FaceN<3>>;
-
typedef tcg::TriMesh<TTextureVertex, tcg::Edge, tcg::FaceN<3>> TriMesh_base;
//******************************************************************************
diff --git a/toonz/sources/common/trop/trop_borders.cpp b/toonz/sources/common/trop/trop_borders.cpp
index c98415ae2..ac39021a9 100644
--- a/toonz/sources/common/trop/trop_borders.cpp
+++ b/toonz/sources/common/trop/trop_borders.cpp
@@ -54,6 +54,25 @@ public:
namespace TRop {
namespace borders {
+//--------------------------------------------------------------------------------
+
+// Standard type instantiations
+
+template void DVAPI readMeshes<TPixel32>(
+ const TRasterPT<TPixel32> &raster, ImageMeshesReaderT<TPixel32> &reader);
+template void DVAPI readMeshes<TPixel64>(
+ const TRasterPT<TPixel64> &raster, ImageMeshesReaderT<TPixel64> &reader);
+template void DVAPI readMeshes<TPixelGR8>(
+ const TRasterPT<TPixelGR8> &raster, ImageMeshesReaderT<TPixelGR8> &reader);
+template void DVAPI readMeshes<TPixelGR16>(
+ const TRasterPT<TPixelGR16> &raster,
+ ImageMeshesReaderT<TPixelGR16> &reader);
+template void DVAPI readMeshes<TPixelCM32>(
+ const TRasterPT<TPixelCM32> &raster,
+ ImageMeshesReaderT<TPixelCM32> &reader);
+
+//--------------------------------------------------------------------------------
+
template <typename Pix>
void readBorders_simple(const TRasterPT<Pix> &raster, BordersReader &reader,
bool onlyCorners) {
@@ -305,27 +324,5 @@ void readMeshes(const TRasterPT<Pix> &raster, ImageMeshesReaderT<Pix> &reader) {
raster->unlock();
}
-//--------------------------------------------------------------
-
-// Standard type instantiations
-
-template DV_EXPORT_API class RasterEdgeIterator<PixelSelector<TPixel32>>;
-template DV_EXPORT_API class RasterEdgeIterator<PixelSelector<TPixel64>>;
-template DV_EXPORT_API class RasterEdgeIterator<PixelSelector<TPixelGR8>>;
-template DV_EXPORT_API class RasterEdgeIterator<PixelSelector<TPixelGR16>>;
-template DV_EXPORT_API class RasterEdgeIterator<PixelSelector<TPixelCM32>>;
-
-template DV_EXPORT_API void readMeshes<TPixel32>(
- const TRasterPT<TPixel32> &raster, ImageMeshesReaderT<TPixel32> &reader);
-template DV_EXPORT_API void readMeshes<TPixel64>(
- const TRasterPT<TPixel64> &raster, ImageMeshesReaderT<TPixel64> &reader);
-template DV_EXPORT_API void readMeshes<TPixelGR8>(
- const TRasterPT<TPixelGR8> &raster, ImageMeshesReaderT<TPixelGR8> &reader);
-template DV_EXPORT_API void readMeshes<TPixelGR16>(
- const TRasterPT<TPixelGR16> &raster,
- ImageMeshesReaderT<TPixelGR16> &reader);
-template DV_EXPORT_API void readMeshes<TPixelCM32>(
- const TRasterPT<TPixelCM32> &raster,
- ImageMeshesReaderT<TPixelCM32> &reader);
}
} // namespace TRop::borders
diff --git a/toonz/sources/common/tsound/tsound_nt.cpp b/toonz/sources/common/tsound/tsound_nt.cpp
index b36552cb3..94a18e366 100644
--- a/toonz/sources/common/tsound/tsound_nt.cpp
+++ b/toonz/sources/common/tsound/tsound_nt.cpp
@@ -62,11 +62,13 @@ private:
};
#endif
-int makeDWORD(const short lo, const short hi) {
+/*
+static int makeDWORD(const short lo, const short hi) {
int dw = hi << 16;
dw |= lo;
return dw;
}
+*/
//==============================================================================
class WavehdrQueue;
@@ -136,7 +138,7 @@ private:
//==============================================================================
-WAVEHDR *prepareWaveHeader(HWAVEOUT wout, const TSoundTrackP &subTrack,
+static WAVEHDR *prepareWaveHeader(HWAVEOUT wout, const TSoundTrackP &subTrack,
ULONG &count) {
WAVEHDR *whdr = new WAVEHDR;
memset(whdr, 0, sizeof(WAVEHDR));
diff --git a/toonz/sources/common/tstream/tstream.cpp b/toonz/sources/common/tstream/tstream.cpp
index 7540dadc2..c4d3bc280 100644
--- a/toonz/sources/common/tstream/tstream.cpp
+++ b/toonz/sources/common/tstream/tstream.cpp
@@ -15,7 +15,6 @@
#include <sstream>
#include <memory>
-#include <strstream>
using namespace std;
diff --git a/toonz/sources/common/tvectorimage/tstroke.cpp b/toonz/sources/common/tvectorimage/tstroke.cpp
index 951f89486..c53e36baa 100644
--- a/toonz/sources/common/tvectorimage/tstroke.cpp
+++ b/toonz/sources/common/tvectorimage/tstroke.cpp
@@ -389,15 +389,14 @@ if (maxRow <=0 ) maxRow = MAX_ROW;
typename T::const_iterator cit;
cit = c.begin();
-ostrstream oss1;
+stringstream oss1;
oss1<<'['<<c.size()<<']'<<"=\n";
TSystem::outputDebug( oss1.str() );
-oss1.freeze(false);
int counter = 0;
for( ; cit != c.end(); ++cit)
{
-ostrstream oss;
+stringstream oss;
if( ++counter == maxRow-1)
{
oss<<'\n';
@@ -405,7 +404,6 @@ if( ++counter == maxRow-1)
}
oss<<(*cit)<<'\n'<<'\0';
TSystem::outputDebug( oss.str() );
-oss.freeze(false);
}
*/
}
diff --git a/toonz/sources/common/tvrender/qtofflinegl.cpp b/toonz/sources/common/tvrender/qtofflinegl.cpp
index fc44d72d6..bc434e5ca 100644
--- a/toonz/sources/common/tvrender/qtofflinegl.cpp
+++ b/toonz/sources/common/tvrender/qtofflinegl.cpp
@@ -6,9 +6,9 @@
//-----------------------------------------------------------------------------
-#ifdef _WIN32
+#if 0 // was _WIN32, this function not used
-void swapRedBlueChannels(
+static void swapRedBlueChannels(
void *buffer,
int bufferSize) // Flips The Red And Blue Bytes (WidthxHeight)
{
diff --git a/toonz/sources/common/tvrender/tofflinegl.cpp b/toonz/sources/common/tvrender/tofflinegl.cpp
index 000e6df20..b4a3c8318 100644
--- a/toonz/sources/common/tvrender/tofflinegl.cpp
+++ b/toonz/sources/common/tvrender/tofflinegl.cpp
@@ -298,7 +298,7 @@ public:
};
// default imp generator
-std::shared_ptr<TOfflineGL::Imp> defaultOfflineGLGenerator(
+static std::shared_ptr<TOfflineGL::Imp> defaultOfflineGLGenerator(
const TDimension &dim, std::shared_ptr<TOfflineGL::Imp> shared) {
return std::make_shared<WIN32Implementation>(dim, shared);
}
@@ -710,13 +710,13 @@ TNZ_MACHINE_CHANNEL_ORDER_MRGB
GLenum fmt = TGL_FMT;
/*
-#ifdef TNZ_MACHINE_CHANNEL_ORDER_BGRM
+#if defined(TNZ_MACHINE_CHANNEL_ORDER_BGRM)
GL_BGRA_EXT;
-#elif TNZ_MACHINE_CHANNEL_ORDER_MBGR
+#elif defined(TNZ_MACHINE_CHANNEL_ORDER_MBGR)
GL_ABGR_EXT;
-#elif TNZ_MACHINE_CHANNEL_ORDER_RGBM
+#elif defined(TNZ_MACHINE_CHANNEL_ORDER_RGBM)
GL_RGBA;
-#elif TNZ_MACHINE_CHANNEL_ORDER_MRGB
+#elif defined(TNZ_MACHINE_CHANNEL_ORDER_MRGB)
#warning "to do"
GL_ABGR_EXT;
#else
diff --git a/toonz/sources/common/twain/ttwain_state.c b/toonz/sources/common/twain/ttwain_state.c
index a9c798483..5a8b907b2 100644
--- a/toonz/sources/common/twain/ttwain_state.c
+++ b/toonz/sources/common/twain/ttwain_state.c
@@ -676,9 +676,9 @@ static BOOL CALLBACK myHackEnumFunction2(HWND hwnd, LPARAM lParam) {
/*---------------------------------------------------------------------------*/
-void bringToTop(HWND hwnd) { BringWindowToTop(hwnd); }
+static void bringToTop(HWND hwnd) { BringWindowToTop(hwnd); }
-void putToBottom(HWND hwnd) {
+static void putToBottom(HWND hwnd) {
const int unused = 0;
BOOL rc = SetWindowPos(hwnd, // handle to window
diff --git a/toonz/sources/common/twain/ttwain_win.c b/toonz/sources/common/twain/ttwain_win.c
index 498a9555d..ec59606b7 100644
--- a/toonz/sources/common/twain/ttwain_win.c
+++ b/toonz/sources/common/twain/ttwain_win.c
@@ -13,9 +13,9 @@ int TTWAIN_EnableWindow(void *hwnd, int flag) {
return TTWAIN_EnableWindowPD(hwnd, flag);
}
-void TTWAIN_EmptyMessageQueue(void) { TTWAIN_EmptyMessageQueuePD(); }
+//static void TTWAIN_EmptyMessageQueue(void) { TTWAIN_EmptyMessageQueuePD(); }
-void TTWAIN_ModalEventLoop(void) { TTWAIN_ModalEventLoopPD(); }
+//static void TTWAIN_ModalEventLoop(void) { TTWAIN_ModalEventLoopPD(); }
#ifdef __cplusplus
}
diff --git a/toonz/sources/image/compatibility/tfile_io.c b/toonz/sources/image/compatibility/tfile_io.c
index 20ca6b8a3..8fabd3bc1 100644
--- a/toonz/sources/image/compatibility/tfile_io.c
+++ b/toonz/sources/image/compatibility/tfile_io.c
@@ -7,7 +7,7 @@
#include <windows.h>
#include <assert.h>
-LPSTR AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp) {
+static LPSTR AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp) {
assert(lpw != NULL);
assert(lpa != NULL);
/*
diff --git a/toonz/sources/include/ext/plasticskeleton.h b/toonz/sources/include/ext/plasticskeleton.h
index a7a339f3e..2e95de88a 100644
--- a/toonz/sources/include/ext/plasticskeleton.h
+++ b/toonz/sources/include/ext/plasticskeleton.h
@@ -8,6 +8,8 @@
// TnzCore includes
#include "tsmartpointer.h"
#include "tpersist.h"
+#include "tmeshimage.h" // add imported template
+ // instance tcg::Vertex<TPointD> (for Windows dll)
// TnzExt includes
#include "plastichandle.h"
diff --git a/toonz/sources/include/tdoubleparam.h b/toonz/sources/include/tdoubleparam.h
index f5412ca2f..70a637e03 100644
--- a/toonz/sources/include/tdoubleparam.h
+++ b/toonz/sources/include/tdoubleparam.h
@@ -156,9 +156,9 @@ public:
std::string getValueAlias(double frame, int precision) override;
};
-DV_IMPORT_API void splitSpeedInOutSegment(TDoubleKeyframe &k,
- TDoubleKeyframe &k0,
- TDoubleKeyframe &k1);
+DVAPI void splitSpeedInOutSegment(TDoubleKeyframe &k,
+ TDoubleKeyframe &k0,
+ TDoubleKeyframe &k1);
//---------------------------------------------------------
diff --git a/toonz/sources/include/tfx.h b/toonz/sources/include/tfx.h
index 02ea1f270..734613f6a 100644
--- a/toonz/sources/include/tfx.h
+++ b/toonz/sources/include/tfx.h
@@ -210,16 +210,16 @@ public:
double m_end;
};
-inline DVAPI TFxTimeRegion operator+(const TFxTimeRegion &tr1,
- const TFxTimeRegion &tr2) {
+inline TFxTimeRegion operator+(const TFxTimeRegion &tr1,
+ const TFxTimeRegion &tr2) {
return TFxTimeRegion(tr1) += tr2;
}
-inline DVAPI TFxTimeRegion operator+(const TFxTimeRegion &tr1, double shift) {
+inline TFxTimeRegion operator+(const TFxTimeRegion &tr1, double shift) {
return TFxTimeRegion(tr1) += shift;
}
-inline DVAPI TFxTimeRegion operator-(const TFxTimeRegion &tr1, double shift) {
+inline TFxTimeRegion operator-(const TFxTimeRegion &tr1, double shift) {
return TFxTimeRegion(tr1) -= shift;
}
diff --git a/toonz/sources/include/tgl.h b/toonz/sources/include/tgl.h
index fa2cdcbb1..6708e5b5d 100644
--- a/toonz/sources/include/tgl.h
+++ b/toonz/sources/include/tgl.h
@@ -151,9 +151,9 @@ inline void tglDrawSegment(double x0, double y0, double x1, double y1) {
*/
DVAPI void tglDrawRect(const TRectD &rect);
-inline void DVAPI tglDrawRect(const TRect &rect) { tglDrawRect(convert(rect)); }
+inline void tglDrawRect(const TRect &rect) { tglDrawRect(convert(rect)); }
-inline void DVAPI tglDrawRect(double x0, double y0, double x1, double y1) {
+inline void tglDrawRect(double x0, double y0, double x1, double y1) {
tglDrawRect(TRectD(x0, y0, x1, y1));
}
@@ -162,9 +162,9 @@ inline void DVAPI tglDrawRect(double x0, double y0, double x1, double y1) {
*/
DVAPI void tglFillRect(const TRectD &rect);
-inline void DVAPI tglFillRect(const TRect &rect) { tglFillRect(convert(rect)); }
+inline void tglFillRect(const TRect &rect) { tglFillRect(convert(rect)); }
-inline void DVAPI tglFillRect(double x0, double y0, double x1, double y1) {
+inline void tglFillRect(double x0, double y0, double x1, double y1) {
tglFillRect(TRectD(x0, y0, x1, y1));
}
diff --git a/toonz/sources/include/tmeshimage.h b/toonz/sources/include/tmeshimage.h
index ff4775cee..edba32513 100644
--- a/toonz/sources/include/tmeshimage.h
+++ b/toonz/sources/include/tmeshimage.h
@@ -91,10 +91,6 @@ public:
}
};
-//-----------------------------------------------------------------------------
-
-typedef tcg::Vertex<RigidPoint> TTextureVertex;
-
//=================================================================================
namespace tcg {
@@ -111,6 +107,16 @@ struct point_traits<RigidPoint> {
} // namespace tcg
+//-----------------------------------------------------------------------------
+
+template class DVAPI tcg::Vertex<TPointD>;
+template class DVAPI tcg::Vertex<RigidPoint>;
+
+typedef tcg::Vertex<RigidPoint> TTextureVertex;
+
+template class DVAPI tcg::Mesh<TTextureVertex, tcg::Edge, tcg::FaceN<3>>;
+template class DVAPI tcg::TriMesh<TTextureVertex, tcg::Edge, tcg::FaceN<3>>;
+
//***********************************************************************************
// TTextureMesh (Textured Mesh Type) declaration
//***********************************************************************************
diff --git a/toonz/sources/include/toonzqt/gutil.h b/toonz/sources/include/toonzqt/gutil.h
index 85004b380..16d984d0b 100644
--- a/toonz/sources/include/toonzqt/gutil.h
+++ b/toonz/sources/include/toonzqt/gutil.h
@@ -93,10 +93,10 @@ QIcon DVAPI createQIconPNG(const char *iconPNGName);
QIcon DVAPI createQIconOnOff(const char *iconSVGName, bool withOver = true);
QIcon DVAPI createQIconOnOffPNG(const char *iconPNGName, bool withOver = true);
-inline QSize DVAPI dimension2QSize(const TDimension &sz) {
+inline QSize dimension2QSize(const TDimension &sz) {
return QSize(sz.lx, sz.ly);
}
-inline TDimension DVAPI qsize2Dimension(const QSize &sz) {
+inline TDimension qsize2Dimension(const QSize &sz) {
return TDimension(sz.width(), sz.height());
}
QString DVAPI toQString(const TFilePath &path);
@@ -117,33 +117,33 @@ bool DVAPI isResourceOrFolder(const QUrl &url);
bool DVAPI acceptResourceDrop(const QList<QUrl> &urls);
bool DVAPI acceptResourceOrFolderDrop(const QList<QUrl> &urls);
-inline QPointF DVAPI toQPointF(const TPointD &p) { return QPointF(p.x, p.y); }
-inline QPointF DVAPI toQPointF(const TPoint &p) { return QPointF(p.x, p.y); }
-inline QPoint DVAPI toQPoint(const TPoint &p) { return QPoint(p.x, p.y); }
-inline TPointD DVAPI toTPointD(const QPointF &p) {
+inline QPointF toQPointF(const TPointD &p) { return QPointF(p.x, p.y); }
+inline QPointF toQPointF(const TPoint &p) { return QPointF(p.x, p.y); }
+inline QPoint toQPoint(const TPoint &p) { return QPoint(p.x, p.y); }
+inline TPointD toTPointD(const QPointF &p) {
return TPointD(p.x(), p.y());
}
-inline TPointD DVAPI toTPointD(const QPoint &p) {
+inline TPointD toTPointD(const QPoint &p) {
return TPointD(p.x(), p.y());
}
-inline TPoint DVAPI toTPoint(const QPoint &p) { return TPoint(p.x(), p.y()); }
+inline TPoint toTPoint(const QPoint &p) { return TPoint(p.x(), p.y()); }
-inline QRect DVAPI toQRect(const TRect &r) {
+inline QRect toQRect(const TRect &r) {
return QRect(r.x0, r.y0, r.getLx(), r.getLy());
}
-inline QRectF DVAPI toQRectF(const TRectD &r) {
+inline QRectF toQRectF(const TRectD &r) {
return QRectF(r.x0, r.y0, r.getLx(), r.getLy());
}
-inline QRectF DVAPI toQRectF(const TRect &r) {
+inline QRectF toQRectF(const TRect &r) {
return QRectF(r.x0, r.y0, r.getLx(), r.getLy());
}
-inline TRect DVAPI toTRect(const QRect &r) {
+inline TRect toTRect(const QRect &r) {
return TRect(r.left(), r.top(), r.right(), r.bottom());
}
-inline TRectD DVAPI toTRectD(const QRectF &r) {
+inline TRectD toTRectD(const QRectF &r) {
return TRectD(r.left(), r.top(), r.right(), r.bottom());
}
-inline TRectD DVAPI toTRectD(const QRect &r) {
+inline TRectD toTRectD(const QRect &r) {
return TRectD(r.left(), r.top(), r.right() + 1, r.bottom() + 1);
}
diff --git a/toonz/sources/include/tpixelutils.h b/toonz/sources/include/tpixelutils.h
index 69eb988e6..b57036b3f 100644
--- a/toonz/sources/include/tpixelutils.h
+++ b/toonz/sources/include/tpixelutils.h
@@ -61,7 +61,7 @@ inline T antialias(const T &a, int num) {
*/
template <class T, class Q>
-DVAPI inline T overPixT(const T &bot, const T &top) {
+inline T overPixT(const T &bot, const T &top) {
UINT max = T::maxChannelValue;
if (top.m == max) return top;
@@ -78,7 +78,7 @@ DVAPI inline T overPixT(const T &bot, const T &top) {
//-----------------------------------------------------------------------------
template <class T, class S, class Q>
-DVAPI inline T overPixGRT(const T &bot, const S &top) {
+inline T overPixGRT(const T &bot, const S &top) {
UINT max = T::maxChannelValue;
if (top.value == max) return T(top.value, top.value, top.value, top.value);
@@ -98,8 +98,7 @@ DVAPI inline T overPixGRT(const T &bot, const S &top) {
// as the other, but without if's. it's quicker if you know for sure that top.m
// is not 0 or 255.
template <class T, class Q>
-
-DVAPI inline T quickOverPixT(const T &bot, const T &top) {
+inline T quickOverPixT(const T &bot, const T &top) {
UINT max = T::maxChannelValue;
TUINT32 r = top.r + bot.r * (max - top.m) / max;
@@ -113,8 +112,7 @@ DVAPI inline T quickOverPixT(const T &bot, const T &top) {
//------------------------------------------------------------------------------------
template <class T, class Q>
-
-DVAPI inline T quickOverPixPremultT(const T &bot, const T &top) {
+inline T quickOverPixPremultT(const T &bot, const T &top) {
UINT max = T::maxChannelValue;
TUINT32 r = (top.r * top.m + bot.r * (max - top.m)) / max;
@@ -128,7 +126,7 @@ DVAPI inline T quickOverPixPremultT(const T &bot, const T &top) {
/*-- Show raster images darken-blended on the viewer --*/
/* references from ino_blend_darken.cpp */
template <class T, class Q>
-DVAPI inline T quickOverPixDarkenBlendedT(const T &bot, const T &top) {
+inline T quickOverPixDarkenBlendedT(const T &bot, const T &top) {
struct locals {
static inline double comp(const double ch_a, const double ch_b,
const double alpha) {
@@ -176,7 +174,7 @@ DVAPI inline T quickOverPixDarkenBlendedT(const T &bot, const T &top) {
//-----------------------------------------------------------------------------
template <class T, class S, class Q>
-DVAPI inline T quickOverPixGRT(const T &bot, const S &top) {
+inline T quickOverPixGRT(const T &bot, const S &top) {
UINT max = T::maxChannelValue;
double aux = (max - top.value) / max;
@@ -190,70 +188,70 @@ DVAPI inline T quickOverPixGRT(const T &bot, const S &top) {
//-----------------------------------------------------------------------------
-DVAPI inline TPixel32 overPix(const TPixel32 &bot, const TPixelGR8 &top) {
+inline TPixel32 overPix(const TPixel32 &bot, const TPixelGR8 &top) {
return overPixGRT<TPixel32, TPixelGR8, UCHAR>(bot, top);
}
//-----------------------------------------------------------------------------
-DVAPI inline TPixel64 overPix(const TPixel64 &bot, const TPixelGR16 &top) {
+inline TPixel64 overPix(const TPixel64 &bot, const TPixelGR16 &top) {
return overPixGRT<TPixel64, TPixelGR16, USHORT>(bot, top);
}
//-----------------------------------------------------------------------------
-DVAPI inline TPixel32 overPix(const TPixel32 &bot, const TPixel32 &top) {
+inline TPixel32 overPix(const TPixel32 &bot, const TPixel32 &top) {
return overPixT<TPixel32, UCHAR>(bot, top);
}
//-----------------------------------------------------------------------------
-DVAPI inline TPixel64 overPix(const TPixel64 &bot, const TPixel64 &top) {
+inline TPixel64 overPix(const TPixel64 &bot, const TPixel64 &top) {
return overPixT<TPixel64, USHORT>(bot, top);
}
//-----------------------------------------------------------------------------
-DVAPI inline TPixel32 quickOverPix(const TPixel32 &bot, const TPixelGR8 &top) {
+inline TPixel32 quickOverPix(const TPixel32 &bot, const TPixelGR8 &top) {
return quickOverPixGRT<TPixel32, TPixelGR8, UCHAR>(bot, top);
}
//-----------------------------------------------------------------------------
-DVAPI inline TPixel64 quickOverPix(const TPixel64 &bot, const TPixelGR16 &top) {
+inline TPixel64 quickOverPix(const TPixel64 &bot, const TPixelGR16 &top) {
return quickOverPixGRT<TPixel64, TPixelGR16, USHORT>(bot, top);
}
//-----------------------------------------------------------------------------
-DVAPI inline TPixel32 quickOverPix(const TPixel32 &bot, const TPixel32 &top) {
+inline TPixel32 quickOverPix(const TPixel32 &bot, const TPixel32 &top) {
return quickOverPixT<TPixel32, UCHAR>(bot, top);
}
//-----------------------------------------------------------------------------
-DVAPI inline TPixel32 quickOverPixPremult(const TPixel32 &bot,
- const TPixel32 &top) {
+inline TPixel32 quickOverPixPremult(const TPixel32 &bot,
+ const TPixel32 &top) {
return quickOverPixPremultT<TPixel32, UCHAR>(bot, top);
}
//-----------------------------------------------------------------------------
-DVAPI inline TPixel64 quickOverPix(const TPixel64 &bot, const TPixel64 &top) {
+inline TPixel64 quickOverPix(const TPixel64 &bot, const TPixel64 &top) {
return quickOverPixT<TPixel64, USHORT>(bot, top);
}
//------------------------------------------------------------------------------------
-DVAPI inline TPixel32 quickOverPixDarkenBlended(const TPixel32 &bot,
- const TPixel32 &top) {
+inline TPixel32 quickOverPixDarkenBlended(const TPixel32 &bot,
+ const TPixel32 &top) {
return quickOverPixDarkenBlendedT<TPixel32, UCHAR>(bot, top);
}
//-----------------------------------------------------------------------------
template <class T, class Q>
-DVAPI inline void overPix(T &outPix, const T &bot, const T &top) {
+inline void overPix(T &outPix, const T &bot, const T &top) {
UINT max = T::maxChannelValue;
if (top.m == max)
@@ -272,7 +270,7 @@ DVAPI inline void overPix(T &outPix, const T &bot, const T &top) {
//-----------------------------------------------------------------------------
-DVAPI inline TPixel32 overPixOnWhite(const TPixel32 &top) {
+inline TPixel32 overPixOnWhite(const TPixel32 &top) {
UINT max = TPixel32::maxChannelValue;
if (top.m == max)
@@ -284,7 +282,7 @@ DVAPI inline TPixel32 overPixOnWhite(const TPixel32 &top) {
top.b + max - top.m, max);
}
-DVAPI inline TPixel32 overPixOnBlack(const TPixel32 &top) {
+inline TPixel32 overPixOnBlack(const TPixel32 &top) {
UINT max = TPixel32::maxChannelValue;
if (top.m == max) return top;
@@ -299,7 +297,7 @@ DVAPI inline TPixel32 overPixOnBlack(const TPixel32 &top) {
/*! this function combines two GR8 pixels returning the darker.
*/
-DVAPI inline TPixelGR8 over(const TPixelGR8 &bot, const TPixelGR8 &top) {
+inline TPixelGR8 over(const TPixelGR8 &bot, const TPixelGR8 &top) {
return TPixelGR8(std::min(bot.value, top.value));
}
@@ -333,7 +331,7 @@ DVAPI inline TPixelGR8 over(const TPixelGR8 &bot, const TPixelGR8 &top) {
//-----------------------------------------------------------------------------
-DVAPI inline void premult(TPixel32 &pix) {
+inline void premult(TPixel32 &pix) {
const int MAGICFAC = (257U * 256U + 1U);
UINT fac = MAGICFAC * pix.m;
@@ -342,20 +340,20 @@ DVAPI inline void premult(TPixel32 &pix) {
pix.b = (UINT)(pix.b * fac + (1U << 23)) >> 24;
}
-DVAPI inline void premult(TPixel64 &pix) {
+inline void premult(TPixel64 &pix) {
pix.r = pix.r * pix.m / 65535.0;
pix.g = pix.g * pix.m / 65535.0;
pix.b = pix.b * pix.m / 65535.0;
}
-DVAPI inline void depremult(TPixel32 &pix) {
+inline void depremult(TPixel32 &pix) {
float fac = 255.0f / pix.m;
pix.r = std::min(pix.r * fac, 255.0f);
pix.g = std::min(pix.g * fac, 255.0f);
pix.b = std::min(pix.b * fac, 255.0f);
}
-DVAPI inline void depremult(TPixel64 &pix) {
+inline void depremult(TPixel64 &pix) {
double fac = 65535.0 / pix.m;
pix.r = std::min(pix.r * fac, 65535.0);
pix.g = std::min(pix.g * fac, 65535.0);
@@ -372,7 +370,7 @@ const double *depremultiplyTable();
//-----------------------------------------------------------------------------
-DVAPI inline TPixel32 premultiply(const TPixel32 &pix) {
+inline TPixel32 premultiply(const TPixel32 &pix) {
const int MAGICFAC = (257U * 256U + 1U);
UINT fac = MAGICFAC * pix.m;
@@ -381,17 +379,17 @@ DVAPI inline TPixel32 premultiply(const TPixel32 &pix) {
((UINT)(pix.b * fac + (1U << 23)) >> 24), pix.m);
}
-DVAPI inline TPixel64 premultiply(const TPixel64 &pix) {
+inline TPixel64 premultiply(const TPixel64 &pix) {
return TPixel64(pix.r * pix.m / 65535.0, pix.g * pix.m / 65535.0,
pix.b * pix.m / 65535.0, pix.m);
}
-DVAPI inline TPixel32 depremultiply(const TPixel32 &pix) {
+inline TPixel32 depremultiply(const TPixel32 &pix) {
return TPixel32(pix.r * 255.0 / pix.m, pix.g * 255.0 / pix.m,
pix.b * 255.0 / pix.m, pix.m);
}
-DVAPI inline TPixel64 depremultiply(const TPixel64 &pix) {
+inline TPixel64 depremultiply(const TPixel64 &pix) {
return TPixel64(pix.r * 65535.0 / pix.m, pix.g * 65535.0 / pix.m,
pix.b * 65535.0 / pix.m, pix.m);
}
diff --git a/toonz/sources/include/traster.h b/toonz/sources/include/traster.h
index b7ad6f53d..13ce6b75d 100644
--- a/toonz/sources/include/traster.h
+++ b/toonz/sources/include/traster.h
@@ -62,6 +62,17 @@ class TRasterPT;
class TRaster;
typedef TSmartPointerT<TRaster> TRasterP;
+
+//------------------------------------------------------------
+
+//
+// Smart Pointer a TRaster
+//
+
+#ifdef _WIN32
+template class DVAPI TSmartPointerT<TRaster>;
+#endif
+
//=========================================================
/*!This class stores bitmap images. */
class DVAPI TRaster : public TSmartObject {
@@ -205,16 +216,6 @@ private:
//------------------------------------------------------------
-//
-// Smart Pointer a TRaster
-//
-
-#ifdef _WIN32
-template class DVAPI TSmartPointerT<TRaster>;
-#endif
-
-//------------------------------------------------------------
-
inline void detach(TRasterP &r) {
if (!r || r->getRefCount() == 1) return;
TRasterP tmp(r->clone());
diff --git a/toonz/sources/include/trop_borders.h b/toonz/sources/include/trop_borders.h
index c42047315..2d15eebfc 100644
--- a/toonz/sources/include/trop_borders.h
+++ b/toonz/sources/include/trop_borders.h
@@ -48,6 +48,14 @@
namespace TRop {
namespace borders {
+// Standard type instantiations
+
+template class DVAPI RasterEdgeIterator<PixelSelector<TPixel32>>;
+template class DVAPI RasterEdgeIterator<PixelSelector<TPixel64>>;
+template class DVAPI RasterEdgeIterator<PixelSelector<TPixelGR8>>;
+template class DVAPI RasterEdgeIterator<PixelSelector<TPixelGR16>>;
+template class DVAPI RasterEdgeIterator<PixelSelector<TPixelCM32>>;
+
//**********************************************************************
// Borders Extraction Reader (callbacks container)
//**********************************************************************
@@ -158,9 +166,16 @@ class ImageMesh final : public TSmartObject,
//--------------------------------------------------------------------------------
+}
+} // namespace TRop::borders
+
#ifdef _WIN32
-template class TSmartPointerT<ImageMesh>;
+template class DVAPI TSmartPointerT<TRop::borders::ImageMesh>;
#endif
+
+namespace TRop {
+namespace borders {
+
typedef TSmartPointerT<ImageMesh> ImageMeshP;
//**********************************************************************
@@ -250,6 +265,9 @@ public:
template <typename Pixel>
void readMeshes(const TRasterPT<Pixel> &raster,
ImageMeshesReaderT<Pixel> &reader);
+
+//--------------------------------------------------------------------------------
+
}
} // namespace TRop::borders
diff --git a/toonz/sources/include/tthread.h b/toonz/sources/include/tthread.h
index 32ca58019..8f9dff9ea 100644
--- a/toonz/sources/include/tthread.h
+++ b/toonz/sources/include/tthread.h
@@ -34,9 +34,12 @@ void DVAPI shutdown();
class ExecutorId; // Private
class Runnable;
-#if !(defined(MACOSX) || defined(LINUX))
-template class TSmartPointerT<Runnable>;
+} // namespace TThread
+#ifdef _WIN32
+template class DVAPI TSmartPointerT<TThread::Runnable>;
#endif
+namespace TThread {
+
typedef TSmartPointerT<Runnable> RunnableP;
//------------------------------------------------------------------------------
diff --git a/toonz/sources/include/ttzpimagefx.h b/toonz/sources/include/ttzpimagefx.h
index 76b87b219..5f0025a47 100644
--- a/toonz/sources/include/ttzpimagefx.h
+++ b/toonz/sources/include/ttzpimagefx.h
@@ -10,9 +10,6 @@
// TnzBase includes
#include "trasterfxrenderdata.h"
-// TnzExt includes
-#include "ext/plasticskeletondeformation.h"
-
// STD includes
#include <vector>
#include <set>
diff --git a/toonz/sources/stdfx/iwa_particlesengine.cpp b/toonz/sources/stdfx/iwa_particlesengine.cpp
index 0e41d9fa1..d0a63c500 100644
--- a/toonz/sources/stdfx/iwa_particlesengine.cpp
+++ b/toonz/sources/stdfx/iwa_particlesengine.cpp
@@ -27,13 +27,13 @@
#include <QMutex>
#include <QMutexLocker>
-#include <strstream>
+#include <sstream>
namespace {
QMutex mutex;
void printTime(TStopWatch &sw, std::string name) {
- std::ostrstream ss;
+ std::stringstream ss;
ss << name << " : ";
sw.print(ss);
ss << '\n' << '\0';
diff --git a/toonz/sources/stdfx/particlesengine.cpp b/toonz/sources/stdfx/particlesengine.cpp
index f13a74b19..1a480db9d 100644
--- a/toonz/sources/stdfx/particlesengine.cpp
+++ b/toonz/sources/stdfx/particlesengine.cpp
@@ -26,7 +26,7 @@
#include "trenderer.h"
-#include <strstream>
+#include <sstream>
/*-----------------------------------------------------------------*/
@@ -34,7 +34,7 @@ Particles_Engine::Particles_Engine(ParticlesFx *parent, double frame)
: m_parent(parent), m_frame(frame) {}
static void printTime(TStopWatch &sw, std::string name) {
- std::ostrstream ss;
+ std::stringstream ss;
ss << name << " : ";
sw.print(ss);
ss << '\n' << '\0';
diff --git a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp
index 462523d80..0ae71b5e4 100644
--- a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp
+++ b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_M.cpp
@@ -3,7 +3,7 @@
#include "TUSBScannerIO.h"
#include "tsystem.h"
#include <iostream>
-#include <strstream>
+#include <sstream>
//#define HAS_LIBUSB
@@ -46,7 +46,7 @@ TUSBScannerIOPD::TUSBScannerIOPD()
namespace {
void buf2printable(const unsigned char *buffer, const int size,
- ostrstream &os) {
+ stringstream &os) {
int i = 0;
if ((size == 2) && (buffer[0] == 0x1b)) {
os << "ESC ";
@@ -155,8 +155,7 @@ int TUSBScannerIO::receive(unsigned char *buffer, int size) {
30 * 1000);
if (m_data->m_trace) {
- ostrstream os;
- os.freeze(false);
+ stringstream os;
os << "receive: size=" << size << " got = " << count << " buf=";
buf2printable(buffer, count, os);
os << '\n' << '\0';
@@ -184,8 +183,7 @@ int TUSBScannerIO::send(unsigned char *buffer, int size) {
count = usb_bulk_write(m_data->m_handle, m_data->m_epW, (char *)buffer, size,
30 * 1000);
if (m_data->m_trace) {
- ostrstream os;
- os.freeze(false);
+ stringstream os;
os << "send: size=" << size << " wrote = " << count << " buf=";
buf2printable(buffer, size, os);
os << '\n' << '\0';
diff --git a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp
index e248b72cd..45e2b715b 100644
--- a/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp
+++ b/toonz/sources/tnzbase/tscanner/TScannerIO/TUSBScannerIO_W.cpp
@@ -5,7 +5,7 @@
#include <windows.h>
-#include <strstream>
+#include <sstream>
class TUSBScannerIOPD {
public:
@@ -17,7 +17,7 @@ public:
//-----------------------------------------------------------------------------
namespace {
void buf2printable(const unsigned char *buffer, const int size,
- std::ostrstream &os) {
+ std::stringstream &os) {
int i = 0;
if ((size == 2) && (buffer[0] == 0x1b)) {
os << "ESC ";
@@ -79,8 +79,7 @@ int TUSBScannerIO::receive(unsigned char *buffer, int size) {
ReadFile(m_data->m_handle, ptr, bytesToRead, &count, &overlapped);
DWORD waitRC = WaitForSingleObject(overlapped.hEvent, INFINITE);
if (m_data->m_trace) {
- std::ostrstream os;
- os.freeze(false);
+ std::stringstream os;
os << "receive: size=" << size << " got = " << count << " buf=";
buf2printable(ptr, count, os);
os << '\n' << '\0';
@@ -109,8 +108,7 @@ int TUSBScannerIO::send(unsigned char *buffer, int size) {
WriteFile(m_data->m_handle, buffer, bytesToWrite, &count, 0);
if (m_data->m_trace) {
- std::ostrstream os;
- os.freeze(false);
+ std::stringstream os;
os << "send: size=" << size << " wrote = " << count << " buf=";
buf2printable(buffer, size, os);
os << '\n' << '\0';
diff --git a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp
index 2cc40ee63..f3ac822f5 100644
--- a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp
+++ b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp
@@ -14,7 +14,7 @@
#include <cassert>
#include <memory>
#include <fstream>
-#include <strstream>
+#include <sstream>
using namespace TScannerUtil;
@@ -311,7 +311,7 @@ throw TException("Scan area too large, select a correct paper size");
bytes_to_read = lines * counter;
if (stx != 0x02) {
- std::ostrstream os;
+ std::stringstream os;
os << "header corrupted (" << std::hex << stx << ")" << '\0';
throw TException(os.str());
}
@@ -641,8 +641,7 @@ throw TException("Scanner error resetting");
#ifdef _DEBUG
memcpy(&status, &(buffer2[1]), 1);
- std::ostrstream os;
- os.freeze(false);
+ std::stringstream os;
os << "stx = " << stx << " status = " << status << " counter=" << counter
<< '\n'
<< '\0';
@@ -754,8 +753,7 @@ bool TScannerEpson::expectACK() {
#ifdef _DEBUG
if (ack != ACK) {
- std::ostrstream os;
- os.freeze(false);
+ std::stringstream os;
os << "ack fails ret = 0x" << std::hex << (int)ack << '\n' << '\0';
TSystem::outputDebug(os.str());
}
@@ -939,8 +937,7 @@ void TScannerEpson::ESCI_readLineData(unsigned char &stx, unsigned char &status,
status = buffer[1];
#ifdef _DEBUG
- std::ostrstream os;
- os.freeze(false);
+ std::stringstream os;
os << "fatal=" << fatalError;
os << " notReady=" << notReady;
@@ -973,8 +970,7 @@ void TScannerEpson::ESCI_readLineData2(unsigned char &stx,
status = buffer[1];
#ifdef _DEBUG
- std::ostrstream os;
- os.freeze(false);
+ std::stringstream os;
os << "fatal=" << fatalError;
os << " notReady=" << notReady;
diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp
index bfa82067d..8fa8452b3 100644
--- a/toonz/sources/toonz/main.cpp
+++ b/toonz/sources/toonz/main.cpp
@@ -396,7 +396,9 @@ int main(int argc, char *argv[]) {
fmt.setStencil(true);
QGLFormat::setDefaultFormat(fmt);
-#ifdef LINUX
+ // seems this function should be called at all systems
+ // pheraps in some GLUT-implementations initalization is mere formality
+#if defined(LINUX) || (defined(_WIN32) && defined(__GNUC__))
glutInit(&argc, argv);
#endif
diff --git a/toonz/sources/toonz/pane.cpp b/toonz/sources/toonz/pane.cpp
index 4e632f0eb..09ab77639 100644
--- a/toonz/sources/toonz/pane.cpp
+++ b/toonz/sources/toonz/pane.cpp
@@ -457,25 +457,28 @@ void TPanelTitleBar::resizeEvent(QResizeEvent *e) {
//-----------------------------------------------------------------------------
TPanelFactory::TPanelFactory(QString panelType) : m_panelType(panelType) {
- assert(m_table.count(panelType) == 0);
- m_table[m_panelType] = this;
+ assert(tableInstance().count(panelType) == 0);
+ tableInstance()[m_panelType] = this;
}
//-----------------------------------------------------------------------------
-TPanelFactory::~TPanelFactory() { m_table.remove(m_panelType); }
+TPanelFactory::~TPanelFactory() { tableInstance().remove(m_panelType); }
//-----------------------------------------------------------------------------
-QMap<QString, TPanelFactory *> TPanelFactory::m_table;
+QMap<QString, TPanelFactory *>& TPanelFactory::tableInstance() {
+ static QMap<QString, TPanelFactory *> table;
+ return table;
+}
//-----------------------------------------------------------------------------
TPanel *TPanelFactory::createPanel(QWidget *parent, QString panelType) {
TPanel *panel = 0;
- QMap<QString, TPanelFactory *>::iterator it = m_table.find(panelType);
- if (it == m_table.end()) {
+ QMap<QString, TPanelFactory *>::iterator it = tableInstance().find(panelType);
+ if (it == tableInstance().end()) {
TPanel *panel = new TPanel(parent);
panel->setPanelType(panelType.toStdString());
return panel;
diff --git a/toonz/sources/toonz/pane.h b/toonz/sources/toonz/pane.h
index 3af30c397..2abc92d82 100644
--- a/toonz/sources/toonz/pane.h
+++ b/toonz/sources/toonz/pane.h
@@ -258,7 +258,7 @@ signals:
class TPanelFactory {
QString m_panelType;
- static QMap<QString, TPanelFactory *> m_table;
+ static QMap<QString, TPanelFactory *>& tableInstance();
public:
TPanelFactory(QString panelType);
diff --git a/toonz/sources/toonzfarm/tfarm/service.cpp b/toonz/sources/toonzfarm/tfarm/service.cpp
index 631b8b89a..9faa1c7dd 100644
--- a/toonz/sources/toonzfarm/tfarm/service.cpp
+++ b/toonz/sources/toonzfarm/tfarm/service.cpp
@@ -27,7 +27,7 @@
//------------------------------------------------------------------------------
-LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize) {
+static LPTSTR GetLastErrorText(LPTSTR lpszBuf, DWORD dwSize) {
DWORD dwRet;
LPTSTR lpszTemp = NULL;
diff --git a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp
index 6490fe1ea..ad75077f4 100644
--- a/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp
+++ b/toonz/sources/toonzfarm/tfarm/tfarmcontroller_c.cpp
@@ -8,7 +8,7 @@
#include "tfarmproxy.h"
#include "tfilepath_io.h"
-#include <strstream>
+#include <sstream>
namespace {
@@ -494,7 +494,7 @@ void loadControllerData(const TFilePath &fp, ControllerData &data) {
is.getline(line, 1024);
if (line[0] != '#' && QString(line) != "") {
- std::istrstream iss(line);
+ std::stringstream iss(line);
char hostName[512];
char ipAddr[80];
diff --git a/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp b/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp
index 024227aa3..7efb069aa 100644
--- a/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp
+++ b/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp
@@ -20,7 +20,7 @@
#include "tthread.h"
-#include <strstream>
+#include <sstream>
#include <string>
using namespace std;
@@ -691,7 +691,7 @@ void FarmController::loadServersData(const TFilePath &globalRoot) {
is.getline(line, 80);
if (line[0] != '#' && QString(line) != "") {
- istrstream iss(line);
+ stringstream iss(line);
char hostName[512];
char ipAddr[80];
diff --git a/toonz/sources/toonzfarm/tnzcore_stuff/tfilepath.cpp b/toonz/sources/toonzfarm/tnzcore_stuff/tfilepath.cpp
index 7b17dc198..237c89926 100644
--- a/toonz/sources/toonzfarm/tnzcore_stuff/tfilepath.cpp
+++ b/toonz/sources/toonzfarm/tnzcore_stuff/tfilepath.cpp
@@ -15,13 +15,12 @@ const char auxslash = '\\';
//=============================================================================
// TFrameId::operator string() const
-string TFrameId::expand(FrameFormat format) const {
+std::string TFrameId::expand(FrameFormat format) const {
if (m_frame == EMPTY_FRAME)
return "";
else if (m_frame == NO_FRAME)
return "-";
- char buffer[80];
- ostrstream o_buff(buffer, sizeof(buffer));
+ std::stringstream o_buff;
if (format == FOUR_ZEROS) {
o_buff.fill('0');
o_buff.width(4);
@@ -31,8 +30,7 @@ string TFrameId::expand(FrameFormat format) const {
o_buff << m_frame;
}
if (m_letter != '\0') o_buff << m_letter;
- int len = o_buff.pcount();
- return string(buffer, len);
+ return o_buff.str();
}
//-------------------------------------------------------------------
diff --git a/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp b/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp
index e3bb19704..88acca869 100644
--- a/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp
+++ b/toonz/sources/toonzfarm/tnzcore_stuff/tsystem.cpp
@@ -390,10 +390,9 @@ string TTime::getDate() const { return getFormattedString("%b %d %Y"); }
//-----------------------------------------------------------------------------------
string TTime::getTime() const { // hh:mm:ss
- char buffer[10];
- ostrstream buff_s(buffer, sizeof(buffer));
+ stringstream buff_s;
buff_s << "." << m_msec << '\0';
- return getFormattedString("%X") + buffer;
+ return getFormattedString("%X") + buff_s.str();
}
//-----------------------------------------------------------------------------------
@@ -431,10 +430,9 @@ string TFileStatus::getGroup() const {
struct group *grp = getgrgid(m_fStatus.st_gid);
if (grp) return string(grp->gr_name);
#endif
- char buffer[1024];
- ostrstream buff(buffer, sizeof(buffer));
+ stringstream buff;
buff << m_fStatus.st_gid;
- return string(buffer, buff.pcount());
+ return buff.str();
}
//-----------------------------------------------------------------------------------
@@ -444,10 +442,9 @@ string TFileStatus::getUser() const {
struct passwd *pw = getpwuid(m_fStatus.st_uid);
if (pw) return string(pw->pw_name);
#endif
- char buffer[1024];
- ostrstream buff(buffer, sizeof(buffer));
+ stringstream buff;
buff << m_fStatus.st_uid;
- return string(buffer, buff.pcount());
+ return buff.str();
}
//-----------------------------------------------------------------------------------
diff --git a/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp b/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp
index e991366e5..55640d1af 100644
--- a/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp
+++ b/toonz/sources/toonzlib/tcenterlinevectorizerOld.cpp
@@ -2462,12 +2462,11 @@ void CenterLineVectorizer::vectorize() {
#ifdef DEBUG
void printTime(TStopWatch &sw, string name) {
- ostrstream ss;
+ stringstream ss;
ss << name << " : ";
sw.print(ss);
ss << '\n' << '\0';
string s = ss.str();
- ss.freeze(false);
TSystem::outputDebug(s);
}
#endif