diff --git a/src/ca/comBuf.h b/src/ca/comBuf.h index fdc238d34..67b8ceb4a 100644 --- a/src/ca/comBuf.h +++ b/src/ca/comBuf.h @@ -348,7 +348,7 @@ inline comBuf::statusPopUInt16 comBuf::popUInt16 () if ( this->occupiedBytes () >= 2u ) { unsigned byte1 = this->buf[ this->nextReadIndex++ ]; unsigned byte2 = this->buf[ this->nextReadIndex++ ]; - tmp.val = static_cast < epicsUInt16 > ( byte1 << 8u | byte2 ); + tmp.val = static_cast < epicsUInt16 > ( byte1 << 8u | byte2 ); tmp.success = true; } else { @@ -362,14 +362,12 @@ inline comBuf::statusPopUInt32 comBuf::popUInt32 () { statusPopUInt32 tmp; if ( this->occupiedBytes () >= 4u ) { - unsigned tmpByte = this->buf[ this->nextReadIndex++ ]; - tmp.val = static_cast < epicsUInt32 > ( tmpByte << 24u ); - tmpByte = this->buf[ this->nextReadIndex++ ]; - tmp.val |= static_cast < epicsUInt32 > ( tmpByte << 16u ); - tmpByte = this->buf[ this->nextReadIndex++ ]; - tmp.val |= static_cast < epicsUInt32 > ( tmpByte << 8u ); - tmpByte = this->buf[ this->nextReadIndex++ ]; - tmp.val |= static_cast < epicsUInt32 > ( tmpByte ); + unsigned byte1 = this->buf[ this->nextReadIndex++ ]; + unsigned byte2 = this->buf[ this->nextReadIndex++ ]; + unsigned byte3 = this->buf[ this->nextReadIndex++ ]; + unsigned byte4 = this->buf[ this->nextReadIndex++ ]; + tmp.val = static_cast < epicsUInt32 > + ( byte1 << 24u | byte2 << 16u | byte3 << 8u | byte4 ); //X aCC 392 tmp.success = true; } else { diff --git a/src/ca/comQueRecv.cpp b/src/ca/comQueRecv.cpp index 29d678f72..9a97af19c 100644 --- a/src/ca/comQueRecv.cpp +++ b/src/ca/comQueRecv.cpp @@ -135,10 +135,9 @@ epicsUInt16 comQueRecv::popUInt16 () // 1) split between buffers expected to run slower // 2) using canonical unsigned tmp avoids ANSI C conversions to int // 3) cast required because sizeof(unsigned) >= sizeof(epicsUInt32) - unsigned tmp = this->popUInt8(); - ret.val = static_cast ( tmp << 8u ); // X aCC 818 - tmp = this->popUInt8(); - ret.val |= static_cast ( tmp << 0u ); // X aCC 818 + unsigned byte1 = this->popUInt8(); + unsigned byte2 = this->popUInt8(); + ret.val = static_cast ( byte1 << 8u | byte2 ); } return ret.val; } @@ -164,14 +163,12 @@ epicsUInt32 comQueRecv::popUInt32 () // 1) split between buffers expected to run slower // 2) using canonical unsigned tmp avoids ANSI C conversions to int // 3) cast required because sizeof(unsigned) >= sizeof(epicsUInt32) - unsigned tmp = this->popUInt8(); - ret.val = static_cast ( tmp << 24u ); - tmp = this->popUInt8(); - ret.val |= static_cast ( tmp << 16u ); - tmp = this->popUInt8(); - ret.val |= static_cast ( tmp << 8u ); - tmp = this->popUInt8(); - ret.val |= static_cast ( tmp << 0u ); + unsigned byte1 = this->popUInt8(); + unsigned byte2 = this->popUInt8(); + unsigned byte3 = this->popUInt8(); + unsigned byte4 = this->popUInt8(); + ret.val = static_cast + ( byte1 << 24u | byte2 << 16u | byte3 << 8u | byte4 ); //X aCC 392 } return ret.val; } diff --git a/src/cas/example/directoryService/directoryServer.h b/src/cas/example/directoryService/directoryServer.h index 8b6892740..369629306 100644 --- a/src/cas/example/directoryService/directoryServer.h +++ b/src/cas/example/directoryService/directoryServer.h @@ -65,7 +65,8 @@ private: // for this breaking out into a seperate class // from pvInfo) // -class pvEntry : public stringId, public tsSLNode { +class pvEntry // X aCC 655 + : public stringId, public tsSLNode { public: pvEntry (const pvInfo &infoIn, directoryServer &casIn, const char *pAliasName) : diff --git a/src/cas/example/directoryService/main.cc b/src/cas/example/directoryService/main.cc index 90fd63e84..1113056c4 100644 --- a/src/cas/example/directoryService/main.cc +++ b/src/cas/example/directoryService/main.cc @@ -196,4 +196,5 @@ LOCAL int parseDirectoryFP (FILE *pf, const char *pFileName) } nPV++; } + return 0; // Make compiler happy } diff --git a/src/cas/example/simple/exPV.cc b/src/cas/example/simple/exPV.cc index 86d10e4b7..c01adc5d9 100644 --- a/src/cas/example/simple/exPV.cc +++ b/src/cas/example/simple/exPV.cc @@ -112,7 +112,8 @@ caStatus exPV::update(smartConstGDDPointer pValueIn) // // exScanTimer::expire () // -epicsTimerNotify::expireStatus exPV::expire ( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus +exPV::expire ( const epicsTime & /*currentTime*/ ) // X aCC 361 { this->scan(); if ( this->scanOn ) { diff --git a/src/cas/example/simple/exServer.cc b/src/cas/example/simple/exServer.cc index 28ff02df9..a099555bd 100644 --- a/src/cas/example/simple/exServer.cc +++ b/src/cas/example/simple/exServer.cc @@ -139,7 +139,7 @@ void exServer::installAliasName(pvInfo &info, const char *pAliasName) // // exServer::pvExistTest() // -pvExistReturn exServer::pvExistTest +pvExistReturn exServer::pvExistTest // X aCC 361 (const casCtx& ctxIn, const char *pPVName) { // @@ -185,7 +185,7 @@ pvExistReturn exServer::pvExistTest // // exServer::pvAttach() // -pvAttachReturn exServer::pvAttach +pvAttachReturn exServer::pvAttach // X aCC 361 (const casCtx &ctx, const char *pName) { // @@ -238,7 +238,8 @@ pvAttachReturn exServer::pvAttach // // pvInfo::createPV() // -exPV *pvInfo::createPV ( exServer &cas, bool preCreateFlag, bool scanOn ) +exPV *pvInfo::createPV ( exServer & /*cas*/, + bool preCreateFlag, bool scanOn ) { if (this->pPV) { return this->pPV; @@ -331,7 +332,7 @@ exAsyncExistIO::~exAsyncExistIO() // exAsyncExistIO::expire() // (a virtual function that runs when the base timer expires) // -epicsTimerNotify::expireStatus exAsyncExistIO::expire ( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus exAsyncExistIO::expire ( const epicsTime & /*currentTime*/ ) { // // post IO completion @@ -366,7 +367,7 @@ exAsyncCreateIO::~exAsyncCreateIO() // exAsyncCreateIO::expire() // (a virtual function that runs when the base timer expires) // -epicsTimerNotify::expireStatus exAsyncCreateIO::expire ( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus exAsyncCreateIO::expire ( const epicsTime & /*currentTime*/ ) { exPV *pPV; diff --git a/src/cas/example/simple/exServer.h b/src/cas/example/simple/exServer.h index be6203672..b6f5ff933 100644 --- a/src/cas/example/simple/exServer.h +++ b/src/cas/example/simple/exServer.h @@ -110,7 +110,8 @@ private: // for this breaking out into a seperate class // from pvInfo) // -class pvEntry : public stringId, public tsSLNode { +class pvEntry // X aCC 655 + : public stringId, public tsSLNode { public: pvEntry (pvInfo &infoIn, exServer &casIn, const char *pAliasName) : diff --git a/src/cas/example/simple/exVectorPV.cc b/src/cas/example/simple/exVectorPV.cc index 648c17aab..91c01f449 100644 --- a/src/cas/example/simple/exVectorPV.cc +++ b/src/cas/example/simple/exVectorPV.cc @@ -36,7 +36,7 @@ unsigned exVectorPV::maxDimension() const // // exVectorPV::maxBound() // -aitIndex exVectorPV::maxBound (unsigned dimension) const +aitIndex exVectorPV::maxBound (unsigned dimension) const // X aCC 361 { if (dimension==0u) { return this->info.getElementCount(); diff --git a/src/cas/generic/caNetAddr.h b/src/cas/generic/caNetAddr.h index e768e74fc..cbb7696b2 100644 --- a/src/cas/generic/caNetAddr.h +++ b/src/cas/generic/caNetAddr.h @@ -57,7 +57,7 @@ public: return this->type != casnaUDF; } - inline bool operator == (const caNetAddr &rhs) const + inline bool operator == (const caNetAddr &rhs) const // X aCC 361 { if (this->type != rhs.type) { return false; @@ -125,7 +125,7 @@ public: assert (sock.sa_family == AF_INET); this->type = casnaInet; const struct sockaddr_in *psip = - (const struct sockaddr_in *) &sock; + reinterpret_cast (&sock); this->addr.ip = *psip; } @@ -156,7 +156,8 @@ public: { struct sockaddr sa; assert (this->type==casnaInet); - struct sockaddr_in *psain = (struct sockaddr_in *) &sa; + struct sockaddr_in *psain = + reinterpret_cast (&sa); *psain = this->addr.ip; return sa; diff --git a/src/cas/generic/caServer.cc b/src/cas/generic/caServer.cc index 893853a36..79b0e16eb 100644 --- a/src/cas/generic/caServer.cc +++ b/src/cas/generic/caServer.cc @@ -95,7 +95,7 @@ epicsShareFunc pvAttachReturn caServer::pvAttach (const casCtx &ctx, const char // // caServer::registerEvent() // -epicsShareFunc casEventMask caServer::registerEvent (const char *pName) +epicsShareFunc casEventMask caServer::registerEvent (const char *pName) // X aCC 361 { if (this->pCAS) { return this->pCAS->registerEvent(pName); @@ -136,7 +136,7 @@ epicsShareFunc void caServer::setDebugLevel (unsigned level) // // caServer::getDebugLevel() // -epicsShareFunc unsigned caServer::getDebugLevel () const +epicsShareFunc unsigned caServer::getDebugLevel () const // X aCC 361 { if (pCAS) { return this->pCAS->getDebugLevel(); @@ -150,7 +150,7 @@ epicsShareFunc unsigned caServer::getDebugLevel () const // // caServer::valueEventMask () // -epicsShareFunc casEventMask caServer::valueEventMask () const +epicsShareFunc casEventMask caServer::valueEventMask () const // X aCC 361 { if (pCAS) { return this->pCAS->valueEventMask(); @@ -164,7 +164,7 @@ epicsShareFunc casEventMask caServer::valueEventMask () const // // caServer::logEventMask () // -epicsShareFunc casEventMask caServer::logEventMask () const +epicsShareFunc casEventMask caServer::logEventMask () const // X aCC 361 { if (pCAS) { return this->pCAS->logEventMask(); @@ -178,7 +178,7 @@ epicsShareFunc casEventMask caServer::logEventMask () const // // caServer::alarmEventMask () // -epicsShareFunc casEventMask caServer::alarmEventMask () const +epicsShareFunc casEventMask caServer::alarmEventMask () const // X aCC 361 { if (pCAS) { return this->pCAS->alarmEventMask(); @@ -201,7 +201,7 @@ class epicsTimer & caServer::createTimer () // caServer::readEventsProcessedCounter // #ifdef CAS_DIAGNOSTICS_API_WHICH_MAY_VANISH_IN_THE_FUTURE -epicsShareFunc unsigned caServer::readEventsProcessedCounter (void) const +epicsShareFunc unsigned caServer::readEventsProcessedCounter (void) const // X aCC 361 { if (pCAS) { return this->pCAS->readEventsProcessedCounter(); @@ -228,7 +228,7 @@ epicsShareFunc void caServer::clearEventsProcessedCounter (void) // caServer::readEventsPostedCounter // #ifdef CAS_DIAGNOSTICS_API_WHICH_MAY_VANISH_IN_THE_FUTURE -epicsShareFunc unsigned caServer::readEventsPostedCounter (void) const +epicsShareFunc unsigned caServer::readEventsPostedCounter (void) const // X aCC 361 { if (pCAS) { return this->pCAS->readEventsPostedCounter (); diff --git a/src/cas/generic/casChannel.cc b/src/cas/generic/casChannel.cc index df9c87358..21f19244a 100644 --- a/src/cas/generic/casChannel.cc +++ b/src/cas/generic/casChannel.cc @@ -51,7 +51,7 @@ epicsShareFunc casChannel::~casChannel() // // casChannel::getPV() // -epicsShareFunc casPV *casChannel::getPV() +epicsShareFunc casPV *casChannel::getPV() // X aCC 361 { casPVI *pPVI = &this->casChannelI::getPVI(); diff --git a/src/cas/generic/casClient.cc b/src/cas/generic/casClient.cc index 298a3045a..f789c13b4 100644 --- a/src/cas/generic/casClient.cc +++ b/src/cas/generic/casClient.cc @@ -462,12 +462,12 @@ const char *pformat, * copy back the request protocol * (in network byte order) */ - reply[1].m_postsize = htons (curp->m_postsize); - reply[1].m_cmmd = htons (curp->m_cmmd); - reply[1].m_dataType = htons (curp->m_dataType); - reply[1].m_count = htons (curp->m_count); - reply[1].m_cid = htonl (curp->m_cid); - reply[1].m_available = htonl (curp->m_available); + reply[1].m_postsize = epicsHTON16 (curp->m_postsize); + reply[1].m_cmmd = epicsHTON16 (curp->m_cmmd); + reply[1].m_dataType = epicsHTON16 (curp->m_dataType); + reply[1].m_count = epicsHTON16 (curp->m_count); + reply[1].m_cid = epicsHTON32 (curp->m_cid); + reply[1].m_available = epicsHTON32 (curp->m_available); /* * add their optional context string into the protocol diff --git a/src/cas/generic/casCtxIL.h b/src/cas/generic/casCtxIL.h index a292e960f..d1ecad67f 100644 --- a/src/cas/generic/casCtxIL.h +++ b/src/cas/generic/casCtxIL.h @@ -2,6 +2,8 @@ #ifndef casCtxILh #define casCtxILh +#include "osiWireFormat.h" + // // casCtx::casCtx() // @@ -17,7 +19,7 @@ inline casCtx::casCtx() : // inline const caHdr *casCtx::getMsg() const { - return (const caHdr *) &this->msg; + return &this->msg; } // @@ -71,12 +73,12 @@ inline void casCtx::setMsg(const char *pBuf) // alignment problems // memcpy (&this->msg, pBuf, sizeof(this->msg)); - this->msg.m_cmmd = ntohs (this->msg.m_cmmd); - this->msg.m_postsize = ntohs (this->msg.m_postsize); - this->msg.m_dataType = ntohs (this->msg.m_dataType); - this->msg.m_count = ntohs (this->msg.m_count); - this->msg.m_cid = ntohl (this->msg.m_cid); - this->msg.m_available = ntohl (this->msg.m_available); + this->msg.m_cmmd = epicsNTOH16 (this->msg.m_cmmd); + this->msg.m_postsize = epicsNTOH16 (this->msg.m_postsize); + this->msg.m_dataType = epicsNTOH16 (this->msg.m_dataType); + this->msg.m_count = epicsNTOH16 (this->msg.m_count); + this->msg.m_cid = epicsNTOH32 (this->msg.m_cid); + this->msg.m_available = epicsNTOH32 (this->msg.m_available); } // diff --git a/src/cas/generic/casDGClient.cc b/src/cas/generic/casDGClient.cc index da8d9db1e..bdb43aa5a 100644 --- a/src/cas/generic/casDGClient.cc +++ b/src/cas/generic/casDGClient.cc @@ -259,7 +259,7 @@ caStatus casDGClient::searchResponse(const caHdr &msg, // server's port when it is a redirect). // if (ina.sin_port==0u) { - ina.sin_port = htons (CA_SERVER_PORT); + ina.sin_port = epicsHTON16 (static_cast (CA_SERVER_PORT)); } } else { @@ -277,17 +277,17 @@ caStatus casDGClient::searchResponse(const caHdr &msg, // o disconnect UDP socket from the destination IP // if ( ina.sin_addr.s_addr == INADDR_ANY ) { - ina.sin_addr.s_addr = ntohl(~0U); + ina.sin_addr.s_addr = epicsNTOH32 (~0U); } } - search_reply->m_cid = ntohl (ina.sin_addr.s_addr); - search_reply->m_dataType = ntohs (ina.sin_port); + search_reply->m_cid = epicsNTOH32 (ina.sin_addr.s_addr); + search_reply->m_dataType = epicsNTOH16 (ina.sin_port); } else { caNetAddr addr = this->serverAddress (); struct sockaddr_in inetAddr = addr.getSockIP(); search_reply->m_cid = ~0U; - search_reply->m_dataType = ntohs (inetAddr.sin_port); + search_reply->m_dataType = epicsNTOH16 (inetAddr.sin_port); } search_reply->m_count = 0ul; @@ -298,7 +298,7 @@ caStatus casDGClient::searchResponse(const caHdr &msg, // This value is ignored by earlier clients. // pMinorVersion = (unsigned short *) (search_reply+1); - *pMinorVersion = htons ( CA_MINOR_PROTOCOL_REVISION ); + *pMinorVersion = epicsHTON16 ( CA_MINOR_PROTOCOL_REVISION ); this->commitMsg(); @@ -344,7 +344,7 @@ void casDGClient::sendBeacon () // create the message // memset ( &buf, 0, sizeof (msg) ); - msg.m_cmmd = htons (CA_PROTO_RSRV_IS_UP); + msg.m_cmmd = epicsHTON16 (CA_PROTO_RSRV_IS_UP); // // send it to all addresses on the beacon list, @@ -357,7 +357,7 @@ void casDGClient::sendBeacon () // // casDGClient::xSend() // -outBuf::flushCondition casDGClient::xSend (char *pBufIn, +outBuf::flushCondition casDGClient::xSend (char *pBufIn, // X aCC 361 bufSizeT nBytesAvailableToSend, bufSizeT nBytesNeedToBeSent, bufSizeT &nBytesSent) { @@ -405,7 +405,7 @@ outBuf::flushCondition casDGClient::xSend (char *pBufIn, // // casDGClient::xRecv () // -inBuf::fillCondition casDGClient::xRecv (char *pBufIn, bufSizeT nBytesToRecv, +inBuf::fillCondition casDGClient::xRecv (char *pBufIn, bufSizeT nBytesToRecv, // X aCC 361 fillParameter parm, bufSizeT &nByesRecv) { const char *pAfter = pBufIn + nBytesToRecv; diff --git a/src/cas/generic/casEventSysIL.h b/src/cas/generic/casEventSysIL.h index 10deeebaa..24de4c21a 100644 --- a/src/cas/generic/casEventSysIL.h +++ b/src/cas/generic/casEventSysIL.h @@ -109,7 +109,7 @@ inline void casEventSys::removeFromEventQueue(casEvent &event) // // casEventSys::full() // -inline bool casEventSys::full() +inline bool casEventSys::full() // X aCC 361 { if (this->replaceEvents || this->eventLogQue.count()>=this->maxLogEntries) { return true; diff --git a/src/cas/generic/casMonitor.cc b/src/cas/generic/casMonitor.cc index a994403f5..ce611bb81 100644 --- a/src/cas/generic/casMonitor.cc +++ b/src/cas/generic/casMonitor.cc @@ -141,7 +141,7 @@ void casMonitor::push (const smartConstGDDPointer &pNewValue) if (!full) { pLog = new casMonEvent (*this, pNewValue); if (pLog) { - this->nPend++; + this->nPend++; // X aCC 818 } } else { @@ -179,7 +179,7 @@ void casMonitor::push (const smartConstGDDPointer &pNewValue) // this->ovf = true; this->overFlowEvent.assign (*this, pNewValue); - this->nPend++; + this->nPend++; // X aCC 818 pLog = &this->overFlowEvent; } @@ -216,7 +216,7 @@ caStatus casMonitor::executeEvent(casMonEvent *pEV) // // decrement the count of the number of events pending // - this->nPend--; + this->nPend--; // X aCC 818 // // delete event object if it isnt a cache entry diff --git a/src/cas/generic/casPVI.cc b/src/cas/generic/casPVI.cc index a9df59c97..a08c35682 100644 --- a/src/cas/generic/casPVI.cc +++ b/src/cas/generic/casPVI.cc @@ -361,7 +361,7 @@ void casPVI::unregisterEvent() // (not inline because details of caServerI must not // leak into server tool) // -caServer *casPVI::getExtServer() const +caServer *casPVI::getExtServer() const // X aCC 361 { if (this->pCAS) { return this->pCAS->getAdapter(); diff --git a/src/cas/generic/casPVIIL.h b/src/cas/generic/casPVIIL.h index e485e1d61..690ce0fad 100644 --- a/src/cas/generic/casPVIIL.h +++ b/src/cas/generic/casPVIIL.h @@ -107,7 +107,7 @@ inline void casPVI::unregisterIO() // // casPVI::bestDBRType() // -inline caStatus casPVI::bestDBRType (unsigned &dbrType) +inline caStatus casPVI::bestDBRType (unsigned &dbrType) // X aCC 361 { unsigned bestAIT = this->bestExternalType(); diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index 938dcadf2..f6df23c43 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -541,7 +541,7 @@ static smartGDDPointer createDBRDD (unsigned dbrType, aitIndex dbrCount) // returned for DBR types // if ( dbrCount > 1 ) { - pDescRet = (gdd *) new gdd (*pDescRet); + pDescRet = new gdd (*pDescRet); // // smart pointer class maintains the ref count from here down // @@ -604,7 +604,7 @@ static smartGDDPointer createDBRDD (unsigned dbrType, aitIndex dbrCount) modAllowed = TRUE; } - for ( dim=0u; dim < (unsigned) pVal->dimension (); dim++ ) { + for ( dim=0u; dim < pVal->dimension (); dim++ ) { if ( pB[dim].first () != 0u && pB[dim].size() != bound ) { if ( modAllowed ) { pVal->setBound( dim, 0u, bound ); @@ -1360,7 +1360,7 @@ caStatus casStrmClient::eventAddAction () // // place monitor mask in correct byte order // - caProtoMask = ntohs (pMonInfo->m_mask); + caProtoMask = epicsNTOH16 (pMonInfo->m_mask); if (caProtoMask&DBE_VALUE) { mask |= this->getCAS().valueEventMask(); } @@ -2036,19 +2036,21 @@ void casStrmClient::removeChannel(casChannelI &chan) // // casStrmClient::xSend() // -outBuf::flushCondition casStrmClient::xSend (char *pBufIn, bufSizeT nBytesAvailableToSend, - bufSizeT nBytesNeedToBeSent, bufSizeT &nActualBytes) +outBuf::flushCondition casStrmClient::xSend (char *pBufIn, + bufSizeT nBytesAvailableToSend, + bufSizeT nBytesNeedToBeSent, + bufSizeT &nActualBytes) { outBuf::flushCondition stat; - bufSizeT nActualBytesDelta; + bufSizeT nActualBytesDelta; bufSizeT totalBytes; - assert (nBytesAvailableToSend>=nBytesNeedToBeSent); + assert (nBytesAvailableToSend>=nBytesNeedToBeSent); - totalBytes = 0u; - while ( true ) { - stat = this->osdSend (&pBufIn[totalBytes], - nBytesAvailableToSend-totalBytes, nActualBytesDelta); + totalBytes = 0u; + while ( true ) { + stat = this->osdSend (&pBufIn[totalBytes], + nBytesAvailableToSend-totalBytes, nActualBytesDelta); if (stat != outBuf::flushProgress) { if (totalBytes>0) { nActualBytes = totalBytes; @@ -2059,21 +2061,22 @@ outBuf::flushCondition casStrmClient::xSend (char *pBufIn, bufSizeT nBytesAvaila return outBuf::flushProgress; } else { - return stat; + return stat; } - } + } - totalBytes += nActualBytesDelta; + totalBytes += nActualBytesDelta; - if (totalBytes>=nBytesNeedToBeSent) { + if (totalBytes>=nBytesNeedToBeSent) { // // !! this time fetch may be slowing things down !! // //this->lastSendTS = epicsTime::getCurrent(); nActualBytes = totalBytes; - return outBuf::flushProgress; - } - } + return outBuf::flushProgress; + } + } + return static_cast (0); // Make compiler happy } // diff --git a/src/cas/generic/casdef.h b/src/cas/generic/casdef.h index e05151f1f..9bffc4557 100644 --- a/src/cas/generic/casdef.h +++ b/src/cas/generic/casdef.h @@ -111,7 +111,7 @@ typedef aitUint32 caStatus; enum pvExistReturnEnum {pverExistsHere, pverDoesNotExistHere, pverAsyncCompletion}; -class epicsShareClass pvExistReturn { +class epicsShareClass pvExistReturn { // X aCC 361 public: // // most server tools will use this diff --git a/src/cas/generic/inBuf.cc b/src/cas/generic/inBuf.cc index ac3c880f8..efe25af75 100644 --- a/src/cas/generic/inBuf.cc +++ b/src/cas/generic/inBuf.cc @@ -123,7 +123,7 @@ inBuf::fillCondition inBuf::fill (fillParameter parm) this->clientHostName(buf, sizeof(buf)); - printf ("CAS: incomming %u byte msg from %s\n", + printf ("CAS: incoming %u byte msg from %s\n", bytesRecv, buf); } } @@ -134,7 +134,8 @@ inBuf::fillCondition inBuf::fill (fillParameter parm) // // inBuf::pushCtx () // -const inBufCtx inBuf::pushCtx (bufSizeT headerSize, bufSizeT bodySize) +const inBufCtx inBuf::pushCtx (bufSizeT headerSize, // X aCC 361 + bufSizeT bodySize) { if (headerSize+bodySize>(this->bytesInBuffer - this->nextReadIndex) || this->ctxRecursCount==UINT_MAX) { @@ -156,7 +157,7 @@ const inBufCtx inBuf::pushCtx (bufSizeT headerSize, bufSizeT bodySize) // // inBuf::popCtx () // -bufSizeT inBuf::popCtx (const inBufCtx &ctx) +bufSizeT inBuf::popCtx (const inBufCtx &ctx) // X aCC 361 { if (ctx.stat==inBufCtx::pushCtxSuccess) { this->mutex.lock(); diff --git a/src/cas/generic/inBufIL.h b/src/cas/generic/inBufIL.h index 2e8e7e3ac..a645526d9 100644 --- a/src/cas/generic/inBufIL.h +++ b/src/cas/generic/inBufIL.h @@ -17,7 +17,7 @@ inline bufSizeT inBuf::bytesAvailable () const { bufSizeT bp; bp = this->bytesPresent(); - bp += this->incommingBytesPresent(); + bp += this->incomingBytesPresent(); return bp; } diff --git a/src/cas/generic/outBuf.cc b/src/cas/generic/outBuf.cc index 7af5b6dab..06ce7f8c0 100644 --- a/src/cas/generic/outBuf.cc +++ b/src/cas/generic/outBuf.cc @@ -31,6 +31,7 @@ #include "server.h" #include "outBufIL.h" // outBuf in line func +#include "osiWireFormat.h" // // outBuf::outBuf() @@ -131,12 +132,12 @@ void outBuf::commitMsg () // convert to network byte order // (data following header is handled elsewhere) // - mp->m_cmmd = htons (mp->m_cmmd); - mp->m_postsize = htons (extSize); - mp->m_dataType = htons (mp->m_dataType); - mp->m_count = htons (mp->m_count); - mp->m_cid = htonl (mp->m_cid); - mp->m_available = htonl (mp->m_available); + mp->m_cmmd = epicsHTON16 (mp->m_cmmd); + mp->m_postsize = epicsHTON16 (extSize); + mp->m_dataType = epicsHTON16 (mp->m_dataType); + mp->m_count = epicsHTON16 (mp->m_count); + mp->m_cid = epicsHTON32 (mp->m_cid); + mp->m_available = epicsHTON32 (mp->m_available); commitRawMsg (extSize + sizeof(*mp)); } @@ -203,7 +204,9 @@ outBuf::flushCondition outBuf::flush (bufSizeT spaceRequired) // // outBuf::pushCtx () // -const outBufCtx outBuf::pushCtx (bufSizeT headerSize, bufSizeT maxBodySize, void *&pHeader) +const outBufCtx outBuf::pushCtx (bufSizeT headerSize, // X aCC 361 + bufSizeT maxBodySize, + void *&pHeader) { bufSizeT totalSize = headerSize + maxBodySize; caStatus status; @@ -228,7 +231,7 @@ const outBufCtx outBuf::pushCtx (bufSizeT headerSize, bufSizeT maxBodySize, void // // outBuf::popCtx () // -bufSizeT outBuf::popCtx (const outBufCtx &ctx) +bufSizeT outBuf::popCtx (const outBufCtx &ctx) // X aCC 361 { if (ctx.stat==outBufCtx::pushCtxSuccess) { bufSizeT bytesAdded = this->stack; diff --git a/src/cas/generic/server.h b/src/cas/generic/server.h index 94aad6289..1fb7470b5 100644 --- a/src/cas/generic/server.h +++ b/src/cas/generic/server.h @@ -306,7 +306,7 @@ private: bufSizeT ioMinSize; unsigned ctxRecursCount; virtual unsigned getDebugLevel () const = 0; - virtual bufSizeT incommingBytesPresent () const = 0; + virtual bufSizeT incomingBytesPresent () const = 0; virtual fillCondition xRecv (char *pBuf, bufSizeT nBytesToRecv, enum inBuf::fillParameter parm, bufSizeT &nByesRecv) = 0; virtual void clientHostName (char *pBuf, unsigned bufSize) const = 0; @@ -343,7 +343,7 @@ public: enum flushCondition {flushNone, flushProgress, flushDisconnect}; outBuf (bufSizeT bufSizeIn); - virtual ~outBuf ()=0; + virtual ~outBuf (); bufSizeT bytesPresent() const; diff --git a/src/cas/generic/st/casDGIntfOS.cc b/src/cas/generic/st/casDGIntfOS.cc index ae571c88d..90f19c293 100644 --- a/src/cas/generic/st/casDGIntfOS.cc +++ b/src/cas/generic/st/casDGIntfOS.cc @@ -426,7 +426,7 @@ void casDGIntfOS::sendCB() } // // this reenables receipt of incoming frames once - // the output has been flushed when the incomming + // the output has been flushed when the incoming // address is different // this->armRecv (); diff --git a/src/cas/generic/st/casStreamOS.cc b/src/cas/generic/st/casStreamOS.cc index 99c921d77..68e01635a 100644 --- a/src/cas/generic/st/casStreamOS.cc +++ b/src/cas/generic/st/casStreamOS.cc @@ -566,7 +566,7 @@ void casStreamOS::sendCB() // // casStreamOS::processInput() // -casProcCond casStreamOS::processInput() +casProcCond casStreamOS::processInput() // X aCC 361 { caStatus status; diff --git a/src/cas/io/bsdSocket/caServerIO.cc b/src/cas/io/bsdSocket/caServerIO.cc index 6b165959a..1353d3cdb 100644 --- a/src/cas/io/bsdSocket/caServerIO.cc +++ b/src/cas/io/bsdSocket/caServerIO.cc @@ -46,10 +46,14 @@ void caServerIO::locateInterfaces () // then use a hard coded default - CA_SERVER_PORT. // if (envGetConfigParamPtr(&EPICS_CAS_SERVER_PORT)) { - port = envGetInetPortConfigParam (&EPICS_CAS_SERVER_PORT, CA_SERVER_PORT); + port = envGetInetPortConfigParam ( + &EPICS_CAS_SERVER_PORT, + static_cast (CA_SERVER_PORT)); } else { - port = envGetInetPortConfigParam (&EPICS_CA_SERVER_PORT, CA_SERVER_PORT); + port = envGetInetPortConfigParam ( + &EPICS_CA_SERVER_PORT, + static_cast (CA_SERVER_PORT)); } memset ((char *)&saddr,0,sizeof(saddr)); @@ -147,7 +151,8 @@ void caServerIO::show (unsigned /* level */) const // // getToken() // -static char *getToken(const char **ppString, char *pBuf, unsigned bufSIze) +static char *getToken(const char **ppString, // X aCC 361 + char *pBuf, unsigned bufSIze) { const char *pToken; unsigned i; diff --git a/src/cas/io/bsdSocket/casDGIntfIO.cc b/src/cas/io/bsdSocket/casDGIntfIO.cc index 69d478aec..9b8dc0f6e 100644 --- a/src/cas/io/bsdSocket/casDGIntfIO.cc +++ b/src/cas/io/bsdSocket/casDGIntfIO.cc @@ -1,5 +1,4 @@ /* - * * Author: Jeffrey O. Hill * hill@luke.lanl.gov * (505) 665 1831 @@ -45,12 +44,12 @@ static void forcePort (ELLLIST *pList, unsigned short port) { osiSockAddrNode *pNode; - pNode = (osiSockAddrNode *) ellFirst ( pList ); + pNode = reinterpret_cast (ellFirst ( pList )); while ( pNode ) { if ( pNode->addr.sa.sa_family == AF_INET ) { pNode->addr.ia.sin_port = htons (port); } - pNode = (osiSockAddrNode *) ellNext ( &pNode->node ); + pNode = reinterpret_cast (ellNext ( &pNode->node )); } } @@ -91,14 +90,14 @@ casDGIntfIO::casDGIntfIO (caServerI &serverIn, const caNetAddr &addr, // if (envGetConfigParamPtr(&EPICS_CAS_SERVER_PORT)) { this->dgPort = envGetInetPortConfigParam (&EPICS_CAS_SERVER_PORT, - CA_SERVER_PORT); + static_cast (CA_SERVER_PORT)); } else { this->dgPort = envGetInetPortConfigParam (&EPICS_CA_SERVER_PORT, - CA_SERVER_PORT); + static_cast (CA_SERVER_PORT)); } beaconPort = envGetInetPortConfigParam (&EPICS_CA_REPEATER_PORT, - CA_REPEATER_PORT); + static_cast (CA_REPEATER_PORT)); // // set up the primary address of the server @@ -122,7 +121,7 @@ casDGIntfIO::casDGIntfIO (caServerI &serverIn, const caNetAddr &addr, socket_close (this->sock); throw S_cas_noInterface; } - pAddr = (osiSockAddrNode *) ellFirst (&BCastAddrList); + pAddr = reinterpret_cast (ellFirst (&BCastAddrList)); serverBCastAddr.ia = pAddr->addr.ia; serverBCastAddr.ia.sin_port = htons (this->dgPort); @@ -261,7 +260,7 @@ void casDGIntfIO::xSetNonBlocking() int status; osiSockIoctl_t yes = TRUE; - status = socket_ioctl(this->sock, FIONBIO, &yes); + status = socket_ioctl(this->sock, FIONBIO, &yes); // X aCC 392 if (status<0) { errlogPrintf("%s:CAS: UDP non blocking IO set fail because \"%s\"\n", __FILE__, SOCKERRSTR(SOCKERRNO)); @@ -271,11 +270,12 @@ void casDGIntfIO::xSetNonBlocking() // // casDGIntfIO::osdRecv() // -inBuf::fillCondition casDGIntfIO::osdRecv(char *pBufIn, bufSizeT size, - fillParameter parm, bufSizeT &actualSize, caNetAddr &fromOut) +inBuf::fillCondition +casDGIntfIO::osdRecv(char *pBufIn, bufSizeT size, // X aCC 361 + fillParameter parm, bufSizeT &actualSize, caNetAddr &fromOut) { - int status; - osiSocklen_t addrSize; + int status; + osiSocklen_t addrSize; sockaddr addr; SOCKET sockThisTime; @@ -286,69 +286,70 @@ inBuf::fillCondition casDGIntfIO::osdRecv(char *pBufIn, bufSizeT size, sockThisTime = this->sock; } - addrSize = ( osiSocklen_t ) sizeof (addr); - status = recvfrom (this->sock, pBufIn, size, 0, - &addr, &addrSize); - if (status<=0) { + addrSize = ( osiSocklen_t ) sizeof (addr); + status = recvfrom (this->sock, pBufIn, size, 0, + &addr, &addrSize); + if (status<=0) { if (status<0) { int errnoCpy = SOCKERRNO; if( errnoCpy != SOCK_EWOULDBLOCK ){ - errlogPrintf("CAS: UDP recv error was %s", - SOCKERRSTR(errnoCpy)); + errlogPrintf("CAS: UDP recv error was %s", + SOCKERRSTR(errnoCpy)); } - } + } return casFillNone; - } + } else { - fromOut = addr; - actualSize = (bufSizeT) status; - return casFillProgress; + fromOut = addr; + actualSize = (bufSizeT) status; + return casFillProgress; } } // // casDGIntfIO::osdSend() // -outBuf::flushCondition casDGIntfIO::osdSend (const char *pBufIn, bufSizeT size, - const caNetAddr &to) +outBuf::flushCondition +casDGIntfIO::osdSend (const char *pBufIn, bufSizeT size, // X aCC 361 + const caNetAddr &to) { - int status; + int status; - // - // (char *) cast below is for brain dead wrs prototype - // - struct sockaddr dest = to; - status = sendto (this->sock, (char *) pBufIn, size, 0, - &dest, sizeof(dest)); - if (status>=0) { + // + // (char *) cast below is for brain dead wrs prototype + // + struct sockaddr dest = to; + status = sendto (this->sock, (char *) pBufIn, size, 0, + &dest, sizeof(dest)); + if (status>=0) { assert ( size == (unsigned) status ); return outBuf::flushProgress; - } - else { + } + else { int errnoCpy = SOCKERRNO; - if (errnoCpy != SOCK_EWOULDBLOCK) { - char buf[64]; + if (errnoCpy != SOCK_EWOULDBLOCK) { + char buf[64]; sockAddrToA (&dest, buf, sizeof(buf)); - errlogPrintf ( - "CAS: UDP socket send to \"%s\" failed because \"%s\"\n", - buf, SOCKERRSTR(errnoCpy)); - } + errlogPrintf ( + "CAS: UDP socket send to \"%s\" failed because \"%s\"\n", + buf, SOCKERRSTR(errnoCpy)); + } return outBuf::flushNone; - } + } } // -// casDGIntfIO::incommingBytesPresent() +// casDGIntfIO::incomingBytesPresent() // // ok to return a size of one here when a datagram is present, and // zero otherwise. // -bufSizeT casDGIntfIO::incommingBytesPresent () const +bufSizeT casDGIntfIO::incomingBytesPresent () const // X aCC 361 { int status; osiSockIoctl_t nchars = 0; - status = socket_ioctl (this->sock, FIONREAD, &nchars); + status = socket_ioctl (this->sock, FIONREAD, &nchars); // X aCC 392 if (status<0) { errlogPrintf ("CAS: FIONREAD failed because \"%s\"\n", SOCKERRSTR(SOCKERRNO)); @@ -365,7 +366,8 @@ bufSizeT casDGIntfIO::incommingBytesPresent () const // // casDGIntfIO::sendBeaconIO() // -void casDGIntfIO::sendBeaconIO (char &msg, unsigned length, aitUint16 &portField, aitUint32 &addrField) +void casDGIntfIO::sendBeaconIO (char &msg, unsigned length, + aitUint16 &portField, aitUint32 &addrField) { caNetAddr addr = this->serverAddress (); struct sockaddr_in inetAddr = addr.getSockIP(); @@ -375,8 +377,8 @@ void casDGIntfIO::sendBeaconIO (char &msg, unsigned length, aitUint16 &portField portField = inetAddr.sin_port; // the TCP port - for (pAddr = (osiSockAddrNode *)ellFirst(&this->beaconAddrList); - pAddr; pAddr = (osiSockAddrNode *)ellNext(&pAddr->node)) { + for (pAddr = reinterpret_cast (ellFirst(&this->beaconAddrList)); + pAddr; pAddr = reinterpret_cast (ellNext(&pAddr->node))) { status = connect (this->beaconSock, &pAddr->addr.sa, sizeof(pAddr->addr.sa)); if (status<0) { ipAddrToA (&pAddr->addr.ia, buf, sizeof(buf)); @@ -523,7 +525,7 @@ SOCKET casDGIntfIO::makeSockDG () // // // this allows for faster connects by queuing - // additional incomming UDP search frames + // additional incoming UDP search frames // // this allocates a 32k buffer // (uses a power of two) diff --git a/src/cas/io/bsdSocket/casIOD.h b/src/cas/io/bsdSocket/casIOD.h index da835d692..4131d0928 100644 --- a/src/cas/io/bsdSocket/casIOD.h +++ b/src/cas/io/bsdSocket/casIOD.h @@ -45,7 +45,7 @@ public: static bufSizeT optimumOutBufferSize (); static bufSizeT optimumInBufferSize (); - bufSizeT incommingBytesPresent () const; + bufSizeT incomingBytesPresent () const; private: ELLLIST beaconAddrList; @@ -85,7 +85,7 @@ public: xBlockingStatus blockingState() const; - bufSizeT incommingBytesPresent() const; + bufSizeT incomingBytesPresent() const; static bufSizeT optimumBufferSize (); diff --git a/src/cas/io/bsdSocket/casIntfIO.cc b/src/cas/io/bsdSocket/casIntfIO.cc index 5b69ab99e..1d4f678f3 100644 --- a/src/cas/io/bsdSocket/casIntfIO.cc +++ b/src/cas/io/bsdSocket/casIntfIO.cc @@ -3,9 +3,7 @@ // // Author Jeff Hill // -// -// -// + #include "server.h" @@ -62,8 +60,9 @@ casIntfIO::casIntfIO (const caNetAddr &addrIn) : } # endif - status = bind(this->sock,(sockaddr *) &this->addr, - sizeof(this->addr)); + status = bind(this->sock, + reinterpret_cast (&this->addr), + sizeof(this->addr)); if (status<0) { if (SOCKERRNO == SOCK_EADDRINUSE) { // @@ -72,10 +71,9 @@ casIntfIO::casIntfIO (const caNetAddr &addrIn) : // work correctly) // this->addr.sin_port = ntohs (0); - status = bind( - this->sock, - (sockaddr *)&this->addr, - sizeof(this->addr)); + status = bind(this->sock, + reinterpret_cast (&this->addr), + sizeof(this->addr)); } if (status<0) { char buf[64]; @@ -97,7 +95,8 @@ casIntfIO::casIntfIO (const caNetAddr &addrIn) : addrSize = ( osiSocklen_t ) sizeof (this->addr); status = getsockname (this->sock, - (struct sockaddr *)&this->addr, &addrSize); + reinterpret_cast (&this->addr) + , &addrSize); if (status) { errlogPrintf("CAS: getsockname() error %s\n", SOCKERRSTR(SOCKERRNO)); @@ -195,7 +194,7 @@ void casIntfIO::setNonBlocking() int status; osiSockIoctl_t yes = TRUE; - status = socket_ioctl(this->sock, FIONBIO, &yes); + status = socket_ioctl(this->sock, FIONBIO, &yes); // X aCC 392 if (status<0) { errlogPrintf( "%s:CAS: server non blocking IO set fail because \"%s\"\n", diff --git a/src/cas/io/bsdSocket/casStreamIO.cc b/src/cas/io/bsdSocket/casStreamIO.cc index 0d63555b2..a75e0dbd8 100644 --- a/src/cas/io/bsdSocket/casStreamIO.cc +++ b/src/cas/io/bsdSocket/casStreamIO.cc @@ -5,6 +5,9 @@ // // // $Log$ +// Revision 1.22 2001/07/11 23:31:45 jhill +// adapt to new timer API +// // Revision 1.21 2001/02/16 03:13:27 jhill // fixed gnu warnings // @@ -205,33 +208,34 @@ outBuf::flushCondition casStreamIO::osdSend (const char *pInBuf, bufSizeT nBytes // // casStreamIO::osdRecv() // -inBuf::fillCondition casStreamIO::osdRecv (char *pInBuf, bufSizeT nBytes, - bufSizeT &nBytesActual) +inBuf::fillCondition +casStreamIO::osdRecv (char *pInBuf, bufSizeT nBytes, // X aCC 361 + bufSizeT &nBytesActual) { - int nchars; + int nchars; - nchars = recv (this->sock, pInBuf, nBytes, 0); - if (nchars==0) { - return casFillDisconnect; - } - else if (nchars<0) { + nchars = recv (this->sock, pInBuf, nBytes, 0); + if (nchars==0) { + return casFillDisconnect; + } + else if (nchars<0) { int myerrno = SOCKERRNO; - char buf[64]; + char buf[64]; if (myerrno==SOCK_EWOULDBLOCK) { return casFillNone; } else { - ipAddrToA (&this->addr, buf, sizeof(buf)); - errlogPrintf( + ipAddrToA (&this->addr, buf, sizeof(buf)); + errlogPrintf( "CAS: client %s disconnected because \"%s\"\n", - buf, SOCKERRSTR(myerrno)); - return casFillDisconnect; + buf, SOCKERRSTR(myerrno)); + return casFillDisconnect; } - } + } else { nBytesActual = (bufSizeT) nchars; - return casFillProgress; + return casFillProgress; } } @@ -259,7 +263,7 @@ void casStreamIO::xSetNonBlocking() int status; osiSockIoctl_t yes = TRUE; - status = socket_ioctl(this->sock, FIONBIO, &yes); + status = socket_ioctl(this->sock, FIONBIO, &yes); // X aCC 392 if (status>=0) { this->blockingFlag = xIsntBlocking; } @@ -279,14 +283,14 @@ xBlockingStatus casStreamIO::blockingState() const } // -// casStreamIO::incommingBytesPresent() +// casStreamIO::incomingBytesPresent() // -bufSizeT casStreamIO::incommingBytesPresent() const +bufSizeT casStreamIO::incomingBytesPresent() const // X aCC 361 { int status; osiSockIoctl_t nchars = 0; - status = socket_ioctl(this->sock, FIONREAD, &nchars); + status = socket_ioctl(this->sock, FIONREAD, &nchars); // X aCC 392 if (status<0) { char buf[64]; int errnoCpy = SOCKERRNO; @@ -342,7 +346,7 @@ printf("the tcp buf size is %d\n", size); return (bufSizeT) size; #else // this needs to be MAX_TCP (until we fix the array problem) - return (bufSizeT) MAX_TCP; + return (bufSizeT) MAX_TCP; // X aCC 392 #endif }