diff --git a/toonz/sources/common/expressions/tgrammar.cpp b/toonz/sources/common/expressions/tgrammar.cpp index 9a21c8a..7fa7720 100644 --- a/toonz/sources/common/expressions/tgrammar.cpp +++ b/toonz/sources/common/expressions/tgrammar.cpp @@ -538,7 +538,7 @@ public: bool matchToken(const std::vector &previousTokens, const Token &token) const override { int i = (int)previousTokens.size(); - return i == 1 && token.getText() == "?" || i == 3 && token.getText() == ":"; + return ((i == 1 && token.getText() == "?") || (i == 3 && token.getText() == ":")); } bool isFinished(const std::vector &previousTokens, const Token &token) const override { @@ -571,8 +571,8 @@ public: } bool matchToken(const std::vector &previousTokens, const Token &token) const override { - return previousTokens.empty() && token.getText() == "(" || - previousTokens.size() == 2 && token.getText() == ")"; + return ((previousTokens.empty() && token.getText() == "(") || + (previousTokens.size() == 2 && token.getText() == ")")); } bool isFinished(const std::vector &previousTokens, const Token &token) const override { @@ -647,9 +647,9 @@ public: bool isFinished(const std::vector &previousTokens, const Token &token) const override { if (previousTokens.empty()) return false; - return m_minArgCount == 0 && previousTokens.size() == 1 && - token.getText() != "(" || - previousTokens.back().getText() == ")"; + return ((m_minArgCount == 0 && previousTokens.size() == 1 && + token.getText() != "(") || + (previousTokens.back().getText() == ")")); } TokenType getTokenType(const std::vector &previousTokens, const Token &token) const override { diff --git a/toonz/sources/common/expressions/ttokenizer.cpp b/toonz/sources/common/expressions/ttokenizer.cpp index d6b2372..15485f4 100644 --- a/toonz/sources/common/expressions/ttokenizer.cpp +++ b/toonz/sources/common/expressions/ttokenizer.cpp @@ -65,7 +65,7 @@ void Tokenizer::setBuffer(std::string buffer) { while (s[i] != '"' && s[i] != '\0') token.append(1, s[i++]); m_tokens.push_back(Token(token, Token::Ident, j)); - } else if (isascii(s[i]) && isalpha(s[i]) || s[i] == '_') { + } else if ((isascii(s[i]) && isalpha(s[i])) || s[i] == '_') { // ident token = std::string(1, s[i++]); @@ -73,7 +73,7 @@ void Tokenizer::setBuffer(std::string buffer) { token.append(1, s[i++]); m_tokens.push_back(Token(token, Token::Ident, j)); - } else if (isascii(s[i]) && isdigit(s[i]) || s[i] == '.') { + } else if ((isascii(s[i]) && isdigit(s[i])) || s[i] == '.') { // number while (isascii(s[i]) && isdigit(s[i])) token.append(1, s[i++]); @@ -83,8 +83,8 @@ void Tokenizer::setBuffer(std::string buffer) { while (isascii(s[i]) && isdigit(s[i])) token.append(1, s[i++]); if ((s[i] == 'e' || s[i] == 'E') && - (isascii(s[i + 1]) && isdigit(s[i + 1]) || - (s[i + 1] == '-' || s[i + 1] == '+') && isascii(s[i + 2]) && + (((isascii(s[i + 1]) && isdigit(s[i + 1])) || + s[i + 1] == '-' || s[i + 1] == '+') && isascii(s[i + 2]) && isdigit(s[i + 2]))) { token.append(1, s[i++]); diff --git a/toonz/sources/common/psdlib/psd.cpp b/toonz/sources/common/psdlib/psd.cpp index aceb37b..a90ba79 100644 --- a/toonz/sources/common/psdlib/psd.cpp +++ b/toonz/sources/common/psdlib/psd.cpp @@ -296,7 +296,7 @@ bool TPSDReader::readLayerInfo(int i) { // layer name li->nameno = (char *)malloc(16); - sprintf(li->nameno, "layer%d", i + 1); + snprintf(li->nameno, 16, "layer%d", i + 1); namelen = fgetc(m_file); li->name = (char *)mymalloc(NEXT4(namelen + 1)); fread(li->name, 1, NEXT4(namelen + 1) - 1, m_file); @@ -651,7 +651,7 @@ void TPSDReader::readImageData(TRasterP &rasP, TPSDLayerInfo *li, // L'indice è riferito al livello. // Nota che nel file photoshop le righe sono memorizzate dall'ultima alla // prima. - int rowOffset = abs(sby1) % m_shrinkY; + int rowOffset = std::abs(sby1) % m_shrinkY; int rowCount = rowOffset; // if(m_shrinkY==3) rowCount--; for (j = 0; j < smallRas->getLy(); j++) { diff --git a/toonz/sources/common/tapptools/tcolorutils.cpp b/toonz/sources/common/tapptools/tcolorutils.cpp index e0a968c..daaddb8 100644 --- a/toonz/sources/common/tapptools/tcolorutils.cpp +++ b/toonz/sources/common/tapptools/tcolorutils.cpp @@ -1106,7 +1106,7 @@ void TColorUtils::buildColorChipPalette(QList> &palette, // remove the coner information from the corner point QMap::const_iterator i = corners.constBegin(); while (i != corners.constEnd()) { - edgePoints[i.value()].info & ~i.key(); + edgePoints[i.value()].info &= ~i.key(); ++i; } if (colorChips.count() >= maxColorCount) break; diff --git a/toonz/sources/common/tapptools/tenv.cpp b/toonz/sources/common/tapptools/tenv.cpp index fce9708..1777ec5 100644 --- a/toonz/sources/common/tapptools/tenv.cpp +++ b/toonz/sources/common/tapptools/tenv.cpp @@ -392,8 +392,8 @@ void VariableSet::load() { char *s = buffer; while (*s == ' ') s++; char *t = s; - while ('a' <= *s && *s <= 'z' || 'A' <= *s && *s <= 'Z' || - '0' <= *s && *s <= '9' || *s == '_') + while (('a' <= *s && *s <= 'z') || ('A' <= *s && *s <= 'Z') || + ('0' <= *s && *s <= '9') || *s == '_') s++; std::string name(t, s - t); if (name.size() == 0) continue; diff --git a/toonz/sources/common/tcore/trandom.cpp b/toonz/sources/common/tcore/trandom.cpp index d13e78c..8545d0f 100644 --- a/toonz/sources/common/tcore/trandom.cpp +++ b/toonz/sources/common/tcore/trandom.cpp @@ -103,10 +103,10 @@ float TRandom::getFloat() // [0,1[ switch (RandomFloatType) { case RANDOM_FLOAT_TYPE_1: - u = (u >> 5) & 0x007fffff | 0x3f800000; + u = ((u >> 5) & 0x007fffff) | 0x3f800000; break; case RANDOM_FLOAT_TYPE_2: - u = u & 0xffff7f00 | 0x0000803f; + u = (u & 0xffff7f00) | 0x0000803f; break; default: assert(0); diff --git a/toonz/sources/common/tfx/tcacheresourcepool.cpp b/toonz/sources/common/tfx/tcacheresourcepool.cpp index 7adf7f9..ec5809f 100644 --- a/toonz/sources/common/tfx/tcacheresourcepool.cpp +++ b/toonz/sources/common/tfx/tcacheresourcepool.cpp @@ -197,11 +197,13 @@ TCacheResource *TCacheResourcePool::getResource(const std::string &name, // Search for an already allocated resource if (m_searchIterator == m_memResources.end()) { m_searchIterator = m_memResources.lower_bound(name); - if (m_searchIterator != m_memResources.end()) - if (!(name < m_searchIterator->first)) + if (m_searchIterator != m_memResources.end()) { + if (!(name < m_searchIterator->first)) { m_foundIterator = true; - else if (m_searchIterator != m_memResources.begin()) + } else if (m_searchIterator != m_memResources.begin()) { m_searchIterator--; + } + } } if (m_foundIterator) { diff --git a/toonz/sources/common/tfx/tpredictivecachemanager.cpp b/toonz/sources/common/tfx/tpredictivecachemanager.cpp index 5765494..a7223fe 100644 --- a/toonz/sources/common/tfx/tpredictivecachemanager.cpp +++ b/toonz/sources/common/tfx/tpredictivecachemanager.cpp @@ -156,7 +156,7 @@ void TPredictiveCacheManager::Imp::getResourceTestRun( it->second.m_usageCount++; else { // Already initializes usageCount at 1 - m_resources.insert(std::make_pair(resource, PredictionData(resData))).first; + m_resources.insert(std::make_pair(resource, PredictionData(resData))); } } diff --git a/toonz/sources/common/tgeometry/tgeometry.cpp b/toonz/sources/common/tgeometry/tgeometry.cpp index e34ee3a..7e8ea1d 100644 --- a/toonz/sources/common/tgeometry/tgeometry.cpp +++ b/toonz/sources/common/tgeometry/tgeometry.cpp @@ -1,9 +1,7 @@ #include "tgeometry.h" -#ifdef LINUX -#include -#endif + using namespace std; diff --git a/toonz/sources/common/tiio/bmp/filebmp.c b/toonz/sources/common/tiio/bmp/filebmp.c index de23ae7..5f3e817 100644 --- a/toonz/sources/common/tiio/bmp/filebmp.c +++ b/toonz/sources/common/tiio/bmp/filebmp.c @@ -213,6 +213,8 @@ int read_bmp_line(FILE *fp, void *line_buffer, UINT w, UINT row, UCHAR **map, pad = (4 - ((w * 3) % 4)) & 0x03; rv = load_lineBMP24(fp, pic, w, (UINT)pad); break; + default: + break; } return !rv; /* return 0 for unsuccess */ @@ -255,6 +257,8 @@ int write_bmp_line(FILE *fp, void *line_buffer, UINT w, UINT row, UCHAR *map, pad = (4 - ((w * 3) % 4)) & 0x03; rv = line_writeBMP24(fp, p24, w, (UINT)pad); break; + default: + break; } return rv; /* 0 for unsuccess */ @@ -294,6 +298,8 @@ int skip_bmp_lines(FILE *fp, UINT w, UINT rows, int whence, BMP_SUBTYPE type) pad = (4 - ((w * 3) % 4)) & 0x03; rv = skip_rowsBMP24(fp, w, (UINT)pad, rows, whence); break; + default: + break; } return !rv; @@ -624,8 +630,9 @@ static int img_read_bmp_region(const MYSTRING fname, IMAGE **pimg, int x1, if ((hd->biBitCount != 1 && hd->biBitCount != 4 && hd->biBitCount != 8 && hd->biBitCount != 24) || hd->biPlanes != 1 || hd->biCompression > BMP_BI_RLE4) { - sprintf(buf, "Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)", - hd->biBitCount, hd->biPlanes, hd->biCompression); + snprintf(buf, sizeof(buf), + "Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)", + hd->biBitCount, hd->biPlanes, hd->biCompression); bmp_error = UNSUPPORTED_BMP_FORMAT; goto ERROR; @@ -636,8 +643,9 @@ static int img_read_bmp_region(const MYSTRING fname, IMAGE **pimg, int x1, hd->biCompression != BMP_BI_RGB) || (hd->biBitCount == 4 && hd->biCompression == BMP_BI_RLE8) || (hd->biBitCount == 8 && hd->biCompression == BMP_BI_RLE4)) { - sprintf(buf, "Bogus BMP File! (bitCount=%d, Compression=%d)", - hd->biBitCount, hd->biCompression); + snprintf(buf, sizeof(buf), + "Bogus BMP File! (bitCount=%d, Compression=%d)", + hd->biBitCount, hd->biCompression); bmp_error = UNSUPPORTED_BMP_FORMAT; goto ERROR; } diff --git a/toonz/sources/common/tiio/movsettings.cpp b/toonz/sources/common/tiio/movsettings.cpp index 4b095fb..98952d4 100644 --- a/toonz/sources/common/tiio/movsettings.cpp +++ b/toonz/sources/common/tiio/movsettings.cpp @@ -112,7 +112,8 @@ void visitAtoms(const QTAtomContainer &atoms, const QTAtom &parent, int sonCount = QTCountChildrenOfType(atoms, curr, 0); char buffer[1024]; - sprintf(buffer, "%d %d %d", (int)atomType, (int)id, sonCount); + snprintf(buffer, sizeof(buffer), "%d %d %d", + (int)atomType, (int)id, sonCount); string str(buffer); if (sonCount > 0) { diff --git a/toonz/sources/common/tparam/tdoublekeyframe.cpp b/toonz/sources/common/tparam/tdoublekeyframe.cpp index 9926afd..641840a 100644 --- a/toonz/sources/common/tparam/tdoublekeyframe.cpp +++ b/toonz/sources/common/tparam/tdoublekeyframe.cpp @@ -50,6 +50,8 @@ void TDoubleKeyframe::saveData(TOStream &os) const { case EaseInOutPercentage: os.child("prev") << m_value << m_speedIn.x; break; + default: + break; } std::string unitName = m_unitName != "" ? m_unitName : "default"; // Dirty resolution. Because the degree sign is converted to unexpected @@ -79,6 +81,8 @@ void TDoubleKeyframe::saveData(TOStream &os) const { os << m_frame << m_fileParams.m_path << m_fileParams.m_fieldIndex << unitName; break; + default: + break; } os.closeChild(); } @@ -149,6 +153,8 @@ void TDoubleKeyframe::loadData(TIStream &is) { is >> m_frame >> m_fileParams.m_path >> m_fileParams.m_fieldIndex >> m_unitName; break; + default: + break; } if (!is.matchEndTag()) throw TException(tagName + " : missing endtag"); if (m_unitName == "default") m_unitName = ""; diff --git a/toonz/sources/common/tparam/tdoubleparam.cpp b/toonz/sources/common/tparam/tdoubleparam.cpp index 37c9e9f..3c2a78d 100644 --- a/toonz/sources/common/tparam/tdoubleparam.cpp +++ b/toonz/sources/common/tparam/tdoubleparam.cpp @@ -379,6 +379,8 @@ double TDoubleParam::Imp::getValue(int segmentIndex, double frame) { case TDoubleKeyframe::SimilarShape: value = getSimilarShapeValue(k0, k1, frame, m_measure); break; + default: + break; } if (convertUnit) value = k0.convertFrom(m_measure, value); return value; diff --git a/toonz/sources/common/tparam/tdoubleparamfile.cpp b/toonz/sources/common/tparam/tdoubleparamfile.cpp index 05fce2f..7ad3723 100644 --- a/toonz/sources/common/tparam/tdoubleparamfile.cpp +++ b/toonz/sources/common/tparam/tdoubleparamfile.cpp @@ -9,7 +9,7 @@ namespace { //--------------------------------------------------------- bool parseDouble(double &value, char *&s) { - if (!(*s == '-' || *s == '.' || '0' <= *s && *s <= '9')) return false; + if (!(*s == '-' || *s == '.' || ('0' <= *s && *s <= '9'))) return false; char *t = s; if (*s == '-') s++; while ('0' <= *s && *s <= '9') s++; diff --git a/toonz/sources/common/trop/tblur.cpp b/toonz/sources/common/trop/tblur.cpp index ff92e11..d6d5f57 100644 --- a/toonz/sources/common/trop/tblur.cpp +++ b/toonz/sources/common/trop/tblur.cpp @@ -10,7 +10,7 @@ #ifdef USE_SSE2 #include -#include +#include #endif diff --git a/toonz/sources/common/trop/tconvolve.cpp b/toonz/sources/common/trop/tconvolve.cpp index 7eb4a07..259801f 100644 --- a/toonz/sources/common/trop/tconvolve.cpp +++ b/toonz/sources/common/trop/tconvolve.cpp @@ -118,24 +118,24 @@ void doConvolve_cm32_row_9_i(PIXOUT *pixout, int n, TPixelCM32 *pixarr[], } pixout->r = (typename PIXOUT::Channel)( - (val[1].r * w1 + val[2].r * w2 + val[3].r * w3 + val[4].r * w4 + - val[5].r * w5 + val[6].r * w6 + val[7].r * w7 + val[8].r * w8 + - val[9].r * w9 + (1 << 15)) >> + (val[0].r * w1 + val[1].r * w2 + val[2].r * w3 + val[3].r * w4 + + val[4].r * w5 + val[5].r * w6 + val[6].r * w7 + val[7].r * w8 + + val[8].r * w9 + (1 << 15)) >> 16); pixout->g = (typename PIXOUT::Channel)( - (val[1].g * w1 + val[2].g * w2 + val[3].g * w3 + val[4].g * w4 + - val[5].g * w5 + val[6].g * w6 + val[7].g * w7 + val[8].g * w8 + - val[9].g * w9 + (1 << 15)) >> + (val[0].g * w1 + val[1].g * w2 + val[2].g * w3 + val[3].g * w4 + + val[4].g * w5 + val[5].g * w6 + val[6].g * w7 + val[7].g * w8 + + val[8].g * w9 + (1 << 15)) >> 16); pixout->b = (typename PIXOUT::Channel)( - (val[1].b * w1 + val[2].b * w2 + val[3].b * w3 + val[4].b * w4 + - val[5].b * w5 + val[6].b * w6 + val[7].b * w7 + val[8].b * w8 + - val[9].b * w9 + (1 << 15)) >> + (val[0].b * w1 + val[1].b * w2 + val[2].b * w3 + val[3].b * w4 + + val[4].b * w5 + val[5].b * w6 + val[6].b * w7 + val[7].b * w8 + + val[8].b * w9 + (1 << 15)) >> 16); pixout->m = (typename PIXOUT::Channel)( - (val[1].m * w1 + val[2].m * w2 + val[3].m * w3 + val[4].m * w4 + - val[5].m * w5 + val[6].m * w6 + val[7].m * w7 + val[8].m * w8 + - val[9].m * w9 + (1 << 15)) >> + (val[0].m * w1 + val[1].m * w2 + val[2].m * w3 + val[3].m * w4 + + val[4].m * w5 + val[5].m * w6 + val[6].m * w7 + val[7].m * w8 + + val[8].m * w9 + (1 << 15)) >> 16); p1++; p2++; diff --git a/toonz/sources/common/trop/trop.cpp b/toonz/sources/common/trop/trop.cpp index 8eb43ec..6d247b7 100644 --- a/toonz/sources/common/trop/trop.cpp +++ b/toonz/sources/common/trop/trop.cpp @@ -137,7 +137,7 @@ pix->r= pix->r*pix->m/T::maxChannelValue; pix->g= pix->g*pix->m/T::maxChannelValue; pix->b= pix->b*pix->m/T::maxChannelValue; }*/ - *pix++; + pix++; } } } @@ -163,7 +163,7 @@ pix->r= pix->r*pix->m/T::maxChannelValue; pix->g= pix->g*pix->m/T::maxChannelValue; pix->b= pix->b*pix->m/T::maxChannelValue; }*/ - *pix++; + pix++; } } } diff --git a/toonz/sources/common/tsystem/tfilepath.cpp b/toonz/sources/common/tsystem/tfilepath.cpp index 862c5ac..a892a8a 100644 --- a/toonz/sources/common/tsystem/tfilepath.cpp +++ b/toonz/sources/common/tsystem/tfilepath.cpp @@ -244,10 +244,10 @@ void TFilePath::setPath(std::wstring path) { if (path.length() == 2 || !isSlash(path[pos])) m_path.append(1, wslash); } // se si tratta di un path in formato UNC e' del tipo "\\\\MachineName" - else if (path.length() >= 3 && path[0] == L'\\' && path[1] == L'\\' && - iswalnum(path[2]) || - path.length() >= 3 && path[0] == L'/' && path[1] == L'/' && - iswalnum(path[2])) { + else if ((path.length() >= 3 && path[0] == L'\\' && path[1] == L'\\' && + iswalnum(path[2])) || + (path.length() >= 3 && path[0] == L'/' && path[1] == L'/' && + iswalnum(path[2]))) { isUncName = true; m_path.append(2, L'\\'); m_path.append(1, path[2]); @@ -281,10 +281,10 @@ void TFilePath::setPath(std::wstring path) { // rimuovo l'eventuale '/' finale (a meno che m_path == "/" o m_path == // ":\" // oppure sia UNC (Windows only) ) - if (!(m_path.length() == 1 && m_path[0] == wslash || - m_path.length() == 3 && iswalpha(m_path[0]) && m_path[1] == L':' && - m_path[2] == wslash) && - m_path.length() > 1 && m_path[m_path.length() - 1] == wslash) + if (!((m_path.length() == 1 && m_path[0] == wslash) || + (m_path.length() == 3 && iswalpha(m_path[0]) && m_path[1] == L':' && + m_path[2] == wslash)) && + (m_path.length() > 1 && m_path[m_path.length() - 1] == wslash)) m_path.erase(m_path.length() - 1, 1); if (isUncName && @@ -507,19 +507,19 @@ else //----------------------------------------------------------------------------- bool TFilePath::isAbsolute() const { - return m_path.length() >= 1 && m_path[0] == slash || - m_path.length() >= 2 && iswalpha(m_path[0]) && m_path[1] == ':'; + return ((m_path.length() >= 1 && m_path[0] == slash) || + (m_path.length() >= 2 && iswalpha(m_path[0]) && m_path[1] == ':')); } //----------------------------------------------------------------------------- bool TFilePath::isRoot() const { - return m_path.length() == 1 && m_path[0] == slash || - m_path.length() == 3 && iswalpha(m_path[0]) && m_path[1] == ':' && - m_path[2] == slash || - m_path.length() > 2 && m_path[0] == slash && m_path[1] == slash && + return ((m_path.length() == 1 && m_path[0] == slash) || + (m_path.length() == 3 && iswalpha(m_path[0]) && m_path[1] == ':' && + m_path[2] == slash) || + ((m_path.length() > 2 && m_path[0] == slash && m_path[1] == slash) && (std::string::npos == m_path.find(slash, 2) || - m_path.find(slash, 2) == m_path.size() - 1); + m_path.find(slash, 2) == (m_path.size() - 1)))); } //----------------------------------------------------------------------------- @@ -634,8 +634,8 @@ TFilePath TFilePath::getParentDir() const // noSlash! { int i = getLastSlash(m_path); // cerco l'ultimo slash if (i < 0) { - if (m_path.length() >= 2 && ('a' <= m_path[0] && m_path[0] <= 'z' || - 'A' <= m_path[0] && m_path[0] <= 'Z') && + if (m_path.length() >= 2 && (('a' <= m_path[0] && m_path[0] <= 'z') || + ('A' <= m_path[0] && m_path[0] <= 'Z')) && m_path[1] == ':') return TFilePath(m_path.substr(0, 2)); else diff --git a/toonz/sources/common/tvectorimage/outlineApproximation.cpp b/toonz/sources/common/tvectorimage/outlineApproximation.cpp index 2915c41..851169b 100644 --- a/toonz/sources/common/tvectorimage/outlineApproximation.cpp +++ b/toonz/sources/common/tvectorimage/outlineApproximation.cpp @@ -259,10 +259,10 @@ void makeOutline(/*std::ofstream& cout,*/ areAlmostEqual( tq.getThickP0(), tq.getThickP2(), 1e-2 )*/; if (isAlmostAPoint || - q_up && checkPointInOutline(q_up->getPoint(parameterTest), tq, + (q_up && checkPointInOutline(q_up->getPoint(parameterTest), tq, parameterTest, error) && q_down && checkPointInOutline(q_down->getPoint(parameterTest), tq, - parameterTest, error)) { + parameterTest, error))) { /* if (edge.first) cout << "left: "<< *(edge.first); else diff --git a/toonz/sources/common/tvectorimage/tcomputeregions.cpp b/toonz/sources/common/tvectorimage/tcomputeregions.cpp index 158370d..bf156bc 100644 --- a/toonz/sources/common/tvectorimage/tcomputeregions.cpp +++ b/toonz/sources/common/tvectorimage/tcomputeregions.cpp @@ -1402,10 +1402,10 @@ static bool addAutocloseIntersection(IntersectionData &intData, { const TThickQuadratic *q = s[i]->m_s->getChunk(0); - if (areAlmostEqual(q->getP0(), v[0], 1e-2) && - areAlmostEqual(q->getP2(), v[1], 1e-2) || - areAlmostEqual(q->getP0(), v[1], 1e-2) && - areAlmostEqual(q->getP2(), v[0], 1e-2)) { + if ((areAlmostEqual(q->getP0(), v[0], 1e-2) && + areAlmostEqual(q->getP2(), v[1], 1e-2)) || + (areAlmostEqual(q->getP0(), v[1], 1e-2) && + areAlmostEqual(q->getP2(), v[0], 1e-2))) { return true; addIntersection(intData, s, i, ii, DoublePair(0.0, w0), strokeSize, isVectorized); diff --git a/toonz/sources/common/tvectorimage/tregion.cpp b/toonz/sources/common/tvectorimage/tregion.cpp index e287871..dda8122 100644 --- a/toonz/sources/common/tvectorimage/tregion.cpp +++ b/toonz/sources/common/tvectorimage/tregion.cpp @@ -820,13 +820,13 @@ int TRegion::Imp::leftScanlineIntersections(const TPointD &p, if (t0 <= s && s < t1) { double ys = getY(q, s); - solIdx[0] = (ys < m_y && m_y <= y0 || y0 <= m_y && m_y < ys) ? 0 : -1; - solIdx[1] = (ys < m_y && m_y < y1 || y1 < m_y && m_y < ys) ? 1 : -1; + solIdx[0] = ((ys < m_y && m_y <= y0) || (y0 <= m_y && m_y < ys)) ? 0 : -1; + solIdx[1] = ((ys < m_y && m_y < y1) || (y1 < m_y && m_y < ys)) ? 1 : -1; } else if (t1 < s && s <= t0) { double ys = getY(q, s); - solIdx[0] = (ys < m_y && m_y <= y0 || y0 <= m_y && m_y < ys) ? 1 : -1; - solIdx[1] = (ys < m_y && m_y < y1 || y1 < m_y && m_y < ys) ? 0 : -1; + solIdx[0] = ((ys < m_y && m_y <= y0) || (y0 <= m_y && m_y < ys)) ? 1 : -1; + solIdx[1] = ((ys < m_y && m_y < y1) || (y1 < m_y && m_y < ys)) ? 0 : -1; } else { solIdx[0] = isInYRange(y0, y1) ? (t0 < s) ? 0 : 1 : -1; solIdx[1] = -1; diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp index ae249e8..757bcc7 100644 --- a/toonz/sources/common/tvectorimage/tvectorimage.cpp +++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp @@ -1031,11 +1031,11 @@ bool TVectorImage::Imp::areWholeGroups(const std::vector &indexes) const { UINT i, j; for (i = 0; i < indexes.size(); i++) { if (m_strokes[indexes[i]]->m_isNewForFill) return false; - if (!m_strokes[indexes[i]]->m_groupId.isGrouped() != 0) return false; + if (!m_strokes[indexes[i]]->m_groupId.isGrouped()) return false; for (j = 0; j < m_strokes.size(); j++) { int ret = areDifferentGroup(indexes[i], false, j, false); if (ret == -1 || - ret >= 1 && find(indexes.begin(), indexes.end(), j) == indexes.end()) + (ret >= 1 && find(indexes.begin(), indexes.end(), j) == indexes.end())) return false; } } @@ -1268,20 +1268,23 @@ void TVectorImage::mergeImage(const TVectorImageP &img, const TAffine &affine, TGroupId()) // if is inside a group, new image is put in that group. { TGroupId groupId; - for (i = m_imp->m_strokes.size() - 1; i >= 0; i--) + for (i = m_imp->m_strokes.size() - 1; i >= 0; i--) { if (m_imp->m_insideGroup.isParentOf(m_imp->m_strokes[i]->m_groupId)) { insertAt = i + 1; groupId = m_imp->m_strokes[i]->m_groupId; break; } - if (insertAt != 0) - for (i = 0; i < (int)img->m_imp->m_strokes.size(); i++) - if (!img->m_imp->m_strokes[i]->m_groupId.isGrouped()) + } + if (insertAt != 0) { + for (i = 0; i < (int)img->m_imp->m_strokes.size(); i++) { + if (!img->m_imp->m_strokes[i]->m_groupId.isGrouped()) { img->m_imp->m_strokes[i]->m_groupId = groupId; - else + } else { img->m_imp->m_strokes[i]->m_groupId = TGroupId(groupId, img->m_imp->m_strokes[i]->m_groupId); - + } + } + } } // si fondono l'ultimo gruppo ghost della vecchia a e il primo della nuova @@ -2904,8 +2907,8 @@ void TVectorImage::Imp::regroupGhosts(std::vector &changedStrokes) { while (i < m_strokes.size() && ((currGroupId.isGrouped(false) != 0 && m_strokes[i]->m_groupId == currGroupId) || - currGroupId.isGrouped(true) != 0 && - m_strokes[i]->m_groupId.isGrouped(true) != 0)) { + (currGroupId.isGrouped(true) != 0 && + m_strokes[i]->m_groupId.isGrouped(true) != 0))) { if (m_strokes[i]->m_groupId != currGroupId) { m_strokes[i]->m_groupId = currGroupId; changedStrokes.push_back(i); diff --git a/toonz/sources/common/tvrender/qtofflinegl.cpp b/toonz/sources/common/tvrender/qtofflinegl.cpp index 8ba5771..b1561a8 100644 --- a/toonz/sources/common/tvrender/qtofflinegl.cpp +++ b/toonz/sources/common/tvrender/qtofflinegl.cpp @@ -178,7 +178,7 @@ void QtOfflineGL::createContext(TDimension rasterSize, m_fbo->bind(); printf("create context:%p [thread:0x%x]\n", m_context.get(), - QThread::currentThreadId()); + (unsigned int)(size_t)QThread::currentThreadId()); // Creo il contesto OpenGL - assicurandomi che sia effettivamente creato // NOTA: Se il contesto non viene creato, di solito basta ritentare qualche diff --git a/toonz/sources/common/tvrender/tcolorstyles.cpp b/toonz/sources/common/tvrender/tcolorstyles.cpp index 49932d6..1f1c89a 100644 --- a/toonz/sources/common/tvrender/tcolorstyles.cpp +++ b/toonz/sources/common/tvrender/tcolorstyles.cpp @@ -525,7 +525,7 @@ void TColorStyle::drawStroke(TFlash &flash, const TStroke *s) const { void TColorStyle::save(TOutputStreamInterface &os) const { std::wstring name = getName(); bool numberedName = - !name.empty() && ('0' <= name[0] && name[0] <= '9' || name[0] == '_'); + !name.empty() && (('0' <= name[0] && name[0] <= '9') || name[0] == '_'); if (m_flags > 0 || (name.length() == 1 && numberedName)) os << ("_" + QString::number(m_flags)).toStdString(); diff --git a/toonz/sources/common/tvrender/tglregions.cpp b/toonz/sources/common/tvrender/tglregions.cpp index 84a9abc..43d6e17 100644 --- a/toonz/sources/common/tvrender/tglregions.cpp +++ b/toonz/sources/common/tvrender/tglregions.cpp @@ -655,7 +655,7 @@ rdRegions.m_alphaChannel = rdRegions.m_antiAliasing = false;*/ int currStrokeIndex = strokeIndex; if (!rd.m_isIcon && vim->isInsideGroup() > 0 && ((drawEnteredGroup && !vim->isEnteredGroupStroke(strokeIndex)) || - !drawEnteredGroup && vim->isEnteredGroupStroke(strokeIndex))) { + (!drawEnteredGroup && vim->isEnteredGroupStroke(strokeIndex)))) { while (strokeIndex < vim->getStrokeCount() && vim->sameGroup(strokeIndex, currStrokeIndex)) strokeIndex++; diff --git a/toonz/sources/common/tvrender/tpaletteutil.cpp b/toonz/sources/common/tvrender/tpaletteutil.cpp index d933eb7..8e4bef9 100644 --- a/toonz/sources/common/tvrender/tpaletteutil.cpp +++ b/toonz/sources/common/tvrender/tpaletteutil.cpp @@ -12,7 +12,7 @@ void mergePalette(const TPaletteP &targetPalette, indexTable[0] = 0; std::set::const_iterator styleIt = sourceIndices.begin(); - for (styleIt; styleIt != sourceIndices.end(); ++styleIt) { + for (; styleIt != sourceIndices.end(); ++styleIt) { int srcStyleId = *styleIt; if (srcStyleId == 0) continue; assert(0 <= srcStyleId && srcStyleId < sourcePalette->getStyleCount()); diff --git a/toonz/sources/common/tvrender/tstrokedeformations.cpp b/toonz/sources/common/tvrender/tstrokedeformations.cpp index 6a49806..afe1c6a 100644 --- a/toonz/sources/common/tvrender/tstrokedeformations.cpp +++ b/toonz/sources/common/tvrender/tstrokedeformations.cpp @@ -479,7 +479,7 @@ TThickPoint TStrokeBenderDeformation::getDisplacement(const TStroke &s, if (m_vect) { double outVal = 0.0; - if (fabs(diff) <= m_lengthOfDeformation) + if (fabs(diff) <= m_lengthOfDeformation) { if (m_versus == INNER) { diff *= (1.0 / m_lengthOfDeformation) * c_maxLengthOfGaussian; outVal = gaussianPotential(diff); @@ -490,6 +490,7 @@ TThickPoint TStrokeBenderDeformation::getDisplacement(const TStroke &s, strokeLengthAtParameter; outVal = 1.0 - gaussianPotential(valForGaussian); } + } TPointD cp = convert(s.getControlPointAtParameter(w)); TPointD p = cp; diff --git a/toonz/sources/common/twain/ttwain_capability.c b/toonz/sources/common/twain/ttwain_capability.c index 2ae88ad..ceaf31f 100644 --- a/toonz/sources/common/twain/ttwain_capability.c +++ b/toonz/sources/common/twain/ttwain_capability.c @@ -62,10 +62,14 @@ int TTWAIN_GetCapCurrent(TW_UINT16 cap_id, TW_UINT16 conType, void *data, /*------------------------------------------------------------------------*/ int TTWAIN_GetCapQuery(TW_UINT16 cap_id, TW_UINT16 *pattern) { int rc; - TW_ONEVALUE data; + /* GCC9 during compilation shows that this code possible call + * TTWAIN_GetCapability() with case TWON_TWON(TWON_RANGE, TWON_RANGE) + * whitch cause stack corruption, so make 'data' big enough to store + * TW_ONEVALUE. */ + TW_ONEVALUE data[1 + (sizeof(TW_RANGE) / sizeof(TW_ONEVALUE))]; rc = TTWAIN_GetCapability(MSG_QUERYSUPPORT, cap_id, TWON_ONEVALUE, &data, 0); if (!rc) return FALSE; - *pattern = (TW_UINT16)data.Item; + *pattern = (TW_UINT16)data[0].Item; return TRUE; } /*------------------------------------------------------------------------*/ diff --git a/toonz/sources/common/twain/ttwain_error.c b/toonz/sources/common/twain/ttwain_error.c index 359b83b..e2c211f 100644 --- a/toonz/sources/common/twain/ttwain_error.c +++ b/toonz/sources/common/twain/ttwain_error.c @@ -98,19 +98,21 @@ void TTWAIN_RecordError(void) { else TTwainData.ErrCC = -1; - strcpy(Msg_out, ""); if (TTwainData.ErrRC < (sizeof(RC_msg) / sizeof(RC_msg[0]))) { - sprintf(Msg_out, "RC: %s(%d)", RC_msg[TTwainData.ErrRC], - (int)TTwainData.ErrRC); + snprintf(Msg_out, sizeof(Msg_out), "RC: %s(%d)", + RC_msg[TTwainData.ErrRC], (int)TTwainData.ErrRC); } else { - sprintf(Msg_out, "RC: %s(%d)", "unknown", (int)TTwainData.ErrRC); + snprintf(Msg_out, sizeof(Msg_out), "RC: %s(%d)", "unknown", + (int)TTwainData.ErrRC); } if (TTwainData.ErrCC < (sizeof(CC_msg) / sizeof(CC_msg[0]))) { - sprintf(tmp, "CC: %s(%d)", CC_msg[TTwainData.ErrCC], (int)TTwainData.ErrCC); + snprintf(tmp, sizeof(tmp), "CC: %s(%d)", CC_msg[TTwainData.ErrCC], + (int)TTwainData.ErrCC); strcat(Msg_out, tmp); } else { - sprintf(tmp, "CC: %s(%d)", "unknown", (int)TTwainData.ErrCC); + snprintf(tmp, sizeof(tmp), "CC: %s(%d)", "unknown", + (int)TTwainData.ErrCC); strcat(Msg_out, tmp); } diff --git a/toonz/sources/common/twain/ttwain_global_def.h b/toonz/sources/common/twain/ttwain_global_def.h index 61db048..a46c67f 100644 --- a/toonz/sources/common/twain/ttwain_global_def.h +++ b/toonz/sources/common/twain/ttwain_global_def.h @@ -44,7 +44,7 @@ typedef void *TW_HANDLE; #define GLOBAL_LOCK(P) (P) #define GLOBAL_ALLOC(T, S) malloc(S) #define GLOBAL_FREE(P) free(P) -#define GLOBAL_UNLOCK(P) (P) +#define GLOBAL_UNLOCK(P) #endif #endif diff --git a/toonz/sources/common/twain/ttwain_state.c b/toonz/sources/common/twain/ttwain_state.c index 5a8b907..3925866 100644 --- a/toonz/sources/common/twain/ttwain_state.c +++ b/toonz/sources/common/twain/ttwain_state.c @@ -46,7 +46,11 @@ static void TTWAIN_FreeVar(void); #define CEIL(x) ((int)(x) < (x) ? (int)(x) + 1 : (int)(x)) +#ifndef _WIN32 +#define PRINTF(args...) +#else #define PRINTF +#endif /*---------------------------------------------------------------------------*/ /* LOCAL PROTOTYPES */ @@ -133,7 +137,8 @@ int TTWAIN_SelectImageSource(void *hwnd) { TTWAIN_MGR(DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &newSourceId); } else { char msg[2048]; - sprintf(msg, "Unable to open Source Manager (%s)", DSM_FILENAME); + snprintf(msg, sizeof(msg), "Unable to open Source Manager (%s)", + DSM_FILENAME); TTWAIN_ErrorBox(msg); return FALSE; } @@ -588,7 +593,8 @@ void *TTWAIN_AcquireNative(void *hwnd) { if (!TTWAIN_OpenSourceManager(hwnd)) /* Bring up to state 4 */ { char msg[2048]; - sprintf(msg, "Unable to open Source Manager (%s)", DSM_FILENAME); + snprintf(msg, sizeof(msg), "Unable to open Source Manager (%s)", + DSM_FILENAME); TTWAIN_ErrorBox(msg); return 0; } @@ -642,7 +648,7 @@ static BOOL CALLBACK myHackEnumFunction(HWND hwnd, LPARAM lParam) { if (len && !strncmp(title, TTwainData.sourceId.ProductName, len)) { /* char dbg_str[1024]; -sprintf(dbg_str,"set focus on 0x%8x %s\n",hwnd, title); +snprintf(dbg_str, sizeof(dbg_str), "set focus on 0x%8x %s\n",hwnd, title); OutputDebugString(dbg_str); */ f = (MyFun *)lParam; diff --git a/toonz/sources/common/twain/ttwain_util.c b/toonz/sources/common/twain/ttwain_util.c index 4c16feb..6982db6 100644 --- a/toonz/sources/common/twain/ttwain_util.c +++ b/toonz/sources/common/twain/ttwain_util.c @@ -441,17 +441,18 @@ l'immagine) /*---------------------------------------------------------------------------*/ char *TTWAIN_GetVersion(void) { static char version[5 + 1 + 5 + 1 + 32 + 1]; - sprintf(version, "%d.", TTwainData.sourceId.Version.MajorNum); - sprintf(&version[strlen(version)], "%d ", - TTwainData.sourceId.Version.MinorNum); - strcat(version, (char *)TTwainData.sourceId.Version.Info); + snprintf(version, sizeof(version), "%d.%d %s", + TTwainData.sourceId.Version.MajorNum, + TTwainData.sourceId.Version.MinorNum, + (char *)TTwainData.sourceId.Version.Info); return version; } /*---------------------------------------------------------------------------*/ char *TTWAIN_GetTwainVersion(void) { static char version[5 + 1 + 5 + 1]; - sprintf(version, "%d.%d", TTwainData.sourceId.ProtocolMajor, - TTwainData.sourceId.ProtocolMinor); + snprintf(version, sizeof(version), "%d.%d", + TTwainData.sourceId.ProtocolMajor, + TTwainData.sourceId.ProtocolMinor); return version; } /*---------------------------------------------------------------------------*/ @@ -882,11 +883,13 @@ TTwainData.transferInfo.multiTransfer = status; TTWAIN_InitVar(); if (TTWAIN_DSM_HasEntryPoint()) return TRUE; - if (TTwainData.twainAvailable == AVAIABLE_DONTKNOW) - if (TTWAIN_LoadSourceManager()) + if (TTwainData.twainAvailable == AVAIABLE_DONTKNOW) { + if (TTWAIN_LoadSourceManager()) { TTWAIN_UnloadSourceManager(); - else + } else { TTwainData.twainAvailable = AVAIABLE_NO; + } + } return (TTwainData.twainAvailable == AVAIABLE_YES); } diff --git a/toonz/sources/common/twain/ttwain_winM.c b/toonz/sources/common/twain/ttwain_winM.c index 81b49cf..70ec579 100644 --- a/toonz/sources/common/twain/ttwain_winM.c +++ b/toonz/sources/common/twain/ttwain_winM.c @@ -9,7 +9,11 @@ extern "C" { #include "ttwain_state.h" #include "ttwainP.h" //#define DEBUG +#ifndef _WIN32 +#define PRINTF(args...) +#else #define PRINTF +#endif #if 1 extern int TTWAIN_MessageHook(void *lpmsg); @@ -147,8 +151,6 @@ void setupUI(void) { /*---------------------------------------------------------------------------*/ -#define PRINTF - void registerTwainCallback(void) { if (TTWAIN_GetState() < TWAIN_SOURCE_OPEN) { PRINTF("%s too early!, don't register\n", __FUNCTION__); diff --git a/toonz/sources/image/bmp/filebmp.c b/toonz/sources/image/bmp/filebmp.c index db9b8c7..1f0a2fc 100644 --- a/toonz/sources/image/bmp/filebmp.c +++ b/toonz/sources/image/bmp/filebmp.c @@ -634,8 +634,9 @@ static int img_read_bmp_region(const MYSTRING fname, IMAGE **pimg, int x1, if ((hd->biBitCount != 1 && hd->biBitCount != 4 && hd->biBitCount != 8 && hd->biBitCount != 24) || hd->biPlanes != 1 || hd->biCompression > BMP_BI_RLE4) { - sprintf(buf, "Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)", - hd->biBitCount, hd->biPlanes, hd->biCompression); + snprintf(buf, sizeof(buf), + "Bogus BMP File! (bitCount=%d, Planes=%d, Compression=%d)", + hd->biBitCount, hd->biPlanes, hd->biCompression); bmp_error = UNSUPPORTED_BMP_FORMAT; goto ERROR; @@ -646,8 +647,9 @@ static int img_read_bmp_region(const MYSTRING fname, IMAGE **pimg, int x1, hd->biCompression != BMP_BI_RGB) || (hd->biBitCount == 4 && hd->biCompression == BMP_BI_RLE8) || (hd->biBitCount == 8 && hd->biCompression == BMP_BI_RLE4)) { - sprintf(buf, "Bogus BMP File! (bitCount=%d, Compression=%d)", - hd->biBitCount, hd->biCompression); + snprintf(buf, sizeof(buf), + "Bogus BMP File! (bitCount=%d, Compression=%d)", + hd->biBitCount, hd->biCompression); bmp_error = UNSUPPORTED_BMP_FORMAT; goto ERROR; } diff --git a/toonz/sources/image/compatibility/tnz4.h b/toonz/sources/image/compatibility/tnz4.h index 60593d6..9488ebe 100644 --- a/toonz/sources/image/compatibility/tnz4.h +++ b/toonz/sources/image/compatibility/tnz4.h @@ -9,8 +9,6 @@ #if defined(MACOSX) #include -#else -#include #endif #define UCHAR unsigned char diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp index 796543a..8061153 100644 --- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp +++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp @@ -301,8 +301,8 @@ TRasterImageP Ffmpeg::getImage(int frameIndex) { ret->yMirror(); return TRasterImageP(ret); } - } else - return TRasterImageP(); + } + return TRasterImageP(); } double Ffmpeg::getFrameRate() { diff --git a/toonz/sources/image/pli/pli_io.cpp b/toonz/sources/image/pli/pli_io.cpp index 16e1571..8baa27e 100644 --- a/toonz/sources/image/pli/pli_io.cpp +++ b/toonz/sources/image/pli/pli_io.cpp @@ -582,7 +582,7 @@ ParsedPliImp::ParsedPliImp(const TFilePath &filename, bool readInfo) m_minorVersionNumber); if (m_majorVersionNumber > 5 || - m_majorVersionNumber == 5 && m_minorVersionNumber >= 8) + (m_majorVersionNumber == 5 && m_minorVersionNumber >= 8)) m_iChan >> m_creator; if (m_majorVersionNumber < 5) { @@ -1055,16 +1055,16 @@ inline bool ParsedPliImp::readDinamicData(TINT32 &val, TUINT32 &bufOffs) { break; case 4: if (m_isIrixEndian) { - val = m_buf[bufOffs + 3] | (m_buf[bufOffs + 2] << 8) | - (m_buf[bufOffs + 1] << 16) | (m_buf[bufOffs] << 24) & 0x7fffffff; + val = (m_buf[bufOffs + 3] | (m_buf[bufOffs + 2] << 8) | + (m_buf[bufOffs + 1] << 16) | (m_buf[bufOffs] << 24)) & 0x7fffffff; if (m_buf[bufOffs] & 0x80) { val = -val; isNegative = true; } } else { - val = m_buf[bufOffs] | (m_buf[bufOffs + 1] << 8) | + val = (m_buf[bufOffs] | (m_buf[bufOffs + 1] << 8) | (m_buf[bufOffs + 2] << 16) | - (m_buf[bufOffs + 3] << 24) & 0x7fffffff; + (m_buf[bufOffs + 3] << 24)) & 0x7fffffff; if (m_buf[bufOffs + 3] & 0x80) { val = -val; isNegative = true; diff --git a/toonz/sources/image/pli/tiio_pli.cpp b/toonz/sources/image/pli/tiio_pli.cpp index 4878a1d..d17ff42 100644 --- a/toonz/sources/image/pli/tiio_pli.cpp +++ b/toonz/sources/image/pli/tiio_pli.cpp @@ -400,7 +400,7 @@ TImageP TImageReaderPli::doLoad() { strokeData.m_options = ((StrokeOutlineOptionsTag *)imageTag->m_object[i])->m_options; break; - case PliTag::AUTOCLOSE_TOLERANCE_GOBJ: + case PliTag::AUTOCLOSE_TOLERANCE_GOBJ: { // aggiunge curve quadratiche con spessore costante AutoCloseToleranceTag *toleranceTag = (AutoCloseToleranceTag *)imageTag->m_object[i]; @@ -408,6 +408,9 @@ TImageP TImageReaderPli::doLoad() { outVectImage->setAutocloseTolerance( ((double)toleranceTag->m_autoCloseTolerance) / 1000); break; + } + default: + break; } // switch(groupTag->m_object[j]->m_type) } // for (i=0; im_numObjects; i++) diff --git a/toonz/sources/image/sgi/filesgi.cpp b/toonz/sources/image/sgi/filesgi.cpp index 9542f19..4621fe1 100644 --- a/toonz/sources/image/sgi/filesgi.cpp +++ b/toonz/sources/image/sgi/filesgi.cpp @@ -26,8 +26,6 @@ #if defined(MACOSX) #include -#else -#include #endif #include @@ -311,7 +309,7 @@ static IMAGERGB *iopen(int fd, OpenMode openMode, unsigned int type, if ((image->tmpbuf = ibufalloc(image, BPP(image->type))) == 0) { char xs[1024]; - sprintf(xs, "%d", image->xsize); + snprintf(xs, sizeof(xs), "%d", image->xsize); TSystem::outputDebug(string("iopen: error on tmpbuf alloc %d\n") + xs); return NULL; diff --git a/toonz/sources/image/svg/tiio_svg.cpp b/toonz/sources/image/svg/tiio_svg.cpp index d527385..42fb613 100644 --- a/toonz/sources/image/svg/tiio_svg.cpp +++ b/toonz/sources/image/svg/tiio_svg.cpp @@ -1870,7 +1870,7 @@ static void writeRegion(TRegion *r, TPalette *plt, QTextStream &out, out << "getStyle(r->getStyle())->getMainColor(); - if (col == TPixel::Transparent) col == TPixel::White; + if (col == TPixel::Transparent) col = TPixel::White; out << "style=\"fill:rgb(" << col.r << "," << col.g << "," << col.b << ")\" \n"; diff --git a/toonz/sources/image/tzl/tiio_tzl.cpp b/toonz/sources/image/tzl/tiio_tzl.cpp index c94d9eb..47c6929 100644 --- a/toonz/sources/image/tzl/tiio_tzl.cpp +++ b/toonz/sources/image/tzl/tiio_tzl.cpp @@ -1374,7 +1374,7 @@ bool TLevelWriterTzl::optimize() { TLevelP level = lr->loadInfo(); if (!level || level->getFrameCount() == 0) return false; TLevel::Iterator levelIt = level->begin(); - for (levelIt; levelIt != level->end(); ++levelIt) { + for (; levelIt != level->end(); ++levelIt) { TToonzImageP img = lr->getFrameReader(levelIt->first)->load(); assert(img); lw->getFrameWriter(levelIt->first)->save(img); diff --git a/toonz/sources/image/tzp/filetzup.cpp b/toonz/sources/image/tzp/filetzup.cpp index 6f931e5..6b55c16 100644 --- a/toonz/sources/image/tzp/filetzup.cpp +++ b/toonz/sources/image/tzp/filetzup.cpp @@ -454,7 +454,7 @@ height = image->pixmap.ysize; tfp, TIFFTAG_XPOSITION, image->pixmap.h_pos / image->pixmap.y_dpi + 8.0); } - /*sprintf(str, "TOONZ %s", versione_del_software);*/ + /*snprintf(str, sizeof(str), "TOONZ %s", versione_del_software);*/ TIFFSetField(tfp, TIFFTAG_SOFTWARE, str); /* Aggiungo le informazioni relative alla savebox a all'history */ diff --git a/toonz/sources/include/tcg/hpp/polyline_ops.hpp b/toonz/sources/include/tcg/hpp/polyline_ops.hpp index 62826e3..bb85849 100644 --- a/toonz/sources/include/tcg/hpp/polyline_ops.hpp +++ b/toonz/sources/include/tcg/hpp/polyline_ops.hpp @@ -146,7 +146,7 @@ _QuadraticsEdgeEvaluator::furthestFrom(const quad_iterator &at) { const point_type &C1 = *(bt.it() + 1); // Ensure that bt is not a corner - if (abs(tcg::point_ops::cross(*(bt.it() - 1) - *bt, *(bt.it() + 1) - *bt)) > + if (std::abs(tcg::point_ops::cross(*(bt.it() - 1) - *bt, *(bt.it() + 1) - *bt)) > 1e-3) break; diff --git a/toonz/sources/include/tversion.h b/toonz/sources/include/tversion.h index c8ffe75..d22470b 100644 --- a/toonz/sources/include/tversion.h +++ b/toonz/sources/include/tversion.h @@ -44,13 +44,13 @@ bool ToonzVersion::hasAppNote(void) { } std::string ToonzVersion::getAppVersionString(void) { char buffer[50]; - sprintf(buffer, "%.1f", applicationVersion); + snprintf(buffer, sizeof(buffer), "%.1f", applicationVersion); std::string appver = std::string(buffer); return appver; } std::string ToonzVersion::getAppRevisionString(void) { char buffer[50]; - sprintf(buffer, "%g", applicationRevision); + snprintf(buffer, sizeof(buffer), "%g", applicationRevision); std::string apprev = std::string(buffer); return apprev; } diff --git a/toonz/sources/stdfx/backlitfx.cpp b/toonz/sources/stdfx/backlitfx.cpp index cefc338..9e7551d 100644 --- a/toonz/sources/stdfx/backlitfx.cpp +++ b/toonz/sources/stdfx/backlitfx.cpp @@ -201,7 +201,7 @@ public: ~BacklitFx() {} bool doGetBBox(double frame, TRectD &bbox, const TRenderSettings &info) override { - if (getActiveTimeRegion().contains(frame)) + if (getActiveTimeRegion().contains(frame)) { if (m_light.isConnected()) { if (m_lighted.isConnected()) { TRectD b0, b1; @@ -209,10 +209,13 @@ public: ret = ret && m_lighted->doGetBBox(frame, b1, info); bbox = b0.enlarge(tceil(m_value->getValue(frame))) + b1; return ret; - } else + } else { return m_light->doGetBBox(frame, bbox, info); - } else if (m_lighted.isConnected()) + } + } else if (m_lighted.isConnected()) { return m_lighted->doGetBBox(frame, bbox, info); + } + } return false; } diff --git a/toonz/sources/stdfx/changecolorfx.cpp b/toonz/sources/stdfx/changecolorfx.cpp index c23048a..4fa3570 100644 --- a/toonz/sources/stdfx/changecolorfx.cpp +++ b/toonz/sources/stdfx/changecolorfx.cpp @@ -246,7 +246,7 @@ to_v =to_hsv[2]/255.; } } // premultiply(*pix); - *pix++; + pix++; } } raster32->unlock(); diff --git a/toonz/sources/stdfx/colorembossfx.cpp b/toonz/sources/stdfx/colorembossfx.cpp index 248d560..94a83f5 100644 --- a/toonz/sources/stdfx/colorembossfx.cpp +++ b/toonz/sources/stdfx/colorembossfx.cpp @@ -136,9 +136,9 @@ void doColorEmboss(TRasterPT ras, TRasterPT srcraster, ? (val > 0 ? (CHANNEL_TYPE)val : 0) : PIXEL::maxChannelValue; (pixout)->m = (pix)->m; - *pix++; - *pixout++; - *ctrpix++; + pix++; + pixout++; + ctrpix++; } } ras->unlock(); diff --git a/toonz/sources/stdfx/dissolvefx.cpp b/toonz/sources/stdfx/dissolvefx.cpp index 9d6716e..9e9c3ac 100644 --- a/toonz/sources/stdfx/dissolvefx.cpp +++ b/toonz/sources/stdfx/dissolvefx.cpp @@ -57,7 +57,7 @@ void doDissolve(const TRasterPT &ras, const double intensity, pix->r = pix->g = pix->b = pix->m = 0; } } - *pix++; + pix++; } } ras->unlock(); diff --git a/toonz/sources/stdfx/embossfx.cpp b/toonz/sources/stdfx/embossfx.cpp index 737c16c..87cd677 100644 --- a/toonz/sources/stdfx/embossfx.cpp +++ b/toonz/sources/stdfx/embossfx.cpp @@ -137,8 +137,8 @@ void doEmboss(TRasterPT ras, TRasterPT srcraster, double azimuth, (pixout)->b = pixout->r; (pixout)->m = (pix)->m; *pixout = premultiply(*pixout); - *pix++; - *pixout++; + pix++; + pixout++; } } diff --git a/toonz/sources/stdfx/freedistortfx.cpp b/toonz/sources/stdfx/freedistortfx.cpp index 45db345..dc94019 100644 --- a/toonz/sources/stdfx/freedistortfx.cpp +++ b/toonz/sources/stdfx/freedistortfx.cpp @@ -590,7 +590,7 @@ void doBlur(TRasterPT &r, double blur0, double blur1, double transp0, row = new PIX[std::max(lx, ly)]; r->lock(); bufin = r->pixels(0); - for (i = 0, cur_blur = blur0 + (blur1 - blur0) * (i - y0) / den, 0.0, + for (i = 0, cur_blur = blur0 + (blur1 - blur0) * (i - y0) / den, actual_blur = std::max(cur_blur, 0.0); i < ly; i++, bufin += wrap, cur_blur += blur_incr, actual_blur = std::max(cur_blur, 0.0)) { diff --git a/toonz/sources/stdfx/glowfx.cpp b/toonz/sources/stdfx/glowfx.cpp index 207c4b1..6bc2bd4 100644 --- a/toonz/sources/stdfx/glowfx.cpp +++ b/toonz/sources/stdfx/glowfx.cpp @@ -147,7 +147,7 @@ public: bool doGetBBox(double frame, TRectD &bbox, const TRenderSettings &info) override { - if (getActiveTimeRegion().contains(frame)) + if (getActiveTimeRegion().contains(frame)) { if (m_light.isConnected()) { TRectD b0, b1; bool ret = m_light->doGetBBox(frame, b0, info); @@ -157,8 +157,10 @@ public: bbox += b1; } return ret; - } else if (m_lighted.isConnected()) + } else if (m_lighted.isConnected()) { return m_lighted->doGetBBox(frame, bbox, info); + } + } return false; } diff --git a/toonz/sources/stdfx/igs_motion_wind_pixel.cpp b/toonz/sources/stdfx/igs_motion_wind_pixel.cpp index 8c96e16..d1e7bad 100644 --- a/toonz/sources/stdfx/igs_motion_wind_pixel.cpp +++ b/toonz/sources/stdfx/igs_motion_wind_pixel.cpp @@ -124,8 +124,8 @@ void invert_pixel_(const int channels, double *pixel) { void rgb_to_lightness_(const double re, const double gr, const double bl, double &li) { li = ((re < gr) ? ((gr < bl) ? bl : gr) - : ((re < bl) ? bl : re) + (gr < re) ? ((bl < gr) ? bl : gr) - : ((bl < re) ? bl : re)) / + : (((re < bl) ? bl : re) + ((gr < re) ? ((bl < gr) ? bl : gr) + : ((bl < re) ? bl : re)))) / 2.0; } double get_lightness_(const int channels, const double *pixel diff --git a/toonz/sources/stdfx/iwa_adjustexposurefx.cpp b/toonz/sources/stdfx/iwa_adjustexposurefx.cpp index ef9b74f..92d7d3a 100644 --- a/toonz/sources/stdfx/iwa_adjustexposurefx.cpp +++ b/toonz/sources/stdfx/iwa_adjustexposurefx.cpp @@ -121,7 +121,7 @@ void Iwa_AdjustExposureFx::doCompute_CPU(TTile &tile, double frame, float scale = (float)m_scale->getValue(frame); float offset = (float)m_offset->getValue(frame); - float exposureOffset = (powf(10.0f, (float)(abs(offset) / hardness)) - 1.0f) * + float exposureOffset = (powf(10.0f, (float)(std::abs(offset) / hardness)) - 1.0f) * ((offset < 0.0f) ? -1.0f : 1.0f); float4 *pix = tile_host; diff --git a/toonz/sources/stdfx/iwa_directionalblurfx.cpp b/toonz/sources/stdfx/iwa_directionalblurfx.cpp index 17ed55d..636b35e 100644 --- a/toonz/sources/stdfx/iwa_directionalblurfx.cpp +++ b/toonz/sources/stdfx/iwa_directionalblurfx.cpp @@ -163,10 +163,10 @@ void Iwa_DirectionalBlurFx::doCompute(TTile &tile, double frame, maxY = (bidirectional) ? -blur.y : 0.0; minY = blur.y; } - int marginLeft = (int)ceil(abs(minX)); - int marginRight = (int)ceil(abs(maxX)); - int marginTop = (int)ceil(abs(maxY)); - int marginBottom = (int)ceil(abs(minY)); + int marginLeft = (int)ceil(std::abs(minX)); + int marginRight = (int)ceil(std::abs(maxX)); + int marginTop = (int)ceil(std::abs(maxY)); + int marginBottom = (int)ceil(std::abs(minY)); /*- マージンは、フィルタの上下左右を反転した寸法になる -*/ TRectD enlargedBBox(bBox.x0 - (double)marginRight, @@ -504,7 +504,7 @@ void Iwa_DirectionalBlurFx::makeDirectionalBlurFilter_CPU( /*- オフセット値を求める -*/ float offset = - (bidirectional) ? abs(framePosRatio * 2.0 - 1.0) : framePosRatio; + (bidirectional) ? std::abs(framePosRatio * 2.0 - 1.0) : framePosRatio; /*- フィルタごとに分ける -*/ float bokeAsiVal; @@ -581,10 +581,10 @@ bool Iwa_DirectionalBlurFx::doGetBBox(double frame, TRectD &bBox, maxY = (bidirectional) ? -blur.y : 0.0; minY = blur.y; } - int marginLeft = (int)ceil(abs(minX)); - int marginRight = (int)ceil(abs(maxX)); - int marginTop = (int)ceil(abs(maxY)); - int marginBottom = (int)ceil(abs(minY)); + int marginLeft = (int)ceil(std::abs(minX)); + int marginRight = (int)ceil(std::abs(maxX)); + int marginTop = (int)ceil(std::abs(maxY)); + int marginBottom = (int)ceil(std::abs(minY)); TRectD enlargedBBox( bBox.x0 - (double)marginLeft, bBox.y0 - (double)marginBottom, diff --git a/toonz/sources/stdfx/iwa_gradientwarpfx.cpp b/toonz/sources/stdfx/iwa_gradientwarpfx.cpp index 339ac06..b387945 100644 --- a/toonz/sources/stdfx/iwa_gradientwarpfx.cpp +++ b/toonz/sources/stdfx/iwa_gradientwarpfx.cpp @@ -126,7 +126,7 @@ void Iwa_GradientWarpFx::doCompute(TTile &tile, double frame, } int margin = static_cast( - ceil((abs(hLength) < abs(vLength)) ? abs(vLength) : abs(hLength))); + ceil((std::abs(hLength) < std::abs(vLength)) ? std::abs(vLength) : std::abs(hLength))); /*- 素材計算範囲を計算 -*/ /*- 出力範囲 -*/ @@ -312,8 +312,8 @@ void Iwa_GradientWarpFx::get_render_real_hv(const double frame, double &v_maxlen) { /*--- ベクトルにする(プラス値) --- */ TPointD rend_vect; - rend_vect.x = abs(m_h_maxlen->getValue(frame)); - rend_vect.y = abs(m_v_maxlen->getValue(frame)); + rend_vect.x = std::abs(m_h_maxlen->getValue(frame)); + rend_vect.y = std::abs(m_v_maxlen->getValue(frame)); /*--- 拡大縮小(移動回転しないで)のGeometryを反映させる ---*/ rend_vect = rend_vect * sqrt(fabs(affine.det())); /*--- 方向は無視して長さを返す(プラス値) ---*/ diff --git a/toonz/sources/stdfx/iwa_motionblurfx.cpp b/toonz/sources/stdfx/iwa_motionblurfx.cpp index 860b033..0cd2b2f 100644 --- a/toonz/sources/stdfx/iwa_motionblurfx.cpp +++ b/toonz/sources/stdfx/iwa_motionblurfx.cpp @@ -322,8 +322,8 @@ void Iwa_MotionBlurCompFx::makeZanzoFilter_CPU( continue; /* Linear interpolation with 4 neighboring pixels */ - float xRatio = 1.0f - abs(pos.x - p0.x); - float yRatio = 1.0f - abs(pos.y - p0.y); + float xRatio = 1.0f - std::abs(pos.x - p0.x); + float yRatio = 1.0f - std::abs(pos.y - p0.y); /* Next, get the value of the gamma strength */ /* Offset value of the frame of the neighbor point */ @@ -691,10 +691,10 @@ void Iwa_MotionBlurCompFx::doCompute(TTile &tile, double frame, if (points.at(p).y > maxY) maxY = points.at(p).y; if (points.at(p).y < minY) minY = points.at(p).y; } - int marginLeft = (int)ceil(abs(minX)); - int marginRight = (int)ceil(abs(maxX)); - int marginTop = (int)ceil(abs(maxY)); - int marginBottom = (int)ceil(abs(minY)); + int marginLeft = (int)ceil(std::abs(minX)); + int marginRight = (int)ceil(std::abs(maxX)); + int marginTop = (int)ceil(std::abs(maxY)); + int marginBottom = (int)ceil(std::abs(minY)); /* Return the input tile as-is if there is not movement * (= filter margins are all 0). */ @@ -897,10 +897,10 @@ bool Iwa_MotionBlurCompFx::doGetBBox(double frame, TRectD &bBox, if (points.at(p).y > maxY) maxY = points.at(p).y; if (points.at(p).y < minY) minY = points.at(p).y; } - int marginLeft = (int)ceil(abs(minX)); - int marginRight = (int)ceil(abs(maxX)); - int marginTop = (int)ceil(abs(maxY)); - int marginBottom = (int)ceil(abs(minY)); + int marginLeft = (int)ceil(std::abs(minX)); + int marginRight = (int)ceil(std::abs(maxX)); + int marginTop = (int)ceil(std::abs(maxY)); + int marginBottom = (int)ceil(std::abs(minY)); TRectD enlargedBBox( bBox.x0 - (double)marginLeft, bBox.y0 - (double)marginBottom, diff --git a/toonz/sources/stdfx/iwa_particlesengine.cpp b/toonz/sources/stdfx/iwa_particlesengine.cpp index 4f48de4..48e1b38 100644 --- a/toonz/sources/stdfx/iwa_particlesengine.cpp +++ b/toonz/sources/stdfx/iwa_particlesengine.cpp @@ -876,7 +876,7 @@ void Iwa_Particles_Engine::do_render( struct particles_values &values, float opacity_range, int dist_frame, std::map, float> &partScales, TTile *baseImgTile) { /*- カメラに対してタテになっている粒子を描かずに飛ばす -*/ - if (abs(cosf(part->flap_phi * 3.14159f / 180.0f)) < 0.03f) { + if (std::abs(cosf(part->flap_phi * 3.14159f / 180.0f)) < 0.03f) { return; } // Retrieve the particle frame - that is, the *column frame* from which we are @@ -923,8 +923,8 @@ void Iwa_Particles_Engine::do_render( float3 lightVec = {sinf(liTheta) * sinf(liPhi), cosf(liTheta) * sinf(liPhi), cosf(liPhi)}; /*- 法線ベクトルと光源ベクトルの内積の絶対値 -*/ - illuminant = abs(normVec.x * lightVec.x + normVec.y * lightVec.y + - normVec.z * lightVec.z); + illuminant = std::abs(normVec.x * lightVec.x + normVec.y * + lightVec.y + normVec.z * lightVec.z); } } @@ -996,11 +996,13 @@ void Iwa_Particles_Engine::do_render( std::string alias; TRasterImageP rimg; - if (rimg = partLevel[part->level]->frame(ndx)) { + rimg = partLevel[part->level]->frame(ndx); + if (rimg) { ras = rimg->getRaster(); } else { alias = "PART: " + (*part_ports[part->level])->getAlias(ndx, riNew); - if (rimg = TImageCache::instance()->get(alias, false)) { + rimg = TImageCache::instance()->get(alias, false); + if (rimg) { ras = rimg->getRaster(); // Check that the raster resolution is sufficient for our purposes @@ -1127,7 +1129,7 @@ void Iwa_Particles_Engine::fill_array( if (myarray[i - 1]) myarray[i] = myarray[i - 1]; } } - *pix++; + pix++; } for (j = 1; j < ly; j++) { @@ -1518,11 +1520,13 @@ void Iwa_Particles_Engine::renderBackground( std::string alias; TRasterImageP rimg; - if (rimg = partLevel[origin.level]->frame(ndx)) { + rimg = partLevel[origin.level]->frame(ndx); + if (rimg) { ras = rimg->getRaster(); } else { alias = "PART: " + (*part_ports[origin.level])->getAlias(ndx, riNew); - if (rimg = TImageCache::instance()->get(alias, false)) { + rimg = TImageCache::instance()->get(alias, false); + if (rimg) { ras = rimg->getRaster(); // Check that the raster resolution is sufficient for our purposes diff --git a/toonz/sources/stdfx/iwa_soapbubblefx.cpp b/toonz/sources/stdfx/iwa_soapbubblefx.cpp index a1d278a..5a2eccf 100644 --- a/toonz/sources/stdfx/iwa_soapbubblefx.cpp +++ b/toonz/sources/stdfx/iwa_soapbubblefx.cpp @@ -927,7 +927,7 @@ void Iwa_SoapBubbleFx::do_distance_transform(float* dst_p, USHORT* binarized_p, float* tmp_dst = dst_p; /* transform along rows */ for (int j = 0; j < dim.ly; j++) { - for (int i = 0; i < dim.lx; i++, *tmp_dst++) { + for (int i = 0; i < dim.lx; i++, tmp_dst++) { f[i] = *tmp_dst; } @@ -960,7 +960,7 @@ void Iwa_SoapBubbleFx::do_distance_transform(float* dst_p, USHORT* binarized_p, /* square root and normalize */ USHORT* region_p = binarized_p; - for (int i = 0; i < dim.lx * dim.ly; i++, *tmp_dst++, region_p++) { + for (int i = 0; i < dim.lx * dim.ly; i++, tmp_dst++, region_p++) { if (max_val[*region_p] > 0) *tmp_dst = std::sqrt(*tmp_dst) / max_val[*region_p]; } diff --git a/toonz/sources/stdfx/iwa_textfx.cpp b/toonz/sources/stdfx/iwa_textfx.cpp index 41892f0..d220937 100644 --- a/toonz/sources/stdfx/iwa_textfx.cpp +++ b/toonz/sources/stdfx/iwa_textfx.cpp @@ -75,7 +75,7 @@ void Iwa_TextFx::doCompute(TTile &tile, double frame, font.fromString(QString::fromStdWString(m_font->getValue())); double fac = sqrt(fabs(ri.m_affine.det())); - int size = (int)(fac * fabs(font.pixelSize())); + int size = (int)(fac * std::abs(font.pixelSize())); TPoint center = convert( fac * m_center->getValue(frame) - diff --git a/toonz/sources/stdfx/noisefx.cpp b/toonz/sources/stdfx/noisefx.cpp index 0679a72..59a7482 100644 --- a/toonz/sources/stdfx/noisefx.cpp +++ b/toonz/sources/stdfx/noisefx.cpp @@ -129,7 +129,7 @@ void doNoise(TRasterPT &ras, double sigma, bool bw, bool red, bool green, pix->b = tcrop(b, 0, pix->m); } } - *pix++; + pix++; } } diff --git a/toonz/sources/stdfx/particlesengine.cpp b/toonz/sources/stdfx/particlesengine.cpp index 5a67d75..636c79a 100644 --- a/toonz/sources/stdfx/particlesengine.cpp +++ b/toonz/sources/stdfx/particlesengine.cpp @@ -744,11 +744,13 @@ void Particles_Engine::do_render( std::string alias; TRasterImageP rimg; - if (rimg = partLevel[part->level]->frame(ndx)) { + rimg = partLevel[part->level]->frame(ndx); + if (rimg) { ras = rimg->getRaster(); } else { alias = "PART: " + (*part_ports[part->level])->getAlias(ndx, riNew); - if (rimg = TImageCache::instance()->get(alias, false)) { + rimg = TImageCache::instance()->get(alias, false); + if (rimg) { ras = rimg->getRaster(); // Check that the raster resolution is sufficient for our purposes @@ -864,7 +866,7 @@ void Particles_Engine::fill_array(TTile *ctrl1, int ®ioncount, if (myarray[i - 1]) myarray[i] = myarray[i - 1]; } } - *pix++; + pix++; } for (j = 1; j < ly; j++) { @@ -1035,7 +1037,7 @@ void Particles_Engine::fill_single_region( // int a=0; } i++; - *pix++; + pix++; } } } else { @@ -1065,7 +1067,7 @@ void Particles_Engine::fill_single_region( } else { } i++; - *pix++; + pix++; } } } diff --git a/toonz/sources/stdfx/perlinnoisefx.cpp b/toonz/sources/stdfx/perlinnoisefx.cpp index e2f9ab1..f4c38fd 100644 --- a/toonz/sources/stdfx/perlinnoisefx.cpp +++ b/toonz/sources/stdfx/perlinnoisefx.cpp @@ -124,8 +124,8 @@ void doPerlinNoise(const TRasterPT &rasOut, pixout->b = (CHANNEL_TYPE)((pix + pixshift)->b); pixout->m = (CHANNEL_TYPE)((pix + pixshift)->m); } - *pix++; - *pixout++; + pix++; + pixout++; } } else @@ -157,8 +157,8 @@ void doPerlinNoise(const TRasterPT &rasOut, pixout->b = (CHANNEL_TYPE)((pix + pixshift)->b); pixout->m = (CHANNEL_TYPE)((pix + pixshift)->m); } - *pix++; - *pixout++; + pix++; + pixout++; } } rasOut->unlock(); diff --git a/toonz/sources/stdfx/pins.cpp b/toonz/sources/stdfx/pins.cpp index 0f1edfc..59206f0 100644 --- a/toonz/sources/stdfx/pins.cpp +++ b/toonz/sources/stdfx/pins.cpp @@ -468,7 +468,7 @@ static int splitMatrix(double **a, int n, int *index) { vv[imax] = vv[j]; } index[j] = imax; - if (fabsf(a[j][j]) <= TINY && (j != n - 1)) { + if (std::abs(a[j][j]) <= TINY && (j != n - 1)) { /*printf("Cazzo, E' singolare %f!\n", a[j][j] );*/ return imax + 1; } diff --git a/toonz/sources/stdfx/posterizefx.cpp b/toonz/sources/stdfx/posterizefx.cpp index fcb892c..715a94a 100644 --- a/toonz/sources/stdfx/posterizefx.cpp +++ b/toonz/sources/stdfx/posterizefx.cpp @@ -65,7 +65,7 @@ void doPosterize(TRasterPT ras, int levels) { pix->r = (CHANNEL_TYPE)(solarize_lut[(int)(pix->r)]); pix->g = (CHANNEL_TYPE)(solarize_lut[(int)(pix->g)]); pix->b = (CHANNEL_TYPE)(solarize_lut[(int)(pix->b)]); - *pix++; + pix++; } } ras->unlock(); diff --git a/toonz/sources/stdfx/rgbmcutfx.cpp b/toonz/sources/stdfx/rgbmcutfx.cpp index be812e1..06b5023 100644 --- a/toonz/sources/stdfx/rgbmcutfx.cpp +++ b/toonz/sources/stdfx/rgbmcutfx.cpp @@ -93,7 +93,7 @@ void doRGBMCut(TRasterPT ras, double hi_m, double hi_r, double hi_g, pix->b = tcrop((int)pix->b, (int)lo_b, (int)hi_b); *pix = premultiply(*pix); } - *pix++; + pix++; } } ras->unlock(); diff --git a/toonz/sources/stdfx/saltpeppernoisefx.cpp b/toonz/sources/stdfx/saltpeppernoisefx.cpp index 3baa53a..5ab42f7 100644 --- a/toonz/sources/stdfx/saltpeppernoisefx.cpp +++ b/toonz/sources/stdfx/saltpeppernoisefx.cpp @@ -65,7 +65,7 @@ void doSaltPepperNoise(const TRasterPT &ras, const double intensity, } else if (data >= data2 && data < 0.5) pix->r = pix->g = pix->b = pix->m; } - *pix++; + pix++; } } ras->unlock(); diff --git a/toonz/sources/stdfx/shaderfx.cpp b/toonz/sources/stdfx/shaderfx.cpp index a427a64..b68b427 100644 --- a/toonz/sources/stdfx/shaderfx.cpp +++ b/toonz/sources/stdfx/shaderfx.cpp @@ -310,6 +310,8 @@ Suggestions are welcome as this is a tad beyond ridiculous... "This system configuration does not support OpenGL Shader " "Programs. Shader Fxs will not be able to render.")); break; + default: + break; } sentMsg = true; @@ -471,6 +473,8 @@ void ShaderFx::initialize() { case ShaderInterface::ANGLE_UI: param->setMeasureName(l_measureNames[ANGLE]); break; + default: + break; } m_params.push_back(param); @@ -511,6 +515,8 @@ void ShaderFx::initialize() { param->getX()->setMeasureName(l_measureNames[ANGLE]); param->getY()->setMeasureName(l_measureNames[ANGLE]); break; + default: + break; } m_params.push_back(param); @@ -552,6 +558,8 @@ void ShaderFx::initialize() { *boost::unsafe_any_cast(&m_params.back())); break; } + default: + break; } } @@ -780,6 +788,8 @@ void ShaderFx::bindParameters(QOpenGLShaderProgram *program, double frame) { (GLfloat)value.m / 255.0f); break; } + default: + break; } } } diff --git a/toonz/sources/stdfx/shaderinterface.cpp b/toonz/sources/stdfx/shaderinterface.cpp index db1bf90..30e9613 100644 --- a/toonz/sources/stdfx/shaderinterface.cpp +++ b/toonz/sources/stdfx/shaderinterface.cpp @@ -509,6 +509,8 @@ void ShaderInterface::Parameter::saveData(TOStream &os) { os << (int)m_default.m_rgb[0] << (int)m_default.m_rgb[1] << (int)m_default.m_rgb[2]; break; + default: + break; } os.closeChild(); @@ -552,6 +554,8 @@ void ShaderInterface::Parameter::saveData(TOStream &os) { << m_range[0].m_ivec4[2] << m_range[1].m_ivec4[2] << m_range[0].m_ivec4[3] << m_range[1].m_ivec4[3]; break; + default: + break; } os.closeChild(); @@ -645,6 +649,8 @@ void ShaderInterface::Parameter::loadData(TIStream &is) { case RGB: m_default.m_rgb[0] = m_default.m_rgb[1] = m_default.m_rgb[2] = 255; break; + default: + break; } // Attempt loading range from file @@ -723,6 +729,8 @@ void ShaderInterface::Parameter::loadData(TIStream &is) { is >> val, m_default.m_rgb[2] = val; break; } + default: + break; } is.closeChild(); @@ -789,6 +797,8 @@ void ShaderInterface::Parameter::loadData(TIStream &is) { m_range[0].m_ivec4[2] >> m_range[1].m_ivec4[2] >> m_range[0].m_ivec4[3] >> m_range[1].m_ivec4[3]; break; + default: + break; } is.closeChild(); diff --git a/toonz/sources/stdfx/solarizefx.cpp b/toonz/sources/stdfx/solarizefx.cpp index fccf91c..dde92e6 100644 --- a/toonz/sources/stdfx/solarizefx.cpp +++ b/toonz/sources/stdfx/solarizefx.cpp @@ -89,7 +89,7 @@ void doSolarize(TRasterPT ras, double max, int edge) { pix->r = (CHANNEL_TYPE)(solarize_lut[(int)(pix->r)]); pix->g = (CHANNEL_TYPE)(solarize_lut[(int)(pix->g)]); pix->b = (CHANNEL_TYPE)(solarize_lut[(int)(pix->b)]); - *pix++; + pix++; } } ras->unlock(); diff --git a/toonz/sources/tcleanupper/tcleanupper.cpp b/toonz/sources/tcleanupper/tcleanupper.cpp index 30f535d..09c121c 100644 --- a/toonz/sources/tcleanupper/tcleanupper.cpp +++ b/toonz/sources/tcleanupper/tcleanupper.cpp @@ -275,7 +275,7 @@ static void searchLevelsToCleanup( continue; } int ltype = sl->getType(); - if (ltype == TZP_XSHLEVEL && sl->getScannedPath() != TFilePath() || + if ((ltype == TZP_XSHLEVEL && sl->getScannedPath() != TFilePath()) || ltype == OVL_XSHLEVEL || ltype == TZI_XSHLEVEL) { wstring levelName = sl->getName(); levelTable[levelName] = sl; diff --git a/toonz/sources/tcomposer/tcomposer.cpp b/toonz/sources/tcomposer/tcomposer.cpp index 08b146b..48eba05 100644 --- a/toonz/sources/tcomposer/tcomposer.cpp +++ b/toonz/sources/tcomposer/tcomposer.cpp @@ -799,7 +799,7 @@ int main(int argc, char *argv[]) { Sw1.start(); - if (!TSystem::doesExistFileOrLevel(srcFilePath)) return false; + if (!TSystem::doesExistFileOrLevel(srcFilePath)) return -2; ToonzScene *scene = new ToonzScene(); TImageStyle::setCurrentScene(scene); diff --git a/toonz/sources/tconverter/tconverter.cpp b/toonz/sources/tconverter/tconverter.cpp index 3a597c6..a133617 100644 --- a/toonz/sources/tconverter/tconverter.cpp +++ b/toonz/sources/tconverter/tconverter.cpp @@ -422,7 +422,7 @@ int main(int argc, char *argv[]) { exit(1); } - if (!TSystem::doesExistFileOrLevel(tnzFilePath)) return false; + if (!TSystem::doesExistFileOrLevel(tnzFilePath)) return -1; ToonzScene *scene = new ToonzScene(); try { scene->loadTnzFile(tnzFilePath); diff --git a/toonz/sources/tnzbase/tscanner/tscanner.cpp b/toonz/sources/tnzbase/tscanner/tscanner.cpp index 2a3aeb8..7da7f2d 100644 --- a/toonz/sources/tnzbase/tscanner/tscanner.cpp +++ b/toonz/sources/tnzbase/tscanner/tscanner.cpp @@ -225,6 +225,8 @@ void TScannerParameters::saveData(TOStream &os) const { case RGB24: scanTypeString = Rgbcolors; break; + default: + break; } attr.clear(); attr["value"] = scanTypeString; diff --git a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp index df3e5de..8da4d15 100644 --- a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp +++ b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp @@ -73,7 +73,7 @@ static unsigned char NotReady = 1 << 6; //----------------------------------------------------------------------------- -#define log +#define log(_str) class TScannerExpection final : public TException { TString m_scannerMsg; diff --git a/toonz/sources/tnzext/ExtUtil.cpp b/toonz/sources/tnzext/ExtUtil.cpp index 2828cc4..69b8274 100644 --- a/toonz/sources/tnzext/ExtUtil.cpp +++ b/toonz/sources/tnzext/ExtUtil.cpp @@ -32,12 +32,13 @@ inline bool isWGood(double first, double w, double second, const TStroke *s) { return false; if (s) { - if (s->isSelfLoop()) + if (s->isSelfLoop()) { if (first > second) { if ((first < w && w <= 1.0) || (0.0 <= w && w < second)) return true; } else if (first == second) { if (areAlmostEqual(w, first)) return true; } + } } if (first < w && w < second) return true; diff --git a/toonz/sources/tnzext/StraightCornerDeformation.cpp b/toonz/sources/tnzext/StraightCornerDeformation.cpp index 6b9862b..3917b4c 100644 --- a/toonz/sources/tnzext/StraightCornerDeformation.cpp +++ b/toonz/sources/tnzext/StraightCornerDeformation.cpp @@ -73,7 +73,7 @@ bool StraightCornerDeformation::check_(const ContextStatus *status) { double w = status->w_; // check extremes in another way. - if (!s->isSelfLoop() && areAlmostEqual(w, 0.0) || areAlmostEqual(w, 1.0)) { + if ((!s->isSelfLoop() && areAlmostEqual(w, 0.0)) || areAlmostEqual(w, 1.0)) { return isAStraightCorner(s, w, &this->getStraightsList()); } diff --git a/toonz/sources/tnztools/autofillpli.cpp b/toonz/sources/tnztools/autofillpli.cpp index c9a51c0..0038a9f 100644 --- a/toonz/sources/tnztools/autofillpli.cpp +++ b/toonz/sources/tnztools/autofillpli.cpp @@ -156,12 +156,12 @@ void assignProbs(std::vector &probVector, probs.m_barycenterProb = tround(1000 * (1 - (delta_pos / delta_pos_max))); - delta_area = abs(reference.m_area - work.m_area); + delta_area = std::abs(reference.m_area - work.m_area); probs.m_areaProb = tround( 1000 * (1 - ((double)delta_area / (reference.m_area + work.m_area)))); - delta_per = abs(reference.m_perimeter - work.m_perimeter); + delta_per = std::abs(reference.m_perimeter - work.m_perimeter); probs.m_perimeterProb = tround( 1000 * (1 - ((double)delta_per / (reference.m_perimeter + work.m_perimeter)))); @@ -346,7 +346,7 @@ bool rect_autofill_apply(const TVectorImageP &imgToApply, const TRectD &rect, regionsReference[from].m_match = to; regionsWork[to].m_styleId = regionsReference[from].m_styleId; TRegion *reg = regionsWork[to].m_region; - if (reg && (!selective || selective && reg->getStyle() == 0)) { + if (reg && (!selective || (selective && reg->getStyle() == 0))) { reg->setStyle(regionsWork[to].m_styleId); filledRegions = true; } @@ -476,7 +476,7 @@ bool stroke_autofill_apply(const TVectorImageP &imgToApply, TStroke *stroke, regionsReference[from].m_match = to; regionsWork[to].m_styleId = regionsReference[from].m_styleId; TRegion *reg = regionsWork[to].m_region; - if (reg && (!selective || selective && reg->getStyle() == 0)) { + if (reg && (!selective || (selective && reg->getStyle() == 0))) { reg->setStyle(regionsWork[to].m_styleId); filledRegions = true; } diff --git a/toonz/sources/tnztools/autofilltlv.cpp b/toonz/sources/tnztools/autofilltlv.cpp index a854c89..98cebe1 100644 --- a/toonz/sources/tnztools/autofilltlv.cpp +++ b/toonz/sources/tnztools/autofilltlv.cpp @@ -22,7 +22,11 @@ #include "toonz/tscenehandle.h" #include "tools/tool.h"*/ +#ifndef _WIN32 +#define PRINTF(args...) +#else #define PRINTF +#endif struct s_segm { int xa, xb, region; @@ -1010,7 +1014,7 @@ static void assign_prob3(int prob[], int i, int j) BIG_TO_DOUBLE(F_work.array[j].by) / F_work.array[j].npix); delta_forma_mom = - abs(sqrt(delta_momx1 + delta_momy1) - sqrt(delta_momx2 + delta_momy2)); + std::abs(sqrt(delta_momx1 + delta_momy1) - sqrt(delta_momx2 + delta_momy2)); delta_forma1 = ROUNDP( 1000 * (((double)F_reference.array[i].per / F_reference.array[i].npix - diff --git a/toonz/sources/tnztools/cuttertool.cpp b/toonz/sources/tnztools/cuttertool.cpp index 593aeb6..3cded97 100644 --- a/toonz/sources/tnztools/cuttertool.cpp +++ b/toonz/sources/tnztools/cuttertool.cpp @@ -225,38 +225,38 @@ public: continue; } - diff = abs(intersection.first - w); + diff = std::abs(intersection.first - w); if (diff < minDiff) { minDiff = diff; nearestW = intersection.first; } - diff = abs(intersection.second - w); + diff = std::abs(intersection.second - w); if (diff < minDiff) { minDiff = diff; nearestW = intersection.second; } if (selfStroke->isSelfLoop()) { - diff = abs(1 - intersection.first) + w; + diff = std::abs(1 - intersection.first) + w; if (diff < minDiff) { minDiff = diff; nearestW = intersection.first; } - diff = intersection.first + abs(1 - w); + diff = intersection.first + std::abs(1 - w); if (diff < minDiff) { minDiff = diff; nearestW = intersection.first; } - diff = abs(1 - intersection.second) + w; + diff = std::abs(1 - intersection.second) + w; if (diff < minDiff) { minDiff = diff; nearestW = intersection.second; } - diff = intersection.second + abs(1 - w); + diff = intersection.second + std::abs(1 - w); if (diff < minDiff) { minDiff = diff; nearestW = intersection.second; @@ -272,20 +272,20 @@ public: intersect(selfStroke, stroke, intersections, false); for (auto &intersection : intersections) { - diff = abs(intersection.first - w); + diff = std::abs(intersection.first - w); if (diff < minDiff) { minDiff = diff; nearestW = intersection.first; } if (selfStroke->isSelfLoop()) { - diff = abs(1 - intersection.first) + w; + diff = std::abs(1 - intersection.first) + w; if (diff < minDiff) { minDiff = diff; nearestW = intersection.first; } - diff = intersection.first + abs(1 - w); + diff = intersection.first + std::abs(1 - w); if (diff < minDiff) { minDiff = diff; nearestW = intersection.first; diff --git a/toonz/sources/tnztools/edittool.cpp b/toonz/sources/tnztools/edittool.cpp index a557a03..3471fdf 100644 --- a/toonz/sources/tnztools/edittool.cpp +++ b/toonz/sources/tnztools/edittool.cpp @@ -489,9 +489,9 @@ public: if (norm2(a) < eps || norm2(b) < eps) return; double fx = b.x / a.x; - if (fabs(fx) > 1) fx = tsign(fx) * sqrt(abs(fx)); + if (fabs(fx) > 1) fx = tsign(fx) * sqrt(std::abs(fx)); double fy = b.y / a.y; - if (fabs(fy) > 1) fy = tsign(fy) * sqrt(abs(fy)); + if (fabs(fy) > 1) fy = tsign(fy) * sqrt(std::abs(fy)); int constraint = m_constraint; if (constraint == ScaleConstraints::None && e.isShiftPressed()) diff --git a/toonz/sources/tnztools/edittoolgadgets.cpp b/toonz/sources/tnztools/edittoolgadgets.cpp index ff06607..eb95383 100644 --- a/toonz/sources/tnztools/edittoolgadgets.cpp +++ b/toonz/sources/tnztools/edittoolgadgets.cpp @@ -1713,6 +1713,8 @@ FxGadget *FxGadgetController::allocateGadget(const TParamUIConcept &uiConcept) { uiConcept.m_params[1]); break; } + default: + break; } if (gadget) gadget->setLabel(uiConcept.m_label); diff --git a/toonz/sources/tnztools/filltool.cpp b/toonz/sources/tnztools/filltool.cpp index 15c85a8..898a66a 100644 --- a/toonz/sources/tnztools/filltool.cpp +++ b/toonz/sources/tnztools/filltool.cpp @@ -1906,7 +1906,7 @@ void FillTool::leftButtonDoubleClick(const TPointD &pos, const TMouseEvent &e) { //----------------------------------------------------------------------------- void FillTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) { - if (m_fillType.getValue() != NORMALFILL && !m_onion.getValue() || + if ((m_fillType.getValue() != NORMALFILL && !m_onion.getValue()) || (m_colorType.getValue() == AREAS && m_onion.getValue())) m_rectFill->leftButtonDrag(pos, e); else if (!m_onion.getValue() && !m_frameRange.getValue()) { diff --git a/toonz/sources/tnztools/fullcolorerasertool.cpp b/toonz/sources/tnztools/fullcolorerasertool.cpp index 2b66c18..df38811 100644 --- a/toonz/sources/tnztools/fullcolorerasertool.cpp +++ b/toonz/sources/tnztools/fullcolorerasertool.cpp @@ -108,7 +108,7 @@ void eraseImage(const TRasterImageP &ri, const TRaster32P &image, TPixel32 *outPix = workRas->pixels(y); TPixel32 *outEndPix = outPix + workRas->getLx(); TPixel32 *inPix = image->pixels(y); - for (outPix; outPix != outEndPix; outPix++, inPix++) { + for (; outPix != outEndPix; outPix++, inPix++) { if (outPix->m == 0) continue; TPixel32 pix = depremultiply(*outPix); pix.m = diff --git a/toonz/sources/tnztools/geometrictool.cpp b/toonz/sources/tnztools/geometrictool.cpp index f5d271a..bd61eea 100644 --- a/toonz/sources/tnztools/geometrictool.cpp +++ b/toonz/sources/tnztools/geometrictool.cpp @@ -1222,7 +1222,7 @@ TPointD Primitive::checkGuideSnapping(TPointD pos) { if (vGuideCount) { for (int j = 0; j < vGuideCount; j++) { double guide = viewer->getVGuide(j); - double tempDistance = abs(guide - pos.y); + double tempDistance = std::abs(guide - pos.y); if (tempDistance < guideDistance && (distanceToVGuide < 0 || tempDistance < distanceToVGuide)) { distanceToVGuide = tempDistance; @@ -1234,7 +1234,7 @@ TPointD Primitive::checkGuideSnapping(TPointD pos) { if (hGuideCount) { for (int j = 0; j < hGuideCount; j++) { double guide = viewer->getHGuide(j); - double tempDistance = abs(guide - pos.x); + double tempDistance = std::abs(guide - pos.x); if (tempDistance < guideDistance && (distanceToHGuide < 0 || tempDistance < distanceToHGuide)) { distanceToHGuide = tempDistance; @@ -1244,8 +1244,8 @@ TPointD Primitive::checkGuideSnapping(TPointD pos) { } } if (useGuides && m_param->m_foundSnap) { - double currYDistance = abs(m_param->m_snapPoint.y - pos.y); - double currXDistance = abs(m_param->m_snapPoint.x - pos.x); + double currYDistance = std::abs(m_param->m_snapPoint.y - pos.y); + double currXDistance = std::abs(m_param->m_snapPoint.x - pos.x); double hypotenuse = sqrt(pow(currYDistance, 2.0) + pow(currXDistance, 2.0)); if ((distanceToVGuide >= 0 && distanceToVGuide < hypotenuse) || diff --git a/toonz/sources/tnztools/pinchtool.cpp b/toonz/sources/tnztools/pinchtool.cpp index 55b5d53..81c4167 100644 --- a/toonz/sources/tnztools/pinchtool.cpp +++ b/toonz/sources/tnztools/pinchtool.cpp @@ -463,8 +463,8 @@ void PinchTool::mouseMove(const TPointD &pos, const TMouseEvent &event) { m_curr = pos; const int pixelRange = 3; - if (abs(m_lastMouseEvent.m_pos.x - event.m_pos.x) < pixelRange && - abs(m_lastMouseEvent.m_pos.y - event.m_pos.y) < pixelRange && + if (std::abs(m_lastMouseEvent.m_pos.x - event.m_pos.x) < pixelRange && + std::abs(m_lastMouseEvent.m_pos.y - event.m_pos.y) < pixelRange && m_lastMouseEvent.getModifiersMask() == event.getModifiersMask()) return; diff --git a/toonz/sources/tnztools/pumptool.cpp b/toonz/sources/tnztools/pumptool.cpp index 5c2de43..2bf1728 100644 --- a/toonz/sources/tnztools/pumptool.cpp +++ b/toonz/sources/tnztools/pumptool.cpp @@ -198,18 +198,22 @@ void PumpTool::draw() { double len = stroke->getLength(w); double len1 = len - actionLen; - if (len1 < 0) - if (stroke->isSelfLoop()) + if (len1 < 0) { + if (stroke->isSelfLoop()) { len1 += totalLen; - else + } else { len1 = 0; + } + } double len2 = len + actionLen; - if (len2 > totalLen) - if (stroke->isSelfLoop()) + if (len2 > totalLen) { + if (stroke->isSelfLoop()) { len2 -= totalLen; - else + } else { len2 = totalLen; + } + } w1 = stroke->getParameterAtLength(len1); w2 = stroke->getParameterAtLength(len2); diff --git a/toonz/sources/tnztools/rulertool.cpp b/toonz/sources/tnztools/rulertool.cpp index 6acf77a..98f1b42 100644 --- a/toonz/sources/tnztools/rulertool.cpp +++ b/toonz/sources/tnztools/rulertool.cpp @@ -301,7 +301,7 @@ TPointD RulerTool::getHVCoordinatedPos(TPointD p, TPointD centerPos) { outPoint.y = p.y; } else if (degree < -22.5) /*--右斜め下--*/ { - if (abs(vec.x) > abs(vec.y)) + if (std::abs(vec.x) > std::abs(vec.y)) outPoint = centerPos + TPointD(-vec.y, vec.y); else outPoint = centerPos + TPointD(vec.x, -vec.x); @@ -311,7 +311,7 @@ TPointD RulerTool::getHVCoordinatedPos(TPointD p, TPointD centerPos) { outPoint.y = centerPos.y; } else if (degree < 67.5) /*--右斜め上--*/ { - if (abs(vec.x) > abs(vec.y)) + if (std::abs(vec.x) > std::abs(vec.y)) outPoint = centerPos + TPointD(vec.y, vec.y); else outPoint = centerPos + TPointD(vec.x, vec.x); diff --git a/toonz/sources/tnztools/screenpicker.cpp b/toonz/sources/tnztools/screenpicker.cpp index 1f3a679..c080e37 100644 --- a/toonz/sources/tnztools/screenpicker.cpp +++ b/toonz/sources/tnztools/screenpicker.cpp @@ -47,7 +47,10 @@ void ScreenPicker::event(QWidget *widget, QEvent *e) { case QEvent::MouseButtonRelease: mouseReleaseEvent(widget, static_cast(e)); - }; + + default: + break; + } } //------------------------------------------------------------------ diff --git a/toonz/sources/tnztools/selectiontool.cpp b/toonz/sources/tnztools/selectiontool.cpp index 48c302a..a911fc5 100644 --- a/toonz/sources/tnztools/selectiontool.cpp +++ b/toonz/sources/tnztools/selectiontool.cpp @@ -59,7 +59,7 @@ int tminPoint(std::vector points, bool isX) { TPointD p = points[0]; for (i = 1; i < (int)points.size(); i++) { TPointD nextP = points[i]; - if (isX && p.x < nextP.x || !isX && p.y < nextP.y) continue; + if ((isX && p.x < nextP.x) || (!isX && p.y < nextP.y)) continue; index = i; } return index; @@ -1024,7 +1024,7 @@ void SelectionTool::updateAction(TPointD pos, const TMouseEvent &e) { m_selectedPoint = NONE; if ((isLevelType() || isSelectedFramesType()) && !isSameStyleType()) { m_what = Inside; - ToolCursor::LevelSelectCursor; + m_cursorId = ToolCursor::LevelSelectCursor; } if (shift) return; diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.cpp b/toonz/sources/tnztools/toonzvectorbrushtool.cpp index cb929bc..cd5f55f 100644 --- a/toonz/sources/tnztools/toonzvectorbrushtool.cpp +++ b/toonz/sources/tnztools/toonzvectorbrushtool.cpp @@ -632,7 +632,7 @@ void ToonzVectorBrushTool::onActivate() { void ToonzVectorBrushTool::onDeactivate() { /*--- - * �h���b�O���Ƀc�[�����؂�ւ�����ꍇ�ɔ����AonDeactivate�ɂ�MouseRelease�Ɠ����������s�� + * ドラッグ中にツールが切り替わった場合に備え、onDeactivateにもMouseReleaseと同じ処理を行う * ---*/ // End current stroke. @@ -714,7 +714,7 @@ void ToonzVectorBrushTool::leftButtonDown(const TPointD &pos, ? computeThickness(e.m_pressure, m_thickness, m_isPath) : m_thickness.getValue().second * 0.5; - /*--- �X�g���[�N�̍ŏ���Max�T�C�Y�̉~���`����Ă��܂��s���h�~���� ---*/ + /*--- ストロークの最初にMaxサイズの円が描かれてしまう不具合を防止する ---*/ if (m_pressure.getValue() && e.m_pressure == 1.0) thickness = m_thickness.getValue().first * 0.5; m_currThickness = thickness; @@ -1419,7 +1419,7 @@ void ToonzVectorBrushTool::checkGuideSnapping(bool beforeMousePress, if (vGuideCount) { for (int j = 0; j < vGuideCount; j++) { double guide = viewer->getVGuide(j); - double tempDistance = abs(guide - m_mousePos.y); + double tempDistance = std::abs(guide - m_mousePos.y); if (tempDistance < guideDistance && (distanceToVGuide < 0 || tempDistance < distanceToVGuide)) { distanceToVGuide = tempDistance; @@ -1431,7 +1431,7 @@ void ToonzVectorBrushTool::checkGuideSnapping(bool beforeMousePress, if (hGuideCount) { for (int j = 0; j < hGuideCount; j++) { double guide = viewer->getHGuide(j); - double tempDistance = abs(guide - m_mousePos.x); + double tempDistance = std::abs(guide - m_mousePos.x); if (tempDistance < guideDistance && (distanceToHGuide < 0 || tempDistance < distanceToHGuide)) { distanceToHGuide = tempDistance; @@ -1441,8 +1441,8 @@ void ToonzVectorBrushTool::checkGuideSnapping(bool beforeMousePress, } } if (useGuides && foundSnap) { - double currYDistance = abs(snapPoint.y - m_mousePos.y); - double currXDistance = abs(snapPoint.x - m_mousePos.x); + double currYDistance = std::abs(snapPoint.y - m_mousePos.y); + double currXDistance = std::abs(snapPoint.x - m_mousePos.x); double hypotenuse = sqrt(pow(currYDistance, 2.0) + pow(currXDistance, 2.0)); if ((distanceToVGuide >= 0 && distanceToVGuide < hypotenuse) || @@ -1473,7 +1473,7 @@ void ToonzVectorBrushTool::checkGuideSnapping(bool beforeMousePress, //------------------------------------------------------------------------------------------------------------- void ToonzVectorBrushTool::draw() { - /*--�V���[�g�J�b�g�ł̃c�[���؂�ւ����ɐԓ_���`�����̂�h�~����--*/ + /*--ショートカットでのツール切り替え時に赤点が描かれるのを防止する--*/ if (m_minThick == 0 && m_maxThick == 0 && !Preferences::instance()->getShow0ThickLines()) return; @@ -1790,7 +1790,7 @@ void ToonzVectorBrushTool::loadLastBrush() { } //------------------------------------------------------------------ -/*! Brush�APaintBrush�AEraserTool��PencilMode�̂Ƃ���True��Ԃ� +/*! Brush、PaintBrush、EraserToolがPencilModeのときにTrueを返す */ bool ToonzVectorBrushTool::isPencilModeActive() { return false; } diff --git a/toonz/sources/tnztools/trackertool.cpp b/toonz/sources/tnztools/trackertool.cpp index 6a6f449..8a37935 100644 --- a/toonz/sources/tnztools/trackertool.cpp +++ b/toonz/sources/tnztools/trackertool.cpp @@ -112,6 +112,7 @@ hook->setAPos(fid, hook->getBPos(fid)); } makeCurrent(); return TDataP(); */ + return (NULL); } TDataP pasteData(const TDataP &data) { return TDataP(); } diff --git a/toonz/sources/tnztools/typetool.cpp b/toonz/sources/tnztools/typetool.cpp index ff198d6..d495d25 100644 --- a/toonz/sources/tnztools/typetool.cpp +++ b/toonz/sources/tnztools/typetool.cpp @@ -1522,7 +1522,7 @@ void TypeTool::deleteKey() { bool TypeTool::keyDown(QKeyEvent *event) { QString text = event->text(); - if ((event->modifiers() & Qt::ShiftModifier)) text.toUpper(); + if ((event->modifiers() & Qt::ShiftModifier)) text = text.toUpper(); if (QKeySequence(event->key() + event->modifiers()) == QKeySequence::Paste) { QClipboard *clipboard = QApplication::clipboard(); diff --git a/toonz/sources/toonz/adjustthicknesspopup.cpp b/toonz/sources/toonz/adjustthicknesspopup.cpp index 7296c5d..9c170d9 100644 --- a/toonz/sources/toonz/adjustthicknesspopup.cpp +++ b/toonz/sources/toonz/adjustthicknesspopup.cpp @@ -465,6 +465,8 @@ AdjustThicknessPopup::SelectionData::SelectionData(const TSelection *sel) case LevelSelection::BOUNDARY_STROKES: m_this->m_contentType = BOUNDARIES; break; + default: + break; } // Discriminate frames selection modes @@ -485,6 +487,8 @@ AdjustThicknessPopup::SelectionData::SelectionData(const TSelection *sel) m_this->m_frameIdxs = std::move(s); break; } + default: + break; } resetIfInvalid(); diff --git a/toonz/sources/toonz/canvassizepopup.cpp b/toonz/sources/toonz/canvassizepopup.cpp index a97a60c..e6ea76a 100644 --- a/toonz/sources/toonz/canvassizepopup.cpp +++ b/toonz/sources/toonz/canvassizepopup.cpp @@ -250,6 +250,8 @@ void PeggingWidget::createButton(QPushButton **button, pix = m_topRightPix.transformed(QMatrix().rotate(90), Qt::SmoothTransformation); break; + default: + break; } (*button)->setIcon(pix); } diff --git a/toonz/sources/toonz/castviewer.cpp b/toonz/sources/toonz/castviewer.cpp index 44ad81c..affcce6 100644 --- a/toonz/sources/toonz/castviewer.cpp +++ b/toonz/sources/toonz/castviewer.cpp @@ -298,11 +298,11 @@ void CastTreeViewer::dragMoveEvent(QDragMoveEvent *event) { (scene->isUntitled()) ? L"Untitled" : scene->getSceneName(); rootName = rootName.fromStdWString(name); } - if (m_dropTargetItem && + if ((m_dropTargetItem && m_dropTargetItem->data(0, Qt::DisplayRole).toString() == - AudioFolderName || - m_dropFilePath != TFilePath() && - m_dropTargetItem->data(0, Qt::DisplayRole).toString() == rootName) + AudioFolderName) || + (m_dropFilePath != TFilePath() && + m_dropTargetItem->data(0, Qt::DisplayRole).toString() == rootName)) m_dropTargetItem = 0; if (!m_dropTargetItem) diff --git a/toonz/sources/toonz/cleanuppopup.cpp b/toonz/sources/toonz/cleanuppopup.cpp index aeb3726..0311550 100644 --- a/toonz/sources/toonz/cleanuppopup.cpp +++ b/toonz/sources/toonz/cleanuppopup.cpp @@ -456,7 +456,7 @@ void CleanupPopup::buildCleanupList() { levelsList.push_back(sl); } /*---TFrameIdを登録---*/ - it->second.insert(cell.getFrameId()).second; + it->second.insert(cell.getFrameId()); } } } @@ -482,7 +482,7 @@ void CleanupPopup::buildCleanupList() { levelsList.push_back(sl); } /*---TFrameIdを登録---*/ - it->second.insert(cell.getFrameId()).second; + it->second.insert(cell.getFrameId()); } } } @@ -563,8 +563,8 @@ bool CleanupPopup::analyzeCleanupList() { } // Prompt user for file conflict resolution - switch (clt.m_resolution = - Resolution(m_overwriteDialog->execute(&clt.m_outputPath))) { + clt.m_resolution = Resolution(m_overwriteDialog->execute(&clt.m_outputPath)); + switch (clt.m_resolution) { case CANCEL: return false; @@ -591,6 +591,8 @@ bool CleanupPopup::analyzeCleanupList() { m_levelAlreadyExists[sl] = false; continue; } + default: + break; } TLevelP level(0); // Current level info. Yeah the init is a shame... :( diff --git a/toonz/sources/toonz/columncommand.cpp b/toonz/sources/toonz/columncommand.cpp index 6195b92..f53f011 100644 --- a/toonz/sources/toonz/columncommand.cpp +++ b/toonz/sources/toonz/columncommand.cpp @@ -1260,9 +1260,9 @@ public: * -*/ if (m_target == TARGET_UPPER && i < cc) continue; - bool negate = m_target == TARGET_CURRENT && cc != i || - m_target == TARGET_OTHER && cc == i || - m_target == TARGET_UPPER && cc == i; + bool negate = ((m_target == TARGET_CURRENT && cc != i) || + (m_target == TARGET_OTHER && cc == i) || + (m_target == TARGET_UPPER && cc == i)); int cmd = m_cmd; diff --git a/toonz/sources/toonz/comboviewerpane.cpp b/toonz/sources/toonz/comboviewerpane.cpp index ee66a47..e10b21c 100644 --- a/toonz/sources/toonz/comboviewerpane.cpp +++ b/toonz/sources/toonz/comboviewerpane.cpp @@ -827,7 +827,7 @@ void ComboViewerPanel::playAudioFrame(int frame) { ->getProperties() ->getOutputProperties() ->getFrameRate(); - m_samplesPerFrame = m_sound->getSampleRate() / abs(m_fps); + m_samplesPerFrame = m_sound->getSampleRate() / std::abs(m_fps); } if (!m_sound) return; m_viewerFps = m_flipConsole->getCurrentFps(); diff --git a/toonz/sources/toonz/dvdirtreeview.cpp b/toonz/sources/toonz/dvdirtreeview.cpp index 1591b26..7366a35 100644 --- a/toonz/sources/toonz/dvdirtreeview.cpp +++ b/toonz/sources/toonz/dvdirtreeview.cpp @@ -1475,7 +1475,7 @@ DvItemListModel::Status DvDirTreeView::getItemVersionControlStatus( SVNStatus s = node->getVersionControlStatus(name); if (s.m_path == name) { if (s.m_item == "missing" || - s.m_item == "none" && s.m_repoStatus == "added") + (s.m_item == "none" && s.m_repoStatus == "added")) return DvItemListModel::VC_Missing; if (s.m_item == "unversioned") return DvItemListModel::VC_Unversioned; // If, for some errors, there is some item added locally but not committed @@ -1535,7 +1535,7 @@ DvItemListModel::Status DvDirTreeView::getItemVersionControlStatus( TFileStatus fs(node->getPath() + levelNames.at(i).toStdWString()); if (s.m_item == "missing" || - s.m_item == "none" && s.m_repoStatus == "added") + (s.m_item == "none" && s.m_repoStatus == "added")) missingCount++; else if (s.m_item == "modified") modifiedCount++; diff --git a/toonz/sources/toonz/dvitemview.cpp b/toonz/sources/toonz/dvitemview.cpp index c5c0b96..c21252b 100644 --- a/toonz/sources/toonz/dvitemview.cpp +++ b/toonz/sources/toonz/dvitemview.cpp @@ -307,6 +307,9 @@ int DvItemListModel::compareData(DataType dataType, int firstIndex, case VersionControlStatus: return firstValue.toInt() < secondValue.toInt(); + + default: + break; } return 0; @@ -818,6 +821,8 @@ void DvItemViewerPanel::setVisibility(DvItemListModel::DataType dataType, case DvItemListModel::VersionControlStatus: BrowserVersionControlStatusisVisible = value; break; + default: + break; } } diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp index 7b6bd1f..1021323 100644 --- a/toonz/sources/toonz/filebrowsermodel.cpp +++ b/toonz/sources/toonz/filebrowsermodel.cpp @@ -411,7 +411,7 @@ QList DvDirVersionControlNode::getMissingFiles() const { while (i != m_statusMap.constEnd()) { SVNStatus s = i.value(); if (s.m_item == "missing" || - s.m_item == "none" && s.m_repoStatus == "added") { + (s.m_item == "none" && s.m_repoStatus == "added")) { TFilePath path(getPath() + TFilePath(s.m_path.toStdWString())); std::string dots = path.getDots(); if (dots != "") { @@ -433,7 +433,7 @@ QStringList DvDirVersionControlNode::getMissingFiles( for (; i != m_statusMap.constEnd(); i++) { SVNStatus s = i.value(); if (s.m_item == "missing" || - s.m_item == "none" && s.m_repoStatus == "added") { + (s.m_item == "none" && s.m_repoStatus == "added")) { TFilePath path(s.m_path.toStdWString()); if (!filter.exactMatch( QString::fromStdWString(path.withoutParentDir().getWideString()))) diff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cpp index 5661738..4f8bf1e 100644 --- a/toonz/sources/toonz/filebrowserpopup.cpp +++ b/toonz/sources/toonz/filebrowserpopup.cpp @@ -189,7 +189,9 @@ void FileBrowserPopup::addFilterType(const QString &type) { //----------------------------------------------------------------------------- void FileBrowserPopup::setFileMode(bool isDirectoryOnly) { - if (m_isDirectoryOnly = isDirectoryOnly) { + + m_isDirectoryOnly = isDirectoryOnly; + if (isDirectoryOnly) { m_nameFieldLabel->setText(tr("Folder name:")); connect(m_browser, SIGNAL(treeFolderChanged(const TFilePath &)), this, SLOT(onFilePathClicked(const TFilePath &))); @@ -2133,7 +2135,7 @@ bool ReplaceParentDirectoryPopup::execute() { std::vector frames; sl->getFids(frames); std::vector::iterator f_it = frames.begin(); - for (f_it; f_it != frames.end(); f_it++) + for (; f_it != frames.end(); f_it++) IconGenerator::instance()->invalidate(sl, *f_it); somethingChanged = true; diff --git a/toonz/sources/toonz/filmstripcommand.cpp b/toonz/sources/toonz/filmstripcommand.cpp index c768bab..9f04e36 100644 --- a/toonz/sources/toonz/filmstripcommand.cpp +++ b/toonz/sources/toonz/filmstripcommand.cpp @@ -629,7 +629,7 @@ public: ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); if (scene) { TCamera *camera = scene->getCurrentCamera(); - TPointD dpi = dpi = camera->getDpi(); + TPointD dpi = camera->getDpi(); dpiX = dpi.x; dpiY = dpi.y; } else diff --git a/toonz/sources/toonz/filmstripselection.cpp b/toonz/sources/toonz/filmstripselection.cpp index 663d98a..a28e09e 100644 --- a/toonz/sources/toonz/filmstripselection.cpp +++ b/toonz/sources/toonz/filmstripselection.cpp @@ -65,7 +65,7 @@ void TFilmstripSelection::enableCommands() { sl->getSimpleLevel()->getFirstFid(), false); bool isNotEditableFullColorLevel = - (type == OVL_XSHLEVEL && path.getFrame() == TFrameId::NO_FRAME || + ((type == OVL_XSHLEVEL && path.getFrame() == TFrameId::NO_FRAME) || (ri && ri->isScanBW())); if (doEnable && !isNotEditableFullColorLevel) { diff --git a/toonz/sources/toonz/flipbook.cpp b/toonz/sources/toonz/flipbook.cpp index 4668097..412efa4 100644 --- a/toonz/sources/toonz/flipbook.cpp +++ b/toonz/sources/toonz/flipbook.cpp @@ -504,7 +504,7 @@ void LoadImagesPopup::onFilePathClicked(const TFilePath &fp) { if (!level || level->getFrameCount() == 0) goto clear; it = level->begin(); - m_to, m_from = it->first.getNumber(); + m_to = m_from = it->first.getNumber(); for (; it != level->end(); ++it) m_to = it->first.getNumber(); @@ -811,6 +811,8 @@ void FlipBook::onButtonPressed(FlipConsole::EGadget button) { case FlipConsole::eSave: saveImages(); break; + default: + break; } } @@ -2237,7 +2239,7 @@ FlipBook *viewFile(const TFilePath &path, int from, int to, int step, if (path.getType() == "scr") return NULL; // Avi and movs may be viewed by an external viewer, depending on preferences - if (path.getType() == "mov" || path.getType() == "avi" && !flipbook) { + if ((path.getType() == "mov" || path.getType() == "avi") && !flipbook) { QString str; QSettings().value("generatedMovieViewEnabled", str); if (str.toInt() != 0) { diff --git a/toonz/sources/toonz/frameheadgadget.cpp b/toonz/sources/toonz/frameheadgadget.cpp index c3dedd0..1e799a8 100644 --- a/toonz/sources/toonz/frameheadgadget.cpp +++ b/toonz/sources/toonz/frameheadgadget.cpp @@ -140,7 +140,7 @@ void FrameHeadGadget::drawOnionSkinSelection(QPainter &p, if (i > 0 || mos > 0) { int ya = y; int yb; - if (i == 0 || mos > 0 && osMask.getMos(i - 1) < 0) { + if (i == 0 || (mos > 0 && osMask.getMos(i - 1) < 0)) { ya = index2y(currentRow) + 10; yb = index2y(currentRow + mos) + 4; } else @@ -177,7 +177,7 @@ bool FrameHeadGadget::eventFilter(QObject *obj, QEvent *e) { int x = mouseEvent->pos().x(); int y = mouseEvent->pos().y() - index2y(frame); - if (x > 24 || x > 12 && frame != currentFrame) return false; + if (x > 24 || (x > 12 && frame != currentFrame)) return false; if (y < 12) { bool isMosArea = x < 6; // click nel quadratino bianco. @@ -206,7 +206,7 @@ bool FrameHeadGadget::eventFilter(QObject *obj, QEvent *e) { int currentFrame = getCurrentFrame(); int x = mouseEvent->pos().x(); int y = mouseEvent->pos().y() - index2y(frame); - if (x > 24 || x > 12 && frame != currentFrame) return false; + if (x > 24 || (x > 12 && frame != currentFrame)) return false; if (mouseEvent->button() == Qt::RightButton) return false; if (x < 12 && y < 12 && frame == currentFrame && m_buttonPressCellIndex == frame) { diff --git a/toonz/sources/toonz/keyframemover.cpp b/toonz/sources/toonz/keyframemover.cpp index efdb2f5..a38c753 100644 --- a/toonz/sources/toonz/keyframemover.cpp +++ b/toonz/sources/toonz/keyframemover.cpp @@ -213,7 +213,7 @@ bool KeyframeMover::moveKeyframes( } else if (m_qualifiers & eInsertKeyframes) { int s = r; TStageObject::Keyframe keyframe = stObj->getKeyframe(r); - if (!m_qualifiers & eCopyKeyframes) stObj->removeKeyframeWithoutUndo(r); + if (!(m_qualifiers & eCopyKeyframes)) stObj->removeKeyframeWithoutUndo(r); std::set keyframeToShift; while (stObj->isKeyframe(s + dr) && s + dr != r) { keyframeToShift.insert(s + dr); diff --git a/toonz/sources/toonz/levelcommand.cpp b/toonz/sources/toonz/levelcommand.cpp index ab63c22..9abd2a4 100644 --- a/toonz/sources/toonz/levelcommand.cpp +++ b/toonz/sources/toonz/levelcommand.cpp @@ -189,7 +189,7 @@ bool loadFids(const TFilePath &path, TXshSimpleLevel *sl, if (!level || level->getFrameCount() == 0) return false; TLevel::Iterator levelIt = level->begin(); bool almostOneUnpaintedFidLoaded = false; - for (levelIt; levelIt != level->end(); ++levelIt) { + for (; levelIt != level->end(); ++levelIt) { TFrameId fid = levelIt->first; std::set::const_iterator it = selectedFids.find(fid); if (it == selectedFids.end()) continue; diff --git a/toonz/sources/toonz/levelsettingspopup.cpp b/toonz/sources/toonz/levelsettingspopup.cpp index af3684d..f50fb5f 100644 --- a/toonz/sources/toonz/levelsettingspopup.cpp +++ b/toonz/sources/toonz/levelsettingspopup.cpp @@ -279,6 +279,8 @@ private: case WhiteTransp: setWhiteTransp(value.toBool()); break; + default: + break; } // This signal is for updating the level settings TApp::instance()->getCurrentScene()->notifySceneChanged(); diff --git a/toonz/sources/toonz/matchlinecommand.cpp b/toonz/sources/toonz/matchlinecommand.cpp index d1156b3..6b33ff9 100644 --- a/toonz/sources/toonz/matchlinecommand.cpp +++ b/toonz/sources/toonz/matchlinecommand.cpp @@ -101,7 +101,7 @@ MergeCmappedDialog::MergeCmappedDialog(TFilePath &levelPath) // MergeColumns command //***************************************************************************** -bool isVectorColumn(const std::set &columns) { +static bool isVectorColumn(const std::set &columns) { TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet(); std::set::const_iterator column = columns.begin(); int start, end; diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp index ec85ddd..0168255 100644 --- a/toonz/sources/toonz/sceneviewer.cpp +++ b/toonz/sources/toonz/sceneviewer.cpp @@ -1116,7 +1116,7 @@ void SceneViewer::hideEvent(QHideEvent *) { disconnect(app, SIGNAL(tabletLeft()), this, SLOT(resetTabletStatus())); - if (!m_stopMotion == NULL) { + if (m_stopMotion) { disconnect(m_stopMotion, SIGNAL(newImageReady()), this, SLOT(onNewStopMotionImageReady())); disconnect(m_stopMotion, SIGNAL(liveViewStopped()), this, @@ -1526,7 +1526,7 @@ void SceneViewer::drawPreview() { } if (!previewer->isFrameReady(row) || - app->getCurrentFrame()->isPlaying() && previewer->isBusy()) { + (app->getCurrentFrame()->isPlaying() && previewer->isBusy())) { glColor3d(1, 0, 0); tglDrawRect(frameRect); @@ -1560,8 +1560,8 @@ void SceneViewer::drawOverlay() { if (!m_drawCameraTest) { // draw grid & guides if (viewGuideToggle.getStatus() && - (m_vRuler && m_vRuler->getGuideCount() || - m_hRuler && m_hRuler->getGuideCount())) { + ((m_vRuler && m_vRuler->getGuideCount()) || + (m_hRuler && m_hRuler->getGuideCount()))) { glPushMatrix(); tglMultMatrix(getViewMatrix()); ViewerDraw::drawGridAndGuides( @@ -2374,16 +2374,18 @@ void SceneViewer::zoomQt(const QPoint ¢er, double factor) { TAffine &viewAff = m_viewAff[i]; double scale2 = fabs(viewAff.det()); if ((scale2 < 100000 || factor < 1) && - (scale2 > 0.001 * 0.05 || factor > 1)) - if (i == m_viewMode) + (scale2 > 0.001 * 0.05 || factor > 1)) { + if (i == m_viewMode) { // viewAff = TTranslation(delta) * TScale(factor) * // TTranslation(-delta) * viewAff; setViewMatrix(TTranslation(delta) * TScale(factor) * TTranslation(-delta) * viewAff, i); - else + } else { // viewAff = TScale(factor) * viewAff; setViewMatrix(TScale(factor) * viewAff, i); + } + } } } diff --git a/toonz/sources/toonz/sceneviewerevents.cpp b/toonz/sources/toonz/sceneviewerevents.cpp index 20cf63c..f64c80c 100644 --- a/toonz/sources/toonz/sceneviewerevents.cpp +++ b/toonz/sources/toonz/sceneviewerevents.cpp @@ -235,6 +235,8 @@ void SceneViewer::onButtonPressed(FlipConsole::EGadget button) { case FlipConsole::eResetView: resetSceneViewer(); break; + default: + break; } } @@ -499,11 +501,11 @@ void SceneViewer::onMove(const TMouseEvent &event) { // if the "compare with snapshot" mode is activated, change the mouse cursor // on the border handle if (m_visualSettings.m_doCompare && isPreviewEnabled()) { - if (abs(curPos.x() - width() * m_compareSettings.m_compareX) < 20) { + if (std::abs(curPos.x() - width() * m_compareSettings.m_compareX) < 20) { cursorSet = true; setToolCursor(this, ToolCursor::ScaleHCursor); - } else if (abs((height() - curPos.y()) - - height() * m_compareSettings.m_compareY) < 20) { + } else if (std::abs((height() - curPos.y()) - + height() * m_compareSettings.m_compareY) < 20) { cursorSet = true; setToolCursor(this, ToolCursor::ScaleVCursor); } @@ -703,7 +705,7 @@ void SceneViewer::onPress(const TMouseEvent &event) { if (!PreviewSubCameraManager::instance()->mousePressEvent(this, event)) return; } else if (m_mouseButton == Qt::LeftButton && m_visualSettings.m_doCompare) { - if (abs(m_pos.x() - width() * m_compareSettings.m_compareX) < 20) { + if (std::abs(m_pos.x() - width() * m_compareSettings.m_compareX) < 20) { m_compareSettings.m_dragCompareX = true; m_compareSettings.m_dragCompareY = false; m_compareSettings.m_compareY = ImagePainter::DefaultCompareValue; @@ -711,8 +713,8 @@ void SceneViewer::onPress(const TMouseEvent &event) { m_tabletEvent = false; m_tabletState = None; return; - } else if (abs((height() - m_pos.y()) - - height() * m_compareSettings.m_compareY) < 20) { + } else if (std::abs((height() - m_pos.y()) - + height() * m_compareSettings.m_compareY) < 20) { m_compareSettings.m_dragCompareY = true; m_compareSettings.m_dragCompareX = false; m_compareSettings.m_compareX = ImagePainter::DefaultCompareValue; @@ -1036,7 +1038,7 @@ void SceneViewer::gestureEvent(QGestureEvent *e) { TPointD center = aff * TPointD(0, 0); if (!m_rotating && !m_zooming) { m_rotationDelta += rotationDelta; - double absDelta = abs(m_rotationDelta); + double absDelta = std::abs(m_rotationDelta); if (absDelta >= 10) { m_rotating = true; } @@ -1310,7 +1312,7 @@ public: bool changeFrameSkippingHolds(QKeyEvent *e) { if ((e->modifiers() & Qt::ShiftModifier) == 0 || - e->key() != Qt::Key_Down && e->key() != Qt::Key_Up) + (e->key() != Qt::Key_Down && e->key() != Qt::Key_Up)) return false; TApp *app = TApp::instance(); TFrameHandle *fh = app->getCurrentFrame(); diff --git a/toonz/sources/toonz/subcameramanager.cpp b/toonz/sources/toonz/subcameramanager.cpp index 59a0199..560ad0b 100644 --- a/toonz/sources/toonz/subcameramanager.cpp +++ b/toonz/sources/toonz/subcameramanager.cpp @@ -136,8 +136,8 @@ bool PreviewSubCameraManager::mouseMoveEvent(SceneViewer *viewer, QPointF curPos(event.mousePos() * getDevPixRatio()); if (event.buttons() == Qt::LeftButton) { if (!bitwiseContains(m_dragType, INNER)) { - if (abs(curPos.x() - m_mousePressPos.x()) > 10 || - abs(curPos.y() - m_mousePressPos.y()) > 10) + if (std::abs(curPos.x() - m_mousePressPos.x()) > 10 || + std::abs(curPos.y() - m_mousePressPos.y()) > 10) m_clickAndDrag = true; } diff --git a/toonz/sources/toonz/svnupdatedialog.cpp b/toonz/sources/toonz/svnupdatedialog.cpp index 13a84e9..c178773 100644 --- a/toonz/sources/toonz/svnupdatedialog.cpp +++ b/toonz/sources/toonz/svnupdatedialog.cpp @@ -226,7 +226,7 @@ void SVNUpdateDialog::checkFiles() { s.m_repoStatus == "modified" || s.m_repoStatus == "modified") { if (s.m_path.endsWith(".tnz") && (s.m_item == "missing" || - s.m_item == "none" && s.m_repoStatus == "added")) { + (s.m_item == "none" && s.m_repoStatus == "added"))) { TFilePath scenePath = TFilePath(m_workingDir.toStdWString()) + s.m_path.toStdWString(); TFilePath iconPath = ToonzScene::getIconPath(scenePath); diff --git a/toonz/sources/toonz/versioncontrol.cpp b/toonz/sources/toonz/versioncontrol.cpp index c99423f..f22677a 100644 --- a/toonz/sources/toonz/versioncontrol.cpp +++ b/toonz/sources/toonz/versioncontrol.cpp @@ -318,7 +318,7 @@ VersionControlManager *VersionControlManager::instance() { } //----------------------------------------------------------------------------- -void setVersionControlCredentials(QString currentPath) { +static void setVersionControlCredentials(QString currentPath) { VersionControl *vc = VersionControl::instance(); QList repositories = vc->getRepositories(); int repoCount = repositories.size(); diff --git a/toonz/sources/toonz/viewerdraw.cpp b/toonz/sources/toonz/viewerdraw.cpp index e8ffe02..9b97047 100644 --- a/toonz/sources/toonz/viewerdraw.cpp +++ b/toonz/sources/toonz/viewerdraw.cpp @@ -284,7 +284,7 @@ void ViewerDraw::drawGridAndGuides(SceneViewer *viewer, double sc, Ruler *vr, double ymax = std::max({p00.y, p01.y, p10.y, p11.y}); double step = 10; - double absSc = abs(sc); + double absSc = std::abs(sc); if (absSc * step < 4) while (absSc * step < 4) step *= 5; else if (absSc * step > 20) diff --git a/toonz/sources/toonz/viewerpane.cpp b/toonz/sources/toonz/viewerpane.cpp index b77e071..f7f4138 100644 --- a/toonz/sources/toonz/viewerpane.cpp +++ b/toonz/sources/toonz/viewerpane.cpp @@ -708,7 +708,7 @@ void SceneViewerPanel::playAudioFrame(int frame) { ->getProperties() ->getOutputProperties() ->getFrameRate(); - m_samplesPerFrame = m_sound->getSampleRate() / abs(m_fps); + m_samplesPerFrame = m_sound->getSampleRate() / std::abs(m_fps); } if (!m_sound) return; m_viewerFps = m_flipConsole->getCurrentFps(); diff --git a/toonz/sources/toonz/xdtsio.cpp b/toonz/sources/toonz/xdtsio.cpp index 5d298f9..9e1a1a3 100644 --- a/toonz/sources/toonz/xdtsio.cpp +++ b/toonz/sources/toonz/xdtsio.cpp @@ -128,7 +128,7 @@ void XdtsFieldTrackItem::write(QJsonObject &json) const { } //----------------------------------------------------------------------------- -bool frameLessThan(const QPair &v1, const QPair &v2) { +static bool frameLessThan(const QPair &v1, const QPair &v2) { return v1.first < v2.first; } diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp index 5456acc..d55cbe4 100644 --- a/toonz/sources/toonz/xshcellviewer.cpp +++ b/toonz/sources/toonz/xshcellviewer.cpp @@ -978,11 +978,11 @@ void RenameCellField::keyPressEvent(QKeyEvent *event) { cellSelection->selectCells(r0, c0, r1 + offset.frame(), c1 + offset.layer()); } else { - CellPosition offset(offset * stride); - int movedR0 = std::max(0, r0 + offset.frame()); + CellPosition offset_(offset * stride); + int movedR0 = std::max(0, r0 + offset_.frame()); int firstCol = Preferences::instance()->isXsheetCameraColumnVisible() ? -1 : 0; - int movedC0 = std::max(firstCol, c0 + offset.layer()); + int movedC0 = std::max(firstCol, c0 + offset_.layer()); int diffFrame = movedR0 - r0; int diffLayer = movedC0 - c0; // It needs to be discussed - I made not to rename cell with arrow key. @@ -990,8 +990,8 @@ void RenameCellField::keyPressEvent(QKeyEvent *event) { // renameCell(); cellSelection->selectCells(r0 + diffFrame, c0 + diffLayer, r1 + diffFrame, c1 + diffLayer); - int newRow = std::max(0, m_row + offset.frame()); - int newCol = std::max(firstCol, m_col + offset.layer()); + int newRow = std::max(0, m_row + offset_.frame()); + int newCol = std::max(firstCol, m_col + offset_.layer()); showInRowCol(newRow, newCol, c1 - c0 > 0); } m_viewer->updateCells(); diff --git a/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp b/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp index 53ef038..f758638 100644 --- a/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp +++ b/toonz/sources/toonzfarm/tfarmcontroller/tfarmcontroller.cpp @@ -1155,8 +1155,8 @@ CtrlFarmTask *FarmController::getTaskToStart(FarmServerProxy *server) { CtrlFarmTask *task = itTask->second; if ((!server || (task->m_platform == NoPlatform || task->m_platform == server->m_platform)) && - ((task->m_status == Waiting && task->m_priority > maxPriority) || - (task->m_status == Aborted && task->m_failureCount < 3) && + (((task->m_status == Waiting && task->m_priority > maxPriority) || + (task->m_status == Aborted && task->m_failureCount < 3)) && task->m_parentId != "")) { bool dependenciesCompleted = true; @@ -2171,7 +2171,7 @@ void FarmController::activateReadyServers() { ServerState state = queryServerState2(server->getId()); int tasksCount = server->m_tasks.size(); if (state == Ready || - state == Busy && tasksCount < server->m_maxTaskCount) { + (state == Busy && tasksCount < server->m_maxTaskCount)) { for (int i = 0; i < (server->m_maxTaskCount - tasksCount); ++i) { // cerca un task da sottomettere al server CtrlFarmTask *task = getTaskToStart(server); diff --git a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp index d40e6c0..6b2cacc 100644 --- a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp +++ b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp @@ -542,7 +542,7 @@ QString FarmServer::execute(const vector &argv) { reply += ","; } - if (!reply.isEmpty()) reply.left(reply.size() - 1); + if (!reply.isEmpty()) reply = reply.left(reply.size() - 1); return reply; } else if (argv[0] == "queryHwInfo") { @@ -727,14 +727,17 @@ std::string getLine(std::istream &is) { while (!is.eof()) { is.get(c); - if (c != '\r') - if (c != '\n') - if (!is.fail()) + if (c != '\r') { + if (c != '\n') { + if (!is.fail()) { out.append(1, c); - else + } else { break; - else + } + } else { break; + } + } } return out; } diff --git a/toonz/sources/toonzlib/autoclose.cpp b/toonz/sources/toonzlib/autoclose.cpp index 48220e7..d41317c 100644 --- a/toonz/sources/toonzlib/autoclose.cpp +++ b/toonz/sources/toonzlib/autoclose.cpp @@ -399,11 +399,13 @@ int intersect_triangle(int x1a, int y1a, int x2a, int y2a, int x3a, int y3a, intersect_segment(x1a, y1a, x2a, y2a, i, &xamin); - if (intersect_segment(x1a, y1a, x3a, y3a, i, &val)) - if (xamin) + if (intersect_segment(x1a, y1a, x3a, y3a, i, &val)) { + if (xamin) { xamax = val; - else + } else { xamin = val; + } + } if (!xamax) intersect_segment(x2a, y2a, x3a, y3a, i, &xamax); @@ -413,11 +415,13 @@ int intersect_triangle(int x1a, int y1a, int x2a, int y2a, int x3a, int y3a, intersect_segment(x1b, y1b, x2b, y2b, i, &xbmin); - if (intersect_segment(x1b, y1b, x3b, y3b, i, &val)) - if (xbmin) + if (intersect_segment(x1b, y1b, x3b, y3b, i, &val)) { + if (xbmin) { xbmax = val; - else + } else { xbmin = val; + } + } if (!xbmax) intersect_segment(x2b, y2b, x3b, y3b, i, &xbmax); diff --git a/toonz/sources/toonzlib/boardsettings.cpp b/toonz/sources/toonzlib/boardsettings.cpp index e910b3c..dc38fea 100644 --- a/toonz/sources/toonzlib/boardsettings.cpp +++ b/toonz/sources/toonzlib/boardsettings.cpp @@ -113,6 +113,8 @@ QString BoardItem::getContentText(ToonzScene *scene) { TOutputProperties *oprop = scene->getProperties()->getOutputProperties(); return scene->decodeFilePath(oprop->getPath()).getQString(); } break; + default: + break; } return QString(); } diff --git a/toonz/sources/toonzlib/mypaintbrushstyle.cpp b/toonz/sources/toonzlib/mypaintbrushstyle.cpp index b299c10..eecc712 100644 --- a/toonz/sources/toonzlib/mypaintbrushstyle.cpp +++ b/toonz/sources/toonzlib/mypaintbrushstyle.cpp @@ -107,7 +107,7 @@ TFilePath TMyPaintBrushStyle::decodePath(const TFilePath &path) const { } //----------------------------------------------------------------------------- -std::string mybToVersion3(std::string origStr) { +static std::string mybToVersion3(std::string origStr) { std::string outStr = ""; std::string comment = ""; bool settingsStarted = false; diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 8212ccf..f29260e 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -317,14 +317,12 @@ void Preferences::initializeOptions() { try { TSystem::readDirectory(room_fpset, room_path, true, false); TFilePathSet::iterator it = room_fpset.begin(); - int i = 0; - for (it; it != room_fpset.end(); it++) { + for (int i = 0; it != room_fpset.end(); it++, i++) { TFilePath newPath = *it; if (newPath == room_path) continue; if (TFileStatus(newPath).isDirectory()) { QString string = QString::fromStdWString(newPath.getWideName()); m_roomMaps[i] = string; - i++; } } } catch (...) { diff --git a/toonz/sources/toonzlib/sandor_fxs/BlurMatrix.cpp b/toonz/sources/toonzlib/sandor_fxs/BlurMatrix.cpp index 7ad5196..b167a8c 100644 --- a/toonz/sources/toonzlib/sandor_fxs/BlurMatrix.cpp +++ b/toonz/sources/toonzlib/sandor_fxs/BlurMatrix.cpp @@ -235,7 +235,8 @@ void CBlurMatrix::print() const { for( vector::const_iterator pp=m_m[0][i].begin(); pp!=m_m[0][i].end(); ++pp,++j ) { - sprintf(s,"(%d,%d,%d,%d) ",i,j,pp->x,pp->y); + snprintf(s, sizeof(s), + "(%d,%d,%d,%d) ",i,j,pp->x,pp->y); OutputDebugString(s); } OutputDebugString("\n"); diff --git a/toonz/sources/toonzlib/sandor_fxs/Params.h b/toonz/sources/toonzlib/sandor_fxs/Params.h index 7e8ad87..c656df3 100644 --- a/toonz/sources/toonzlib/sandor_fxs/Params.h +++ b/toonz/sources/toonzlib/sandor_fxs/Params.h @@ -41,12 +41,12 @@ void print() int i; OutputDebugString("===== PARAMS =====\n"); - sprintf(s,"Scale=%f\n",m_scale); + snprintf(s, sizeof(s), "Scale=%f\n",m_scale); OutputDebugString(s); i=0; for( vector::iterator p=m_params.begin(); p!=m_params.end(); ++p,++i ){ - sprintf(s,"--- %d. Param ---\n",i); + snprintf(s, sizeof(s), "--- %d. Param ---\n",i); OutputDebugString(s); p->print(); } diff --git a/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp b/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp index 5cd0882..b05d4d9 100644 --- a/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp +++ b/toonz/sources/toonzlib/sandor_fxs/Pattern.cpp @@ -202,7 +202,7 @@ void CPattern::optimalizeSize() { std::unique_ptr nPat(new UC_PIXEL[nLX * nLY]); if (!nPat) { char s[200]; - sprintf(s, "in Pattern Optimalization \n"); + snprintf(s, sizeof(s), "in Pattern Optimalization \n"); throw SMemAllocError(s); } for (int y = bb.y0; y <= bb.y1; y++) @@ -239,7 +239,7 @@ void CPattern::rotate(const double angle) { std::unique_ptr nPat(new UC_PIXEL[nLXY * nLXY]); if (!nPat) { char s[200]; - sprintf(s, "in Pattern Rotation \n"); + snprintf(s, sizeof(s), "in Pattern Rotation \n"); throw SMemAllocError(s); } eraseBuffer(nLXY, nLXY, nPat.get()); diff --git a/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp b/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp index 3aac31d..a20af3a 100644 --- a/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp +++ b/toonz/sources/toonzlib/sandor_fxs/PatternPosition.cpp @@ -57,7 +57,7 @@ void CPatternPosition::makeRandomPositions(const int nbPat, const int nbPixel, } } catch (exception) { char s[50]; - sprintf(s, "in Pattern Position Generation"); + snprintf(s, sizeof(s), "in Pattern Position Generation"); throw SMemAllocError(s); } } @@ -157,7 +157,7 @@ void CPatternPosition::prepareCircle(vector &v, const double r) { } } catch (exception) { char s[50]; - sprintf(s, "Position Generation"); + snprintf(s, sizeof(s), "Position Generation"); throw SMemAllocError(s); } } @@ -188,7 +188,7 @@ void CPatternPosition::makeDDPositions(const int lX, const int lY, UCHAR *sel, std::unique_ptr lSel(new UCHAR[lX * lY]); if (!lSel) { char s[50]; - sprintf(s, "in Pattern Position Generation"); + snprintf(s, sizeof(s), "in Pattern Position Generation"); throw SMemAllocError(s); } memcpy(lSel.get(), sel, lX * lY * sizeof(UCHAR)); @@ -209,7 +209,7 @@ void CPatternPosition::makeDDPositions(const int lX, const int lY, UCHAR *sel, } } catch (exception) { char s[50]; - sprintf(s, "in Pattern Position Generation"); + snprintf(s, sizeof(s), "in Pattern Position Generation"); throw SMemAllocError(s); } // memcpy(sel,lSel,lX*lY); diff --git a/toonz/sources/toonzlib/sandor_fxs/STColSelPic.h b/toonz/sources/toonzlib/sandor_fxs/STColSelPic.h index 06d1262..8811926 100644 --- a/toonz/sources/toonzlib/sandor_fxs/STColSelPic.h +++ b/toonz/sources/toonzlib/sandor_fxs/STColSelPic.h @@ -45,8 +45,8 @@ public: if (!m_sel) throw SMemAllocError(" in initColorSelection"); } else { char s[200]; - sprintf(s, " in initColorSelection lXY=(%d,%d)\n", CSTPic

::m_lX, - CSTPic

::m_lY); + snprintf(s, sizeof(s), " in initColorSelection lXY=(%d,%d)\n", + CSTPic

::m_lX, CSTPic

::m_lY); throw SMemAllocError(s); } } diff --git a/toonz/sources/toonzlib/sandor_fxs/STPic.h b/toonz/sources/toonzlib/sandor_fxs/STPic.h index d6135e7..d7c8623 100644 --- a/toonz/sources/toonzlib/sandor_fxs/STPic.h +++ b/toonz/sources/toonzlib/sandor_fxs/STPic.h @@ -131,7 +131,7 @@ public: lock(); } else { char s[200]; - sprintf(s, "in initPic lXY=(%d,%d)\n", m_lX, m_lY); + snprintf(s, sizeof(s), "in initPic lXY=(%d,%d)\n", m_lX, m_lY); throw SMemAllocError(s); } } @@ -322,7 +322,9 @@ public: ip.b = (int)pLL.b; ip.m = (int)pLL.m; break; - } + default: + break; + } } else ip.r = ip.g = ip.b = ip.m = 0; } @@ -358,6 +360,8 @@ public: pS->b = (USHORT)ip.b; pS->m = (USHORT)ip.m; break; + default: + break; } } } @@ -467,6 +471,8 @@ public: p->m = PIX_USHORT_FROM_BYTE((UCHAR)ip.m); } break; + default: + break; } } } diff --git a/toonz/sources/toonzlib/sandor_fxs/YOMBParam.cpp b/toonz/sources/toonzlib/sandor_fxs/YOMBParam.cpp index d42b73b..ef0f7e9 100644 --- a/toonz/sources/toonzlib/sandor_fxs/YOMBParam.cpp +++ b/toonz/sources/toonzlib/sandor_fxs/YOMBParam.cpp @@ -30,27 +30,28 @@ void CYOMBParam::print() { char s[1024]; OutputDebugString(" ----- YOMB Param -----\n"); - sprintf(s," Name=%s\n",m_name.c_str()); + snprintf(s, sizeof(s), " Name=%s\n",m_name.c_str()); OutputDebugString(s); - sprintf(s," RandomSampling=%d\n",m_isRandomSampling); + snprintf(s, sizeof(s), " RandomSampling=%d\n",m_isRandomSampling); OutputDebugString(s); - sprintf(s," ShowSelection=%d\n",m_isShowSelection); + snprintf(s, sizeof(s), " ShowSelection=%d\n",m_isShowSelection); OutputDebugString(s); - sprintf(s," StopAtContour=%d\n",m_isStopAtContour); + snprintf(s, sizeof(s), " StopAtContour=%d\n",m_isStopAtContour); OutputDebugString(s); - sprintf(s," dSample=%f\n",m_dSample); + snprintf(s, sizeof(s), " dSample=%f\n",m_dSample); OutputDebugString(s); - sprintf(s," nbSample=%d\n",m_nbSample); + snprintf(s, sizeof(s), " nbSample=%d\n",m_nbSample); OutputDebugString(s); - sprintf(s," dA=%f\n",m_dA); + snprintf(s, sizeof(s), " dA=%f\n",m_dA); OutputDebugString(s); - sprintf(s," dAB=%f\n",m_dAB); + snprintf(s, sizeof(s), " dAB=%f\n",m_dAB); OutputDebugString(s); for( vector::iterator p=m_color.begin(); p!=m_color.end(); ++p ) { - sprintf(s," RGBM=(%d,%d,%d,%d)\n",p->r,p->g,p->b,p->m); + snprintf(s, sizeof(s), " RGBM=(%d,%d,%d,%d)\n", + p->r,p->g,p->b,p->m); OutputDebugString(s); } OutputDebugString(" ----------------------\n"); diff --git a/toonz/sources/toonzlib/sandor_fxs/YOMBParam.h b/toonz/sources/toonzlib/sandor_fxs/YOMBParam.h index f049c86..12e93f7 100644 --- a/toonz/sources/toonzlib/sandor_fxs/YOMBParam.h +++ b/toonz/sources/toonzlib/sandor_fxs/YOMBParam.h @@ -166,7 +166,7 @@ public: int y = yy + xyd->y; if (x >= 0 && y >= 0 && x < pic.m_lX && y < pic.m_lY) { int xy = y * pic.m_lX + x; - if (*(pic.m_sel + xy) > (UCHAR)0) + if (*(pic.m_sel + xy) > (UCHAR)0) { if (bm.m_isSAC) { if (!isContourOnPath(xx, yy, pBS, pic)) { addPixel(p, pic, xxyy, xy); @@ -176,6 +176,7 @@ public: addPixel(p, pic, xxyy, xy); nb++; } + } } } diff --git a/toonz/sources/toonzlib/scenefx.cpp b/toonz/sources/toonzlib/scenefx.cpp index 64672fb..077fbeb 100644 --- a/toonz/sources/toonzlib/scenefx.cpp +++ b/toonz/sources/toonzlib/scenefx.cpp @@ -785,8 +785,8 @@ PlacedFx FxBuilder::makePF(TLevelColumnFx *lcfx) { /*-- ParticleFxのTextureポートに繋がっていない場合 --*/ if (m_particleDescendentCount == 0) { if (!xl || - xl->getType() != PLI_XSHLEVEL && xl->getType() != TZP_XSHLEVEL && - xl->getType() != CHILD_XSHLEVEL) + (xl->getType() != PLI_XSHLEVEL && xl->getType() != TZP_XSHLEVEL && + xl->getType() != CHILD_XSHLEVEL)) return PlacedFx(); } /*-- ParticleFxのTextureポートに繋がっている場合 --*/ diff --git a/toonz/sources/toonzlib/stagevisitor.cpp b/toonz/sources/toonzlib/stagevisitor.cpp index 7480003..b73077e 100644 --- a/toonz/sources/toonzlib/stagevisitor.cpp +++ b/toonz/sources/toonzlib/stagevisitor.cpp @@ -701,7 +701,7 @@ void RasterPainter::drawRasterImages(QPainter &p, QPolygon cameraPol) { p.setClipRegion(QRegion(cameraPol)); for (i = 0; i < (int)m_nodes.size(); i++) { if (m_nodes[i].m_onionMode != Node::eOnionSkinNone) continue; - p.resetMatrix(); + p.resetTransform(); TRasterP ras = m_nodes[i].m_raster; TAffine aff = TTranslation(-rect.x0, -rect.y0) * flipY * m_nodes[i].m_aff; QMatrix matrix(aff.a11, aff.a21, aff.a12, aff.a22, aff.a13, aff.a23); @@ -711,7 +711,7 @@ void RasterPainter::drawRasterImages(QPainter &p, QPolygon cameraPol) { p.drawImage(rect.getP00().x, rect.getP00().y, image); } - p.resetMatrix(); + p.resetTransform(); m_nodes.clear(); } diff --git a/toonz/sources/toonzlib/tcenterlineadjustments.cpp b/toonz/sources/toonzlib/tcenterlineadjustments.cpp index 9489fd4..b15a12b 100644 --- a/toonz/sources/toonzlib/tcenterlineadjustments.cpp +++ b/toonz/sources/toonzlib/tcenterlineadjustments.cpp @@ -70,12 +70,15 @@ void organizeGraphs(SkeletonList *skeleton, VectorizerCoreGlobals &g) { // Discriminate between graphs, two-endpoint single sequences, and circular // ones bool has1DegreePoint = 0; - for (i = 0; i < currGraph.getNodesCount(); ++i) - if (currGraph.getNode(i).degree() != 2) - if (currGraph.getNode(i).degree() == 1) + for (i = 0; i < currGraph.getNodesCount(); ++i) { + if (currGraph.getNode(i).degree() != 2) { + if (currGraph.getNode(i).degree() == 1) { has1DegreePoint = 1; - else + } else { goto _graph; + } + } + } if (has1DegreePoint) goto _two_endpoint; diff --git a/toonz/sources/toonzlib/tcenterlinepolygonizer.cpp b/toonz/sources/toonzlib/tcenterlinepolygonizer.cpp index d829435..efb7dae 100644 --- a/toonz/sources/toonzlib/tcenterlinepolygonizer.cpp +++ b/toonz/sources/toonzlib/tcenterlinepolygonizer.cpp @@ -378,7 +378,7 @@ static RawBorder *extractPath(Signaturemap &ras, int x0, int y0, int pathType, // If the inner region's overall area is under a given threshold, // then erase it (intended as image noise). - if (abs(area) < despeckling) { + if (std::abs(area) < despeckling) { setSignature(ras, *path, invalid); delete path; path = 0; @@ -416,11 +416,13 @@ static BorderList *extractBorders(const TRasterP &ras, int threshold, if ((signature = byteImage.getSignature(x, y)) == none) { // We've found a border if ((foundPath = extractPath(byteImage, x, y, !enteredRegionType, - xOuterPixel, despeckling))) - if (enteredRegionType == outer) + xOuterPixel, despeckling))) { + if (enteredRegionType == outer) { innerBorders.push_back(foundPath); - else + } else { outerBorders.push_back(foundPath); + } + } } // If leaving a white region, remember it - in order to establish diff --git a/toonz/sources/toonzlib/tcenterlineskeletonizer.cpp b/toonz/sources/toonzlib/tcenterlineskeletonizer.cpp index 5fdadc4..2f5b219 100644 --- a/toonz/sources/toonzlib/tcenterlineskeletonizer.cpp +++ b/toonz/sources/toonzlib/tcenterlineskeletonizer.cpp @@ -1229,6 +1229,8 @@ inline bool Event::process() { } break; + default: + break; } } diff --git a/toonz/sources/toonzlib/tcenterlinevectorizer.cpp b/toonz/sources/toonzlib/tcenterlinevectorizer.cpp index 65992fd..2118f18 100644 --- a/toonz/sources/toonzlib/tcenterlinevectorizer.cpp +++ b/toonz/sources/toonzlib/tcenterlinevectorizer.cpp @@ -177,7 +177,8 @@ TVectorImageP VectorizerCore::centerlineVectorize( converter.setPalette(palette); QList dummy; - if (ti = converter.makeTlv(true, dummy)) // Transparent synthetic inks + ti = converter.makeTlv(true, dummy); + if (ti) // Transparent synthetic inks { image = ti; ras = ti->getRaster(); diff --git a/toonz/sources/toonzlib/tcleanupper.cpp b/toonz/sources/toonzlib/tcleanupper.cpp index d813cc1..3c69ba8 100644 --- a/toonz/sources/toonzlib/tcleanupper.cpp +++ b/toonz/sources/toonzlib/tcleanupper.cpp @@ -412,8 +412,8 @@ bool TCleanupper::getResampleValues(const TRasterImageP &image, TAffine &aff, TRect saveBox = image->getSavebox(); bool raster_is_savebox = true; if (saveBox == TRect() && - (saveBox.getLx() > 0 && saveBox.getLx() < rasterLx || - saveBox.getLy() > 0 && saveBox.getLy() < rasterLy)) + ((saveBox.getLx() > 0 && saveBox.getLx() < rasterLx) || + (saveBox.getLy() > 0 && saveBox.getLy() < rasterLy))) raster_is_savebox = false; // Use the same source dpi throughout the level diff --git a/toonz/sources/toonzlib/tdistort.cpp b/toonz/sources/toonzlib/tdistort.cpp index c208fc3..098a701 100644 --- a/toonz/sources/toonzlib/tdistort.cpp +++ b/toonz/sources/toonzlib/tdistort.cpp @@ -993,33 +993,41 @@ inline void updateResult(const TPointD &srcCorner, const TPointD &xDer, if (jacobianSign > 0) { hasPositiveResults = true; - if (sideDerXAgainstRectSideX != -sideDerXAgainstRectSideY) + if (sideDerXAgainstRectSideX != -sideDerXAgainstRectSideY) { // Rect lies on one side of the derivative line extension. Therefore, the // inverted rect can be updated. - if (sideDerXAgainstRectSideX > 0 || sideDerXAgainstRectSideY > 0) + if (sideDerXAgainstRectSideX > 0 || sideDerXAgainstRectSideY > 0) { posResult.y0 = std::min(posResult.y0, srcCorner.y - securityAddendum); - else + } else { posResult.y1 = std::max(posResult.y1, srcCorner.y + securityAddendum); + } + } - if (sideDerYAgainstRectSideX != -sideDerYAgainstRectSideY) - if (sideDerYAgainstRectSideX > 0 || sideDerYAgainstRectSideY > 0) + if (sideDerYAgainstRectSideX != -sideDerYAgainstRectSideY) { + if (sideDerYAgainstRectSideX > 0 || sideDerYAgainstRectSideY > 0) { posResult.x1 = std::max(posResult.x1, srcCorner.x + securityAddendum); - else + } else { posResult.x0 = std::min(posResult.x0, srcCorner.x - securityAddendum); + } + } } else if (jacobianSign < 0) { hasNegativeResults = true; - if (sideDerXAgainstRectSideX != -sideDerXAgainstRectSideY) - if (sideDerXAgainstRectSideX > 0 || sideDerXAgainstRectSideY > 0) + if (sideDerXAgainstRectSideX != -sideDerXAgainstRectSideY) { + if (sideDerXAgainstRectSideX > 0 || sideDerXAgainstRectSideY > 0) { negResult.y1 = std::max(posResult.y1, srcCorner.y + securityAddendum); - else + } else { negResult.y0 = std::min(posResult.y0, srcCorner.y - securityAddendum); + } + } - if (sideDerYAgainstRectSideX != -sideDerYAgainstRectSideY) - if (sideDerYAgainstRectSideX > 0 || sideDerYAgainstRectSideY > 0) + if (sideDerYAgainstRectSideX != -sideDerYAgainstRectSideY) { + if (sideDerYAgainstRectSideX > 0 || sideDerYAgainstRectSideY > 0) { negResult.x0 = std::min(posResult.x0, srcCorner.x - securityAddendum); - else + } else { negResult.x1 = std::max(posResult.x1, srcCorner.x + securityAddendum); + } + } } } diff --git a/toonz/sources/toonzlib/tframehandle.cpp b/toonz/sources/toonzlib/tframehandle.cpp index 12f7cce..73aea2d 100644 --- a/toonz/sources/toonzlib/tframehandle.cpp +++ b/toonz/sources/toonzlib/tframehandle.cpp @@ -14,6 +14,7 @@ namespace { +#if 0 /* int getCurrentSceneFrameCount() { return 100; // @@ -34,6 +35,7 @@ namespace { /* r0 = 0; r1 = getCurrentSceneFrameCount()-1; }*/ +#endif bool getCurrentLevelFids(std::vector &fids) { /* diff --git a/toonz/sources/toonzlib/toonzimageutils.cpp b/toonz/sources/toonzlib/toonzimageutils.cpp index 7f9302e..4f40dc1 100644 --- a/toonz/sources/toonzlib/toonzimageutils.cpp +++ b/toonz/sources/toonzlib/toonzimageutils.cpp @@ -724,7 +724,7 @@ void ToonzImageUtils::eraseImage(const TToonzImageP &ti, TPixelCM32 *outPix = workRas->pixels(y); TPixelCM32 *outEndPix = outPix + workRas->getLx(); TPixel32 *inPix = image->pixels(y); - for (outPix; outPix != outEndPix; outPix++, inPix++) { + for (; outPix != outEndPix; outPix++, inPix++) { bool canEraseInk = !selective || (selective && styleId == outPix->getInk()); bool canErasePaint = diff --git a/toonz/sources/toonzlib/toonzscene.cpp b/toonz/sources/toonzlib/toonzscene.cpp index 2b08313..6f66006 100644 --- a/toonz/sources/toonzlib/toonzscene.cpp +++ b/toonz/sources/toonzlib/toonzscene.cpp @@ -1043,6 +1043,8 @@ static LevelType getLevelType(const TFilePath &fp) { case TFileType::MESH_LEVEL: ret.m_ltype = MESH_XSHLEVEL; break; + default: + break; } return ret; diff --git a/toonz/sources/toonzlib/toutlinevectorizer.cpp b/toonz/sources/toonzlib/toutlinevectorizer.cpp index c8196b0..c75858e 100644 --- a/toonz/sources/toonzlib/toutlinevectorizer.cpp +++ b/toonz/sources/toonzlib/toutlinevectorizer.cpp @@ -496,7 +496,7 @@ void OutlineVectorizer::createOutlineStrokes() { std::list>::iterator it_outlines = m_protoOutlines.begin(); - for (it_outlines; it_outlines != m_protoOutlines.end(); it_outlines++) { + for (; it_outlines != m_protoOutlines.end(); it_outlines++) { if (it_outlines->size() > 3) { std::vector points; std::vector::iterator it; diff --git a/toonz/sources/toonzlib/txsheetexpr.cpp b/toonz/sources/toonzlib/txsheetexpr.cpp index 8dd475c..fd904d0 100644 --- a/toonz/sources/toonzlib/txsheetexpr.cpp +++ b/toonz/sources/toonzlib/txsheetexpr.cpp @@ -228,9 +228,9 @@ public: int i = (int)previousTokens.size(); if (i == 0) return matchObjectName(token) != TStageObjectId::NoneId; - else if (i == 1 && token.getText() == "." || - i == 3 && token.getText() == "(" || - i == 5 && token.getText() == ")") + else if ((i == 1 && token.getText() == ".") || + (i == 3 && token.getText() == "(") || + (i == 5 && token.getText() == ")")) return true; else if (i == 2) { if (matchChannelName(token) < TStageObject::T_ChannelCount) diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp index f04f13a..cf2ff70 100644 --- a/toonz/sources/toonzlib/txshsimplelevel.cpp +++ b/toonz/sources/toonzlib/txshsimplelevel.cpp @@ -996,7 +996,7 @@ public: bool match(const TFrameId &fid) const { /*-- ↓SubSequent範囲内にある条件 ↓全部ロードする場合 --*/ - return m_fromFid <= fid && fid <= m_toFid || m_fromFid > m_toFid; + return ((m_fromFid <= fid && fid <= m_toFid) || m_fromFid > m_toFid); } bool isEnabled() const { return m_fromFid <= m_toFid; } void reset() { diff --git a/toonz/sources/toonzqt/docklayout.cpp b/toonz/sources/toonzqt/docklayout.cpp index 3ebe00f..f0ccdac 100644 --- a/toonz/sources/toonzqt/docklayout.cpp +++ b/toonz/sources/toonzqt/docklayout.cpp @@ -540,7 +540,7 @@ void Region::insertSubRegion(Region *subRegion, int idx) { Region *Region::insertItem(DockWidget *item, int idx) { Region *newRegion = new Region(m_owner, item); - if (this) insertSubRegion(newRegion, idx); + insertSubRegion(newRegion, idx); return newRegion; } diff --git a/toonz/sources/toonzqt/expressionfield.cpp b/toonz/sources/toonzqt/expressionfield.cpp index 88cba01..3a6dc12 100644 --- a/toonz/sources/toonzqt/expressionfield.cpp +++ b/toonz/sources/toonzqt/expressionfield.cpp @@ -235,7 +235,7 @@ void ExpressionField::keyPressEvent(QKeyEvent *e) { QTextEdit::keyPressEvent(e); if (m_completerPopup->isVisible()) { updateCompleterPopup(); - } else if (Qt::Key_A <= e->key() && e->key() <= Qt::Key_Z || + } else if ((Qt::Key_A <= e->key() && e->key() <= Qt::Key_Z) || std::string("+&|!*/=?,:-").find(e->key()) != std::string::npos) { openCompleterPopup(); } @@ -371,9 +371,9 @@ int ExpressionField::computeSuggestions() { start--; while (start > 0) { char c = text[start - 1]; - if (isascii(c) && isalpha(c) || c == '_' || - c == '.' && (start - 2 < 0 || - isascii(text[start - 2]) && isalpha(text[start - 2]))) { + if ((isascii(c) && isalpha(c)) || c == '_' || + (c == '.' && (start - 2 < 0 || + (isascii(text[start - 2]) && isalpha(text[start - 2]))))) { } else break; start--; diff --git a/toonz/sources/toonzqt/flipconsole.cpp b/toonz/sources/toonzqt/flipconsole.cpp index 94eef12..37abca3 100644 --- a/toonz/sources/toonzqt/flipconsole.cpp +++ b/toonz/sources/toonzqt/flipconsole.cpp @@ -672,24 +672,27 @@ void FlipConsole::enableButton(UINT button, bool enable, bool doShowHide) { if (!m_playToolBar) return; QList list = m_playToolBar->actions(); - int i; - for (i = 0; i < (int)list.size(); i++) + for (size_t i = 0; i < list.size(); i++) if (list[i]->data().toUInt() == button) { - if (button == eSound) - if (doShowHide) + if (button == eSound) { + if (doShowHide) { m_soundSep->setVisible(enable); - else + } else { m_soundSep->setEnabled(enable); + } + } if (button == eHisto) { - if (doShowHide) + if (doShowHide) { m_histoSep->setVisible(enable && m_customizeMask & eShowHisto); - else + } else { m_histoSep->setEnabled(enable); + } } - if (doShowHide) + if (doShowHide) { list[i]->setVisible(enable); - else + } else { list[i]->setEnabled(enable); + } if (!enable && list[i]->isChecked()) pressButton((EGadget)button); return; @@ -707,6 +710,8 @@ void FlipConsole::enableButton(UINT button, bool enable, bool doShowHide) { case eGBlue: if (m_doubleBlue) m_doubleBlue->setEnabledSecondButton(enable); break; + default: + break; } } diff --git a/toonz/sources/toonzqt/functionpanel.cpp b/toonz/sources/toonzqt/functionpanel.cpp index bd7ed8c..4cc6612 100644 --- a/toonz/sources/toonzqt/functionpanel.cpp +++ b/toonz/sources/toonzqt/functionpanel.cpp @@ -755,6 +755,8 @@ void FunctionPanel::updateGadgets(TDoubleParam *curve) { m_gadgets.push_back(Gadget(EaseInPercentage, i, q, 6, 15)); break; } + default: + break; } // Right handle @@ -784,6 +786,8 @@ void FunctionPanel::updateGadgets(TDoubleParam *curve) { m_gadgets.push_back(Gadget(EaseOutPercentage, i, q, 6, 15)); break; } + default: + break; } } } @@ -993,6 +997,8 @@ void FunctionPanel::drawCurrentCurve(QPainter &painter) { painter.setPen(isHighlighted ? QColor(255, 126, 0) : m_selectedColor); painter.drawLine(p.x(), p.y() - 15, p.x(), p.y() + 15); break; + default: + break; } } @@ -1055,6 +1061,8 @@ void FunctionPanel::drawGroupKeyframes(QPainter &painter) { pp.lineTo(p + QPointF(d, h)); painter.drawPath(pp); break; + default: + break; } } painter.setPen(m_textColor); @@ -1227,8 +1235,8 @@ void FunctionPanel::mousePressEvent(QMouseEvent *e) { FunctionTreeModel::Channel *currentChannel = m_functionTreeModel ? m_functionTreeModel->getCurrentChannel() : 0; if (!currentChannel || - getCurveDistance(currentChannel->getParam(), winPos) > maxDistance && - closestGadgetId < 0) { + (getCurveDistance(currentChannel->getParam(), winPos) > maxDistance && + closestGadgetId < 0)) { // if current channel is undefined or its curve is too far from the clicked // point // the user is possibly trying to select a different curve diff --git a/toonz/sources/toonzqt/fxschematicnode.cpp b/toonz/sources/toonzqt/fxschematicnode.cpp index 5affb29..a9cd864 100644 --- a/toonz/sources/toonzqt/fxschematicnode.cpp +++ b/toonz/sources/toonzqt/fxschematicnode.cpp @@ -554,6 +554,8 @@ FxPainter::FxPainter(FxSchematicNode *parent, double width, double height, } break; } + default: + break; } } @@ -784,8 +786,8 @@ void FxPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { else menu.addAction(connectToXSheet); menu.addAction(duplicateFx); - if (zsrc && zsrc->getZeraryFx() && - zsrc->getZeraryFx()->getLinkedFx() != zsrc->getZeraryFx() || + if ((zsrc && zsrc->getZeraryFx() && + zsrc->getZeraryFx()->getLinkedFx() != zsrc->getZeraryFx()) || fx->getLinkedFx() != fx) menu.addAction(unlinkFx); } @@ -2441,6 +2443,8 @@ FxSchematicNormalFxNode::FxSchematicNormalFxNode(FxSchematicScene *scene, else setToolTip(m_name); } + default: + break; } m_nameItem = new SchematicName(this, 72, 20); // for rename @@ -2601,6 +2605,8 @@ void FxSchematicNormalFxNode::onNameChanged() { else setToolTip(m_name); } + default: + break; } setFlag(QGraphicsItem::ItemIsSelectable, true); diff --git a/toonz/sources/toonzqt/fxschematicscene.cpp b/toonz/sources/toonzqt/fxschematicscene.cpp index 2ada469..533b260 100644 --- a/toonz/sources/toonzqt/fxschematicscene.cpp +++ b/toonz/sources/toonzqt/fxschematicscene.cpp @@ -1468,29 +1468,31 @@ void FxSchematicScene::onUncacheFx() { setEnableCache(false); } void FxSchematicScene::setEnableCache(bool toggle) { QList selectedFxs = m_selection->getFxs(); - int i; - for (i = 0; i < selectedFxs.size(); i++) { + for (int i = 0; i < selectedFxs.size(); i++) { TFx *fx = selectedFxs[i].getPointer(); TZeraryColumnFx *zcfx = dynamic_cast(fx); if (zcfx) fx = zcfx->getZeraryFx(); TFxAttributes *attr = fx->getAttributes(); - if (!attr->isGrouped() || attr->isGroupEditing()) - if (toggle) + if (!attr->isGrouped() || attr->isGroupEditing()) { + if (toggle) { TPassiveCacheManager::instance()->enableCache(fx); - else + } else { TPassiveCacheManager::instance()->disableCache(fx); - else { + } + } else { QMap::iterator it; for (it = m_groupedTable.begin(); it != m_groupedTable.end(); it++) { FxGroupNode *group = it.value(); QList roots = group->getRootFxs(); - int j; - for (j = 0; j < roots.size(); j++) - if (fx == roots[j].getPointer()) - if (toggle) + for (int j = 0; j < roots.size(); j++) { + if (fx == roots[j].getPointer()) { + if (toggle) { TPassiveCacheManager::instance()->enableCache(fx); - else + } else { TPassiveCacheManager::instance()->disableCache(fx); + } + } + } group->update(); } } diff --git a/toonz/sources/toonzqt/intfield.cpp b/toonz/sources/toonzqt/intfield.cpp index 300d0ad..9445115 100644 --- a/toonz/sources/toonzqt/intfield.cpp +++ b/toonz/sources/toonzqt/intfield.cpp @@ -443,7 +443,7 @@ void IntField::onEditingFinished() { // Controllo necessario per evitare che il segnale di cambiamento venga emesso // piu' volte. if ((pos2value(m_slider->value()) == value && m_slider->isVisible()) || - (int)m_roller->getValue() == value && m_roller->isVisible()) + ((int)m_roller->getValue() == value && m_roller->isVisible())) return; m_slider->setValue(value2pos(value)); m_roller->setValue((double)value); diff --git a/toonz/sources/toonzqt/keyframenavigator.cpp b/toonz/sources/toonzqt/keyframenavigator.cpp index 6a1b29a..24925b8 100644 --- a/toonz/sources/toonzqt/keyframenavigator.cpp +++ b/toonz/sources/toonzqt/keyframenavigator.cpp @@ -595,7 +595,7 @@ void FxKeyframeNavigator::toggle() { if (!isKeyframe) isFullKeyframe = false; // modifico lo stato: nokeyframe->full, full->no, partial->full - bool on = !isKeyframe || isKeyframe && !isFullKeyframe; + bool on = (!isKeyframe || (isKeyframe && !isFullKeyframe)); for (i = 0; i < fx->getParams()->getParamCount(); i++) { // TODO. spostare questo codice in TParam TParamP param = fx->getParams()->getParam(i); diff --git a/toonz/sources/toonzqt/menubarcommand.cpp b/toonz/sources/toonzqt/menubarcommand.cpp index 2ab4af3..16d51c9 100644 --- a/toonz/sources/toonzqt/menubarcommand.cpp +++ b/toonz/sources/toonzqt/menubarcommand.cpp @@ -124,8 +124,8 @@ void CommandManager::define(CommandId id, CommandType type, node->m_type = type; node->m_qaction = qaction; node->m_qaction->setEnabled( - node->m_enabled && - (!!node->m_handler || node->m_qaction->actionGroup() != 0) || + (node->m_enabled && + (node->m_handler || node->m_qaction->actionGroup() != 0)) || node->m_type == MiscCommandType || node->m_type == ToolModifierCommandType); diff --git a/toonz/sources/toonzqt/plugin_param_traits.h b/toonz/sources/toonzqt/plugin_param_traits.h index e59ed45..8960680 100644 --- a/toonz/sources/toonzqt/plugin_param_traits.h +++ b/toonz/sources/toonzqt/plugin_param_traits.h @@ -52,7 +52,7 @@ inline F &get_func_b(RT *t) { template <> inline TDoubleParamP &get_func_a(TRangeParam *t) { printf("get_func_a< TRangeParam, TDoubleParamP& >(TRangeParam* t)\n"); - return std::mem_fun(&TRangeParam::getMin)(t); + return std::mem_fn(&TRangeParam::getMin)(t); } template <> @@ -62,7 +62,7 @@ inline TDoubleParamP &get_func_b(TRangeParam *t) // t) { printf("get_func_b< TRangeParam, TDoubleParamP& >(TRangeParam* t)\n"); - return std::mem_fun(&TRangeParam::getMax)(t); + return std::mem_fn(&TRangeParam::getMax)(t); } /* TPointParam */ @@ -73,7 +73,7 @@ inline TDoubleParamP &get_func_a(TPointParam *t) // t) { printf("get_func_a< TPointParam, TDoubleParamP& >(TPointParam* t)\n"); - return std::mem_fun(&TPointParam::getX)(t); + return std::mem_fn(&TPointParam::getX)(t); } template <> @@ -83,7 +83,7 @@ inline TDoubleParamP &get_func_b(TPointParam *t) // t) { printf("get_func_b< TPointParam, TDoubleParamP& >(TPointParam* t)\n"); - return std::mem_fun(&TPointParam::getY)(t); + return std::mem_fn(&TPointParam::getY)(t); } /* valuetype が集約型の場合、 スカラを取得するための関数 */ diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index 8556bf0..77e49fc 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -236,6 +236,8 @@ void ColorModel::setValues(ColorChannel channel, int v, int u) { setValue(eHue, v); setValue(eSaturation, u); break; + default: + break; } } @@ -274,6 +276,8 @@ void ColorModel::getValues(ColorChannel channel, int &u, int &v) { u = getValue(eHue); v = getValue(eSaturation); break; + default: + break; } } diff --git a/toonz/sources/toonzqt/swatchviewer.cpp b/toonz/sources/toonzqt/swatchviewer.cpp index 0e89f69..55782b5 100644 --- a/toonz/sources/toonzqt/swatchviewer.cpp +++ b/toonz/sources/toonzqt/swatchviewer.cpp @@ -197,10 +197,10 @@ double ZoomFactors[ZOOMLEVELS] = { 1, 2, 3, 4, 5, 6, 7, 8, 12, 16}; double getQuantizedZoomFactor(double zf, bool forward) { - if (forward && zf > ZoomFactors[ZOOMLEVELS - 1] || + if ((forward && zf > ZoomFactors[ZOOMLEVELS - 1]) || areAlmostEqual(zf, ZoomFactors[ZOOMLEVELS - 1], 1e-5)) return zf; - else if (!forward && zf < ZoomFactors[0] || + else if ((!forward && zf < ZoomFactors[0]) || areAlmostEqual(zf, ZoomFactors[0], 1e-5)) return zf; diff --git a/toonz/sources/toonzqt/tonecurvefield.cpp b/toonz/sources/toonzqt/tonecurvefield.cpp index 0dd016f..f8b766b 100644 --- a/toonz/sources/toonzqt/tonecurvefield.cpp +++ b/toonz/sources/toonzqt/tonecurvefield.cpp @@ -29,8 +29,8 @@ double getPercentAtPoint(QPointF point, QPainterPath path) { for (i = 1; i < 100; i++) { double p = double(i) * 0.01; QPointF pathPoint = path.pointAtPercent(p); - if (abs(pathPoint.x() - point.x()) < 3 && - abs(pathPoint.y() - point.y()) < 3) + if (std::abs(pathPoint.x() - point.x()) < 3 && + std::abs(pathPoint.y() - point.y()) < 3) return p; } return 0; @@ -457,13 +457,13 @@ void ChennelCurveEditor::addControlPoint(double percent) { QPointF p0 = checkPoint(m_points.at(beforeControlPointIndex)); // Se sono troppo vicino al punto di controllo precedente ritorno - if (abs(p.x() - p0.x()) <= cpMargin) return; + if (std::abs(p.x() - p0.x()) <= cpMargin) return; double beforeControlPointPercent = getPercentAtPoint(p0, path); QPointF p1 = checkPoint(m_points.at(beforeControlPointIndex + 1)); QPointF p2 = checkPoint(m_points.at(beforeControlPointIndex + 2)); QPointF p3 = checkPoint(m_points.at(beforeControlPointIndex + 3)); // Se sono troppo vicino al punto di controllo successivo ritorno - if (abs(p3.x() - p.x()) <= cpMargin) return; + if (std::abs(p3.x() - p.x()) <= cpMargin) return; double nextControlPointPercent = getPercentAtPoint(p3, path); // Calcolo la velocita' e quindi il coiffciente angolare.