diff --git a/toonz/sources/common/tapptools/tenv.cpp b/toonz/sources/common/tapptools/tenv.cpp index f41fe41..25d15a9 100644 --- a/toonz/sources/common/tapptools/tenv.cpp +++ b/toonz/sources/common/tapptools/tenv.cpp @@ -24,7 +24,7 @@ TOfflineGL::Imp *MacOfflineGenerator1(const TDimension &dim) #endif #include -#include +#include using namespace TEnv; @@ -217,10 +217,10 @@ TFilePath EnvGlobals::getSystemPath(int id) if(it != m_systemPaths.end()) return it->second; switch(id) { - case StuffDir: return TFilePath(); + case StuffDir: return TFilePath(); case ConfigDir: return getSystemPath(StuffDir) + "config"; case ProfilesDir: return getSystemPath(StuffDir) + "profiles"; - default: return TFilePath(); + default: return TFilePath(); } } @@ -636,21 +636,17 @@ std::istream &operator>>(std::istream &is, TRect &rect) template std::string toString2(T value) { - std::ostrstream ss; + std::ostringstream ss; ss << value << '\0'; - std::string s(ss.str()); - ss.freeze(false); - return s; + return ss.str(); } template <> std::string toString2(TRect value) { - std::ostrstream ss; + std::ostringstream ss; ss << value.x0 << " " << value.y0 << " " << value.x1 << " " << value.y1 << '\0'; - std::string s = ss.str(); - ss.freeze(false); - return s; + return ss.str(); } template @@ -658,7 +654,7 @@ void fromString(std::string s, T &value) { if (s.empty()) return; - std::istrstream is(s.c_str(), s.size()); + std::istringstream is(s); is >> value; } diff --git a/toonz/sources/common/tcore/tstopwatch.cpp b/toonz/sources/common/tcore/tstopwatch.cpp index 5d7601f..8d45e98 100644 --- a/toonz/sources/common/tcore/tstopwatch.cpp +++ b/toonz/sources/common/tcore/tstopwatch.cpp @@ -2,7 +2,7 @@ #include "tstopwatch.h" -#include +#include #ifdef _WIN32 #include @@ -353,10 +353,9 @@ TUINT32 TStopWatch::getSystemTime() TStopWatch::operator string() { - char buffer[256]; - ostrstream out(buffer, sizeof(buffer)); + ostringstream out; out << m_name.c_str() << ": " << (int)getTotalTime() << " u" << (int)getUserTime() << " s" << (TINT32)getSystemTime(); - return string(buffer, out.pcount()); + return out.str(); } //------------------------------------------------------------ diff --git a/toonz/sources/common/trasterimage/tcachedlevel.cpp b/toonz/sources/common/trasterimage/tcachedlevel.cpp index 8edcccd..2e03fab 100644 --- a/toonz/sources/common/trasterimage/tcachedlevel.cpp +++ b/toonz/sources/common/trasterimage/tcachedlevel.cpp @@ -1,4 +1,4 @@ - +#include #include "tsystem.h" #include "tcachedlevel.h" @@ -169,9 +169,8 @@ private: default: char *sysErr = strerror(errorCode); - ostrstream os; + ostringstream os; os << errorCode << '\0'; - os.freeze(false); return string(sysErr) + "(" + os.str() + ")"; break; } diff --git a/toonz/sources/common/tsystem/tfilepath.cpp b/toonz/sources/common/tsystem/tfilepath.cpp index 6865457..df85daf 100644 --- a/toonz/sources/common/tsystem/tfilepath.cpp +++ b/toonz/sources/common/tsystem/tfilepath.cpp @@ -22,7 +22,7 @@ const char wauxslash = '\\'; #include "tconvert.h" #include #include -#include +#include bool TFilePath::m_underscoreFormatAllowed = true; @@ -49,8 +49,7 @@ std::string TFrameId::expand(FrameFormat format) const return ""; else if (m_frame == NO_FRAME) return "-"; - char buffer[80]; - std::ostrstream o_buff(buffer, sizeof(buffer)); + std::ostringstream o_buff; if (format == FOUR_ZEROS || format == UNDERSCORE_FOUR_ZEROS) { o_buff.fill('0'); o_buff.width(4); @@ -61,8 +60,7 @@ std::string TFrameId::expand(FrameFormat format) const } if (m_letter != '\0') o_buff << m_letter; - int len = o_buff.pcount(); - return std::string(buffer, len); + return o_buff.str(); } //------------------------------------------------------------------- @@ -117,9 +115,9 @@ inline int getLastSlash(const std::wstring &path) void TFilePath::setPath(string path) { bool isUncName = false; - // elimino i '//', './' e '/' finali; raddrizzo gli slash 'storti'. + // elimino i '//', './' e '/' finali; raddrizzo gli slash 'storti'. // se il path comincia con ":" aggiungo uno slash - int length =path.length(); + int length =path.length(); int pos = 0; if(path.length()>=2 && isalpha(path[0]) && path[1] == ':') { @@ -141,13 +139,13 @@ bool isUncName = false; if(path[pos] == '.') { pos++; - if(pos>=length) + if(pos>=length) { if(pos>1) m_path.append(1,'.'); } else if(!isSlash(path[pos])) m_path.append(path,pos-1,2); else { - while(pos+11 && m_path[m_path.length()-1] == slash) m_path.erase(m_path.length()-1, 1); - + if (isUncName && m_path.find_last_of('\\') == 1) // e' indicato solo il nome della macchina... m_path.append(1, slash); } @@ -181,9 +179,9 @@ void append(string &out, wchar_t c) { if(32 <= c && c<=127 && c!='&') out.append(1, (char)c); else if(c=='&') out.append("&"); - else + else { - ostrstream ss; + ostringstream ss; ss << "&#" << c << ";" << '\0'; out += ss.str(); ss.freeze(0); @@ -421,7 +419,7 @@ const std::wstring TFilePath::getWideString() const { char c = m_path[i]; if(c!='&') s.append(1, (unsigned short)c); - else + else { i++; if(m_path[i] == '#') @@ -441,7 +439,7 @@ const std::wstring TFilePath::getWideString() const break; i++; } - s.append(1, w); + s.append(1, w); } } } @@ -483,9 +481,9 @@ TFilePath TFilePath::operator+ (const TFilePath &fp) const assert(!fp.isAbsolute()); if(fp.isEmpty()) return *this; else if(isEmpty()) return fp; -else if(m_path.length()!=1 || m_path[0] != slash) +else if(m_path.length()!=1 || m_path[0] != slash) return TFilePath(m_path + slash + fp.m_path); -else +else return TFilePath(m_path + fp.m_path); } */ diff --git a/toonz/sources/common/ttest/ttest.cpp b/toonz/sources/common/ttest/ttest.cpp index 705a890..073a397 100644 --- a/toonz/sources/common/ttest/ttest.cpp +++ b/toonz/sources/common/ttest/ttest.cpp @@ -14,7 +14,7 @@ #include "tcolorstyles.h" #include -#include +#include #if defined(LINUX) #include @@ -173,7 +173,7 @@ void TTest::runTests(string name) cout << "Test file : '" << testFile << "'" << endl; char buffer[1024]; while (is.getline(buffer, sizeof(buffer))) { - std::istrstream ss(buffer); + std::istringstream ss(buffer); while (ss) { string s; ss >> s; diff --git a/toonz/sources/common/tvectorimage/tregionutil.cpp b/toonz/sources/common/tvectorimage/tregionutil.cpp index d0b33f1..789c6b6 100644 --- a/toonz/sources/common/tvectorimage/tregionutil.cpp +++ b/toonz/sources/common/tvectorimage/tregionutil.cpp @@ -70,7 +70,7 @@ void print(list &intersectionList, char *str) TColorStyle* fs = it1->m_edge.m_fillStyle; if (fs==0) of<<"NO color: "<< endl; - else + else { TFillStyleP fp = fs->getFillStyle(); if (fp) @@ -1413,10 +1413,10 @@ for (it=strokeList.begin(); it!=strokeList.end(); ++it) TPointD curTan = getTangent(*it); double angle0 = getAngle(lastTan, curTan); double angle1 = getAngle(lastTan, tanRef); - + if (areAlmostEqual(angle0, angle1, 1e-8)) { - double angle = getNearAngle( it->m_edge.m_s, it->m_edge.m_w0, it->m_gettingOut, + double angle = getNearAngle( it->m_edge.m_s, it->m_edge.m_w0, it->m_gettingOut, item.m_edge.m_s, item.m_edge.m_w0, item.m_gettingOut); angle1 += angle; if (angle1>360) angle1-=360; } @@ -1493,7 +1493,7 @@ void addBranches(IntersectionData &intData, Intersection &intersection, const ve it2 = it1; it2++; for (; it2!=intersection.m_strokeList.end(); ++it1, ++it2) { - if ((*it1).m_gettingOut!=(*it2).m_gettingOut &&((*it1).m_edge.m_index==jj && (*it2).m_edge.m_index==ii) || + if ((*it1).m_gettingOut!=(*it2).m_gettingOut &&((*it1).m_edge.m_index==jj && (*it2).m_edge.m_index==ii) || ((*it1).m_edge.m_index==ii && (*it2).m_edge.m_index==jj)) { IntersectedStroke& el1 = (*it1); @@ -2022,12 +2022,11 @@ void printStrokes1(vector &v, int size) #ifdef _DEBUG static void printTime(TStopWatch &sw, string name) { - ostrstream ss; + ostringstream ss; ss << name << " : "; sw.print(ss); ss << '\n' << '\0'; - string s = ss.str(); - ss.freeze(false); + string s(ss.str()); //TSystem::outputDebug(s); } #endif @@ -2052,7 +2051,7 @@ int TVectorImage::Imp::computeRegions() for( i=0; i(), false); - + return true; }*/ @@ -2176,11 +2175,11 @@ class Branch return m_next?m_next:m_intersection->m_branchList; } } - - + + class Intersection { - private: + private: TPointD m_intersectionPoint; int m_intersectionCount; Branch *m_branchList; diff --git a/toonz/sources/toonzlib/autopos.cpp b/toonz/sources/toonzlib/autopos.cpp index c6394b4..33dd585 100644 --- a/toonz/sources/toonzlib/autopos.cpp +++ b/toonz/sources/toonzlib/autopos.cpp @@ -3,7 +3,7 @@ #include "autopos.h" #include "cleanupcommon.h" -#include +#include using namespace CleanupTypes; @@ -12,7 +12,7 @@ guardare DAFARE guardare assumo autoalign rgb ->ora viene chiamata con un buffer rgbm ! modificare opportunamente -fare resize e realloc size dello stack a 65000 unita' +fare resize e realloc size dello stack a 65000 unita' */ @@ -28,7 +28,7 @@ static int Debug_flag = FALSE; /*===========================================================================*/ /* - AUTOALIGNMENT + AUTOALIGNMENT */ @@ -451,7 +451,7 @@ if ( image->orientation != TOR_LEFTBOT && */ /* - * Calcoli in millimetri per questa funzione che alla fine restituisce un + * Calcoli in millimetri per questa funzione che alla fine restituisce un * valore per la striscia di ricerca direttamente in pixel */ @@ -700,7 +700,7 @@ static int find_dots_bw(const TRasterP &img, int strip_width, PEGS_SIDE pegs_sid ysize = strip_width; vertical = FALSE; break; - + case PEGS_LEFT: case PEGS_RIGHT: x0 = pegs_side == PEGS_LEFT ? 0 : img->lx - strip_width; @@ -711,10 +711,9 @@ static int find_dots_bw(const TRasterP &img, int strip_width, PEGS_SIDE pegs_sid break; default: { - ostrstream os; + std::ostringstream os; os << "find dots internal error: pegs_side = " << std::hex << pegs_side << '\0'; - os.freeze(false); - throw TCleanupException(os.str()); + throw TCleanupException(os.str().c_str()); x0 = y0 = xsize = ysize = vertical = 0; } } @@ -844,10 +843,9 @@ static int find_dots_gr8(const TRasterGR8P &img, int strip_width, PEGS_SIDE pegs vertical = TRUE; break; default: { - std::ostrstream os; + std::ostringstream os; os << "find dots internal error: pegs_side = " << std::hex << pegs_side << '\0'; - os.freeze(false); - throw TCleanupException(os.str()); + throw TCleanupException(os.str().c_str()); x0 = y0 = xsize = ysize = vertical = 0; } } @@ -973,10 +971,9 @@ static int find_dots_rgb(const TRaster32P &img, int strip_width, PEGS_SIDE pegs_ vertical = TRUE; break; default: { - std::ostrstream os; + std::ostringstream os; os << "find dots internal error: pegs_side = " << std::hex << pegs_side << '\0'; - os.freeze(false); - throw TCleanupException(os.str()); + throw TCleanupException(os.str().c_str()); x0 = y0 = xsize = ysize = vertical = 0; break; }