link and format

This commit is contained in:
Erik Frojdh
2019-02-16 16:46:09 +01:00
parent d0e1289c1b
commit b52c6b05b8
4 changed files with 23 additions and 23 deletions

View File

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

View File

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

View File

@ -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;
} }
} }

View File

@ -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';
} }