mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 22:07:12 +02:00
Merge branch 'refactor' of github.com:slsdetectorgroup/slsDetectorPackage into refactor
This commit is contained in:
@ -49,10 +49,13 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||||
message(FATAL_ERROR "GCC version must be at least 4.8!")
|
message(FATAL_ERROR "GCC version must be at least 4.8!")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation -Wno-stringop-truncation -Wno-class-memaccess")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Suppressed warnings in GCC
|
||||||
|
# -Wno-stringop-truncation happens when we do sls::strcpy_safe truncates string instead of overwrite buffer
|
||||||
|
# -Wno-class-memaccess - on memcpy in rapidjson should be investigated upgrade implementation?
|
||||||
|
# -Wno-misleading-indentation - until clang format
|
||||||
|
|
||||||
#set (CMAKE_CXX_STANDARD 11)
|
#set (CMAKE_CXX_STANDARD 11)
|
||||||
#set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
#set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
@ -23,7 +23,6 @@ target_include_directories(slsDetectorShared PUBLIC
|
|||||||
target_link_libraries(slsDetectorShared PUBLIC
|
target_link_libraries(slsDetectorShared PUBLIC
|
||||||
slsSupportLib
|
slsSupportLib
|
||||||
${ZeroMQ_LIBRARIES}
|
${ZeroMQ_LIBRARIES}
|
||||||
zmq
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PUBLICHEADERS
|
set(PUBLICHEADERS
|
||||||
|
@ -512,7 +512,6 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
|||||||
|
|
||||||
detectors[pos]->setHostname(hostname);
|
detectors[pos]->setHostname(hostname);
|
||||||
detectors[pos]->setOnline(true);
|
detectors[pos]->setOnline(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum(int detPos) {
|
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum(int detPos) {
|
||||||
@ -2116,8 +2115,8 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
int xmin, xmax, ymin, ymax, channelX, channelY, idet, lastChannelX,
|
int xmin = 0, xmax = 0, ymin = 0, ymax = 0, channelX = 0, channelY = 0, idet = 0, lastChannelX = 0,
|
||||||
lastChannelY, index, offsetX, offsetY;
|
lastChannelY = 0, index = 0, offsetX = 0, offsetY = 0;
|
||||||
|
|
||||||
bool invalidroi = false;
|
bool invalidroi = false;
|
||||||
int ndet = detectors.size();
|
int ndet = detectors.size();
|
||||||
@ -2227,7 +2226,6 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
allroi[idet][index].ymin = ymin;
|
allroi[idet][index].ymin = ymin;
|
||||||
allroi[idet][index].ymax = ymax;
|
allroi[idet][index].ymax = ymax;
|
||||||
// nroi[idet] = nroi[idet] + 1;
|
// nroi[idet] = nroi[idet] + 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -14,7 +14,7 @@ Still this is better than strcpy and a buffer overflow...
|
|||||||
*/
|
*/
|
||||||
template <size_t array_size>
|
template <size_t array_size>
|
||||||
void strcpy_safe(char (&destination)[array_size], const char *source) {
|
void strcpy_safe(char (&destination)[array_size], const char *source) {
|
||||||
strncpy(destination, source, array_size);
|
strncpy(destination, source, array_size-1);
|
||||||
destination[array_size - 1] = '\0';
|
destination[array_size - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user