mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
printf and uninitialized variables
This commit is contained in:
parent
0e120330f4
commit
cd738106ec
@ -7,13 +7,16 @@ option (USE_TEXTCLIENT "Text Client" OFF)
|
||||
option (USE_RECEIVER "Receiver" OFF)
|
||||
option (USE_GUI "GUI" OFF)
|
||||
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++98 -Wno-misleading-indentation")
|
||||
else ()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++98")
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# clang does not support -Wno-misleading-indentation
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++98")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++98 -Wno-misleading-indentation")
|
||||
else ()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++98")
|
||||
endif ()
|
||||
endif()
|
||||
find_package(Qt4)
|
||||
find_package(Qwt 6)
|
||||
find_package(CBF)
|
||||
|
@ -2213,7 +2213,7 @@ string slsDetector::getLastClientIP() {
|
||||
|
||||
int slsDetector::exitServer() {
|
||||
|
||||
int retval;
|
||||
int retval = FAIL;
|
||||
int fnum=F_EXIT_SERVER;
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
@ -3158,13 +3158,15 @@ string slsDetector::getSettingsDir() {
|
||||
return std::string(thisDetector->settingsDir);
|
||||
}
|
||||
string slsDetector::setSettingsDir(string s) {
|
||||
sprintf(thisDetector->settingsDir, s.c_str()); return thisDetector->settingsDir;
|
||||
sprintf(thisDetector->settingsDir, "%s", s.c_str());
|
||||
return thisDetector->settingsDir;
|
||||
}
|
||||
string slsDetector::getCalDir() {
|
||||
return thisDetector->calDir;
|
||||
}
|
||||
string slsDetector::setCalDir(string s) {
|
||||
sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir;
|
||||
sprintf(thisDetector->calDir, "%s", s.c_str());
|
||||
return thisDetector->calDir;
|
||||
}
|
||||
|
||||
|
||||
@ -4338,7 +4340,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index, int imod) {
|
||||
|
||||
|
||||
int fnum=F_GET_TIME_LEFT;
|
||||
int64_t retval;
|
||||
int64_t retval = FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret=OK;
|
||||
|
||||
@ -4627,7 +4629,7 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod) {
|
||||
|
||||
dacs_t slsDetector::getADC(dacIndex index, int imod) {
|
||||
|
||||
dacs_t retval;
|
||||
dacs_t retval = 0;
|
||||
int fnum=F_GET_ADC;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
@ -6364,7 +6366,7 @@ int slsDetector::setFlippedData(dimension d, int value) {
|
||||
|
||||
int slsDetector::setAllTrimbits(int val, int imod) {
|
||||
int fnum=F_SET_ALL_TRIMBITS;
|
||||
int retval;
|
||||
int retval = FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret=OK;
|
||||
|
||||
@ -7665,17 +7667,13 @@ int slsDetector::setChip(int reg, int ichip, int imod) {
|
||||
int slsDetector::setChip(sls_detector_chip chip) {
|
||||
|
||||
int fnum=F_SET_CHIP;
|
||||
int retval;
|
||||
int retval = FAIL;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
|
||||
int ichi=chip.chip;
|
||||
int im=chip.module;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
@ -8492,7 +8490,7 @@ string slsDetector::getReceiverLastClientIP() {
|
||||
|
||||
int slsDetector::exitReceiver() {
|
||||
|
||||
int retval;
|
||||
int retval = FAIL;
|
||||
int fnum=F_EXIT_RECEIVER;
|
||||
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
@ -8664,7 +8662,7 @@ void slsDetector::sendMultiDetectorSize() {
|
||||
ret=thisReceiver->sendIntArray(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if((ret==FAIL)){
|
||||
if(ret==FAIL){
|
||||
std::cout << "Could not set position Id" << std::endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_MULTI_DET_SIZE_NOT_SET));
|
||||
}
|
||||
|
@ -3434,34 +3434,27 @@ string slsDetectorCommand::cmdAngConv(int narg, char *args[], int action){
|
||||
} else {
|
||||
return string("none");
|
||||
}
|
||||
}else{
|
||||
return "unknown action";
|
||||
}
|
||||
} else if (string(args[0])==string("globaloff")) {
|
||||
c=GLOBAL_OFFSET;
|
||||
|
||||
|
||||
} else if (string(args[0])==string("fineoff")) {
|
||||
c=FINE_OFFSET;
|
||||
|
||||
|
||||
} else if (string(args[0])==string("binsize")) {
|
||||
c=BIN_SIZE;
|
||||
|
||||
} else if (string(args[0])==string("angdir")) {
|
||||
c=ANGULAR_DIRECTION;
|
||||
|
||||
} else if (string(args[0])==string("moveflag")) {
|
||||
c=MOVE_FLAG;
|
||||
} else if (string(args[0])==string("samplex")) {
|
||||
c=SAMPLE_X;
|
||||
} else if (string(args[0])==string("sampley")) {
|
||||
c=SAMPLE_Y;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
}else{
|
||||
return string("could not decode angular conversion parameter ")+cmd;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
if (sscanf(args[1],"%lf",&fval))
|
||||
@ -3568,7 +3561,7 @@ string slsDetectorCommand::helpThreaded(int narg, char *args[], int action){
|
||||
|
||||
string slsDetectorCommand::cmdImage(int narg, char *args[], int action){
|
||||
string sval;
|
||||
int retval;
|
||||
int retval = FAIL;
|
||||
if (action==HELP_ACTION)
|
||||
return helpImage(narg,args,HELP_ACTION);
|
||||
else if (action==GET_ACTION)
|
||||
@ -3609,7 +3602,7 @@ string slsDetectorCommand::cmdCounter(int narg, char *args[], int action){
|
||||
int ival;
|
||||
char answer[100];
|
||||
string sval;
|
||||
int retval;
|
||||
int retval = FAIL;
|
||||
if (action==HELP_ACTION)
|
||||
return helpCounter(narg,args,HELP_ACTION);
|
||||
else if (action==PUT_ACTION)
|
||||
@ -6209,7 +6202,8 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action)
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot put");
|
||||
return string(""+myDet->printReceiverConfiguration());
|
||||
myDet->printReceiverConfiguration();
|
||||
return string("");
|
||||
}else if (cmd=="parameters") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
|
@ -96,7 +96,7 @@ double angularConversionStatic::convertAngle(double pos, int ich, angleConversio
|
||||
// cout << "no ang conv " << endl;
|
||||
|
||||
double enc=0, trans=0;
|
||||
double ang;
|
||||
double ang=0;
|
||||
|
||||
switch (mF) {
|
||||
case 0:
|
||||
|
@ -93,7 +93,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
*/
|
||||
virtual std::string setFilePath(std::string s) {
|
||||
pthread_mutex_lock(&mf);
|
||||
sprintf(filePath, s.c_str());
|
||||
sprintf(filePath, "%s", s.c_str());
|
||||
pthread_mutex_unlock(&mf);
|
||||
return std::string(filePath);
|
||||
};
|
||||
@ -105,7 +105,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
||||
*/
|
||||
virtual std::string setFileName(std::string s) {
|
||||
pthread_mutex_lock(&mf);
|
||||
sprintf(fileName, s.c_str());
|
||||
sprintf(fileName, "%s", s.c_str());
|
||||
pthread_mutex_unlock(&mf);
|
||||
return std::string(fileName);};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef POSTPROCESSINGFUNCS_H
|
||||
#define POSTPROCESSINGFUNC_H
|
||||
#define POSTPROCESSINGFUNCS_H
|
||||
|
||||
|
||||
|
||||
@ -77,4 +77,4 @@ class postProcessingFuncs : public virtual angularConversionStatic
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif //POSTPROCESSINGFUNCS_H
|
||||
|
@ -189,10 +189,6 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** additional json header */
|
||||
char* additionJsonHeader;
|
||||
|
||||
/** Silent Mode */
|
||||
bool* silentMode;
|
||||
|
||||
|
||||
/** Aquisition Started flag */
|
||||
bool acquisitionStartedFlag;
|
||||
|
||||
|
@ -146,7 +146,7 @@ void DataProcessor::ResetParametersforNewMeasurement(){
|
||||
delete [] tempBuffer;
|
||||
tempBuffer = 0;
|
||||
}
|
||||
if (*gapPixelsEnable >= 0) {
|
||||
if (*gapPixelsEnable) {
|
||||
tempBuffer = new char[generalData->imageSize];
|
||||
memset(tempBuffer, 0, generalData->imageSize);
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
fileIndex(fi),
|
||||
flippedData(fd),
|
||||
additionJsonHeader(ajh),
|
||||
silentMode(sm),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
|
Loading…
x
Reference in New Issue
Block a user