From b610c8b3fe8ed80f3a0b59aae20903d9b881b95c Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 16 Jun 1998 00:24:26 +0000 Subject: [PATCH] avoid purify warning --- src/ca/access.c | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/src/ca/access.c b/src/ca/access.c index 91ad3a00b..bf96a8e30 100644 --- a/src/ca/access.c +++ b/src/ca/access.c @@ -99,6 +99,9 @@ /************************************************************************/ /* * $Log$ + * Revision 1.103 1998/04/23 01:04:05 jhill + * fixed overzelous chan check in ca_clear_channel() - when the PV is local under vxWorks + * * Revision 1.102 1998/04/13 19:14:33 jhill * fixed task variable problem * @@ -1328,6 +1331,10 @@ const void *arg if (count > chix->privCount) return ECA_BADCOUNT; + if (pfunc==NULL) { + return ECA_BADFUNCPTR; + } + if(!chix->ar.read_access){ return ECA_NORDACCESS; } @@ -1554,6 +1561,10 @@ const void *usrarg return ECA_NOWTACCESS; } + if (pfunc==NULL) { + return ECA_BADFUNCPTR; + } + /* * check for valid count */ @@ -1873,8 +1884,13 @@ const void *pvalue /* * No compound types here because these types are read only * and therefore only appropriate for gets or monitors + * + * I changed from a for to a while loop here to avoid bounds + * checker pointer out of range error, and unused pointer + * update when it is a single element. */ - for (i=0; i< count; i++) { + i=0; + while (TRUE) { switch (type) { case DBR_LONG: *(long *)pdest = htonl (*(dbr_long_t *)pvalue); @@ -1913,6 +1929,11 @@ const void *pvalue UNLOCK; return ECA_BADTYPE; } + + if (++i>=count) { + break; + } + pdest = ((char *)pdest) + size_of_one; pvalue = ((char *)pvalue) + size_of_one; } @@ -2127,6 +2148,10 @@ long mask return ECA_TOLARGE; } + if (ast==NULL) { + return ECA_BADFUNCPTR; + } + if(!mask) return ECA_BADMASK; @@ -2766,7 +2791,7 @@ int epicsShareAPI ca_pend (ca_real timeout, int early) */ ca_static->ca_flush_pending = TRUE; - if(pndrecvcnt==0u && early){ + if(pndrecvcnt==0u && early){ /* * force the flush */ @@ -2789,16 +2814,15 @@ int epicsShareAPI ca_pend (ca_real timeout, int early) while(TRUE){ ca_real remaining; - if (pndrecvcnt==0 && early) { + if (pndrecvcnt==0 && early) { /* * force the flush */ CLR_CA_TIME (&tmo); cac_mux_io(&tmo); - return ECA_NORMAL; + return ECA_NORMAL; } - - if(timeout == 0.0){ + if(timeout == 0.0){ remaining = cac_fetch_poll_period(); } else{ @@ -2838,6 +2862,12 @@ int epicsShareAPI ca_pend (ca_real timeout, int early) * force the flush */ CLR_CA_TIME (&tmo); + /* + * unfortunately this causes additional messages + * to be read and so it is possible in rare circumstances + * for ECA_TIMEOUT to be returned when the IO completed + * during the pend io timeout clean up phase. + */ cac_block_for_io_completion (&tmo); return ECA_TIMEOUT; } @@ -3378,7 +3408,7 @@ int issue_claim_channel (chid pchan) /* * dont broadcast */ - if (piiu == piiuCast) { + if (piiu == piiuCast) { ca_printf("CAC: UDP claim attempted?\n"); UNLOCK; return ECA_INTERNAL;