diff --git a/src/ca/access.cpp b/src/ca/access.cpp index aa27bf0cd..5b7b6fcaf 100644 --- a/src/ca/access.cpp +++ b/src/ca/access.cpp @@ -666,7 +666,7 @@ chid epicsShareAPI ca_evid_to_chid ( evid pMon ) } // extern "C" -int epicsShareAPI ca_pend ( ca_real timeout, int early ) +int epicsShareAPI ca_pend ( ca_real timeout, int early ) // X aCC 361 { if ( early ) { return ca_pend_io ( timeout ); @@ -750,7 +750,7 @@ int epicsShareAPI ca_flush_io () * CA_TEST_IO () */ // extern "C" -int epicsShareAPI ca_test_io () +int epicsShareAPI ca_test_io () // X aCC 361 { oldCAC *pcac; int caStatus = fetchClientContext ( &pcac ); @@ -934,7 +934,7 @@ arrayElementCount epicsShareAPI ca_element_count ( chid pChan ) * ca_state () */ // extern "C" -enum channel_state epicsShareAPI ca_state ( chid pChan ) +enum channel_state epicsShareAPI ca_state ( chid pChan ) // X aCC 361 { if ( pChan->connected() ) { return cs_conn; diff --git a/src/ca/caProto.h b/src/ca/caProto.h index 5dfcac50a..2476ad1aa 100644 --- a/src/ca/caProto.h +++ b/src/ca/caProto.h @@ -81,8 +81,10 @@ * "EPICS_CA_SERVER_PORT" */ #define CA_PORT_BASE IPPORT_USERRESERVED + 56U -#define CA_SERVER_PORT (CA_PORT_BASE+CA_MAJOR_PROTOCOL_REVISION*2u) -#define CA_REPEATER_PORT (CA_PORT_BASE+CA_MAJOR_PROTOCOL_REVISION*2u+1u) +#define CA_SERVER_PORT static_cast \ + (CA_PORT_BASE+CA_MAJOR_PROTOCOL_REVISION*2u) +#define CA_REPEATER_PORT static_cast \ + (CA_PORT_BASE+CA_MAJOR_PROTOCOL_REVISION*2u+1u) /* * 1500 (max of ethernet and 802.{2,3} MTU) - 20(IP) - 8(UDP) * (the MTU of Ethernet is currently independent of its speed varient) diff --git a/src/ca/caServerID.h b/src/ca/caServerID.h index 83e5db2e7..45b4e250e 100644 --- a/src/ca/caServerID.h +++ b/src/ca/caServerID.h @@ -19,7 +19,7 @@ class caServerID { public: - caServerID ( const struct sockaddr_in & addrIn, unsigned priority ); + caServerID ( const struct sockaddr_in & addrIn, unsigned char priority ); bool operator == ( const caServerID & ) const; resTableIndex hash () const; static unsigned maxIndexBitWidth (); @@ -38,7 +38,7 @@ static const unsigned caServerMinIndexBitWidth = 2u; static const unsigned caServerMaxIndexBitWidth = 32u; inline caServerID::caServerID ( - const struct sockaddr_in & addrIn, unsigned priorityIn ) : + const struct sockaddr_in & addrIn, unsigned char priorityIn ) : addr ( addrIn ), pri ( priorityIn ) { assert ( priorityIn <= 0xff ); diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index 2ff481ede..356752991 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -1,5 +1,5 @@ - -/* $Id$ +/* + * $Id$ * * L O S A L A M O S * Los Alamos National Laboratory @@ -749,7 +749,7 @@ bool cac::lookupChannelAndTransferToTCP ( unsigned cid, unsigned sid, const epicsTime & currentTime ) { tcpiiu * pnewiiu = 0; - unsigned retrySeqNumber; + unsigned short retrySeqNumber; if ( addr.sa.sa_family != AF_INET ) { return false; @@ -980,8 +980,9 @@ void cac::writeRequest ( nciu &chan, unsigned type, unsigned nElem, const void * chan.getPIIU()->writeRequest ( chan, type, nElem, pValue ); } -cacChannel::ioid cac::writeNotifyRequest ( nciu &chan, unsigned type, unsigned nElem, - const void *pValue, cacWriteNotify ¬ifyIn ) +cacChannel::ioid +cac::writeNotifyRequest ( nciu &chan, unsigned type, unsigned nElem, // X aCC 361 + const void *pValue, cacWriteNotify ¬ifyIn ) { epicsAutoMutex autoMutex ( this->mutex ); autoPtrRecycle < netWriteNotifyIO > pIO ( this->ioTable, chan.cacPrivateListOfIO::eventq, @@ -999,11 +1000,13 @@ cacChannel::ioid cac::writeNotifyRequest ( nciu &chan, unsigned type, unsigned n } } -cacChannel::ioid cac::readNotifyRequest ( nciu &chan, unsigned type, - unsigned nElem, cacReadNotify ¬ifyIn ) +cacChannel::ioid +cac::readNotifyRequest ( nciu &chan, unsigned type, // X aCC 361 + unsigned nElem, cacReadNotify ¬ifyIn ) { epicsAutoMutex autoMutex ( this->mutex ); - autoPtrRecycle < netReadNotifyIO > pIO ( this->ioTable, chan.cacPrivateListOfIO::eventq, *this, + autoPtrRecycle < netReadNotifyIO > pIO ( this->ioTable, + chan.cacPrivateListOfIO::eventq, *this, netReadNotifyIO::factory ( this->freeListReadNotifyIO, chan, notifyIn ) ); if ( pIO.get() ) { this->ioTable.add ( *pIO ); @@ -1293,12 +1296,16 @@ void cac::recycleSubscription ( netSubscription &io ) this->freeListSubscription.release ( &io, sizeof ( io ) ); } -cacChannel::ioid cac::subscriptionRequest ( nciu &chan, unsigned type, - arrayElementCount nElem, unsigned mask, cacStateNotify ¬ifyIn ) +cacChannel::ioid +cac::subscriptionRequest ( nciu &chan, unsigned type, // X aCC 361 + arrayElementCount nElem, unsigned mask, + cacStateNotify ¬ifyIn ) { epicsAutoMutex autoMutex ( this->mutex ); - autoPtrRecycle < netSubscription > pIO ( this->ioTable, chan.cacPrivateListOfIO::eventq, *this, - netSubscription::factory ( this->freeListSubscription, chan, type, nElem, mask, notifyIn ) ); + autoPtrRecycle < netSubscription > pIO ( this->ioTable, + chan.cacPrivateListOfIO::eventq, *this, + netSubscription::factory ( this->freeListSubscription, + chan, type, nElem, mask, notifyIn ) ); if ( pIO.get() ) { this->ioTable.add ( *pIO ); chan.cacPrivateListOfIO::eventq.add ( *pIO ); diff --git a/src/ca/cac.h b/src/ca/cac.h index 94c2bc423..18128a2e9 100644 --- a/src/ca/cac.h +++ b/src/ca/cac.h @@ -38,7 +38,7 @@ class netSubscription; // used to control access to cac's recycle routines which // should only be indirectly invoked by CAC when its lock // is applied -class cacRecycle { +class cacRecycle { // X aCC 655 public: virtual void recycleReadNotifyIO ( netReadNotifyIO &io ) = 0; virtual void recycleWriteNotifyIO ( netWriteNotifyIO &io ) = 0; diff --git a/src/ca/cacIO.h b/src/ca/cacIO.h index 763dc08f2..9e743e3f9 100644 --- a/src/ca/cacIO.h +++ b/src/ca/cacIO.h @@ -49,7 +49,7 @@ typedef unsigned long arrayElementCount; // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacWriteNotify { +class epicsShareClass cacWriteNotify { // X aCC 655 public: virtual ~cacWriteNotify () = 0; virtual void completion () = 0; @@ -59,7 +59,7 @@ public: // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacReadNotify { +class epicsShareClass cacReadNotify { // X aCC 655 public: virtual ~cacReadNotify () = 0; virtual void completion ( unsigned type, @@ -70,7 +70,7 @@ public: // 1) this should not be passing caerr.h status to the exception callback // 2) needless-to-say the data should be passed here using the new data access API -class epicsShareClass cacStateNotify { +class epicsShareClass cacStateNotify { // X aCC 655 public: virtual ~cacStateNotify () = 0; virtual void current ( unsigned type, @@ -119,12 +119,12 @@ public: // Notes // 1) This interface assumes that when a channel is deleted then all // attached IO is deleted. This is left over from the old interface, -// but perhaps is a bad practce that should be eliminated? If so, +// but perhaps is a bad practice that should be eliminated? If so, // then the IO should not store or use a pointer to the channel. // class epicsShareClass cacChannel { public: - typedef unsigned priLev; + typedef unsigned char priLev; static const priLev priorityMax; static const priLev priorityMin; static const priLev priorityDefault; @@ -159,7 +159,8 @@ public: virtual bool ca_v42_ok () const; // defaults to true virtual bool connected () const; // defaults to true virtual bool previouslyConnected () const; // defaults to true - virtual void hostName ( char *pBuf, unsigned bufLength ) const; // defaults to local host name + virtual void hostName ( + char *pBuf, unsigned bufLength ) const; // defaults to local host name virtual const char * pHostName () const; virtual void notifyStateChangeFirstConnectInCountOfOutstandingIO (); @@ -181,7 +182,7 @@ private: cacChannelNotify & callback; }; -class cacNotify { +class cacNotify { // X aCC 655 public: virtual ~cacNotify () = 0; virtual void exception ( int status, const char *pContext, @@ -195,7 +196,7 @@ public: virtual void attachToClientCtx () = 0; }; -struct cacService : public tsDLNode < cacService > { +class cacService : public tsDLNode < cacService > { // X aCC 655 public: virtual cacChannel * createChannel ( const char *pName, cacChannelNotify &, diff --git a/src/ca/cacServiceList.cpp b/src/ca/cacServiceList.cpp index 71ac62e81..8e956e63f 100644 --- a/src/ca/cacServiceList.cpp +++ b/src/ca/cacServiceList.cpp @@ -1,15 +1,14 @@ - /* * $Id$ - * - * + * + * * L O S A L A M O S * Los Alamos National Laboratory * Los Alamos, New Mexico 87545 - * + * * Copyright, 1986, The Regents of the University of California. - * - * + * + * * Author Jeffrey O. Hill * johill@lanl.gov * 505 665 1831 @@ -56,4 +55,3 @@ void cacServiceList::show ( unsigned level ) const iter++; } } - diff --git a/src/ca/cadef.h b/src/ca/cadef.h index 41ed6dd7b..4a174d29c 100644 --- a/src/ca/cadef.h +++ b/src/ca/cadef.h @@ -242,7 +242,7 @@ epicsShareFunc int epicsShareAPI ca_search_and_connect /* End of anachronistic entry points */ /************************************************************************/ -typedef unsigned capri; +typedef unsigned char capri; #define CA_PRIORITY_MAX 99 #define CA_PRIORITY_MIN 0 #define CA_PRIORITY_DEFAULT CA_PRIORITY_MIN diff --git a/src/ca/casw.cpp b/src/ca/casw.cpp index d411ec8c0..9f3dfd89d 100644 --- a/src/ca/casw.cpp +++ b/src/ca/casw.cpp @@ -62,7 +62,7 @@ int main ( int, char ** ) } osiSockIoctl_t yes = true; - status = socket_ioctl ( sock, FIONBIO, &yes ); + status = socket_ioctl ( sock, FIONBIO, &yes ); // X aCC 392 if ( status < 0 ) { socket_close ( sock ); errlogPrintf ("casw: unable to set socket to nonblocking state because \"%s\"\n", @@ -93,7 +93,7 @@ int main ( int, char ** ) } osiSockIoctl_t no = false; - status = socket_ioctl ( sock, FIONBIO, &no ); + status = socket_ioctl ( sock, FIONBIO, &no ); // X aCC 392 if ( status < 0 ) { socket_close ( sock ); errlogPrintf ("casw: unable to set socket to blocking state because \"%s\"\n", diff --git a/src/ca/comBuf.h b/src/ca/comBuf.h index 32d1ce3b3..ae6caea96 100644 --- a/src/ca/comBuf.h +++ b/src/ca/comBuf.h @@ -29,13 +29,13 @@ static const unsigned comBufSize = 0x4000; -class wireSendAdapter { +class wireSendAdapter { // X aCC 655 public: virtual unsigned sendBytes ( const void *pBuf, unsigned nBytesInBuf ) = 0; }; -class wireRecvAdapter { +class wireRecvAdapter { // X aCC 655 public: virtual unsigned recvBytes ( void *pBuf, unsigned nBytesInBuf ) = 0; @@ -347,8 +347,8 @@ inline comBuf::statusPopUInt16 comBuf::popUInt16 () { statusPopUInt16 tmp; if ( this->occupiedBytes () >= 2u ) { - tmp.val = static_cast < epicsUInt16 > ( this->buf[ this->nextReadIndex++ ] << 8u ); - tmp.val |= static_cast < epicsUInt16 > ( this->buf[ this->nextReadIndex++ ] << 0u ); + tmp.val = static_cast < epicsUInt16 > ( this->buf[ this->nextReadIndex++ ] << 8u + | this->buf[ this->nextReadIndex++ ] << 0u ); tmp.success = true; } else { diff --git a/src/ca/comQueRecv.cpp b/src/ca/comQueRecv.cpp index a88c6cda8..754bef8d1 100644 --- a/src/ca/comQueRecv.cpp +++ b/src/ca/comQueRecv.cpp @@ -115,6 +115,7 @@ epicsUInt8 comQueRecv::popUInt8 () return tmp; } throw insufficentBytesAvailable (); + return 0; // make compiler happy } // optimization here complicates this function somewhat @@ -135,12 +136,13 @@ epicsUInt16 comQueRecv::popUInt16 () } else { // split between buffers runs slower - tmp = this->popUInt8() << 8u; - tmp |= this->popUInt8() << 0u; + tmp = this->popUInt8() << 8u; // X aCC 818 + tmp |= this->popUInt8() << 0u; // X aCC 818 } return tmp; } throw insufficentBytesAvailable (); + return 0; // make compiler happy } // optimization here complicates this function somewhat @@ -169,4 +171,5 @@ epicsUInt32 comQueRecv::popUInt32 () return tmp; } throw insufficentBytesAvailable (); + return 0; // make compiler happy } diff --git a/src/ca/comQueRecv.h b/src/ca/comQueRecv.h index 9b006b809..23cf5e9b2 100644 --- a/src/ca/comQueRecv.h +++ b/src/ca/comQueRecv.h @@ -54,16 +54,14 @@ inline epicsInt8 comQueRecv::popInt8 () inline epicsInt16 comQueRecv::popInt16 () { - epicsInt16 tmp; - tmp = static_cast < epicsInt16 > ( this->popInt8() << 8u ); - tmp |= static_cast < epicsInt16 > ( this->popInt8() << 0u ); - return tmp; + return static_cast < epicsInt16 > ( this->popInt8() << 8u + | this->popInt8() << 0u ); } inline epicsInt32 comQueRecv::popInt32 () { epicsInt32 tmp ; - tmp |= this->popInt8() << 24u; + tmp = this->popInt8() << 24u; tmp |= this->popInt8() << 16u; tmp |= this->popInt8() << 8u; tmp |= this->popInt8() << 0u; diff --git a/src/ca/iocinf.cpp b/src/ca/iocinf.cpp index 0e49f4e8a..301fdefe0 100644 --- a/src/ca/iocinf.cpp +++ b/src/ca/iocinf.cpp @@ -51,12 +51,8 @@ static char *getToken ( const char **ppString, char *pBuf, unsigned bufSIze ) *ppString = &pToken[i]; - if(*pToken){ - return pBuf; - } - else{ - return NULL; - } + if ( *pToken ) return pBuf; + return NULL; } /* @@ -118,7 +114,7 @@ extern "C" void epicsShareAPI removeDuplicatesAddresses if ( pNode->addr.sa.sa_family == AF_INET ) { - pTmpNode = (osiSockAddrNode *) ellFirst (pDestList); + pTmpNode = (osiSockAddrNode *) ellFirst (pDestList); // X aCC 749 while ( pTmpNode ) { if (pTmpNode->addr.sa.sa_family == AF_INET) { unsigned netMask = pNode->netMask.ia.sin_addr.s_addr | @@ -134,7 +130,7 @@ extern "C" void epicsShareAPI removeDuplicatesAddresses break; } } - pTmpNode = (osiSockAddrNode *) ellNext (&pTmpNode->node); + pTmpNode = (osiSockAddrNode *) ellNext (&pTmpNode->node); // X aCC 749 } if (pNode) { ellAdd (pDestList, &pNode->node); @@ -153,12 +149,12 @@ static void forcePort ( ELLLIST *pList, unsigned short port ) { osiSockAddrNode *pNode; - pNode = ( osiSockAddrNode * ) ellFirst ( pList ); + pNode = ( osiSockAddrNode * ) ellFirst ( pList ); // X aCC 749 while ( pNode ) { if ( pNode->addr.sa.sa_family == AF_INET ) { pNode->addr.ia.sin_port = htons (port); } - pNode = ( osiSockAddrNode * ) ellNext ( &pNode->node ); + pNode = ( osiSockAddrNode * ) ellNext ( &pNode->node ); // X aCC 749 } } @@ -177,9 +173,9 @@ extern "C" void epicsShareAPI configureChannelAccessAddressList /* * dont load the list twice */ - assert ( ellCount (pList) == 0 ); + assert ( ellCount (pList) == 0 ); // X aCC 392 - ellInit ( &tmpList ); + ellInit ( &tmpList ); // X aCC 392 /* * Check to see if the user has disabled @@ -203,7 +199,7 @@ extern "C" void epicsShareAPI configureChannelAccessAddressList osiSockAddr addr; addr.ia.sin_family = AF_UNSPEC; osiSockDiscoverBroadcastAddresses ( &tmpList, sock, &addr ); - if ( ellCount ( &tmpList ) == 0 ) { + if ( ellCount ( &tmpList ) == 0 ) { // X aCC 392 osiSockAddrNode *pNewNode; pNewNode = (osiSockAddrNode *) calloc ( 1, sizeof (*pNewNode) ); if ( pNewNode ) { @@ -239,11 +235,11 @@ extern "C" void epicsShareAPI printChannelAccessAddressList ( const ELLLIST *pLi osiSockAddrNode *pNode; ::printf ( "Channel Access Address List\n" ); - pNode = (osiSockAddrNode *) ellFirst ( pList ); + pNode = (osiSockAddrNode *) ellFirst ( pList ); // X aCC 749 while (pNode) { char buf[64]; ipAddrToA ( &pNode->addr.ia, buf, sizeof ( buf ) ); ::printf ( "%s\n", buf ); - pNode = (osiSockAddrNode *) ellNext ( &pNode->node ); + pNode = (osiSockAddrNode *) ellNext ( &pNode->node ); // X aCC 749 } } diff --git a/src/ca/nciu.cpp b/src/ca/nciu.cpp index 0543b51ec..a5729068e 100644 --- a/src/ca/nciu.cpp +++ b/src/ca/nciu.cpp @@ -56,7 +56,7 @@ nciu::nciu ( cac & cacIn, netiiu & iiuIn, cacChannelNotify & chanIn, count ( 0 ), retry ( 0u ), retrySeqNo ( 0u ), - nameLength ( strlen ( pNameIn ) + 1 ), + nameLength ( static_cast ( strlen ( pNameIn ) + 1 ) ), typeCode ( USHRT_MAX ), priority ( pri ), f_connected ( false ), diff --git a/src/ca/nciu.h b/src/ca/nciu.h index faa6de12d..0ae7e17c3 100644 --- a/src/ca/nciu.h +++ b/src/ca/nciu.h @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -57,7 +56,7 @@ public: void * operator new ( size_t size ); void operator delete ( void *pCadaver, size_t size ); void resetRetryCount (); - unsigned getRetrySeqNo () const; + unsigned short getRetrySeqNo () const; void accessRightsStateChange ( const caAccessRights & ); ca_uint32_t getSID () const; ca_uint32_t getCID () const; @@ -84,18 +83,18 @@ private: cac & cacCtx; char * pNameStr; netiiu * piiu; - ca_uint32_t sid; // server id + ca_uint32_t sid; // server id unsigned count; - unsigned retry; // search retry number + unsigned retry; // search retry number ca_uint16_t retrySeqNo; // search retry seq number ca_uint16_t nameLength; // channel name length ca_uint16_t typeCode; ca_uint8_t priority; - unsigned f_connected:1; - unsigned f_previousConn:1; // T if connected in the past - unsigned f_claimSent:1; - unsigned f_firstConnectDecrementsOutstandingIO:1; - unsigned f_connectTimeOutSeen:1; + bool f_connected:1; + bool f_previousConn:1; // T if connected in the past + bool f_claimSent:1; + bool f_firstConnectDecrementsOutstandingIO:1; + bool f_connectTimeOutSeen:1; void initiateConnect (); ioStatus read ( unsigned type, arrayElementCount count, cacReadNotify &, ioid * ); @@ -156,7 +155,7 @@ inline ca_uint32_t nciu::getCID () const return this->id; } -inline unsigned nciu::getRetrySeqNo () const +inline unsigned short nciu::getRetrySeqNo () const { return this->retrySeqNo; } diff --git a/src/ca/netIO.h b/src/ca/netIO.h index 6cc1a29bc..fa91bbaf8 100644 --- a/src/ca/netIO.h +++ b/src/ca/netIO.h @@ -174,7 +174,7 @@ inline netSubscription * netSubscription::factory ( count, mask, notify ); } -inline arrayElementCount netSubscription::getCount () const +inline arrayElementCount netSubscription::getCount () const // X aCC 361 { arrayElementCount nativeCount = this->chan.nativeElementCount (); if ( this->count == 0u || this->count > nativeCount ) { diff --git a/src/ca/netiiu.h b/src/ca/netiiu.h index abba55243..6f95df38b 100644 --- a/src/ca/netiiu.h +++ b/src/ca/netiiu.h @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -68,7 +67,7 @@ private: virtual void lastChannelDetachNotify (); }; -class limboiiu : public netiiu { +class limboiiu : public netiiu { // X aCC 655 public: limboiiu (); }; diff --git a/src/ca/oldCAC.cpp b/src/ca/oldCAC.cpp index b9c6fa17c..eac397f04 100644 --- a/src/ca/oldCAC.cpp +++ b/src/ca/oldCAC.cpp @@ -79,7 +79,7 @@ int oldCAC::printf ( const char *pformat, ... ) const return status; } -int oldCAC::vPrintf ( const char *pformat, va_list args ) const +int oldCAC::vPrintf ( const char *pformat, va_list args ) const // X aCC 361 { caPrintfFunc *pFunc; { diff --git a/src/ca/oldChannelNotify.cpp b/src/ca/oldChannelNotify.cpp index 4c853b3e2..2be828334 100644 --- a/src/ca/oldChannelNotify.cpp +++ b/src/ca/oldChannelNotify.cpp @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -44,7 +43,7 @@ extern "C" void cacNoopAccesRightsHandler ( struct access_rights_handler_args ) } oldChannelNotify::oldChannelNotify ( oldCAC & cacIn, const char *pName, - caCh * pConnCallBackIn, void * pPrivateIn, capri priority ) : + caCh * pConnCallBackIn, void * pPrivateIn, capri priority ) : io ( cacIn.createChannel ( pName, *this, priority ) ), cacCtx ( cacIn ), pConnCallBack ( pConnCallBackIn ? pConnCallBackIn : cacNoopConnHandler ), diff --git a/src/ca/repeater.cpp b/src/ca/repeater.cpp index fd522d1e4..5071ae49f 100644 --- a/src/ca/repeater.cpp +++ b/src/ca/repeater.cpp @@ -1,7 +1,7 @@ /* * $Id$ * - * REPEATER.C + * REPEATER.cpp * * CA broadcast repeater * @@ -89,7 +89,7 @@ protected: private: osiSockAddr from; SOCKET sock; - unsigned port () const; + unsigned short port () const; static tsFreeList < class repeaterClient, 0x20 > freeList; static epicsMutex freeListMutex; }; @@ -150,7 +150,9 @@ LOCAL makeSocketReturn makeSocket ( unsigned short port, bool reuseAddr ) bd.sin_family = AF_INET; bd.sin_addr.s_addr = htonl (INADDR_ANY); bd.sin_port = htons (port); - status = bind (msr.sock, (struct sockaddr *)&bd, (int)sizeof(bd)); + status = bind (msr.sock, + reinterpret_cast (&bd), + (int)sizeof(bd)); if ( status < 0 ) { msr.errNumber = SOCKERRNO; msr.pErrStr = SOCKERRSTR ( msr.errNumber ); @@ -207,7 +209,7 @@ bool repeaterClient::connect () return true; } -bool repeaterClient::sendConfirm () +bool repeaterClient::sendConfirm () // X aCC 361 { int status; @@ -231,7 +233,7 @@ bool repeaterClient::sendConfirm () } } -bool repeaterClient::sendMessage ( const void *pBuf, unsigned bufSize ) +bool repeaterClient::sendMessage ( const void *pBuf, unsigned bufSize ) // X aCC 361 { int status; @@ -278,7 +280,7 @@ inline void repeaterClient::destroy () delete this; } -inline unsigned repeaterClient::port () const +inline unsigned short repeaterClient::port () const { return ntohs ( this->from.ia.sin_port ); } @@ -305,7 +307,7 @@ inline bool repeaterClient::identicalPort ( const osiSockAddr &fromIn ) return false; } -bool repeaterClient::verify () +bool repeaterClient::verify () // X aCC 361 { makeSocketReturn msr; msr = makeSocket ( this->port (), false ); diff --git a/src/ca/repeaterSubscribeTimer.cpp b/src/ca/repeaterSubscribeTimer.cpp index 1df81c159..c00bea78f 100644 --- a/src/ca/repeaterSubscribeTimer.cpp +++ b/src/ca/repeaterSubscribeTimer.cpp @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -34,7 +33,7 @@ repeaterSubscribeTimer::~repeaterSubscribeTimer () } epicsTimerNotify::expireStatus repeaterSubscribeTimer:: - expire ( const epicsTime & /* currentTime */ ) + expire ( const epicsTime & /* currentTime */ ) // X aCC 361 { static const unsigned nTriesToMsg = 50; if ( this->attempts > nTriesToMsg && ! this->once ) { diff --git a/src/ca/searchTimer.cpp b/src/ca/searchTimer.cpp index 64be9b9d2..0af60ef3d 100644 --- a/src/ca/searchTimer.cpp +++ b/src/ca/searchTimer.cpp @@ -1,5 +1,5 @@ - -/* * $Id$ +/* + * $Id$ * * L O S A L A M O S * Los Alamos National Laboratory @@ -195,7 +195,7 @@ void searchTimer::notifySearchResponse ( unsigned short retrySeqNoIn, // // searchTimer::expire () // -epicsTimerNotify::expireStatus searchTimer::expire ( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus searchTimer::expire ( const epicsTime & currentTime ) // X aCC 361 { epicsAutoMutex locker ( this->mutex ); unsigned nFrameSent = 0u; @@ -218,7 +218,7 @@ epicsTimerNotify::expireStatus searchTimer::expire ( const epicsTime & currentTi /* * increment the retry sequence number */ - this->retrySeqNo++; /* allowed to roll over */ + this->retrySeqNo++; /* allowed to roll over */ // X aCC 818 this->timeAtLastRetry = currentTime; /* @@ -296,7 +296,7 @@ epicsTimerNotify::expireStatus searchTimer::expire ( const epicsTime & currentTi this->searchAttempts = 0; this->searchResponses = 0; - while ( 1 ) { + while ( true ) { /* * clear counter when we reach the end of the list @@ -320,7 +320,7 @@ epicsTimerNotify::expireStatus searchTimer::expire ( const epicsTime & currentTi * we are handling a response from an old * search message) */ - this->retrySeqNo++; /* allowed to roll over */ + this->retrySeqNo++; /* allowed to roll over */ // X aCC 818 /* * so that old search tries will not update the counters diff --git a/src/ca/syncGroup.h b/src/ca/syncGroup.h index 2639b9823..a9e7fbaf6 100644 --- a/src/ca/syncGroup.h +++ b/src/ca/syncGroup.h @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -33,7 +32,7 @@ static const unsigned CASG_MAGIC = 0xFAB4CAFE; // used to control access to CASG's recycle routines which // should only be indirectly invoked by CASG when its lock // is applied -class casgRecycle { +class casgRecycle { // X aCC 655 public: virtual void recycleSyncGroupWriteNotify ( class syncGroupWriteNotify & io ) = 0; virtual void recycleSyncGroupReadNotify ( class syncGroupReadNotify & io ) = 0; diff --git a/src/ca/syncgrp.cpp b/src/ca/syncgrp.cpp index a8e1ed3b0..0a8b5c15f 100644 --- a/src/ca/syncgrp.cpp +++ b/src/ca/syncgrp.cpp @@ -38,7 +38,7 @@ /* * ca_sg_create() */ -extern "C" int epicsShareAPI ca_sg_create ( CA_SYNC_GID *pgid ) +extern "C" int epicsShareAPI ca_sg_create ( CA_SYNC_GID *pgid ) // X aCC 361 { oldCAC *pcac; int caStatus; @@ -161,7 +161,7 @@ extern "C" int epicsShareAPI ca_sg_stat ( const CA_SYNC_GID gid ) /* * ca_sg_test */ -extern "C" int epicsShareAPI ca_sg_test ( const CA_SYNC_GID gid ) +extern "C" int epicsShareAPI ca_sg_test ( const CA_SYNC_GID gid ) // X aCC 361 { oldCAC *pcac; CASG *pcasg; diff --git a/src/ca/tcpRecvWatchdog.cpp b/src/ca/tcpRecvWatchdog.cpp index d8dfd333a..873889c08 100644 --- a/src/ca/tcpRecvWatchdog.cpp +++ b/src/ca/tcpRecvWatchdog.cpp @@ -1,5 +1,5 @@ - -/* * $Id$ +/* + * $Id$ * * L O S A L A M O S * Los Alamos National Laboratory @@ -31,14 +31,16 @@ tcpRecvWatchdog::~tcpRecvWatchdog () this->timer.destroy (); } -epicsTimerNotify::expireStatus tcpRecvWatchdog::expire ( const epicsTime & /* currentTime */ ) +epicsTimerNotify::expireStatus +tcpRecvWatchdog::expire ( const epicsTime & /* currentTime */ ) // X aCC 361 { if ( this->responsePending ) { this->cancel (); # ifdef DEBUG char hostName[128]; this->iiu.hostName ( hostName, sizeof (hostName) ); - debugPrintf ( ( "CA server \"%s\" unresponsive after %g inactive sec - disconnecting.\n", + debugPrintf ( ( "CA server \"%s\" unresponsive after %g inactive sec" + "- disconnecting.\n", hostName, this->period ) ); # endif this->iiu.forcedShutdown (); diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index 5b56c0ea1..e9b545e46 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -329,7 +329,8 @@ extern "C" void cacRecvThreadTCP ( void *pParam ) { int status; osiSockIoctl_t bytesPending = 0; - status = socket_ioctl ( piiu->sock, FIONREAD, & bytesPending ); + status = socket_ioctl ( piiu->sock, // X aCC 392 + FIONREAD, & bytesPending ); if ( status || bytesPending == 0u ) { break; } @@ -757,7 +758,7 @@ void tcpiiu::show ( unsigned level ) const } } -bool tcpiiu::setEchoRequestPending () +bool tcpiiu::setEchoRequestPending () // X aCC 361 { { epicsAutoMutex locker ( this->pCAC()->mutexRef() ); @@ -878,6 +879,7 @@ bool tcpiiu::processIncoming () this->msgHeaderAvailable = false; this->curDataBytes = 0u; } + return false; // to make compiler happy... } inline void insertRequestHeader ( @@ -962,7 +964,7 @@ void tcpiiu::userNameSetRequest () epicsAutoMutex locker ( this->pCAC()->mutexRef() ); this->sendQue.beginMsg (); this->sendQue.pushUInt16 ( CA_PROTO_CLIENT_NAME ); // cmd - this->sendQue.pushUInt16 ( postSize ); // postsize + this->sendQue.pushUInt16 ( static_cast ( postSize ) ); // postsize this->sendQue.pushUInt16 ( 0u ); // dataType this->sendQue.pushUInt16 ( 0u ); // count this->sendQue.pushUInt32 ( 0u ); // cid @@ -1171,7 +1173,7 @@ void tcpiiu::createChannelRequest ( nciu &chan ) this->sendQue.beginMsg (); this->sendQue.pushUInt16 ( CA_PROTO_CLAIM_CIU ); // cmd - this->sendQue.pushUInt16 ( postCnt ); // postsize + this->sendQue.pushUInt16 ( static_cast < epicsUInt16 > ( postCnt ) ); // postsize this->sendQue.pushUInt16 ( 0u ); // dataType this->sendQue.pushUInt16 ( 0u ); // count this->sendQue.pushUInt32 ( identity ); // cid @@ -1310,6 +1312,7 @@ bool tcpiiu::flush () return false; } } + return false; // to make compiler happy... } // ~tcpiiu() will not return while this->blockingForFlush is greater than zero diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index 86e6045db..85efb09c5 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -1,5 +1,5 @@ - -/* $Id$ +/* + * $Id$ * * L O S A L A M O S * Los Alamos National Laboratory @@ -105,7 +105,7 @@ udpiiu::udpiiu ( cac &cac ) : memset ( (char *)&addr, 0 , sizeof (addr) ); addr.ia.sin_family = AF_INET; addr.ia.sin_addr.s_addr = htonl (INADDR_ANY); - addr.ia.sin_port = htons (PORT_ANY); + addr.ia.sin_port = htons (PORT_ANY); // X aCC 818 status = bind (this->sock, &addr.sa, sizeof (addr) ); if ( status < 0 ) { socket_close (this->sock); @@ -143,9 +143,9 @@ udpiiu::udpiiu ( cac &cac ) : * load user and auto configured * broadcast address list */ - ellInit ( &this->dest ); + ellInit ( &this->dest ); // X aCC 392 configureChannelAccessAddressList ( &this->dest, this->sock, this->serverPort ); - if ( ellCount ( &this->dest ) == 0 ) { + if ( ellCount ( &this->dest ) == 0 ) { // X aCC 392 // no need to lock callbacks here because // 1) this is called while in a CA client function // 2) no auxiliary threads are running at this point @@ -336,20 +336,20 @@ void epicsShareAPI caRepeaterRegistrationMessage ( */ saddr.ia.sin_family = AF_INET; saddr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK ); - saddr.ia.sin_port = htons ( repeaterPort ); + saddr.ia.sin_port = static_cast ( htons ( repeaterPort ) ); } else { - saddr.ia.sin_port = htons ( repeaterPort ); + saddr.ia.sin_port = static_cast ( htons ( repeaterPort ) ); } } else { saddr.ia.sin_family = AF_INET; saddr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK ); - saddr.ia.sin_port = htons ( repeaterPort ); + saddr.ia.sin_port = static_cast ( htons ( repeaterPort ) ); } memset ( (char *) &msg, 0, sizeof (msg) ); - msg.m_cmmd = htons ( REPEATER_REGISTER ); + msg.m_cmmd = static_cast ( htons ( REPEATER_REGISTER ) ); msg.m_available = saddr.ia.sin_addr.s_addr; /* @@ -365,8 +365,9 @@ void epicsShareAPI caRepeaterRegistrationMessage ( len = 0; # endif - status = sendto ( sock, (char *) &msg, len, - 0, (struct sockaddr *) &saddr, sizeof ( saddr ) ); + status = sendto ( sock, (char *) &msg, len, 0, + reinterpret_cast (&saddr), + sizeof ( saddr ) ); if ( status < 0 ) { int errnoCpy = SOCKERRNO; /* @@ -430,7 +431,9 @@ void epicsShareAPI caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) bd.sin_family = AF_INET; bd.sin_addr.s_addr = htonl ( INADDR_ANY ); bd.sin_port = htons ( port ); - status = bind ( tmpSock, (struct sockaddr *) &bd, sizeof ( bd ) ); + status = bind ( tmpSock, + reinterpret_cast (&bd), + sizeof ( bd ) ); if ( status < 0 ) { if ( SOCKERRNO == SOCK_EADDRINUSE ) { installed = true; @@ -510,8 +513,8 @@ bool udpiiu::noopAction ( const caHdr &, const osiSockAddr &, const epicsTime & return true; } -bool udpiiu::searchRespAction ( const caHdr &msg, - const osiSockAddr &addr, const epicsTime ¤tTime ) +bool udpiiu::searchRespAction ( const caHdr &msg, // X aCC 361 + const osiSockAddr &addr, const epicsTime ¤tTime ) { osiSockAddr serverAddr; unsigned minorVersion; @@ -734,7 +737,7 @@ bool udpiiu::pushDatagramMsg ( const caHdr &msg, const void *pExt, ca_uint16_t e ca_uint16_t allignedExtSize; caHdr *pbufmsg; - allignedExtSize = CA_MESSAGE_ALIGN ( extsize ); + allignedExtSize = static_cast (CA_MESSAGE_ALIGN ( extsize )); msgsize = sizeof ( caHdr ) + allignedExtSize; @@ -768,7 +771,7 @@ void udpiiu::datagramFlush () return; } - pNode = (osiSockAddrNode *) ellFirst ( &this->dest ); + pNode = (osiSockAddrNode *) ellFirst ( &this->dest ); // X aCC 749 while ( pNode ) { int status; @@ -813,7 +816,7 @@ void udpiiu::datagramFlush () } } } - pNode = (osiSockAddrNode *) ellNext ( &pNode->node ); + pNode = (osiSockAddrNode *) ellNext ( &pNode->node ); // X aCC 749 } this->nBytesInXmitBuf = 0u; diff --git a/src/ca/virtualCircuit.h b/src/ca/virtualCircuit.h index 3923ad026..f689f1ee2 100644 --- a/src/ca/virtualCircuit.h +++ b/src/ca/virtualCircuit.h @@ -1,4 +1,3 @@ - /* * $Id$ * @@ -162,7 +161,7 @@ inline bool tcpiiu::ca_v49_ok () const return CA_V49 ( this->minorProtocolVersion ); } -inline bool tcpiiu::alive () const +inline bool tcpiiu::alive () const // X aCC 361 { if ( this->state == iiu_connecting || this->state == iiu_connected ) {