diff --git a/src/ca/addrList.h b/src/ca/addrList.h index 1c95363b2..d95dd3d22 100644 --- a/src/ca/addrList.h +++ b/src/ca/addrList.h @@ -23,7 +23,6 @@ epicsShareFunc void caAddConfiguredAddr ( cac *pcac, ELLLIST *pList, const ENV_PARAM *pEnv, - SOCKET socket, unsigned short port); int local_addr(SOCKET socket, struct sockaddr_in *plcladdr); diff --git a/src/ca/iocinf.cpp b/src/ca/iocinf.cpp index 5de924456..d2312f3a1 100644 --- a/src/ca/iocinf.cpp +++ b/src/ca/iocinf.cpp @@ -221,7 +221,7 @@ LOCAL void cac_tcp_recv_msg (tcpiiu *piiu) /* * cacSendThreadTCP () */ -LOCAL void cacSendThreadTCP (void *pParam) +extern "C" void cacSendThreadTCP (void *pParam) { tcpiiu *piiu = (tcpiiu *) pParam; @@ -279,7 +279,7 @@ LOCAL void cacSendThreadTCP (void *pParam) /* * cacRecvThreadTCP () */ -LOCAL void cacRecvThreadTCP (void *pParam) +extern "C" void cacRecvThreadTCP (void *pParam) { tcpiiu *piiu = (tcpiiu *) pParam; unsigned chanDisconnectCount; @@ -591,7 +591,7 @@ LOCAL int cac_udp_recv_msg (udpiiu *piiu) /* * cacRecvThreadUDP () */ -LOCAL void cacRecvThreadUDP (void *pParam) +extern "C" void cacRecvThreadUDP (void *pParam) { udpiiu *piiu = (udpiiu *) pParam; int status; @@ -724,7 +724,7 @@ void notify_ca_repeater (udpiiu *piiu) /* * cacSendThreadUDP () */ -LOCAL void cacSendThreadUDP (void *pParam) +extern "C" void cacSendThreadUDP (void *pParam) { udpiiu *piiu = (udpiiu *) pParam; @@ -856,7 +856,7 @@ LOCAL char *getToken(const char **ppString, char *pBuf, unsigned bufSIze) * caAddConfiguredAddr() */ void caAddConfiguredAddr (cac *pcac, ELLLIST *pList, const ENV_PARAM *pEnv, - SOCKET socket, unsigned short port) + unsigned short port) { osiSockAddrNode *pNewNode; const char *pStr; @@ -938,7 +938,7 @@ void caSetupBCastAddrList (cac *pcac, ELLLIST *pList, osiSockDiscoverBroadcastAddresses ( &tmpList, sock, &addr ); } - caAddConfiguredAddr (pcac, &tmpList, &EPICS_CA_ADDR_LIST, sock, port ); + caAddConfiguredAddr (pcac, &tmpList, &EPICS_CA_ADDR_LIST, port ); /* * eliminate duplicates and set the port @@ -1054,26 +1054,26 @@ int repeater_installed (udpiiu *piiu) // udpiiu::udpiiu () // udpiiu::udpiiu (cac *pcac) : - searchTmr (*this, pcac->timerQueue), repeaterSubscribeTmr (*this, pcac->timerQueue) + searchTmr (*this, pcac->timerQueue), + repeaterSubscribeTmr (*this, pcac->timerQueue) { static const unsigned short PORT_ANY = 0u; osiSockAddr addr; int boolValue = TRUE; - SOCKET sock; int status; threadId tid; this->repeaterPort = caFetchPortConfig (pcac, &EPICS_CA_REPEATER_PORT, CA_REPEATER_PORT); - sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (sock == INVALID_SOCKET) { + this->sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (this->sock == INVALID_SOCKET) { ca_printf (pcac, "CAC: unable to create datagram socket because = \"%s\"\n", SOCKERRSTR (SOCKERRNO)); throwWithLocation ( noSocket () ); } - status = setsockopt ( sock, SOL_SOCKET, SO_BROADCAST, + status = setsockopt ( this->sock, SOL_SOCKET, SO_BROADCAST, (char *) &boolValue, sizeof (boolValue) ); if (status<0) { ca_printf (pcac, "CAC: unable to enable IP broadcasting because = \"%s\"\n", @@ -1089,7 +1089,7 @@ udpiiu::udpiiu (cac *pcac) : * bump up the UDP recv buffer */ int size = 1u<<15u; - status = setsockopt ( sock, SOL_SOCKET, SO_RCVBUF, + status = setsockopt ( this->sock, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof (size) ); if (status<0) { ca_printf ("CAC: unable to set socket option SO_RCVBUF because \"%s\"\n", @@ -1106,9 +1106,9 @@ udpiiu::udpiiu (cac *pcac) : addr.ia.sin_family = AF_INET; addr.ia.sin_addr.s_addr = htonl (INADDR_ANY); addr.ia.sin_port = htons (PORT_ANY); - status = bind (sock, &addr.sa, sizeof (addr) ); + status = bind (this->sock, &addr.sa, sizeof (addr) ); if (status<0) { - socket_close (sock); + socket_close (this->sock); ca_printf (pcac, "CAC: unable to bind to an unconstrained address because = \"%s\"\n", SOCKERRSTR (SOCKERRNO)); throwWithLocation ( noSocket () ); @@ -1116,7 +1116,6 @@ udpiiu::udpiiu (cac *pcac) : constructNIIU (pcac, &this->niiu); - this->sock = sock; this->nBytesInXmitBuf = 0u; this->contactRepeater = 0u; this->repeaterContacted = 0u; @@ -1208,8 +1207,6 @@ udpiiu::udpiiu (cac *pcac) : */ osptr = osiSpawnDetachedProcess ("CA Repeater", "caRepeater"); if (osptr==osiSpawnDetachedProcessNoSupport) { - threadId tid; - tid = threadCreate ( "CA repeater", threadPriorityChannelAccessClient, diff --git a/src/ca/iocinf.h b/src/ca/iocinf.h index 24c22accd..e0bf3a03a 100644 --- a/src/ca/iocinf.h +++ b/src/ca/iocinf.h @@ -608,7 +608,7 @@ tcpiiu *iiuToTCPIIU (baseIIU *pIn); netIIU *iiuToNIIU (baseIIU *pIn); lclIIU *iiuToLIIU (baseIIU *pIn); int fetchClientContext (cac **ppcac); -void caRepeaterThread (void *pDummy); +extern "C" void caRepeaterThread (void *pDummy); unsigned short caFetchPortConfig (cac *pcac, const ENV_PARAM *pEnv, unsigned short defaultPort); diff --git a/src/ca/repeater.cpp b/src/ca/repeater.cpp index 3c6830160..5b95fc9b1 100644 --- a/src/ca/repeater.cpp +++ b/src/ca/repeater.cpp @@ -481,7 +481,7 @@ void epicsShareAPI ca_repeater () /* * caRepeaterThread () */ -void caRepeaterThread (void *pDummy) +void caRepeaterThread (void * /* pDummy */ ) { taskwdInsert (threadGetIdSelf(), NULL, NULL); ca_repeater(); diff --git a/src/ca/repeaterSubscribeTimer.cpp b/src/ca/repeaterSubscribeTimer.cpp index 626cd3e25..0430711e5 100644 --- a/src/ca/repeaterSubscribeTimer.cpp +++ b/src/ca/repeaterSubscribeTimer.cpp @@ -44,7 +44,7 @@ double repeaterSubscribeTimer::delay () const return REPEATER_TRY_PERIOD; } -void repeaterSubscribeTimer::show (unsigned level) const +void repeaterSubscribeTimer::show (unsigned /* level */ ) const { } diff --git a/src/ca/ringBuffer.cpp b/src/ca/ringBuffer.cpp index 73112bb3e..98430e4c2 100644 --- a/src/ca/ringBuffer.cpp +++ b/src/ca/ringBuffer.cpp @@ -171,7 +171,7 @@ static inline unsigned cacRingBufferContiguousWriteSize (ringBuffer *pBuf) * returns the number of bytes read which may be less than * the number requested. */ -static inline unsigned cacRingBufferReadPartial (ringBuffer *pRing, void *pBuf, +static unsigned cacRingBufferReadPartial (ringBuffer *pRing, void *pBuf, unsigned nBytes) { unsigned totalBytes; @@ -256,7 +256,7 @@ unsigned cacRingBufferRead (ringBuffer *pRing, void *pBuf, * returns the number of bytes written which may be less than * the number requested. */ -static inline unsigned cacRingBufferWritePartial (ringBuffer *pRing, +static unsigned cacRingBufferWritePartial (ringBuffer *pRing, const void *pBuf, unsigned nBytes) { unsigned totalBytes; diff --git a/src/ca/searchTimer.cpp b/src/ca/searchTimer.cpp index 574278989..64df82bfa 100644 --- a/src/ca/searchTimer.cpp +++ b/src/ca/searchTimer.cpp @@ -33,14 +33,14 @@ searchTimer::searchTimer (udpiiu &iiuIn, osiTimerQueue &queueIn) : // // searchTimer::reset () // -void searchTimer::reset (double period) +void searchTimer::reset (double periodIn) { LOCK (this->iiu.niiu.iiu.pcas); this->retry = 0; - this->period = period; + this->period = periodIn; UNLOCK (this->iiu.niiu.iiu.pcas); - if (this->timeRemaining()>period) { + if (this->timeRemaining()>this->period) { this->reschedule (0.0); } } @@ -338,7 +338,7 @@ double searchTimer::delay () const return this->period; } -void searchTimer::show (unsigned level) const +void searchTimer::show (unsigned /* level */) const { } diff --git a/src/ca/syncgrp.cpp b/src/ca/syncgrp.cpp index 5fdeabf26..b4f1c4deb 100644 --- a/src/ca/syncgrp.cpp +++ b/src/ca/syncgrp.cpp @@ -417,9 +417,9 @@ int epicsShareAPI ca_sg_test (const CA_SYNC_GID gid) } /* - * io_complete() + * ca_sync_grp_io_complete () */ -LOCAL void io_complete (struct event_handler_args args) +extern "C" void ca_sync_grp_io_complete (struct event_handler_args args) { unsigned long size; CASGOP *pcasgop; @@ -538,7 +538,7 @@ const void *pvalue) UNLOCK (pcac); status = ca_array_put_callback (type, count, chix, - pvalue, io_complete, pcasgop); + pvalue, ca_sync_grp_io_complete, pcasgop); if (status != ECA_NORMAL) { LOCK (pcac); assert (pcasg->opPendCount>=1u); @@ -600,20 +600,16 @@ void *pvalue) UNLOCK (pcac); - status = ca_array_get_callback( - type, - count, - chix, - io_complete, - pcasgop); + status = ca_array_get_callback ( + type, count, chix, ca_sync_grp_io_complete, pcasgop); if(status != ECA_NORMAL){ LOCK (pcac); - assert(pcasg->opPendCount>=1u); + assert (pcasg->opPendCount>=1u); pcasg->opPendCount--; - ellDelete(&pcac->activeCASGOP, &pcasgop->node); + ellDelete (&pcac->activeCASGOP, &pcasgop->node); UNLOCK (pcac); - freeListFree(pcac->ca_sgopFreeListPVT, pcasgop); + freeListFree (pcac->ca_sgopFreeListPVT, pcasgop); } return status; }