diff --git a/modules/ca/src/client/acctst.c b/modules/ca/src/client/acctst.c index 34298680c..44cc0673a 100644 --- a/modules/ca/src/client/acctst.c +++ b/modules/ca/src/client/acctst.c @@ -2575,7 +2575,8 @@ void monitorUpdateTest ( chid chan, unsigned interestLevel ) SEVCHK ( ca_get ( DBR_FLOAT, chan, &temp ), NULL ); SEVCHK ( ca_pend_io ( timeoutToPendIO ), NULL ); - /* printf ( "flow control bypassed %u events\n", flowCtrlCount ); */ + if (0) + printf ( "flow control bypassed %u events\n", flowCtrlCount ); showProgressEnd ( interestLevel ); } diff --git a/modules/ca/src/client/cac.cpp b/modules/ca/src/client/cac.cpp index f8d1d0800..cb09d8d78 100644 --- a/modules/ca/src/client/cac.cpp +++ b/modules/ca/src/client/cac.cpp @@ -1008,7 +1008,7 @@ bool cac::defaultExcep ( char buf[512]; char hostName[64]; iiu.getHostName ( guard, hostName, sizeof ( hostName ) ); - sprintf ( buf, "host=%s ctx=%.400s", hostName, pCtx ); + snprintf( buf, sizeof(buf), "host=%s ctx=%.400s", hostName, pCtx ); this->notify.exception ( guard, status, buf, 0, 0u ); return true; } @@ -1312,7 +1312,7 @@ void cac::pvMultiplyDefinedNotify ( msgForMultiplyDefinedPV & mfmdpv, const char * pChannelName, const char * pAcc, const char * pRej ) { char buf[256]; - sprintf ( buf, "Channel: \"%.64s\", Connecting to: %.64s, Ignored: %.64s", + snprintf( buf, sizeof(buf), "Channel: \"%.64s\", Connecting to: %.64s, Ignored: %.64s", pChannelName, pAcc, pRej ); { callbackManager mgr ( this->notify, this->cbMutex ); diff --git a/modules/libcom/src/osi/epicsTime.cpp b/modules/libcom/src/osi/epicsTime.cpp index 43442225e..ae7eb25eb 100644 --- a/modules/libcom/src/osi/epicsTime.cpp +++ b/modules/libcom/src/osi/epicsTime.cpp @@ -238,7 +238,7 @@ size_t epicsStdCall epicsTimeToStrftime (char *pBuff, size_t bufLength, const ch // convert nanosecs to integer of correct range frac /= div[fracWid]; char fracFormat[32]; - sprintf ( fracFormat, "%%0%lulu", fracWid ); + snprintf ( fracFormat, sizeof ( fracFormat ), "%%0%lulu", fracWid ); int status = epicsSnprintf ( pBufCur, bufLenLeft, fracFormat, frac ); if ( status > 0 ) { unsigned long nChar = static_cast < unsigned long > ( status ); diff --git a/modules/libcom/test/epicsEventTest.cpp b/modules/libcom/test/epicsEventTest.cpp index cc73f8398..7f93c36a9 100644 --- a/modules/libcom/test/epicsEventTest.cpp +++ b/modules/libcom/test/epicsEventTest.cpp @@ -244,7 +244,7 @@ MAIN(epicsEventTest) name = (char **)calloc(nthreads, sizeof(char *)); for(int i = 0; i < nthreads; i++) { name[i] = (char *)calloc(16, sizeof(char)); - sprintf(name[i],"producer %d",i); + snprintf(name[i], 16, "producer %d",i); id[i] = epicsThreadCreate(name[i], 40, stackSize, producer, pinfo); epicsThreadSleep(0.1); } diff --git a/modules/libcom/test/epicsMessageQueueTest.cpp b/modules/libcom/test/epicsMessageQueueTest.cpp index d245cde89..d78cfdbd9 100644 --- a/modules/libcom/test/epicsMessageQueueTest.cpp +++ b/modules/libcom/test/epicsMessageQueueTest.cpp @@ -232,7 +232,7 @@ sender(void *arg) int i = 0; while (!sendExit) { - len = sprintf(cbuf, "%s -- %d.", epicsThreadGetNameSelf(), ++i); + len = snprintf(cbuf, sizeof(cbuf), "%s -- %d.", epicsThreadGetNameSelf(), ++i); while (q->trySend((void *)cbuf, len) < 0) epicsThreadSleep(0.005 * (randBelow(5))); epicsThreadSleep(0.005 * (randBelow(20))); @@ -421,7 +421,7 @@ extern "C" void messageQueueTest(void *parm) epicsThreadPriorityHigh, epicsThreadPriorityHigh }; - sprintf(name, "Sender %d", i+1); + snprintf(name, sizeof(name), "Sender %d", i+1); opts.priority = pri[i]; senderId[i] = epicsThreadCreateOpt(name, sender, &q1, &opts); if (!senderId[i]) diff --git a/modules/libcom/test/epicsMutexTest.cpp b/modules/libcom/test/epicsMutexTest.cpp index 3086f679a..5228e9bed 100644 --- a/modules/libcom/test/epicsMutexTest.cpp +++ b/modules/libcom/test/epicsMutexTest.cpp @@ -266,7 +266,7 @@ MAIN(epicsMutexTest) stackSize = epicsThreadGetStackSize(epicsThreadStackSmall); for(i=0; ithreadnum = i; pinfo[i]->mutex = mutex; diff --git a/modules/libcom/test/epicsThreadTest.cpp b/modules/libcom/test/epicsThreadTest.cpp index 24ca294cc..573739f39 100644 --- a/modules/libcom/test/epicsThreadTest.cpp +++ b/modules/libcom/test/epicsThreadTest.cpp @@ -73,7 +73,7 @@ void testMyThread() int startPriority = 0; for (int i = 0; i < ntasks; i++) { char name[10]; - sprintf(name, "t%d", i); + snprintf(name, sizeof(name), "t%d", i); myThreads[i] = new myThread(i, name); if (i == 0) startPriority = myThreads[i]->thread.getPriority();