Clean up Clang 15 sprintf() warnings in libcom and ca

This commit is contained in:
Andrew Johnson
2023-12-12 13:53:33 -06:00
parent 56dbc949ff
commit 5ecf7d18a8
7 changed files with 10 additions and 9 deletions

View File

@@ -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])