diff --git a/src/ca/comBuf.h b/src/ca/comBuf.h index ae6caea96..ac1676a43 100644 --- a/src/ca/comBuf.h +++ b/src/ca/comBuf.h @@ -243,9 +243,9 @@ inline unsigned comBuf::copyIn ( const epicsInt16 *pValue, unsigned nElem ) nElem = this->unoccupiedElem ( sizeof (*pValue), nElem ); for ( unsigned i = 0u; i < nElem; i++ ) { this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 8u ); + static_cast < epicsUInt8 > ( pValue[i] >> 8u ); this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 0u ); + static_cast < epicsUInt8 > ( pValue[i] >> 0u ); } return nElem; } @@ -255,9 +255,9 @@ inline unsigned comBuf::copyIn ( const epicsUInt16 *pValue, unsigned nElem ) nElem = this->unoccupiedElem ( sizeof (*pValue), nElem ); for ( unsigned i = 0u; i < nElem; i++ ) { this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 8u ); + static_cast < epicsUInt8 > ( pValue[i] >> 8u ); this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 0u ); + static_cast < epicsUInt8 > ( pValue[i] >> 0u ); } return nElem; } @@ -267,13 +267,13 @@ inline unsigned comBuf::copyIn ( const epicsInt32 *pValue, unsigned nElem ) nElem = this->unoccupiedElem ( sizeof (*pValue), nElem ); for ( unsigned i = 0u; i < nElem; i++ ) { this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 24u ); + static_cast < epicsUInt8 > ( pValue[i] >> 24u ); this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 16u ); + static_cast < epicsUInt8 > ( pValue[i] >> 16u ); this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 8u ); + static_cast < epicsUInt8 > ( pValue[i] >> 8u ); this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 0u ); + static_cast < epicsUInt8 > ( pValue[i] >> 0u ); } return nElem; } @@ -283,13 +283,13 @@ inline unsigned comBuf::copyIn ( const epicsUInt32 *pValue, unsigned nElem ) nElem = this->unoccupiedElem ( sizeof (*pValue), nElem ); for ( unsigned i = 0u; i < nElem; i++ ) { this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 24u ); + static_cast < epicsUInt8 > ( pValue[i] >> 24u ); this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 16u ); + static_cast < epicsUInt8 > ( pValue[i] >> 16u ); this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 8u ); + static_cast < epicsUInt8 > ( pValue[i] >> 8u ); this->buf[this->nextWriteIndex++] = - static_cast < char > ( pValue[i] >> 0u ); + static_cast < epicsUInt8 > ( pValue[i] >> 0u ); } return nElem; } @@ -347,8 +347,9 @@ inline comBuf::statusPopUInt16 comBuf::popUInt16 () { statusPopUInt16 tmp; if ( this->occupiedBytes () >= 2u ) { - tmp.val = static_cast < epicsUInt16 > ( this->buf[ this->nextReadIndex++ ] << 8u - | this->buf[ this->nextReadIndex++ ] << 0u ); + unsigned byte1 = this->buf[ this->nextReadIndex++ ]; + unsigned byte2 = this->buf[ this->nextReadIndex++ ]; + tmp.val = static_cast < epicsUInt16 > ( byte1 << 8u | byte2 ); tmp.success = true; } else { @@ -362,10 +363,14 @@ inline comBuf::statusPopUInt32 comBuf::popUInt32 () { statusPopUInt32 tmp; if ( this->occupiedBytes () >= 4u ) { - tmp.val = this->buf[ this->nextReadIndex++ ] << 24u; - tmp.val |= this->buf[ this->nextReadIndex++ ] << 16u; - tmp.val |= this->buf[ this->nextReadIndex++ ] << 8u; - tmp.val |= this->buf[ this->nextReadIndex++ ] << 0u; + 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 ); tmp.success = true; } else { diff --git a/src/ca/comQueRecv.cpp b/src/ca/comQueRecv.cpp index 754bef8d1..85e2be46a 100644 --- a/src/ca/comQueRecv.cpp +++ b/src/ca/comQueRecv.cpp @@ -136,8 +136,8 @@ epicsUInt16 comQueRecv::popUInt16 () } else { // split between buffers runs slower - tmp = this->popUInt8() << 8u; // X aCC 818 - tmp |= this->popUInt8() << 0u; // X aCC 818 + tmp = static_cast ( this->popUInt8() << 8u ); + tmp |= static_cast ( this->popUInt8() << 0u ); } return tmp; } diff --git a/src/ca/nciu.cpp b/src/ca/nciu.cpp index 9410032fa..bbad23dfc 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 ( static_cast ( strlen ( pNameIn ) + 1 ) ), + nameLength ( 0u ), typeCode ( USHRT_MAX ), priority ( static_cast ( pri ) ), f_connected ( false ), @@ -65,10 +65,18 @@ nciu::nciu ( cac & cacIn, netiiu & iiuIn, cacChannelNotify & chanIn, f_firstConnectDecrementsOutstandingIO ( false ), f_connectTimeOutSeen ( false ) { + size_t nameLengthTmp = strlen ( pNameIn ) + 1; + // second constraint is imposed by size field in protocol header - if ( this->nameLength > MAX_UDP_SEND - sizeof ( caHdr ) || this->nameLength > 0xffff ) { + if ( nameLengthTmp > MAX_UDP_SEND - sizeof ( caHdr ) || nameLengthTmp > USHRT_MAX ) { throw cacChannel::badString (); } + + if ( pri > 0xff ) { + throw cacChannel::badPriority (); + } + + this->nameLength = static_cast ( nameLengthTmp ); this->pNameStr = new char [ this->nameLength ]; if ( ! this->pNameStr ) { diff --git a/src/ca/nciu.h b/src/ca/nciu.h index 0ae7e17c3..ddd43844b 100644 --- a/src/ca/nciu.h +++ b/src/ca/nciu.h @@ -33,9 +33,13 @@ class cac; class netiiu; class cacPrivateListOfIO { +public: + cacPrivateListOfIO (); private: tsDLList < class baseNMIU > eventq; friend class cac; + cacPrivateListOfIO ( const cacPrivateListOfIO & ); + cacPrivateListOfIO & operator = ( const cacPrivateListOfIO & ); }; class nciu : public cacChannel, public tsDLNode < nciu >, @@ -83,15 +87,15 @@ 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 - ca_uint16_t retrySeqNo; // search retry seq number - ca_uint16_t nameLength; // channel name length + unsigned retry; // search retry number + unsigned short retrySeqNo; // search retry seq number + unsigned short nameLength; // channel name length ca_uint16_t typeCode; ca_uint8_t priority; bool f_connected:1; - bool f_previousConn:1; // T if connected in the past + bool f_previousConn:1; // T if connected in the past bool f_claimSent:1; bool f_firstConnectDecrementsOutstandingIO:1; bool f_connectTimeOutSeen:1; @@ -116,6 +120,8 @@ private: static void stringVerify ( const char *pStr, const unsigned count ); static tsFreeList < class nciu, 1024 > freeList; static epicsMutex freeListMutex; + nciu ( const nciu & ); + nciu & operator = ( const nciu & ); }; inline void * nciu::operator new ( size_t size ) @@ -231,4 +237,8 @@ inline cacChannel::priLev nciu::getPriority () const return this->priority; } +inline cacPrivateListOfIO::cacPrivateListOfIO () +{ +} + #endif // ifdef nciuh diff --git a/src/ca/repeater.cpp b/src/ca/repeater.cpp index 3a12f13d2..bb1062822 100644 --- a/src/ca/repeater.cpp +++ b/src/ca/repeater.cpp @@ -130,7 +130,10 @@ typedef struct { LOCAL makeSocketReturn makeSocket ( unsigned short port, bool reuseAddr ) { int status; - struct sockaddr_in bd; + union { + struct sockaddr_in ia; + struct sockaddr sa; + } bd; makeSocketReturn msr; int flag; @@ -147,12 +150,10 @@ LOCAL makeSocketReturn makeSocket ( unsigned short port, bool reuseAddr ) if (port != PORT_ANY) { memset ( (char *) &bd, 0, sizeof (bd) ); - bd.sin_family = AF_INET; - bd.sin_addr.s_addr = htonl (INADDR_ANY); - bd.sin_port = htons (port); - status = bind (msr.sock, - reinterpret_cast (&bd), - (int)sizeof(bd)); + bd.ia.sin_family = AF_INET; + bd.ia.sin_addr.s_addr = htonl (INADDR_ANY); + bd.ia.sin_port = htons (port); + status = bind ( msr.sock, &bd.sa, (int) sizeof(bd) ); if ( status < 0 ) { msr.errNumber = SOCKERRNO; msr.pErrStr = SOCKERRSTR ( msr.errNumber ); diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index e9b545e46..a5dc9b569 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -100,7 +100,7 @@ unsigned tcpiiu::sendBytes ( const void *pBuf, unsigned nBytesInBuf ) { int status; - unsigned nBytes; + unsigned nBytes = 0u; if ( this->state != iiu_connected ) { return 0u; @@ -1020,7 +1020,7 @@ void tcpiiu::versionMessage ( const cacChannel::priLev & priority ) this->sendQue.beginMsg (); this->sendQue.pushUInt16 ( CA_PROTO_VERSION ); // cmd this->sendQue.pushUInt16 ( 0u ); // postsize ( old possize field ) - this->sendQue.pushUInt16 ( priority ); // old dataType field + this->sendQue.pushUInt16 ( static_cast ( priority ) ); // old dataType field this->sendQue.pushUInt16 ( CA_MINOR_PROTOCOL_REVISION ); // old count field this->sendQue.pushUInt32 ( 0u ); // ( old cid field ) this->sendQue.pushUInt32 ( 0u ); // ( old available field ) diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index ff25a5088..dc6ce809f 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -309,6 +309,9 @@ void epicsShareAPI caRepeaterRegistrationMessage ( int status; int len; + assert ( repeaterPort <= USHRT_MAX ); + unsigned short port = static_cast ( repeaterPort ); + /* * In 3.13 beta 11 and before the CA repeater calls local_addr() * to determine a local address and does not allow registration @@ -338,16 +341,16 @@ void epicsShareAPI caRepeaterRegistrationMessage ( */ saddr.ia.sin_family = AF_INET; saddr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK ); - saddr.ia.sin_port = static_cast ( htons ( repeaterPort ) ); + saddr.ia.sin_port = static_cast ( htons ( port ) ); } else { - saddr.ia.sin_port = static_cast ( htons ( repeaterPort ) ); + saddr.ia.sin_port = static_cast ( htons ( port ) ); } } else { saddr.ia.sin_family = AF_INET; saddr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK ); - saddr.ia.sin_port = static_cast ( htons ( repeaterPort ) ); + saddr.ia.sin_port = static_cast ( htons ( port ) ); } memset ( (char *) &msg, 0, sizeof (msg) ); @@ -368,8 +371,7 @@ void epicsShareAPI caRepeaterRegistrationMessage ( # endif status = sendto ( sock, (char *) &msg, len, 0, - reinterpret_cast (&saddr), - sizeof ( saddr ) ); + &saddr.sa, sizeof ( saddr ) ); if ( status < 0 ) { int errnoCpy = SOCKERRNO; /* @@ -418,7 +420,10 @@ void epicsShareAPI caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) bool installed = false; int status; SOCKET tmpSock; - struct sockaddr_in bd; + union { + struct sockaddr_in ia; + struct sockaddr sa; + } bd; int flag; if ( repeaterPort > 0xffff ) { @@ -430,12 +435,10 @@ void epicsShareAPI caStartRepeaterIfNotInstalled ( unsigned repeaterPort ) if ( tmpSock != INVALID_SOCKET ) { ca_uint16_t port = static_cast < ca_uint16_t > ( repeaterPort ); memset ( (char *) &bd, 0, sizeof ( bd ) ); - bd.sin_family = AF_INET; - bd.sin_addr.s_addr = htonl ( INADDR_ANY ); - bd.sin_port = htons ( port ); - status = bind ( tmpSock, - reinterpret_cast (&bd), - sizeof ( bd ) ); + bd.ia.sin_family = AF_INET; + bd.ia.sin_addr.s_addr = htonl ( INADDR_ANY ); + bd.ia.sin_port = htons ( port ); + status = bind ( tmpSock, &bd.sa, sizeof ( bd ) ); if ( status < 0 ) { if ( SOCKERRNO == SOCK_EADDRINUSE ) { installed = true; diff --git a/src/cas/generic/casClient.cc b/src/cas/generic/casClient.cc index b15163a1c..298a3045a 100644 --- a/src/cas/generic/casClient.cc +++ b/src/cas/generic/casClient.cc @@ -478,7 +478,9 @@ const char *pformat, pMsgString[size-1u] = '\0'; } - reply->m_postsize = size + sizeof(caHdr); + size += sizeof(caHdr); + assert ( size < 0xffff ); + reply->m_postsize = static_cast ( size ); this->outBuf::commitMsg(); diff --git a/src/cas/generic/casClientMon.cc b/src/cas/generic/casClientMon.cc index 380015bf6..07836aa35 100644 --- a/src/cas/generic/casClientMon.cc +++ b/src/cas/generic/casClientMon.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.7 2001/01/11 21:54:53 jhill + * accomodate Marty's osi => epics name changes + * * Revision 1.6 2000/04/28 02:23:30 jhill * many, many changes * @@ -91,8 +94,12 @@ caStatus casClientMon::callBack (const smartConstGDDPointer &value) // msg.m_cmmd = CA_PROTO_EVENT_ADD; msg.m_postsize = 0u; - msg.m_dataType = this->getType(); - msg.m_count = (ca_uint16_t) this->getCount(); + unsigned type = this->getType(); + assert ( type <= 0xffff ); + msg.m_dataType = static_cast ( type ); + unsigned long count = this->getCount(); + assert ( count <= 0xffff ); + msg.m_count = static_cast ( count ); msg.m_cid = this->getChannel().getSID(); msg.m_available = this->getClientId(); diff --git a/src/cas/generic/casInternal.h b/src/cas/generic/casInternal.h index 9f958ca5d..f3ba9a5cb 100644 --- a/src/cas/generic/casInternal.h +++ b/src/cas/generic/casInternal.h @@ -67,11 +67,14 @@ enum casResType {casChanT=1, casClientMonT, casPVT}; class casRes : public chronIntIdRes { public: + casRes (); epicsShareFunc virtual ~casRes(); virtual casResType resourceType() const = 0; virtual void show (unsigned level) const = 0; virtual void destroy() = 0; private: + casRes ( const casRes & ); + casRes & operator = ( const casRes & ); }; class ioBlockedList; @@ -100,6 +103,8 @@ public: epicsShareFunc virtual ~ioBlockedList (); void signal (); void addItemToIOBLockedList (ioBlocked &item); + ioBlockedList ( const ioBlockedList & ); + ioBlockedList & operator = ( const ioBlockedList & ); }; class casMonitor; @@ -193,6 +198,8 @@ private: void disable(); void push (const smartConstGDDPointer &pValue); + casMonitor ( const casMonitor & ); + casMonitor & operator = ( const casMonitor & ); }; // @@ -268,6 +275,9 @@ private: epicsShareFunc virtual void destroy (); epicsShareFunc virtual bool readOP() const; + + casAsyncIOI ( const casAsyncIOI & ); + casAsyncIOI & operator = ( const casAsyncIOI & ); }; class casDGClient; @@ -366,6 +376,8 @@ protected: unsigned accessRightsEvPending:1; epicsShareFunc virtual void destroy (); + casChannelI ( const casChannelI & ); + casChannelI & operator = ( const casChannelI & ); }; // @@ -374,8 +386,10 @@ protected: class casPVListChan : public casChannelI, public tsDLNode { public: - casPVListChan (const casCtx &ctx); - epicsShareFunc virtual ~casPVListChan(); + casPVListChan (const casCtx &ctx); + epicsShareFunc virtual ~casPVListChan(); + casPVListChan ( const casPVListChan & ); + casPVListChan & operator = ( const casPVListChan & ); }; class caServerI; @@ -481,5 +495,7 @@ private: inline void unlock () const; epicsShareFunc virtual void destroy (); // casPVI destructor noop + casPVI ( const casPVI & ); + casPVI & operator = ( const casPVI & ); }; diff --git a/src/cas/generic/casMonitor.cc b/src/cas/generic/casMonitor.cc index 11ff1ff76..a994403f5 100644 --- a/src/cas/generic/casMonitor.cc +++ b/src/cas/generic/casMonitor.cc @@ -49,7 +49,7 @@ casMonitor::casMonitor(caResId clientIdIn, casChannelI &chan, ciu(chan), mask(maskIn), clientId(clientIdIn), - dbrType(dbrTypeIn), + dbrType(static_cast ( dbrTypeIn ) ), nPend(0u), ovf(false), enabled(false) @@ -58,6 +58,7 @@ casMonitor::casMonitor(caResId clientIdIn, casChannelI &chan, // If these are nill it is a programmer error // assert (&this->ciu); + assert (dbrTypeIn<=0xff); this->ciu.addMonitor(*this); diff --git a/src/cas/generic/casPVI.cc b/src/cas/generic/casPVI.cc index ee550350d..a9df59c97 100644 --- a/src/cas/generic/casPVI.cc +++ b/src/cas/generic/casPVI.cc @@ -34,6 +34,8 @@ #include "server.h" #include "casPVIIL.h" // caServerI inline func +casRes::casRes () {} + // // casPVI::casPVI() // diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index d70def3db..938dcadf2 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -267,11 +267,13 @@ caStatus casStrmClient::readResponse (casChannelI *pChan, const caHdr &msg, return localStatus; } + // // setup response message // *reply = msg; - reply->m_postsize = size; + assert ( size <= 0xffff ); + reply->m_postsize = static_cast ( size ); reply->m_cid = pChan->getCID(); // @@ -300,7 +302,8 @@ caStatus casStrmClient::readResponse (casChannelI *pChan, const caHdr &msg, if (msg.m_dataType == DBR_STRING && msg.m_count == 1u) { /* add 1 so that the string terminator will be shipped */ strcnt = strlen((char *)(reply + 1u)) + 1u; - reply->m_postsize = strcnt; + assert ( strcnt <= 0xffff ); + reply->m_postsize = static_cast (strcnt); } this->commitMsg (); @@ -402,7 +405,6 @@ caStatus casStrmClient::readNotifyResponseECA_XXX (casChannelI *pChan, caHdr *reply; unsigned size; caStatus status; - int strcnt; size = dbr_size_n (msg.m_dataType, msg.m_count); status = this->allocMsg(size, &reply); @@ -422,7 +424,8 @@ caStatus casStrmClient::readNotifyResponseECA_XXX (casChannelI *pChan, // setup response message // *reply = msg; - reply->m_postsize = size; + assert ( size <= 0xffff ); + reply->m_postsize = static_cast (size); // // cid field abused to store the status here @@ -483,8 +486,9 @@ caStatus casStrmClient::readNotifyResponseECA_XXX (casChannelI *pChan, // if (msg.m_dataType == DBR_STRING && msg.m_count == 1u) { /* add 1 so that the string terminator will be shipped */ - strcnt = strlen((char *)(reply + 1u)) + 1u; - reply->m_postsize = strcnt; + size_t strcnt = strlen((char *)(reply + 1u)) + 1u; + assert ( strcnt < 0xffff ); + reply->m_postsize = static_cast ( strcnt ); } this->commitMsg (); @@ -635,7 +639,6 @@ caStatus casStrmClient::monitorResponse (casChannelI &chan, const caHdr &msg, caHdr *pReply; unsigned size; caStatus status; - int strcnt; gddStatus gdds; size = dbr_size_n (msg.m_dataType, msg.m_count); @@ -657,7 +660,8 @@ caStatus casStrmClient::monitorResponse (casChannelI &chan, const caHdr &msg, // setup response message // *pReply = msg; - pReply->m_postsize = size; + assert ( size <= 0xffff ); + pReply->m_postsize = static_cast (size); // // verify read access @@ -720,8 +724,9 @@ caStatus casStrmClient::monitorResponse (casChannelI &chan, const caHdr &msg, if (msg.m_dataType == DBR_STRING && msg.m_count == 1u) { // add 1 so that the string terminator // will be shipped - strcnt = strlen((char *)(pReply + 1u)) + 1u; - pReply->m_postsize = strcnt; + size_t strcnt = strlen((char *)(pReply + 1u)) + 1u; + assert ( strcnt < 0xffff ); + pReply->m_postsize = static_cast ( strcnt ); } } else { @@ -1124,7 +1129,6 @@ caStatus casStrmClient::createChanResponse(const caHdr &hdr, const pvAttachRetur casChannel *pChan; casChannelI *pChanI; caHdr *claim_reply; - unsigned nativeType; bufSizeT nBytes; caStatus status; @@ -1145,6 +1149,7 @@ caStatus casStrmClient::createChanResponse(const caHdr &hdr, const pvAttachRetur // // fetch the native type // + unsigned nativeType; status = pPV->bestDBRType(nativeType); if (status) { errMessage(status, "best external dbr type fetch failed"); @@ -1219,8 +1224,11 @@ caStatus casStrmClient::createChanResponse(const caHdr &hdr, const pvAttachRetur *claim_reply = nill_msg; claim_reply->m_cmmd = CA_PROTO_CLAIM_CIU; - claim_reply->m_dataType = nativeType; - claim_reply->m_count = pPV->nativeCount(); + assert ( nativeType <= 0xffff ); + claim_reply->m_dataType = static_cast (nativeType); + unsigned nativeCount = pPV->nativeCount(); + assert ( nativeType <= 0xffff ); + claim_reply->m_count = static_cast (nativeCount); claim_reply->m_cid = hdr.m_cid; claim_reply->m_available = pChanI->getSID(); this->commitMsg(); @@ -1534,7 +1542,9 @@ caStatus casStrmClient::eventCancelAction () reply->m_cmmd = CA_PROTO_EVENT_ADD; reply->m_postsize = 0u; - reply->m_dataType = pMon->getType (); + unsigned type = pMon->getType (); + assert ( type <= 0xff ); + reply->m_dataType = static_cast ( type ); reply->m_count = (unsigned short) pMon->getCount (); reply->m_cid = pciu->getCID (); reply->m_available = pMon->getClientId (); @@ -2036,7 +2046,7 @@ outBuf::flushCondition casStrmClient::xSend (char *pBufIn, bufSizeT nBytesAvaila assert (nBytesAvailableToSend>=nBytesNeedToBeSent); totalBytes = 0u; - while (TRUE) { + while ( true ) { stat = this->osdSend (&pBufIn[totalBytes], nBytesAvailableToSend-totalBytes, nActualBytesDelta); if (stat != outBuf::flushProgress) { diff --git a/src/cas/generic/casdef.h b/src/cas/generic/casdef.h index 39c83f2eb..e05151f1f 100644 --- a/src/cas/generic/casdef.h +++ b/src/cas/generic/casdef.h @@ -618,6 +618,8 @@ public: private: casPV *apiPointer (); //retruns NULL if casPVI isnt a base of casPV + casPV ( const casPV & ); + casPV & operator = ( const casPV & ); public: // @@ -705,6 +707,9 @@ public: // epicsShareFunc casPV *getPV (); + casChannel ( const casChannel & ); + casChannel & operator = ( const casChannel & ); + // // only used when casStrmClient converts between // casChannel * and casChannelI * @@ -811,6 +816,9 @@ private: epicsShareFunc bool readOP() const; epicsShareFunc caStatus cbFuncAsyncIO(); + + casAsyncReadIO ( const casAsyncReadIO & ); + casAsyncReadIO & operator = ( const casAsyncReadIO & ); }; // @@ -867,6 +875,8 @@ private: caStatus completionStatus; epicsShareFunc caStatus cbFuncAsyncIO (); + casAsyncWriteIO ( const casAsyncWriteIO & ); + casAsyncWriteIO & operator = ( const casAsyncWriteIO & ); }; // @@ -914,6 +924,8 @@ private: const caNetAddr dgOutAddr; epicsShareFunc caStatus cbFuncAsyncIO(); + casAsyncPVExistIO ( const casAsyncPVExistIO & ); + casAsyncPVExistIO & operator = ( const casAsyncPVExistIO & ); }; // @@ -958,6 +970,8 @@ private: pvAttachReturn retVal; epicsShareFunc caStatus cbFuncAsyncIO (); + casAsyncPVAttachIO ( const casAsyncPVAttachIO & ); + casAsyncPVAttachIO & operator = ( const casAsyncPVAttachIO & ); }; // @@ -967,7 +981,10 @@ private: class casAsyncPVCreateIO : private casAsyncPVAttachIO { public: epicsShareFunc casAsyncPVCreateIO(const casCtx &ctx); - epicsShareFunc virtual ~casAsyncPVCreateIO(); + epicsShareFunc virtual ~casAsyncPVCreateIO(); +private: + casAsyncPVCreateIO ( const casAsyncPVCreateIO & ); + casAsyncPVCreateIO & operator = ( const casAsyncPVCreateIO & ); }; // TODO: diff --git a/src/cas/generic/outBuf.cc b/src/cas/generic/outBuf.cc index 59eee3661..7af5b6dab 100644 --- a/src/cas/generic/outBuf.cc +++ b/src/cas/generic/outBuf.cc @@ -103,8 +103,8 @@ caStatus outBuf::allocRawMsg (bufSizeT msgsize, void **ppMsg) // void outBuf::commitMsg () { - caHdr *mp; - ca_uint16_t diff; + caHdr *mp; + unsigned diff; ca_uint16_t extSize; mp = (caHdr *) &this->pBuf[this->stack]; diff --git a/src/cas/generic/server.h b/src/cas/generic/server.h index 327265529..94aad6289 100644 --- a/src/cas/generic/server.h +++ b/src/cas/generic/server.h @@ -157,6 +157,8 @@ private: virtual void eventFlush () = 0; virtual void eventSignal () = 0; virtual casRes *lookupRes (const caResId &idIn, casResType type) = 0; + casEventSys ( const casEventSys & ); + casEventSys & operator = ( const casEventSys & ); }; // @@ -180,6 +182,8 @@ public: virtual void destroy(); private: + casClientMon ( const casClientMon & ); + casClientMon & operator = ( const casClientMon & ); }; class casCtx { @@ -301,12 +305,13 @@ private: bufSizeT nextReadIndex; bufSizeT ioMinSize; unsigned ctxRecursCount; - virtual unsigned getDebugLevel () const = 0; virtual bufSizeT incommingBytesPresent () 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; + inBuf ( const inBuf & ); + inBuf & operator = ( const inBuf & ); }; // @@ -404,6 +409,9 @@ private: virtual flushCondition xSend (char *pBuf, bufSizeT nBytesAvailableToSend, bufSizeT nBytesNeedToBeSent, bufSizeT &nBytesSent) = 0; virtual void clientHostName (char *pBuf, unsigned bufSize) const = 0; + + outBuf ( const outBuf & ); + outBuf & operator = ( const outBuf & ); }; // @@ -468,6 +476,8 @@ protected: private: tsDLList ioInProgList; + casCoreClient ( const casCoreClient & ); + casCoreClient & operator = ( const casCoreClient & ); }; // @@ -553,6 +563,9 @@ private: static void loadProtoJumpTable(); static pCASMsgHandler msgHandlers[CA_PROTO_LAST_CMMD+1u]; static int msgHandlersInit; + + casClient ( const casClient & ); + casClient & operator = ( const casClient & ); }; // @@ -678,6 +691,9 @@ private: const caHdr &msg, const smartConstGDDPointer &pDesc, const caStatus ecaStatus); caStatus writeNotifyResponseECA_XXX (const caHdr &msg, const caStatus status); + + casStrmClient ( const casStrmClient & ); + casStrmClient & operator = ( const casStrmClient & ); }; class casDGIntfIO; @@ -761,6 +777,8 @@ private: bufSizeT cadg_nBytes; }; + casDGClient ( const casDGClient & ); + casDGClient & operator = ( const casDGClient & ); }; // @@ -776,7 +794,9 @@ public: virtual void destroy(); private: - casEventRegistry ® + casEventRegistry ® + casEventMaskEntry ( const casEventMaskEntry & ); + casEventMaskEntry & operator = ( const casEventMaskEntry & ); }; // @@ -796,8 +816,10 @@ public: private: unsigned maskBitAllocator; - + casEventMask maskAllocator(); + casEventRegistry ( const casEventRegistry & ); + casEventRegistry & operator = ( const casEventRegistry & ); }; #include "casIOD.h" // IO dependent @@ -910,6 +932,9 @@ private: caStatus attachInterface (const caNetAddr &addr, bool autoBeaconAddr, bool addConfigAddr); + + caServerI ( const caServerI & ); + caServerI & operator = ( const caServerI & ); }; #define CAServerConnectPendQueueSize 10 diff --git a/src/cas/generic/st/caServerOS.cc b/src/cas/generic/st/caServerOS.cc index 5414b24f4..2e5893489 100644 --- a/src/cas/generic/st/caServerOS.cc +++ b/src/cas/generic/st/caServerOS.cc @@ -24,6 +24,8 @@ private: epicsTimer &timer; caServerOS &os; expireStatus expire ( const epicsTime & currentTime ); + casBeaconTimer ( const casBeaconTimer & ); + casBeaconTimer & operator = ( const casBeaconTimer & ); }; casBeaconTimer::casBeaconTimer ( double delay, caServerOS &osIn ) : @@ -61,7 +63,7 @@ caServerOS::~caServerOS() // // casBeaconTimer::expire() // -epicsTimerNotify::expireStatus casBeaconTimer::expire( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus casBeaconTimer::expire( const epicsTime & /* currentTime */ ) { os.sendBeacon (); return expireStatus ( restart, os.getBeaconPeriod() ); diff --git a/src/cas/generic/st/casDGIntfOS.cc b/src/cas/generic/st/casDGIntfOS.cc index 41b0ed084..ae571c88d 100644 --- a/src/cas/generic/st/casDGIntfOS.cc +++ b/src/cas/generic/st/casDGIntfOS.cc @@ -27,8 +27,9 @@ public: void show (unsigned level) const; private: casDGIntfOS &os; - void callBack (); + casDGReadReg ( const casDGReadReg & ); + casDGReadReg & operator = ( const casDGReadReg & ); }; // @@ -43,8 +44,9 @@ public: void show (unsigned level) const; private: casDGIntfOS &os; - void callBack (); + casDGBCastReadReg ( const casDGBCastReadReg & ); + casDGBCastReadReg & operator = ( const casDGBCastReadReg & ); }; // @@ -59,8 +61,9 @@ public: void show (unsigned level) const; private: casDGIntfOS &os; - void callBack (); + casDGWriteReg ( const casDGWriteReg & ); + casDGWriteReg & operator = ( const casDGWriteReg & ); }; // @@ -128,7 +131,7 @@ void casDGEvWakeup::show ( unsigned level ) const // // casDGEvWakeup::expire() // -epicsTimerNotify::expireStatus casDGEvWakeup::expire ( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus casDGEvWakeup::expire ( const epicsTime & /* currentTime */ ) { this->pOS->casEventSys::process(); this->pOS = 0; @@ -158,7 +161,7 @@ casDGIOWakeup::~casDGIOWakeup() // guarantees that we will not call processInput() // recursively // -epicsTimerNotify::expireStatus casDGIOWakeup::expire( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus casDGIOWakeup::expire( const epicsTime & /* currentTime */ ) { // // in case there is something in the input buffer diff --git a/src/cas/generic/st/casIntfOS.cc b/src/cas/generic/st/casIntfOS.cc index 45a38e01f..b80ec9e22 100644 --- a/src/cas/generic/st/casIntfOS.cc +++ b/src/cas/generic/st/casIntfOS.cc @@ -18,13 +18,14 @@ // class casServerReg : public fdReg { public: - casServerReg (casIntfOS &osIn) : - fdReg (osIn.casIntfIO::getFD(), fdrRead), os (osIn) {} - ~casServerReg (); + casServerReg (casIntfOS &osIn) : + fdReg (osIn.casIntfIO::getFD(), fdrRead), os (osIn) {} + ~casServerReg (); private: - casIntfOS &os; - - void callBack (); + casIntfOS &os; + void callBack (); + casServerReg ( const casServerReg & ); + casServerReg & operator = ( const casServerReg & ); }; // diff --git a/src/cas/generic/st/casOSD.h b/src/cas/generic/st/casOSD.h index 8ba707c22..f9db1b3e2 100644 --- a/src/cas/generic/st/casOSD.h +++ b/src/cas/generic/st/casOSD.h @@ -55,6 +55,8 @@ private: epicsTimer &timer; class casDGIntfOS *pOS; expireStatus expire( const epicsTime & currentTime ); + casDGEvWakeup ( const casDGEvWakeup & ); + casDGEvWakeup & operator = ( const casDGEvWakeup & ); }; // @@ -70,6 +72,8 @@ private: epicsTimer &timer; class casDGIntfOS *pOS; expireStatus expire( const epicsTime & currentTime ); + casDGIOWakeup ( const casDGIOWakeup & ); + casDGIOWakeup & operator = ( const casDGIOWakeup & ); }; // @@ -113,6 +117,8 @@ private: void eventSignal (); void eventFlush (); + casDGIntfOS ( const casDGIntfOS & ); + casDGIntfOS & operator = ( const casDGIntfOS & ); }; // @@ -134,6 +140,9 @@ public: private: caServerI &cas; casServerReg *pRdReg; + + casIntfOS ( const casIntfOS & ); + casIntfOS & operator = ( const casIntfOS & ); }; class casStreamWriteReg; @@ -152,6 +161,8 @@ private: epicsTimer &timer; casStreamOS *pOS; expireStatus expire ( const epicsTime & currentTime ); + casStreamIOWakeup ( const casStreamIOWakeup & ); + casStreamIOWakeup & operator = ( const casStreamIOWakeup & ); }; // @@ -167,6 +178,8 @@ private: epicsTimer &timer; casStreamOS *pOS; expireStatus expire ( const epicsTime & currentTime ); + casStreamEvWakeup ( const casStreamEvWakeup & ); + casStreamEvWakeup & operator = ( const casStreamEvWakeup & ); }; // @@ -206,6 +219,9 @@ private: void eventSignal (); void eventFlush (); + + casStreamOS ( const casStreamOS & ); + casStreamOS & operator = ( const casStreamOS & ); }; // no additions below this line diff --git a/src/cas/generic/st/casStreamOS.cc b/src/cas/generic/st/casStreamOS.cc index 7f817a94d..99c921d77 100644 --- a/src/cas/generic/st/casStreamOS.cc +++ b/src/cas/generic/st/casStreamOS.cc @@ -25,8 +25,10 @@ public: inline ~casStreamReadReg (); void show (unsigned level) const; private: - casStreamOS &os; + casStreamOS &os; void callBack (); + casStreamReadReg ( const casStreamReadReg & ); + casStreamReadReg & operator = ( const casStreamReadReg & ); }; // @@ -64,14 +66,15 @@ inline casStreamReadReg::~casStreamReadReg () // class casStreamWriteReg : public fdReg { public: - inline casStreamWriteReg (casStreamOS &osIn); - inline ~casStreamWriteReg (); - - void show (unsigned level) const; + inline casStreamWriteReg (casStreamOS &osIn); + inline ~casStreamWriteReg (); + + void show (unsigned level) const; private: - casStreamOS &os; - - void callBack (); + casStreamOS &os; + void callBack (); + casStreamWriteReg ( const casStreamWriteReg & ); + casStreamWriteReg & operator = ( const casStreamWriteReg & ); }; // @@ -134,7 +137,7 @@ void casStreamEvWakeup::show(unsigned level) const // // casStreamEvWakeup::expire() // -epicsTimerNotify::expireStatus casStreamEvWakeup::expire( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus casStreamEvWakeup::expire( const epicsTime & /* currentTime */ ) { casStreamOS &os = *this->pOS; this->pOS = 0; @@ -206,7 +209,7 @@ void casStreamIOWakeup::show ( unsigned level ) const // guarantees that we will not call processInput() // recursively // -epicsTimerNotify::expireStatus casStreamIOWakeup::expire ( const epicsTime & currentTime ) +epicsTimerNotify::expireStatus casStreamIOWakeup::expire ( const epicsTime & /* currentTime */ ) { // // in case there is something in the input buffer diff --git a/src/cas/io/bsdSocket/casDGIntfIO.cc b/src/cas/io/bsdSocket/casDGIntfIO.cc index c4fdd6ee2..69d478aec 100644 --- a/src/cas/io/bsdSocket/casDGIntfIO.cc +++ b/src/cas/io/bsdSocket/casDGIntfIO.cc @@ -111,9 +111,12 @@ casDGIntfIO::casDGIntfIO (caServerI &serverIn, const caNetAddr &addr, // { osiSockAddrNode *pAddr; + ELLLIST tmpList; - osiSockDiscoverBroadcastAddresses (&BCastAddrList, + ellInit ( &tmpList ); + osiSockDiscoverBroadcastAddresses (&tmpList, this->sock, &serverAddr); // match addr + removeDuplicatesAddresses ( &BCastAddrList, &tmpList, 1 ); if (ellCount(&BCastAddrList)<1) { errMessage (S_cas_noInterface, "unable to continue"); socket_close (this->sock); @@ -165,7 +168,7 @@ casDGIntfIO::casDGIntfIO (caServerI &serverIn, const caNetAddr &addr, &BCastAddrList, pParam, beaconPort); } - removeDuplicatesAddresses ( &this->beaconAddrList, &BCastAddrList ); + removeDuplicatesAddresses ( &this->beaconAddrList, &BCastAddrList, 0 ); // // Solaris specific: diff --git a/src/cas/io/bsdSocket/casIOD.h b/src/cas/io/bsdSocket/casIOD.h index 7c108d492..da835d692 100644 --- a/src/cas/io/bsdSocket/casIOD.h +++ b/src/cas/io/bsdSocket/casIOD.h @@ -55,6 +55,8 @@ private: unsigned short dgPort; static SOCKET makeSockDG (); + casDGIntfIO ( const casDGIntfIO & ); + casDGIntfIO & operator = ( const casDGIntfIO & ); }; struct ioArgsToNewStreamIO { @@ -98,6 +100,8 @@ private: SOCKET sock; struct sockaddr_in addr; xBlockingStatus blockingFlag; + casStreamIO ( const casStreamIO & ); + casStreamIO & operator = ( const casStreamIO & ); }; class caServerIO; diff --git a/src/cas/io/bsdSocket/casIntfIO.cc b/src/cas/io/bsdSocket/casIntfIO.cc index 7eb181952..5b69ab99e 100644 --- a/src/cas/io/bsdSocket/casIntfIO.cc +++ b/src/cas/io/bsdSocket/casIntfIO.cc @@ -22,7 +22,6 @@ casIntfIO::casIntfIO (const caNetAddr &addrIn) : sock (INVALID_SOCKET), addr (addrIn.getSockIP()) { - int yes = TRUE; int status; osiSocklen_t addrSize; bool portChange; @@ -48,6 +47,7 @@ casIntfIO::casIntfIO (const caNetAddr &addrIn) : * they exit ( even if SO_REUSEADDR isnt set ). */ # ifndef SO_REUSEADDR_ALLOWS_SIMULTANEOUS_TCP_SERVERS_TO_USE_SAME_PORT + int yes = TRUE; status = setsockopt ( this->sock, SOL_SOCKET, diff --git a/src/db/dbEvent.c b/src/db/dbEvent.c index b76ffc224..a1b22cc12 100644 --- a/src/db/dbEvent.c +++ b/src/db/dbEvent.c @@ -23,6 +23,7 @@ of this distribution. #include #include #include +#include #include "epicsAssert.h" #include "cantProceed.h" @@ -113,7 +114,7 @@ struct event_user { */ #define RNGINC(OLD)\ -((OLD)+1)>=EVENTQUESIZE ? 0 : ((OLD)+1) +( (unsigned short) ( (OLD) >= (EVENTQUESIZE-1) ? 0 : (OLD)+1 ) ) #define RNGSPACE(EVQ)\ ( ( ((EVQ)->getix)>((EVQ)->putix) ) ? \ @@ -343,7 +344,7 @@ dbEventSubscription epicsShareAPI db_add_event ( /* * Don't add events which will not be triggered */ - if (!select) { + if ( select==0 || select > UCHAR_MAX ) { return NULL; } @@ -385,7 +386,7 @@ dbEventSubscription epicsShareAPI db_add_event ( pevent->user_sub = user_sub; pevent->user_arg = user_arg; pevent->paddr = paddr; - pevent->select = select; + pevent->select = (unsigned char) select; pevent->pLastLog = NULL; /* not yet in the queue */ pevent->callBackInProgress = FALSE; pevent->enabled = FALSE; @@ -672,7 +673,7 @@ LOCAL void db_post_single_event_private (struct evSubscrip *event) else { firstEventFlag = 0; } - ev_que->putix = RNGINC(ev_que->putix); + ev_que->putix = RNGINC ( ev_que->putix ); } else { /*