From d951871decb9fb036fb07309db2822e6c1c7fa88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Tue, 26 Jul 2016 13:08:49 +0000 Subject: [PATCH] QNX 6.3.0 gcc 3.3.1 git-svn-id: svn://db.shs.com.ru/pip@212 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src/core/pitime.h | 12 ++++++------ src/io/pidir.cpp | 28 ++++++++++++++++++---------- src/io/piethernet.cpp | 20 +++++++++++++++----- src/math/pimathbase.h | 8 +++++++- 4 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/core/pitime.h b/src/core/pitime.h index ff0711a7..439e749d 100755 --- a/src/core/pitime.h +++ b/src/core/pitime.h @@ -50,11 +50,11 @@ void piUSleep(int usecs); // on !Windows consider constant "usleep" offset /*! \brief Precise sleep for "msecs" milliseconds * \details This function exec \a piUSleep (msecs * 1000). */ -inline void piMSleep(double msecs) {piUSleep(msecs * 1000);} // on !Windows consider constant "usleep" offset +inline void piMSleep(double msecs) {piUSleep(int(msecs * 1000.));} // on !Windows consider constant "usleep" offset /*! \brief Precise sleep for "secs" seconds * \details This function exec \a piUSleep (msecs * 1000000). */ -inline void piSleep(double secs) {piUSleep(secs * 1000000);} // on !Windows consider constant "usleep" offset +inline void piSleep(double secs) {piUSleep(int(secs * 1000000.));} // on !Windows consider constant "usleep" offset class PIP_EXPORT PISystemTime { public: @@ -151,16 +151,16 @@ public: //! Contructs system time from seconds "v" - static PISystemTime fromSeconds(double v) {int s = piFloord(v); return PISystemTime(s, (v - s) * 1000000000);} + static PISystemTime fromSeconds(double v) {int s = piFloord(v); return PISystemTime(s, int((v - s) * 1000000000.));} //! Contructs system time from milliseconds "v" - static PISystemTime fromMilliseconds(double v) {int s = piFloord(v / 1000.); return PISystemTime(s, (v / 1000. - s) * 1000000000);} + static PISystemTime fromMilliseconds(double v) {int s = piFloord(v / 1000.); return PISystemTime(s, int((v / 1000. - s) * 1000000000.));} //! Contructs system time from microseconds "v" - static PISystemTime fromMicroseconds(double v) {int s = piFloord(v / 1000000.); return PISystemTime(s, (v / 1000000. - s) * 1000000000);} + static PISystemTime fromMicroseconds(double v) {int s = piFloord(v / 1000000.); return PISystemTime(s, int((v / 1000000. - s) * 1000000000.));} //! Contructs system time from nanoseconds "v" - static PISystemTime fromNanoseconds(double v) {int s = piFloord(v / 1000000000.); return PISystemTime(s, (v / 1000000000. - s) * 1000000000);} + static PISystemTime fromNanoseconds(double v) {int s = piFloord(v / 1000000000.); return PISystemTime(s, int((v / 1000000000. - s) * 1000000000.));} //! Returns current system time static PISystemTime current(bool precise_but_not_system = false); diff --git a/src/io/pidir.cpp b/src/io/pidir.cpp index ab39af13..c7f8af10 100755 --- a/src/io/pidir.cpp +++ b/src/io/pidir.cpp @@ -268,24 +268,32 @@ PIVector PIDir::entries() { } #else +# ifdef QNX + struct dirent * de = 0; + DIR * dir = 0; + dir = opendir(p.data()); + if (dir) { + for (;;) { + de = readdir(dir); + if (!de) break; + l << PIFile::fileInfo(dp + PIString(de->d_name)); + } + closedir(dir); + } +# else dirent ** list; - int cnt = scandir( -# ifndef QNX - p.data(), &list -# else - const_cast(p.data()), 0 -# endif - , 0, -# if defined(MAC_OS) || defined(ANDROID) || defined(BLACKBERRY) + int cnt = scandir(p.data(), &list, 0, +# if defined(MAC_OS) || defined(ANDROID) || defined(BLACKBERRY) || defined(QNX) alphasort); -# else +# else versionsort); -# endif +# endif for (int i = 0; i < cnt; ++i) { l << PIFile::fileInfo(dp + PIString(list[i]->d_name)); free(list[i]); } free(list); +# endif #endif // piCout << "end entries from" << p; return l; diff --git a/src/io/piethernet.cpp b/src/io/piethernet.cpp index 6e692c6a..34f4262c 100755 --- a/src/io/piethernet.cpp +++ b/src/io/piethernet.cpp @@ -21,8 +21,18 @@ #include "piconfig.h" #include "pisysteminfo.h" #ifdef QNX +# include # include # include +# include +# include +# include +# include +# include +# include +# include +# include +# include # ifdef BLACKBERRY # include # else @@ -304,14 +314,14 @@ void PIEthernet::applyTimeout(int fd, int opt, double ms) { if (fd == 0) return; //piCoutObj << "setReadIsBlocking" << yes; #ifdef WINDOWS - DWORD tm = ms; + DWORD _tm = ms; #else double s = ms / 1000.; - timeval tm; - tm.tv_sec = piFloord(s); s -= tm.tv_sec; - tm.tv_usec = s * 1000000.; + timeval _tm; + _tm.tv_sec = piFloord(s); s -= _tm.tv_sec; + _tm.tv_usec = s * 1000000.; #endif - ethSetsockopt(fd, SOL_SOCKET, opt, &tm, sizeof(tm)); + ethSetsockopt(fd, SOL_SOCKET, opt, &_tm, sizeof(_tm)); } diff --git a/src/math/pimathbase.h b/src/math/pimathbase.h index 61bf0a77..bc86c50c 100644 --- a/src/math/pimathbase.h +++ b/src/math/pimathbase.h @@ -170,7 +170,13 @@ inline PIByteArray & operator >>(PIByteArray & s, complexld & v) {ldouble t; s > void randomize(); // [-1 ; 1] -inline double randomd() {return (double)random() / RAND_MAX * 2. - 1.;} +inline double randomd() {return (double) +#ifdef QNX + rand() +#else + random() +#endif + / RAND_MAX * 2. - 1.;} // [-1 ; 1] normal double randomn(double dv = 0., double sv = 1.);