diff --git a/toonz/sources/common/tiio/tiio_jpg_exif.cpp b/toonz/sources/common/tiio/tiio_jpg_exif.cpp index c7613dd..36774b8 100644 --- a/toonz/sources/common/tiio/tiio_jpg_exif.cpp +++ b/toonz/sources/common/tiio/tiio_jpg_exif.cpp @@ -135,7 +135,7 @@ const int TAG_IMAGE_UNIQUE_ID = 0xA420; typedef struct { unsigned short Tag; - char *Desc; + const char *Desc; } TagTable_t; const TagTable_t TagTable[] = { @@ -253,7 +253,7 @@ const int TAG_TABLE_SIZE = (sizeof(TagTable) / sizeof(TagTable_t)); const int TRUE = 1; const int FALSE = 0; -} +} // namespace //-------------------------------------------------------------------------- // Convert a 16 bit unsigned value from file's native byte order @@ -633,7 +633,7 @@ void JpgExifReader::ProcessExifDir(unsigned char *DirStart, break; case FMT_UNDEFINED: - // Undefined is typically an ascii string. + // Undefined is typically an ascii string. case FMT_STRING: // String arrays printed without function call (different from int @@ -683,7 +683,7 @@ void JpgExifReader::ProcessExifDir(unsigned char *DirStart, case TAG_DATETIME_ORIGINAL: // If we get a DATETIME_ORIGINAL, we use that one. strncpy(ImageInfo.DateTime, (char *)ValuePtr, 19); - // Fallthru... + // Fallthru... case TAG_DATETIME_DIGITIZED: case TAG_DATETIME: @@ -737,7 +737,7 @@ void JpgExifReader::ProcessExifDir(unsigned char *DirStart, // Copy the comment { - int msiz = ExifLength - (ValuePtr - OffsetBase); + int msiz = ExifLength - (ValuePtr - OffsetBase); if (msiz > ByteCount) msiz = ByteCount; if (msiz > MAX_COMMENT_SIZE - 1) msiz = MAX_COMMENT_SIZE - 1; if (msiz > 5 && memcmp(ValuePtr, "ASCII", 5) == 0) { diff --git a/toonz/sources/common/tvrender/tglregions.cpp b/toonz/sources/common/tvrender/tglregions.cpp index 8ae9139..86a4073 100644 --- a/toonz/sources/common/tvrender/tglregions.cpp +++ b/toonz/sources/common/tvrender/tglregions.cpp @@ -135,7 +135,7 @@ void drawControlPoints(const TVectorRenderData &rd, TStroke *stroke, //----------------------------------------------------------------------------- -void drawArrows(TStroke *stroke, bool onlyFirstPoint) { +static void drawArrows(TStroke *stroke, bool onlyFirstPoint) { double length = stroke->getLength(0.0, 1.0); int points = length / 20; if (points < 2) points += 1; @@ -179,7 +179,8 @@ void drawArrows(TStroke *stroke, bool onlyFirstPoint) { //----------------------------------------------------------------------------- // Used for Guided Drawing -void drawFirstControlPoint(const TVectorRenderData &rd, TStroke *stroke) { +static void drawFirstControlPoint(const TVectorRenderData &rd, + TStroke *stroke) { TPointD p = stroke->getPoint(0.0); double length = stroke->getLength(0.0, 1.0); int msecs = QTime::currentTime().msec(); @@ -276,8 +277,8 @@ void tglDraw(const TVectorRenderData &rd, TRegion *r, bool pushAttribs) { } else { visible = false; for (j = 0; j < colorCount && !visible; j++) { - TPixel32 color = style->getColorParamValue(j); - if (rd.m_cf) color = (*(rd.m_cf))(color); + TPixel32 color = style->getColorParamValue(j); + if (rd.m_cf) color = (*(rd.m_cf))(color); if (color.m != 0) visible = true; } } @@ -434,7 +435,7 @@ bool isOThick(const TStroke *s) { if (s->getControlPoint(i).thick != 0) return false; return true; } -} +} // namespace void tglDraw(const TVectorRenderData &rd, const TStroke *s, bool pushAttribs) { assert(s); @@ -554,8 +555,8 @@ static void tglDoDraw(const TVectorRenderData &rd, TRegion *r) { else { visible = false; for (int j = 0; j < colorCount && !visible; j++) { - TPixel32 color = style->getColorParamValue(j); - if (rd.m_cf) color = (*(rd.m_cf))(color); + TPixel32 color = style->getColorParamValue(j); + if (rd.m_cf) color = (*(rd.m_cf))(color); if (color.m != 0) visible = true; } } @@ -584,8 +585,8 @@ static bool tglDoDraw(const TVectorRenderData &rd, const TStroke *s) { else { visible = false; for (int j = 0; j < style->getColorParamCount() && !visible; j++) { - TPixel32 color = style->getColorParamValue(j); - if (rd.m_cf) color = (*(rd.m_cf))(color); + TPixel32 color = style->getColorParamValue(j); + if (rd.m_cf) color = (*(rd.m_cf))(color); if (color.m != 0) visible = true; } } @@ -676,7 +677,7 @@ rdRegions.m_alphaChannel = rdRegions.m_antiAliasing = false;*/ } } } -} +} // namespace //------------------------------------------------------------------------------------ diff --git a/toonz/sources/common/twain/ttwain_stateX.c b/toonz/sources/common/twain/ttwain_stateX.c index 8295d7a..75c820d 100644 --- a/toonz/sources/common/twain/ttwain_stateX.c +++ b/toonz/sources/common/twain/ttwain_stateX.c @@ -4,6 +4,8 @@ extern "C" { #endif +#include "ttwain_statePD.h" + int TTWAIN_LoadSourceManagerPD(void) { return 0; } int TTWAIN_UnloadSourceManagerPD(void) { return 1; } diff --git a/toonz/sources/toonz/filmstripcommand.cpp b/toonz/sources/toonz/filmstripcommand.cpp index 1dfc524..da4bc84 100644 --- a/toonz/sources/toonz/filmstripcommand.cpp +++ b/toonz/sources/toonz/filmstripcommand.cpp @@ -70,9 +70,8 @@ void doUpdateXSheet(TXshSimpleLevel *sl, std::vector oldFids, cells[i].m_level->getType() == CHILD_XSHLEVEL) { TXshChildLevel *level = cells[i].m_level->getChildLevel(); // make sure we haven't already checked the level - if (level && - std::find(childLevels.begin(), childLevels.end(), level) == - childLevels.end()) { + if (level && std::find(childLevels.begin(), childLevels.end(), + level) == childLevels.end()) { childLevels.push_back(level); TXsheet *subXsh = level->getXsheet(); doUpdateXSheet(sl, oldFids, newFids, subXsh, childLevels); @@ -101,8 +100,8 @@ void doUpdateXSheet(TXshSimpleLevel *sl, std::vector oldFids, //----------------------------------------------------------------------------- -void updateXSheet(TXshSimpleLevel *sl, std::vector oldFids, - std::vector newFids) { +static void updateXSheet(TXshSimpleLevel *sl, std::vector oldFids, + std::vector newFids) { std::vector childLevels; TXsheet *xsh = TApp::instance()->getCurrentScene()->getScene()->getTopXsheet(); @@ -145,7 +144,7 @@ void makeSpaceForFids(TXshSimpleLevel *sl, if (Preferences::instance()->isSyncLevelRenumberWithXsheetEnabled()) updateXSheet(sl, oldFids, fids); sl->renumber(fids); - sl->setDirtyFlag(true); + sl->setDirtyFlag(true); } } @@ -250,10 +249,10 @@ bool pasteAreasWithoutUndo(const QMimeData *data, TXshSimpleLevel *sl, affine *= sc; int i; TRectD boxD; - if (rects.size() > 0) boxD = rects[0]; + if (rects.size() > 0) boxD = rects[0]; if (strokes.size() > 0) boxD = strokes[0].getBBox(); for (i = 0; i < rects.size(); i++) boxD += rects[i]; - for (i = 0; i < strokes.size(); i++) boxD += strokes[i].getBBox(); + for (i = 0; i < strokes.size(); i++) boxD += strokes[i].getBBox(); boxD = affine * boxD; TRect box = ToonzImageUtils::convertWorldToRaster(boxD, ti); TPoint pos = box.getP00(); @@ -309,10 +308,10 @@ bool pasteAreasWithoutUndo(const QMimeData *data, TXshSimpleLevel *sl, affine *= sc; int i; TRectD boxD; - if (rects.size() > 0) boxD = rects[0]; + if (rects.size() > 0) boxD = rects[0]; if (strokes.size() > 0) boxD = strokes[0].getBBox(); for (i = 0; i < rects.size(); i++) boxD += rects[i]; - for (i = 0; i < strokes.size(); i++) boxD += strokes[i].getBBox(); + for (i = 0; i < strokes.size(); i++) boxD += strokes[i].getBBox(); boxD = affine * boxD; TRect box = TRasterImageUtils::convertWorldToRaster(boxD, ri); TPoint pos = box.getP00(); @@ -604,13 +603,13 @@ public: int i; TRectD boxD; - if (rects.size() > 0) boxD = rects[0]; + if (rects.size() > 0) boxD = rects[0]; if (strokes.size() > 0) boxD = strokes[0].getBBox(); for (i = 0; i < rects.size(); i++) boxD += rects[i]; - for (i = 0; i < strokes.size(); i++) boxD += strokes[i].getBBox(); - boxD = affine * boxD; - TRect box = ToonzImageUtils::convertWorldToRaster(boxD, ti); - TPoint pos = box.getP00(); + for (i = 0; i < strokes.size(); i++) boxD += strokes[i].getBBox(); + boxD = affine * boxD; + TRect box = ToonzImageUtils::convertWorldToRaster(boxD, ti); + TPoint pos = box.getP00(); TRasterCM32P app = ras; TRop::over(ti->getRaster(), app, pos, affine); ToolUtils::updateSaveBox(m_level, *it); @@ -639,13 +638,13 @@ public: affine *= sc; int i; TRectD boxD; - if (rects.size() > 0) boxD = rects[0]; + if (rects.size() > 0) boxD = rects[0]; if (strokes.size() > 0) boxD = strokes[0].getBBox(); for (i = 0; i < rects.size(); i++) boxD += rects[i]; - for (i = 0; i < strokes.size(); i++) boxD += strokes[i].getBBox(); - boxD = affine * boxD; - TRect box = TRasterImageUtils::convertWorldToRaster(boxD, ri); - TPoint pos = box.getP00(); + for (i = 0; i < strokes.size(); i++) boxD += strokes[i].getBBox(); + boxD = affine * boxD; + TRect box = TRasterImageUtils::convertWorldToRaster(boxD, ri); + TPoint pos = box.getP00(); TRasterCM32P app = ras; if (app) TRop::over(ri->getRaster(), app, ri->getPalette(), pos, affine); @@ -985,7 +984,7 @@ public: updateXSheet(m_sl.getPointer(), newFrames, m_oldLevelFrameId); } m_sl->renumber(m_oldLevelFrameId); - m_sl->setDirtyFlag(true); + m_sl->setDirtyFlag(true); TApp::instance() ->getPaletteController() ->getCurrentLevelPalette() @@ -1309,8 +1308,8 @@ public: m_level->renumber(fids); TSelection *selection = TSelection::getCurrent(); if (selection) selection->selectNone(); - m_level->setDirtyFlag(true); - TApp::instance()->getCurrentLevel()->notifyLevelChange(); + m_level->setDirtyFlag(true); + TApp::instance()->getCurrentLevel()->notifyLevelChange(); } void undo() const override { std::vector fids; @@ -1725,7 +1724,7 @@ public: // TImageCache::instance()->add("UndoInsertEmptyFrames"+QString::number((UINT)this), // img); TImageCache::instance()->add( - "UndoInsertEmptyFrames" + QString::number((uintptr_t) this), img); + "UndoInsertEmptyFrames" + QString::number((uintptr_t)this), img); } } m_updateXSheet = @@ -1735,7 +1734,7 @@ public: ~UndoInsertEmptyFrames() { // TImageCache::instance()->remove("UndoInsertEmptyFrames"+QString::number((UINT)this)); TImageCache::instance()->remove("UndoInsertEmptyFrames" + - QString::number((uintptr_t) this)); + QString::number((uintptr_t)this)); } void undo() const override { @@ -1747,7 +1746,7 @@ public: updateXSheet(m_level.getPointer(), newFrames, m_oldFrames); } m_level->renumber(m_oldFrames); - m_level->setDirtyFlag(true); + m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } @@ -1762,7 +1761,7 @@ public: // (TToonzImageP)TImageCache::instance()->get("UndoInsertEmptyFrames"+QString::number((UINT)this), // true); TToonzImageP image = (TToonzImageP)TImageCache::instance()->get( - "UndoInsertEmptyFrames" + QString::number((uintptr_t) this), true); + "UndoInsertEmptyFrames" + QString::number((uintptr_t)this), true); if (!image) return; for (it = m_frames.begin(); it != m_frames.end(); ++it) m_level->setFrame(*it, image); @@ -2039,7 +2038,7 @@ public: m_level->renumber(m_oldFrames); TSelection *selection = TSelection::getCurrent(); if (selection) selection->selectNone(); - m_level->setDirtyFlag(true); + m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } void redo() const override { @@ -2205,7 +2204,7 @@ public: updateXSheet(m_level.getPointer(), newFrames, m_oldFrames); } m_level->renumber(m_oldFrames); - m_level->setDirtyFlag(true); + m_level->setDirtyFlag(true); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } void redo() const override { diff --git a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp index f4c79a8..66ffc5f 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp @@ -19,7 +19,7 @@ // MACOSX includes #ifdef _WIN32 #include -#elif MACOSX +#elif defined(MACOSX) #include "tversion.h" using namespace TVER; #include // gethostbyname @@ -361,12 +361,12 @@ void TFarmTask::saveData(TOStream &os) { //------------------------------------------------------------------------------ namespace { -QString getExeName(bool isComposer) { +static QString getExeName(bool isComposer) { QString name = isComposer ? "tcomposer" : "tcleanup"; #ifdef _WIN32 return name + ".exe "; -#elif MACOSX +#elif defined(MACOSX) TVER::ToonzVersion tver; return "\"./" + QString::fromStdString(tver.getAppName()) + "_" + QString::fromStdString(tver.getAppVersionString()) + @@ -380,7 +380,7 @@ QString getExeName(bool isComposer) { QString toString(int value, int w, char c = ' ') { QString s = QString::number(value); - while (s.size() < w) s= c + s; + while (s.size() < w) s = c + s; return s; } @@ -642,7 +642,7 @@ TFarmTaskGroup::TFarmTaskGroup(const QString &id, const QString &name, threadsIndex, maxTileSizeIndex, Overwrite_Off, false) , m_imp(new Imp()) { int subCount = 0; - if (chunksize > 0) subCount= tceil((to - from + 1) / (double)chunksize); + if (chunksize > 0) subCount = tceil((to - from + 1) / (double)chunksize); int ra = from; if (subCount > 1) { diff --git a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp index b9281ec..be839a3 100644 --- a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp +++ b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp @@ -378,12 +378,12 @@ private: }; //------------------------------------------------------------------- -QString getExeName(bool isComposer) { +static QString getExeName(bool isComposer) { QString name = isComposer ? "tcomposer" : "tcleanup"; #ifdef _WIN32 return name + ".exe "; -#elif MACOSX +#elif defined(MACOSX) TVER::ToonzVersion tver; return "\"./" + QString::fromStdString(tver.getAppName()) + "_" + QString::fromStdString(tver.getAppVersionString()) + @@ -433,7 +433,7 @@ void Task::run() { m_log->info(logMsg); -// =========== + // =========== #ifdef _WIN32 if (m_cmdline.contains("runcasm")) service.mountDisks(); @@ -994,8 +994,8 @@ void FarmServerService::onStop() { } catch (TException & /*e*/) { } -// i dischi vengono montati al primo task di tipo "runcasm" -// e smontati allo stop del servizio + // i dischi vengono montati al primo task di tipo "runcasm" + // e smontati allo stop del servizio #ifdef _WIN32 unmountDisks(); diff --git a/toonz/sources/toonzlib/cellpositionratio.cpp b/toonz/sources/toonzlib/cellpositionratio.cpp index 1b95b03..f3286ec 100644 --- a/toonz/sources/toonzlib/cellpositionratio.cpp +++ b/toonz/sources/toonzlib/cellpositionratio.cpp @@ -4,7 +4,7 @@ #include // Euclid's algorithm -int greatestCommonDivisor(int a, int b) { +static int greatestCommonDivisor(int a, int b) { a = std::abs(a); b = std::abs(b); int c = std::max(a, b); @@ -18,12 +18,14 @@ int greatestCommonDivisor(int a, int b) { return c; } +#if 0 /* UNUSED */ int leastCommonMultiple(int a, int b) { return a * b / greatestCommonDivisor(a, b); } +#endif void Ratio::normalize() { - int gcd = greatestCommonDivisor(m_num, m_denom); + int gcd = greatestCommonDivisor(m_num, m_denom); if (m_denom < 0) gcd = -gcd; m_num /= gcd; m_denom /= gcd;