mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
replaced sprintf on the same buffer with strcat
This commit is contained in:
parent
4a8a72c447
commit
d0e1289c1b
@ -254,7 +254,7 @@ public:
|
|||||||
char* additionalJsonHeader = 0) {
|
char* additionalJsonHeader = 0) {
|
||||||
|
|
||||||
|
|
||||||
char buf[MAX_STR_LENGTH] = "";
|
|
||||||
/** Json Header Format */
|
/** Json Header Format */
|
||||||
const char* jsonHeaderFormat =
|
const char* jsonHeaderFormat =
|
||||||
"{"
|
"{"
|
||||||
@ -286,7 +286,8 @@ public:
|
|||||||
"\"flippedDataX\":%u"
|
"\"flippedDataX\":%u"
|
||||||
|
|
||||||
;//"}\n";
|
;//"}\n";
|
||||||
int length = sprintf(buf, jsonHeaderFormat,
|
char buf[MAX_STR_LENGTH] = "";
|
||||||
|
sprintf(buf, jsonHeaderFormat,
|
||||||
jsonversion, dynamicrange, fileIndex, npixelsx, npixelsy, imageSize,
|
jsonversion, dynamicrange, fileIndex, npixelsx, npixelsy, imageSize,
|
||||||
acqIndex, fIndex, (fname == NULL)? "":fname, dummy?0:1,
|
acqIndex, fIndex, (fname == NULL)? "":fname, dummy?0:1,
|
||||||
|
|
||||||
@ -297,11 +298,13 @@ public:
|
|||||||
//additional stuff
|
//additional stuff
|
||||||
((flippedData == 0 ) ? 0 :flippedData[0])
|
((flippedData == 0 ) ? 0 :flippedData[0])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (additionalJsonHeader && strlen(additionalJsonHeader)) {
|
if (additionalJsonHeader && strlen(additionalJsonHeader)) {
|
||||||
length = sprintf(buf, "%s, %s}\n", buf, additionalJsonHeader);
|
strcat(buf, ", ");
|
||||||
} else {
|
strcat(buf, additionalJsonHeader);
|
||||||
length = sprintf(buf, "%s}\n", buf);
|
}
|
||||||
}
|
strcat(buf, "}\n");
|
||||||
|
int length = strlen(buf);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
//if(!index)
|
//if(!index)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user