Clang warnings: sprintf() => epicsSnprintf()
This commit is contained in:
committed by
mdavidsaver
parent
d0ff9a9592
commit
0c1773f25d
@@ -15,6 +15,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include <epicsString.h>
|
||||
#include <epicsStdio.h>
|
||||
#include <epicsMutex.h>
|
||||
#include <epicsThread.h>
|
||||
|
||||
@@ -378,7 +379,8 @@ BoundedScalarArray::BoundedScalarArray(ScalarType elementType, size_t size)
|
||||
string BoundedScalarArray::getID() const
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf(buffer, "%s<%zu>", ScalarTypeFunc::name(getElementType()), size);
|
||||
epicsSnprintf(buffer, sizeof(buffer), "%s<%lu>",
|
||||
ScalarTypeFunc::name(getElementType()), (unsigned long) size);
|
||||
return string(buffer);
|
||||
}
|
||||
|
||||
@@ -403,7 +405,8 @@ FixedScalarArray::FixedScalarArray(ScalarType elementType, size_t size)
|
||||
string FixedScalarArray::getID() const
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf(buffer, "%s[%zu]", ScalarTypeFunc::name(getElementType()), size);
|
||||
epicsSnprintf(buffer, sizeof(buffer), "%s[%lu]",
|
||||
ScalarTypeFunc::name(getElementType()), (unsigned long) size);
|
||||
return string(buffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <testMain.h>
|
||||
#include <epicsUnitTest.h>
|
||||
#include <epicsStdio.h>
|
||||
|
||||
#include <pv/current_function.h>
|
||||
#include <pv/pvData.h>
|
||||
@@ -54,7 +55,7 @@ void buildMiss()
|
||||
for(size_t i=0; i<1000; i++) {
|
||||
// unique name each time to (partially) defeat caching
|
||||
char buf[10];
|
||||
sprintf(buf, "field%zu", i);
|
||||
epicsSnprintf(buf, sizeof(buf), "field%lu", (unsigned long) i);
|
||||
|
||||
record.start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user