From ed059005f93360d9b7fe588ce05abdb37d356d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Tue, 25 Apr 2017 12:55:47 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@470 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src_main/core/pibitarray.cpp | 3 +- src_main/core/pibitarray.h | 4 +- src_main/core/pibytearray.cpp | 2 + src_main/core/pibytearray.h | 2 + src_main/core/pichar.cpp | 5 +- src_main/core/pichar.h | 2 + src_main/core/picout.cpp | 2 +- src_main/core/picout.h | 2 +- src_main/core/piincludes.h | 2 - src_main/io/piconfig.cpp | 4 ++ src_main/io/piconfig.h | 9 +++ src_main/io/pifile.cpp | 128 ++++++++++++++++++---------------- src_main/io/pifile.h | 2 +- src_main/system/piprocess.cpp | 11 +-- src_main/system/piprocess.h | 1 - 15 files changed, 101 insertions(+), 78 deletions(-) diff --git a/src_main/core/pibitarray.cpp b/src_main/core/pibitarray.cpp index 73f8c5c7..53034451 100644 --- a/src_main/core/pibitarray.cpp +++ b/src_main/core/pibitarray.cpp @@ -13,7 +13,7 @@ PICout operator <<(PICout s, const PIBitArray & ba) { return s; } - +#ifdef PIP_STD_IOSTREAM std::ostream &operator <<(std::ostream & s, const PIBitArray & ba) { for (uint i = 0; i < ba.bitSize(); ++i) { s << ba[i]; @@ -21,4 +21,5 @@ std::ostream &operator <<(std::ostream & s, const PIBitArray & ba) { } return s; } +#endif diff --git a/src_main/core/pibitarray.h b/src_main/core/pibitarray.h index c47bb8f6..37f53a03 100755 --- a/src_main/core/pibitarray.h +++ b/src_main/core/pibitarray.h @@ -100,7 +100,9 @@ private: }; -std::ostream & operator <<(std::ostream & s, const PIBitArray & ba); +#ifdef PIP_STD_IOSTREAM +//std::ostream & operator <<(std::ostream & s, const PIBitArray & ba); +#endif inline PICout operator <<(PICout s, const PIBitArray & ba); diff --git a/src_main/core/pibytearray.cpp b/src_main/core/pibytearray.cpp index a2ce26d4..00eb3d23 100755 --- a/src_main/core/pibytearray.cpp +++ b/src_main/core/pibytearray.cpp @@ -361,6 +361,7 @@ PICout operator <<(PICout s, const PIByteArray & ba) { } +#ifdef PIP_STD_IOSTREAM std::ostream &operator <<(std::ostream & s, const PIByteArray & ba) { s << "{"; for (uint i = 0; i < ba.size(); ++i) { @@ -370,3 +371,4 @@ std::ostream &operator <<(std::ostream & s, const PIByteArray & ba) { s << "}"; return s; } +#endif diff --git a/src_main/core/pibytearray.h b/src_main/core/pibytearray.h index 020e315c..383803c7 100755 --- a/src_main/core/pibytearray.h +++ b/src_main/core/pibytearray.h @@ -125,8 +125,10 @@ public: inline bool operator <(const PIByteArray & v0, const PIByteArray & v1) {if (v0.size() == v1.size()) {for (uint i = 0; i < v0.size(); ++i) if (v0[i] != v1[i]) return v0[i] < v1[i]; return false;} return v0.size() < v1.size();} +#ifdef PIP_STD_IOSTREAM //! \relatesalso PIByteArray \brief Output to std::ostream operator inline std::ostream & operator <<(std::ostream & s, const PIByteArray & ba); +#endif //! \relatesalso PIByteArray \brief Output to PICout operator PICout operator <<(PICout s, const PIByteArray & ba); diff --git a/src_main/core/pichar.cpp b/src_main/core/pichar.cpp index 1baa6381..86613e2a 100644 --- a/src_main/core/pichar.cpp +++ b/src_main/core/pichar.cpp @@ -266,13 +266,12 @@ PIChar PIChar::toLower() const { } - - +#ifdef PIP_STD_IOSTREAM std::ostream & operator <<(std::ostream & s, const PIChar & v) { s << v.toCharPtr(); return s; } - +#endif PICout operator <<(PICout s, const PIChar & v) { s.space(); diff --git a/src_main/core/pichar.h b/src_main/core/pichar.h index 50430bb9..3184089f 100755 --- a/src_main/core/pichar.h +++ b/src_main/core/pichar.h @@ -157,8 +157,10 @@ private: }; +#ifdef PIP_STD_IOSTREAM //! Output operator to \c std::ostream std::ostream & operator <<(std::ostream & s, const PIChar & v); +#endif //! Output operator to \a PICout PICout operator <<(PICout s, const PIChar & v); diff --git a/src_main/core/picout.cpp b/src_main/core/picout.cpp index 885629af..961fb24f 100644 --- a/src_main/core/picout.cpp +++ b/src_main/core/picout.cpp @@ -195,7 +195,7 @@ PICout PICout::operator <<(const PICoutAction v) { PICout PICout::operator <<(const char * v) {if (v[0] == '\0') return *this; space(); quote(); PICOUTTOTARGET(v) quote(); return *this;} -PICout PICout::operator <<(const std::string & v) {space(); quote(); if (PICout::buffer_) __PICout_string__ << StdString2PIString(v); else std::cout << (v); quote(); return *this;} +//PICout PICout::operator <<(const std::string & v) {space(); quote(); if (PICout::buffer_) __PICout_string__ << StdString2PIString(v); else std::cout << (v); quote(); return *this;} PICout PICout::operator <<(const bool v) {space(); if (v) PICOUTTOTARGET("true") else PICOUTTOTARGET("false") return *this;} diff --git a/src_main/core/picout.h b/src_main/core/picout.h index 95f3036c..b7531a14 100644 --- a/src_main/core/picout.h +++ b/src_main/core/picout.h @@ -123,7 +123,7 @@ public: PICout operator <<(const char * v); //! Output operator for strings with "std::string" type - PICout operator <<(const std::string & v); + //PICout operator <<(const std::string & v); //! Output operator for boolean values PICout operator <<(const bool v); diff --git a/src_main/core/piincludes.h b/src_main/core/piincludes.h index f0f8e7d6..65faa6dd 100755 --- a/src_main/core/piincludes.h +++ b/src_main/core/piincludes.h @@ -25,8 +25,6 @@ #include "pimonitor.h" #ifdef PIP_STD_IOSTREAM # include -#else -# include #endif extern PIMonitor piMonitor; diff --git a/src_main/io/piconfig.cpp b/src_main/io/piconfig.cpp index 94055d31..28bf59e4 100755 --- a/src_main/io/piconfig.cpp +++ b/src_main/io/piconfig.cpp @@ -237,12 +237,14 @@ bool PIConfig::Entry::entryExists(const Entry * e, const PIString & name) const } +#ifdef PIP_STD_IOSTREAM void PIConfig::Entry::coutt(std::ostream & s, const PIString & p) const { PIString nl = p + " "; if (!_value.isEmpty()) s << p << _name << " = " << _value << std::endl; else std::cout << p << _name << std::endl; piForeachC (Entry * i, _children) i->coutt(s, nl); } +#endif void PIConfig::Entry::piCoutt(PICout s, const PIString & p) const { @@ -815,6 +817,7 @@ void PIConfig::parse() { } +#ifdef PIP_STD_IOSTREAM std::ostream &operator <<(std::ostream & s, const PIConfig::Entry & v) { s << v.value(); return s; @@ -825,3 +828,4 @@ std::ostream &operator <<(std::ostream & s, const PIConfig::Branch & v) { v.coutt(s, ""); return s; } +#endif diff --git a/src_main/io/piconfig.h b/src_main/io/piconfig.h index 1ab8e6c9..885c77f9 100755 --- a/src_main/io/piconfig.h +++ b/src_main/io/piconfig.h @@ -75,7 +75,9 @@ public: class PIP_EXPORT Branch: public PIVector { friend class PIConfig; friend class Entry; +#ifdef PIP_STD_IOSTREAM friend std::ostream & operator <<(std::ostream & s, const Branch & v); +#endif friend PICout operator <<(PICout s, const Branch & v); public: Branch() {;} @@ -97,7 +99,9 @@ public: private: bool entryExists(const Entry * e, const PIString & name) const; void allLeaves(Branch & b, Entry * e) {piForeach (Entry * i, e->_children) {if (i->isLeaf()) b << i; else allLeaves(b, i);}} +#ifdef PIP_STD_IOSTREAM void coutt(std::ostream & s, const PIString & p) const {piForeachC (Entry * i, *this) i->coutt(s, p);} +#endif void piCoutt(PICout s, const PIString & p) const {piForeachC (Entry * i, *this) i->piCoutt(s, p);} static Entry _empty; @@ -303,7 +307,9 @@ public: bool entryExists(const Entry * e, const PIString & name) const; void buildLine() {_all = _tab + _full_name + " = " + _value + " #" + _type + " " + _comment;} void clear() {_children.clear(); _name = _value = _type = _comment = _all = PIString(); _line = 0; _parent = 0;} +#ifdef PIP_STD_IOSTREAM void coutt(std::ostream & s, const PIString & p) const; +#endif void piCoutt(PICout s, const PIString & p) const; void deleteBranch() {piForeach (Entry * i, _children) {i->deleteBranch(); delete i;}} @@ -500,8 +506,11 @@ private: }; +#ifdef PIP_STD_IOSTREAM std::ostream & operator <<(std::ostream & s, const PIConfig::Branch & v); std::ostream & operator <<(std::ostream & s, const PIConfig::Entry & v); +#endif + inline PICout operator <<(PICout s, const PIConfig::Branch & v) {s.setControl(0, true); v.piCoutt(s, ""); s.restoreControl(); return s;} inline PICout operator <<(PICout s, const PIConfig::Entry & v) {s << v.value(); return s;} diff --git a/src_main/io/pifile.cpp b/src_main/io/pifile.cpp index 5d364277..2262ec8d 100755 --- a/src_main/io/pifile.cpp +++ b/src_main/io/pifile.cpp @@ -85,6 +85,10 @@ REGISTER_DEVICE(PIFile) +PRIVATE_DEFINITION_START(PIFile) + FILE * fd; +PRIVATE_DEFINITION_END(PIFile) + PIString PIFile::FileInfo::name() const { if (path.isEmpty()) return PIString(); @@ -123,14 +127,14 @@ PIString PIFile::FileInfo::dir() const { PIFile::PIFile(): PIIODevice() { - fd = 0; + PRIVATE->fd = 0; fdi = -1; setPrecision(5); } PIFile::PIFile(const PIString & path, PIIODevice::DeviceMode mode): PIIODevice(path, mode) { - fd = 0; + PRIVATE->fd = 0; fdi = -1; setPrecision(5); if (!path.isEmpty()) @@ -144,7 +148,7 @@ bool PIFile::openTemporary(PIIODevice::DeviceMode mode) { //PIFile::PIFile(const PIFile & other) { -// fd = 0; +// PRIVATE->fd = 0; // fdi = -1; // setPrecision(other.prec_); // setPath(other.path()); @@ -162,29 +166,29 @@ bool PIFile::openDevice() { if (fd != 0) fclose(fd); } } - fd = _fopen_call_(p.data(), strType(mode_).data()); - //piCout << "fopen " << path() << ": " << strType(mode_).data() << fd; - bool opened = (fd != 0); + PRIVATE->fd = _fopen_call_(p.data(), strType(mode_).data()); + //piCout << "fopen " << path() << ": " << strType(mode_).data() << PRIVATE->fd; + bool opened = (PRIVATE->fd != 0); if (opened) { - fdi = fileno(fd); + fdi = fileno(PRIVATE->fd); #ifndef WINDOWS fcntl(fdi, F_SETFL, O_NONBLOCK); #endif - _fseek_call_(fd, 0, SEEK_SET); - clearerr(fd); + _fseek_call_(PRIVATE->fd, 0, SEEK_SET); + clearerr(PRIVATE->fd); } - //piCout << "open file" << fd << opened_; + //piCout << "open file" << PRIVATE->fd << opened_; return opened; } bool PIFile::closeDevice() { - //piCout << "close file" << fd << opened_; - if (isClosed() || fd == 0) return true; - bool cs = (fclose(fd) == 0); - if (cs) fd = 0; + //piCout << "close file" << PRIVATE->fd << opened_; + if (isClosed() || PRIVATE->fd == 0) return true; + bool cs = (fclose(PRIVATE->fd) == 0); + if (cs) PRIVATE->fd = 0; fdi = -1; - //piCout << "closed file" << fd << opened_; + //piCout << "closed file" << PRIVATE->fd << opened_; return cs; } @@ -194,7 +198,7 @@ PIString PIFile::readLine() { if (isClosed()) return str; int cc; while (!isEnd()) { - cc = fgetc(fd); + cc = fgetc(PRIVATE->fd); if (char(cc) == '\n' || cc == EOF) break; str.push_back(char(cc)); } @@ -243,9 +247,9 @@ PIByteArray PIFile::readAll(bool forceRead) { llong PIFile::size() const { if (isClosed()) return -1; llong s, cp = pos(); - _fseek_call_(fd, 0, SEEK_END); clearerr(fd); + _fseek_call_(PRIVATE->fd, 0, SEEK_END); clearerr(PRIVATE->fd); s = pos(); - _fseek_call_(fd, cp, SEEK_SET); clearerr(fd); + _fseek_call_(PRIVATE->fd, cp, SEEK_SET); clearerr(PRIVATE->fd); return s; } @@ -313,29 +317,29 @@ PIString PIFile::strType(const PIIODevice::DeviceMode type) { void PIFile::flush() { - if (isOpened()) fflush(fd); + if (isOpened()) fflush(PRIVATE->fd); } void PIFile::seek(llong position) { if (isClosed()) return; if (position == pos()) return; - _fseek_call_(fd, position, SEEK_SET); - clearerr(fd); + _fseek_call_(PRIVATE->fd, position, SEEK_SET); + clearerr(PRIVATE->fd); } void PIFile::seekToBegin() { if (isClosed()) return; - _fseek_call_(fd, 0, SEEK_SET); - clearerr(fd); + _fseek_call_(PRIVATE->fd, 0, SEEK_SET); + clearerr(PRIVATE->fd); } void PIFile::seekToEnd() { if (isClosed()) return; - _fseek_call_(fd, 0, SEEK_END); - clearerr(fd); + _fseek_call_(PRIVATE->fd, 0, SEEK_END); + clearerr(PRIVATE->fd); } @@ -343,12 +347,12 @@ void PIFile::seekToLine(llong line) { if (isClosed()) return; seekToBegin(); piForTimes(line) readLine(); - clearerr(fd); + clearerr(PRIVATE->fd); } char PIFile::readChar() { - return (char)fgetc(fd); + return (char)fgetc(PRIVATE->fd); } @@ -360,13 +364,13 @@ void PIFile::setPath(const PIString & path) { llong PIFile::pos() const { if (isClosed()) return -1; - return _ftell_call_(fd); + return _ftell_call_(PRIVATE->fd); } bool PIFile::isEnd() const { if (isClosed()) return true; - return (feof(fd) || ferror(fd)); + return (feof(PRIVATE->fd) || ferror(PRIVATE->fd)); } @@ -378,169 +382,169 @@ void PIFile::setPrecision(int prec) { PIFile &PIFile::operator <<(double v) { - if (canWrite() && fd != 0) ret = fprintf(fd, ("%" + prec_str + "lf").data(), v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, ("%" + prec_str + "lf").data(), v); return *this; } PIFile &PIFile::operator >>(double & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%lf", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%lf", &v); return *this; } PIFile &PIFile::operator >>(float & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%f", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%f", &v); return *this; } PIFile &PIFile::operator >>(ullong & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%lln", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%lln", &v); return *this; } PIFile &PIFile::operator >>(ulong & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%ln", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%ln", &v); return *this; } PIFile &PIFile::operator >>(uint & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%n", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%n", &v); return *this; } PIFile &PIFile::operator >>(ushort & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%hn", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%hn", &v); return *this; } PIFile &PIFile::operator >>(uchar & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%hhn", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%hhn", &v); return *this; } PIFile &PIFile::operator >>(llong & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%lln", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%lln", &v); return *this; } PIFile &PIFile::operator >>(long & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%ln", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%ln", &v); return *this; } PIFile &PIFile::operator >>(int & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%n", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%n", &v); return *this; } PIFile &PIFile::operator >>(short & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%hn", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%hn", &v); return *this; } PIFile &PIFile::operator >>(char & v) { - if (canRead() && fd != 0) ret = fscanf(fd, "%hhn", &v); + if (canRead() && PRIVATE->fd != 0) ret = fscanf(PRIVATE->fd, "%hhn", &v); return *this; } PIFile &PIFile::operator <<(float v) { - if (canWrite() && fd != 0) ret = fprintf(fd, ("%" + prec_str + "f").data(), v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, ("%" + prec_str + "f").data(), v); return *this; } PIFile &PIFile::operator <<(ullong v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%llu", v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%llu", v); return *this; } PIFile &PIFile::operator <<(ulong v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%lu", v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%lu", v); return *this; } PIFile &PIFile::operator <<(uint v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%u", v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%u", v); return *this; } PIFile &PIFile::operator <<(ushort v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%hu", v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%hu", v); return *this; } PIFile &PIFile::operator <<(uchar v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%u", int(v)); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%u", int(v)); return *this; } PIFile &PIFile::operator <<(llong v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%lld", v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%lld", v); return *this; } PIFile &PIFile::operator <<(long v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%ld", v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%ld", v); return *this; } PIFile &PIFile::operator <<(int v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%d", v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%d", v); return *this; } PIFile &PIFile::operator <<(short v) { - if (canWrite() && fd != 0) ret = fprintf(fd, "%hd", v); + if (canWrite() && PRIVATE->fd != 0) ret = fprintf(PRIVATE->fd, "%hd", v); return *this; } PIFile &PIFile::operator <<(const PIByteArray & v) { - if (canWrite() && fd != 0) write(v.data(), v.size()); + if (canWrite() && PRIVATE->fd != 0) write(v.data(), v.size()); return *this; } PIFile &PIFile::operator <<(const char v) { - if (canWrite() && fd != 0) write(&v, 1); + if (canWrite() && PRIVATE->fd != 0) write(&v, 1); return *this; } int PIFile::readDevice(void * read_to, int max_size) { - if (!canRead() || fd == 0) return -1; - return fread(read_to, 1, max_size, fd); + if (!canRead() || PRIVATE->fd == 0) return -1; + return fread(read_to, 1, max_size, PRIVATE->fd); } int PIFile::writeDevice(const void * data, int max_size) { - if (!canWrite() || fd == 0) return -1; - return fwrite(data, 1, max_size, fd); + if (!canWrite() || PRIVATE->fd == 0) return -1; + return fwrite(data, 1, max_size, PRIVATE->fd); } PIFile &PIFile::operator <<(const PIString & v) { - if (canWrite() && fd != 0) + if (canWrite() && PRIVATE->fd != 0) *this << v.toCharset(defaultCharset()); return *this; } @@ -548,9 +552,9 @@ PIFile &PIFile::operator <<(const PIString & v) { void PIFile::clear() { close(); - fd = fopen(path().data(), "w"); - if (fd != 0) fclose(fd); - fd = 0; + PRIVATE->fd = fopen(path().data(), "w"); + if (PRIVATE->fd != 0) fclose(PRIVATE->fd); + PRIVATE->fd = 0; opened_ = false; open(); } diff --git a/src_main/io/pifile.h b/src_main/io/pifile.h index 6ad6bdd9..71bfd5ce 100755 --- a/src_main/io/pifile.h +++ b/src_main/io/pifile.h @@ -297,7 +297,7 @@ protected: private: PIString strType(const PIIODevice::DeviceMode type); - FILE * fd; + PRIVATE_DECLARATION int ret, prec_, fdi; PIString prec_str; diff --git a/src_main/system/piprocess.cpp b/src_main/system/piprocess.cpp index eee58825..785074d7 100755 --- a/src_main/system/piprocess.cpp +++ b/src_main/system/piprocess.cpp @@ -34,6 +34,7 @@ PRIVATE_DEFINITION_START(PIProcess) #else pid_t pid; #endif +FILE * tf_in, * tf_out, * tf_err; PRIVATE_DEFINITION_END(PIProcess) @@ -48,7 +49,7 @@ PIProcess::PIProcess(): PIThread() { is_exec = false; g_in = g_out = g_err = false; t_in = t_out = t_err = false; - tf_in = tf_out = tf_err = 0; + PRIVATE->tf_in = PRIVATE->tf_out = PRIVATE->tf_err = 0; env = PIProcess::currentEnvironment(); } @@ -139,12 +140,12 @@ void PIProcess::startProc(bool detached) { if (!detached) PRIVATE->pid = pid_; if (pid_ == 0) { #endif - tf_in = tf_out = tf_err = 0; + PRIVATE->tf_in = PRIVATE->tf_out = PRIVATE->tf_err = 0; //cout << "exec " << tf_in << ", " << tf_out << ", " << tf_err << endl; //cout << f_out.path() << endl; - if (g_in) tf_in = freopen(f_in.path().data(), "r", stdin); - if (g_out) tf_out = freopen(f_out.path().data(), "w", stdout); - if (g_err) tf_err = freopen(f_err.path().data(), "w", stderr); + if (g_in) PRIVATE->tf_in = freopen(f_in.path().data(), "r", stdin); + if (g_out) PRIVATE->tf_out = freopen(f_out.path().data(), "w", stdout); + if (g_err) PRIVATE->tf_err = freopen(f_err.path().data(), "w", stderr); #ifndef WINDOWS if (!wd.isEmpty()) if (!chdir(wd.data())) diff --git a/src_main/system/piprocess.h b/src_main/system/piprocess.h index 0fabafe6..abe6b989 100755 --- a/src_main/system/piprocess.h +++ b/src_main/system/piprocess.h @@ -97,7 +97,6 @@ private: PIFile f_in, f_out, f_err; bool g_in, g_out, g_err, t_in, t_out, t_err; PRIVATE_DECLARATION - FILE * tf_in, * tf_out, * tf_err; int exit_code, sz; bool is_exec;