From 7a5b239bffcc22bb0e3bca845ed4971c52a466db Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 14 Dec 2000 00:41:49 +0000 Subject: [PATCH] fixed gnu warnings --- src/libCom/cxxTemplates/resourceLib.h | 11 +++---- src/libCom/cxxTemplates/tsSLList.h | 24 +++++++++------- src/libCom/misc/locationException.h | 18 +++++++++++- src/libCom/osi/osiTime.cpp | 7 ++--- src/libCom/osi/osiTime.h | 41 +++++++++++++-------------- 5 files changed, 58 insertions(+), 43 deletions(-) diff --git a/src/libCom/cxxTemplates/resourceLib.h b/src/libCom/cxxTemplates/resourceLib.h index 5515c769a..847911813 100644 --- a/src/libCom/cxxTemplates/resourceLib.h +++ b/src/libCom/cxxTemplates/resourceLib.h @@ -167,10 +167,10 @@ private: unsigned nInUse; resTableIndex hash (const ID & idIn) const; - T *find (tsSLList &list, const ID &idIn) const; - T *findDelete (tsSLList &list, const ID &idIn); + resTable ( const resTable & ); + resTable & operator = ( const resTable & ); }; @@ -284,7 +284,7 @@ public: class epicsShareClass dynamicMemoryAllocationFailed {}; enum allocationType {copyString, refString}; stringId (const char * idIn, allocationType typeIn=copyString); - ~ stringId(); + virtual ~stringId(); resTableIndex hash (unsigned nBitsIndex) const; bool operator == (const stringId &idIn) const; const char * resourceName() const; // return the pointer to the string @@ -294,6 +294,7 @@ public: private: stringId & operator = ( const stringId & ); + stringId ( const stringId &); const char * pStr; const allocationType allocType; static const unsigned char fastHashPermutedIndexSpace[256]; @@ -307,8 +308,8 @@ private: // resTable::resTable (unsigned nHashTableEntries) // template -resTable::resTable (unsigned nHashTableEntries) : - nInUse (0) +resTable::resTable ( unsigned nHashTableEntries ) : + pTable ( 0 ), hashIdMask ( 0 ), hashIdNBits ( 0 ), nInUse ( 0 ) { unsigned nbits, mask = 0u; diff --git a/src/libCom/cxxTemplates/tsSLList.h b/src/libCom/cxxTemplates/tsSLList.h index caaf92543..8215c2d0a 100644 --- a/src/libCom/cxxTemplates/tsSLList.h +++ b/src/libCom/cxxTemplates/tsSLList.h @@ -59,8 +59,9 @@ friend class tsSLIter < T >; friend class tsSLIterConst < T >; public: tsSLNode (); - void operator = ( const tsSLNode < T > & ) const; + const tsSLNode < T > & operator = ( const tsSLNode < T > & ) const; private: + tsSLNode ( const tsSLNode < T > & ); void removeNextItem (); // removes the item after this node T *pNext; }; @@ -103,8 +104,8 @@ public: const T & operator * () const; const T * operator -> () const; - tsSLIterConst operator ++ (); // prefix ++ - tsSLIterConst operator ++ (int); // postfix ++ + tsSLIterConst & operator ++ (); // prefix ++ + tsSLIterConst & operator ++ (int); // postfix ++ # if defined(_MSC_VER) && _MSC_VER < 1200 tsSLIterConst (const class tsSLIterConst ©In); @@ -142,8 +143,8 @@ public: T & operator * () const; T * operator -> () const; - tsSLIter operator ++ (); // prefix ++ - tsSLIter operator ++ (int); // postfix ++ + tsSLIter & operator ++ (); // prefix ++ + tsSLIter & operator ++ (int); // postfix ++ # if defined(_MSC_VER) && _MSC_VER < 1200 tsSLIter (class tsSLIter ©In); @@ -176,7 +177,10 @@ tsSLNode < T > ::tsSLNode () : pNext ( 0 ) {} // do _not_ change the node pointers // template < class T > -inline void tsSLNode < T >::operator = ( const tsSLNode < T > & ) const {} +inline const tsSLNode < T > & tsSLNode < T >::operator = ( const tsSLNode < T > & ) const +{ + return *this; +} // // removeNextItem () @@ -326,7 +330,7 @@ inline const T * tsSLIterConst::operator -> () const } template < class T > -inline tsSLIterConst tsSLIterConst::operator ++ () // prefix ++ +inline tsSLIterConst & tsSLIterConst::operator ++ () // prefix ++ { const tsSLNode < T > *pCurNode = this->pConstEntry; this->pConstEntry = pCurNode->pNext; @@ -334,7 +338,7 @@ inline tsSLIterConst tsSLIterConst::operator ++ () // prefix ++ } template < class T > -inline tsSLIterConst tsSLIterConst::operator ++ (int) // postfix ++ +inline tsSLIterConst & tsSLIterConst::operator ++ (int) // postfix ++ { tsSLIterConst tmp = *this; tsSLNode < T > *pCurNode = this->pConstEntry; @@ -417,14 +421,14 @@ inline T * tsSLIter::operator -> () const } template < class T > -inline tsSLIter tsSLIter::operator ++ () // prefix ++ +inline tsSLIter & tsSLIter::operator ++ () // prefix ++ { this->tsSLIterConst::operator ++ (); return *this; } template < class T > -inline tsSLIter tsSLIter::operator ++ (int) // postfix ++ +inline tsSLIter & tsSLIter::operator ++ (int) // postfix ++ { tsSLIter tmp = *this; this->tsSLIterConst::operator ++ (); diff --git a/src/libCom/misc/locationException.h b/src/libCom/misc/locationException.h index 7fe9d7b96..786b1b484 100644 --- a/src/libCom/misc/locationException.h +++ b/src/libCom/misc/locationException.h @@ -17,6 +17,8 @@ template class sourceFileLocation : public T { public: sourceFileLocation (const T &parm, const char *fileName, unsigned lineNumber); + sourceFileLocation ( const sourceFileLocation & ); + sourceFileLocation & operator = ( const sourceFileLocation & ); const char *fileName () const; unsigned lineNumber () const; private: @@ -26,9 +28,23 @@ private: template inline sourceFileLocation::sourceFileLocation (const T &parm, const char *fileName, unsigned lineNumber) : - T (parm), pFileName (fileName) , lineNumberCopy(lineNumber) {} + T ( parm ), pFileName ( fileName ) , lineNumberCopy ( lineNumber ) {} template +inline sourceFileLocation::sourceFileLocation ( const sourceFileLocation &in ) : + T ( in ), pFileName ( in.pFileName ), lineNumberCopy ( in.lineNumberCopy ) +{ +} + +template < class T > +inline sourceFileLocation & sourceFileLocation::operator = ( const sourceFileLocation &in ) +{ + this->pFileName = in.pFileName; + this->lineNumberCopy = in.lineNumberCopy; + return *this; +} + +template < class T > inline unsigned sourceFileLocation::lineNumber () const { return this->lineNumberCopy; diff --git a/src/libCom/osi/osiTime.cpp b/src/libCom/osi/osiTime.cpp index 48db660c3..1955baabc 100644 --- a/src/libCom/osi/osiTime.cpp +++ b/src/libCom/osi/osiTime.cpp @@ -80,11 +80,8 @@ static char *fracFormat (const char *pFormat, unsigned long *width); // // osiTime (const unsigned long secIn, const unsigned long nSecIn) // -inline osiTime::osiTime (const unsigned long secIn, const unsigned long nSecIn) -{ - this->secPastEpoch = nSecIn/nSecPerSec + secIn; - this->nSec = nSecIn%nSecPerSec; -} +inline osiTime::osiTime (const unsigned long secIn, const unsigned long nSecIn) : + secPastEpoch ( nSecIn / nSecPerSec + secIn ), nSec ( nSecIn % nSecPerSec ) {} // // osiTimeLoadTimeInit diff --git a/src/libCom/osi/osiTime.h b/src/libCom/osi/osiTime.h index bdd1178e6..4f19dc60c 100644 --- a/src/libCom/osi/osiTime.h +++ b/src/libCom/osi/osiTime.h @@ -139,7 +139,7 @@ public: // operator TS_STAMP () const; osiTime (const TS_STAMP &ts); - osiTime operator = (const TS_STAMP &rhs); + osiTime & operator = (const TS_STAMP &rhs); // // convert to and from ANSI C's "time_t" @@ -150,42 +150,42 @@ public: // operator time_t_wrapper () const; osiTime (const time_t_wrapper &tv); - osiTime operator = (const time_t_wrapper &rhs); + osiTime & operator = (const time_t_wrapper &rhs); // // convert to and from ANSI C's "struct tm" (with nano seconds) // operator tm_nano_sec () const; osiTime (const tm_nano_sec &ts); - osiTime operator = (const tm_nano_sec &rhs); + osiTime & operator = (const tm_nano_sec &rhs); // // convert to and from POSIX RT's "struct timespec" // operator struct timespec () const; osiTime (const struct timespec &ts); - osiTime operator = (const struct timespec &rhs); + osiTime & operator = (const struct timespec &rhs); // // convert to and from BSD's "struct timeval" // operator struct timeval () const; osiTime (const struct timeval &ts); - osiTime operator = (const struct timeval &rhs); + osiTime & operator = (const struct timeval &rhs); // // convert to and from NTP timestamp format // operator ntpTimeStamp () const; osiTime (const ntpTimeStamp &ts); - osiTime operator = (const ntpTimeStamp &rhs); + osiTime & operator = (const ntpTimeStamp &rhs); // // convert to and from GDD's aitTimeStamp format // operator aitTimeStamp () const; osiTime (const aitTimeStamp &ts); - osiTime operator = (const aitTimeStamp &rhs); + osiTime & operator = (const aitTimeStamp &rhs); // // arithmetic operators @@ -193,8 +193,8 @@ public: double operator- (const osiTime &rhs) const; // returns seconds osiTime operator+ (const double &rhs) const; // add rhs seconds osiTime operator- (const double &rhs) const; // subtract rhs seconds - osiTime operator+= (const double &rhs); // add rhs seconds - osiTime operator-= (const double &rhs); // subtract rhs seconds + osiTime & operator+= (const double &rhs); // add rhs seconds + osiTime & operator-= (const double &rhs); // subtract rhs seconds // // comparison operators @@ -249,11 +249,8 @@ private: // type osiTime inline member functions // -inline osiTime::osiTime (const TS_STAMP &ts) -{ - this->secPastEpoch = ts.secPastEpoch; - this->nSec = ts.nsec; -} +inline osiTime::osiTime (const TS_STAMP &ts) : + secPastEpoch ( ts.secPastEpoch ), nSec ( ts.nsec ) {} // // getCurrent () @@ -295,13 +292,13 @@ inline osiTime osiTime::operator - (const double &rhs) const return osiTime::operator + (-rhs); } -inline osiTime osiTime::operator += (const double &rhs) +inline osiTime & osiTime::operator += (const double &rhs) { *this = osiTime::operator + (rhs); return *this; } -inline osiTime osiTime::operator -= (const double &rhs) +inline osiTime & osiTime::operator -= (const double &rhs) { *this = osiTime::operator + (-rhs); return *this; @@ -332,24 +329,24 @@ inline bool osiTime::operator > (const osiTime &rhs) const return ! ( *this <= rhs ); } -inline osiTime osiTime::operator = (const tm_nano_sec &rhs) +inline osiTime & osiTime::operator = (const tm_nano_sec &rhs) { return *this = osiTime (rhs); } -inline osiTime osiTime::operator = (const struct timespec &rhs) +inline osiTime & osiTime::operator = (const struct timespec &rhs) { *this = osiTime (rhs); return *this; } -inline osiTime osiTime::operator = (const aitTimeStamp &rhs) +inline osiTime & osiTime::operator = (const aitTimeStamp &rhs) { *this = osiTime (rhs); return *this; } -inline osiTime osiTime::operator = (const TS_STAMP &rhs) +inline osiTime & osiTime::operator = (const TS_STAMP &rhs) { *this = osiTime (rhs); return *this; @@ -364,14 +361,14 @@ inline osiTime::operator TS_STAMP () const } #ifdef NTP_SUPPORT -inline osiTime osiTime::operator = (const ntpTimeStamp &rhs) +inline osiTime & osiTime::operator = (const ntpTimeStamp &rhs) { *this = osiTime (rhs); return *this; } #endif -inline osiTime osiTime::operator = (const time_t_wrapper &rhs) +inline osiTime & osiTime::operator = (const time_t_wrapper &rhs) { *this = osiTime (rhs); return *this;