OpenToonz - An open-source full-featured 2D animation creation software
C
use stringstream instead og strstream (#398)
tomosu5162807399b4
diff --git a/toonz/sources/common/tstream/tstream.cpp b/toonz/sources/common/tstream/tstream.cppindex df277d471..e31d83518 100644--- a/toonz/sources/common/tstream/tstream.cpp+++ b/toonz/sources/common/tstream/tstream.cpp@@ -223,7 +223,7 @@ public:ostream *m_os;bool m_chanOwner;bool m_compressed;- ostrstream m_ostrstream;+ ostringstream m_ostringstream;vector<std::string> m_tagStack;int m_tab;@@ -244,7 +244,7 @@ TOStream::TOStream(const TFilePath &fp, bool compressed)m_imp->m_filepath = fp;if (compressed) {- m_imp->m_os = &m_imp->m_ostrstream;+ m_imp->m_os = &m_imp->m_ostringstream;m_imp->m_compressed = true;m_imp->m_chanOwner = false;} else {@@ -305,7 +305,9 @@ TOStream::~TOStream()m_imp->m_justStarted = true;} else {if (m_imp->m_compressed) {- const void *in = (const void *)m_imp->m_ostrstream.str();+ std::string tmp = m_imp->m_ostringstream.str();+ const void *in = (const void *)tmp.c_str();+size_t in_len = strlen((char *)in);size_t out_len = LZ4F_compressFrameBound(in_len, NULL);@@ -324,8 +326,6 @@ TOStream::~TOStream()v = out_len;os.write((char *)&v, sizeof v);os.write((char *)out, out_len);-- m_imp->m_ostrstream.freeze(0);}free(out);@@ -435,7 +435,7 @@ TOStream &TOStream::operator<<(std::wstring v)int len = v.length();if(len==0){- os << "\"" << "\"" << " ";+ os << "\"" << "\"" << " ";m_imp->m_justStarted = false;return *this;}@@ -460,7 +460,7 @@ TOStream &TOStream::operator<<(std::wstring v)os << "\\n";else if(iswprint(v[i]))os << v[i];- else+ else{os.put('\\'); os << (int)v[i];}os << "\" ";}@@ -635,7 +635,7 @@ bool TOStream::checkStatus() const}//===============================================================-/*!+/*!This class contains TIStream's attributes.It is created by memory allocation in the TIStream's constructor.*/@@ -975,7 +975,7 @@ TIStream::TIStream(const TFilePath &fp)if (check_len != out_len)throw TException("corrupted file");- m_imp->m_is = new istrstream((char *)out, out_len);+ m_imp->m_is = new istringstream((char *)out, out_len);}m_imp->m_chanOwner = true;@@ -1317,7 +1317,7 @@ bool TIStream::getTagParam(string paramName, int &value)string svalue;if (!getTagParam(paramName, svalue))return false;- istrstream is(svalue.c_str(), svalue.length());+ istringstream is(svalue.c_str(), svalue.length());value = 0;is >> value;return true;