mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 07:01:33 +01:00
compilation warnings (unused variables, no return value for non void functions etc.) removed
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@142 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@@ -2629,9 +2629,9 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
||||
} else{
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
thisDetector->currentSettings=(detectorSettings)retval;
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Settings are "<< retval << std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
@@ -2774,22 +2774,25 @@ detectorSettings slsDetector::setSettings( detectorSettings isettings, int imod)
|
||||
|
||||
int slsDetector::updateDetectorNoWait() {
|
||||
|
||||
int ret=OK;
|
||||
// int ret=OK;
|
||||
enum detectorSettings t;
|
||||
int thr, n, nm;
|
||||
int it;
|
||||
int64_t retval, tns=-1;
|
||||
// int it;
|
||||
int64_t retval;// tns=-1;
|
||||
char lastClientIP[INET_ADDRSTRLEN];
|
||||
|
||||
switch(thisDetector->myDetectorType){
|
||||
case GOTTHARD:
|
||||
n = controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
//cout << "Updating detector last modified by " << lastClientIP << endl; commented out by dhanya for now
|
||||
#ifdef VERBOSE
|
||||
cout << "Updating detector last modified by " << lastClientIP << endl;// commented out by dhanya for now
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
n = controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
cout << "Updating detector last modified by " << lastClientIP << endl;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Updating detector last modified by " << lastClientIP << endl;
|
||||
#endif
|
||||
n = controlSocket->ReceiveDataOnly(&nm,sizeof(nm));
|
||||
thisDetector->nMod[X]=nm;
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
@@ -3021,32 +3024,33 @@ int* slsDetector::getDataFromDetector(){
|
||||
#ifdef VERBOSE
|
||||
cout << "ret=" << ret << endl;
|
||||
#endif
|
||||
if (ret!=OK) {
|
||||
n= controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
if (ret==FAIL) {
|
||||
thisDetector->stoppedFlag=1;
|
||||
std::cout<< "Detector returned: " << mess << " " << n << std::endl;
|
||||
} else {
|
||||
;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Detector successfully returned: " << mess << " " << n << std::endl;
|
||||
#endif
|
||||
}
|
||||
delete [] retval;
|
||||
retval=NULL;
|
||||
} else {
|
||||
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
|
||||
|
||||
if (ret!=OK) {
|
||||
n= controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
if (ret==FAIL) {
|
||||
thisDetector->stoppedFlag=1;
|
||||
std::cout<< "Detector returned: " << mess << " " << n << std::endl;
|
||||
} else {
|
||||
;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Received "<< n << " data bytes" << std::endl;
|
||||
std::cout<< "Detector successfully returned: " << mess << " " << n << std::endl;
|
||||
#endif
|
||||
}
|
||||
delete [] retval;
|
||||
retval=NULL;
|
||||
} else {
|
||||
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Received "<< n << " data bytes" << std::endl;
|
||||
#endif
|
||||
if (n!=thisDetector->dataBytes) {
|
||||
std::cout<< "wrong data size received: received " << n << " but expected " << thisDetector->dataBytes << std::endl;
|
||||
thisDetector->stoppedFlag=1;
|
||||
ret=FAIL;
|
||||
delete [] retval;
|
||||
retval=NULL;
|
||||
}
|
||||
if (n!=thisDetector->dataBytes) {
|
||||
std::cout<< "wrong data size received: received " << n << " but expected " << thisDetector->dataBytes << std::endl;
|
||||
thisDetector->stoppedFlag=1;
|
||||
ret=FAIL;
|
||||
delete [] retval;
|
||||
retval=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -3077,7 +3081,7 @@ int* slsDetector::readAll(){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< i << std::endl;
|
||||
#else
|
||||
std::cout << "-" ;
|
||||
std::cout << "-" << flush ;
|
||||
#endif
|
||||
dataQueue.push(retval);
|
||||
}
|
||||
@@ -3138,7 +3142,7 @@ int* slsDetector::startAndReadAll(){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< i << std::endl;
|
||||
#else
|
||||
std::cout<< "-" ;
|
||||
std::cout<< "-" << flush;
|
||||
#endif
|
||||
dataQueue.push(retval);
|
||||
}
|
||||
@@ -3345,7 +3349,7 @@ int slsDetector::setPort(portType index, int num){
|
||||
|
||||
int fnum=F_SET_PORT;
|
||||
int retval;
|
||||
uint64_t ut;
|
||||
// uint64_t ut;
|
||||
char mess[100];
|
||||
int ret=FAIL;
|
||||
int n=0;
|
||||
@@ -3808,7 +3812,9 @@ int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
|
||||
if (controlSocket) {
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "sending mode bytes= "<< controlSocket->SendDataOnly(&mode,sizeof(mode)) << std::endl;
|
||||
#endif
|
||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
@@ -4485,17 +4491,17 @@ int slsDetector::setAngularConversion(string fname) {
|
||||
if (fname=="") {
|
||||
thisDetector->correctionMask&=~(1<< ANGULAR_CONVERSION);
|
||||
//strcpy(thisDetector->angConvFile,"none");
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Unsetting angular conversion" << std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
} else {
|
||||
if (fname=="default") {
|
||||
fname=string(thisDetector->angConvFile);
|
||||
}
|
||||
|
||||
//#ifdef VERBOSE
|
||||
std::cout << "Setting angular conversion to" << fname << std:: endl;
|
||||
//#endif
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Setting angular conversion to" << fname << std:: endl;
|
||||
#endif
|
||||
if (readAngularConversion(fname)>=0) {
|
||||
thisDetector->correctionMask|=(1<< ANGULAR_CONVERSION);
|
||||
strcpy(thisDetector->angConvFile,fname.c_str());
|
||||
@@ -4673,8 +4679,8 @@ int slsDetector::readConfigurationFile(string const fname){
|
||||
string ans;
|
||||
string str;
|
||||
ifstream infile;
|
||||
int iargval;
|
||||
int interrupt=0;
|
||||
// int iargval;
|
||||
// int interrupt=0;
|
||||
char *args[100];
|
||||
for (int ia=0; ia<100; ia++) {
|
||||
args[ia]=new char[1000];
|
||||
@@ -4683,7 +4689,9 @@ int slsDetector::readConfigurationFile(string const fname){
|
||||
|
||||
string sargname, sargval;
|
||||
int iline=0;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "config file name "<< fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
iline=readConfigurationFile(infile);
|
||||
|
||||
@@ -868,7 +868,7 @@ string slsDetectorCommand::cmdRemove(int narg, char *args[], int action){
|
||||
|
||||
|
||||
ostringstream os;
|
||||
int ivar, ival;
|
||||
int ival;//ivar,
|
||||
string var=string(args[0]);
|
||||
|
||||
if (action==HELP_ACTION) {
|
||||
@@ -901,7 +901,7 @@ string slsDetectorCommand::cmdHostname(int narg, char *args[], int action){
|
||||
}
|
||||
|
||||
ostringstream os;
|
||||
int ivar, ival;
|
||||
int ivar;//, ival;
|
||||
string var=string(args[0]);
|
||||
char hostname[1000];
|
||||
|
||||
@@ -960,7 +960,7 @@ string slsDetectorCommand::cmdId(int narg, char *args[], int action){
|
||||
ostringstream os;
|
||||
int ivar, ival;
|
||||
string var=string(args[0]);
|
||||
char answer[1000];
|
||||
// char answer[1000];
|
||||
|
||||
|
||||
size_t p=string(args[0]).find(':');
|
||||
@@ -1274,6 +1274,9 @@ string slsDetectorCommand::helpFileIndex(int narg, char *args[], int action){
|
||||
|
||||
string slsDetectorCommand::cmdFlatField(int narg, char *args[], int action){
|
||||
|
||||
if (action==HELP_ACTION) {
|
||||
return helpFlatField(narg, args, action);
|
||||
}
|
||||
string sval;
|
||||
|
||||
if (string(args[0])==string("ffdir")) {
|
||||
@@ -1294,7 +1297,7 @@ string slsDetectorCommand::cmdFlatField(int narg, char *args[], int action){
|
||||
myDet->setFlatFieldCorrection(sval);
|
||||
return string(myDet->getFlatFieldCorrectionFile());
|
||||
|
||||
} else if (action==GET_ACTION) {
|
||||
} else {// if (action==GET_ACTION) {
|
||||
if (narg>1)
|
||||
sval=string(args[1]);
|
||||
else
|
||||
@@ -1310,8 +1313,8 @@ string slsDetectorCommand::cmdFlatField(int narg, char *args[], int action){
|
||||
return string("none");
|
||||
}
|
||||
}
|
||||
} else
|
||||
return string("could not decode flat field action ")+cmd;
|
||||
}
|
||||
return string("could not decode flat field action ")+cmd;
|
||||
|
||||
}
|
||||
|
||||
@@ -1349,6 +1352,9 @@ string slsDetectorCommand::helpFlatField(int narg, char *args[], int action){
|
||||
|
||||
string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action){
|
||||
|
||||
if (action==HELP_ACTION) {
|
||||
return helpRateCorr(narg, args, action);
|
||||
}
|
||||
float fval;
|
||||
char answer[1000];
|
||||
|
||||
@@ -1383,7 +1389,9 @@ string slsDetectorCommand::cmdBadChannels(int narg, char *args[], int action){
|
||||
|
||||
string sval;
|
||||
|
||||
|
||||
if (action==HELP_ACTION) {
|
||||
return helpBadChannels(narg, args, action);
|
||||
}
|
||||
if (action==PUT_ACTION) {
|
||||
sval=string(args[1]);
|
||||
if (sval=="none")
|
||||
@@ -1429,6 +1437,9 @@ string slsDetectorCommand::helpBadChannels(int narg, char *args[], int action){
|
||||
|
||||
string slsDetectorCommand::cmdAngConv(int narg, char *args[], int action){
|
||||
|
||||
if (action==HELP_ACTION) {
|
||||
return helpAngConv(narg, args, action);
|
||||
}
|
||||
string sval;
|
||||
char answer[1000];
|
||||
float fval;
|
||||
@@ -1796,7 +1807,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
|
||||
cout << fmin << " " << fmax << " " << fstep << endl;
|
||||
#endif
|
||||
|
||||
ns=(fmax-fmin)/fstep;
|
||||
ns=(int)((fmax-fmin)/fstep);
|
||||
if (ns<0)
|
||||
ns=-1*ns;
|
||||
|
||||
@@ -1897,7 +1908,7 @@ string slsDetectorCommand::cmdPort(int narg, char *args[], int action) {
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
return helpPort(narg,args,action);
|
||||
int ret, val;
|
||||
int val; //ret,
|
||||
char ans[1000];
|
||||
portType index;
|
||||
|
||||
@@ -1954,7 +1965,7 @@ string slsDetectorCommand::cmdLock(int narg, char *args[], int action) {
|
||||
if (action==HELP_ACTION)
|
||||
return helpLock(narg,args,action);
|
||||
|
||||
int val, ret;
|
||||
int val;//, ret;
|
||||
char ans[1000];
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
@@ -2092,7 +2103,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
return helpDetectorSize(narg,args,action);
|
||||
int ret, val=-1;
|
||||
char ans[1000];
|
||||
portType index;
|
||||
// portType index;
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
if (cmd=="maxmod")
|
||||
@@ -2146,9 +2157,9 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
return helpSettings(narg,args,action);
|
||||
int ret, val=-1;
|
||||
int val=-1;//ret,
|
||||
char ans[1000];
|
||||
portType index;
|
||||
// portType index;
|
||||
|
||||
|
||||
|
||||
@@ -2628,7 +2639,7 @@ string slsDetectorCommand::helpDAC(int narg, char *args[], int action) {
|
||||
string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
||||
|
||||
dacIndex adc;
|
||||
float val=-1;
|
||||
// float val=-1;
|
||||
char answer[1000];
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
@@ -2727,8 +2738,8 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
else
|
||||
return string("cannot scan timer value ")+string(args[1]);
|
||||
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||
t=val*1E+9;
|
||||
else t=val;
|
||||
t=(int64_t)(val*1E+9);
|
||||
else t=(int64_t)val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -215,10 +215,10 @@ int slsDetectorUtils::getVariablesFromFileName(string fname, int &index, int &p_
|
||||
//return i;
|
||||
s=fname.substr(0,uscore);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
else
|
||||
cout << "******************************** cannot parse file index" << endl;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << s << endl;
|
||||
#endif
|
||||
|
||||
@@ -235,13 +235,11 @@ int slsDetectorUtils::getVariablesFromFileName(string fname, int &index, int &p_
|
||||
#endif
|
||||
s=fname.substr(0,uscore);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
else
|
||||
cout << "******************************** cannot parse position index" << endl;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << s << endl;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -259,10 +257,10 @@ int slsDetectorUtils::getVariablesFromFileName(string fname, int &index, int &p_
|
||||
#endif
|
||||
s=fname.substr(0,uscore);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
else
|
||||
cout << "******************************** cannot parse scan varable 1" << endl;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << s << endl;
|
||||
|
||||
|
||||
@@ -279,10 +277,10 @@ int slsDetectorUtils::getVariablesFromFileName(string fname, int &index, int &p_
|
||||
cout << "******************************** scan variable 0 is " << sv0 << endl;
|
||||
#endif
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
else
|
||||
cout << "******************************** cannot parse scan varable 0" << endl;
|
||||
|
||||
#ifdef VERBOSE
|
||||
#endif
|
||||
|
||||
|
||||
@@ -482,12 +480,12 @@ float slsDetectorUtils::getAngularConversionParameter(angleConversionParameter c
|
||||
int slsDetectorUtils::readAngularConversion(string fname, int nmod, angleConversionConstant *angOff) {
|
||||
|
||||
ifstream infile;
|
||||
int mod;
|
||||
float center, ecenter;
|
||||
float r_conv, er_conv;
|
||||
float off, eoff;
|
||||
// int mod;
|
||||
// float center, ecenter;
|
||||
// float r_conv, er_conv;
|
||||
// float off, eoff;
|
||||
string ss;
|
||||
int interrupt=0;
|
||||
// int interrupt=0;
|
||||
|
||||
//" module %i center %E +- %E conversion %E +- %E offset %f +- %f \n"
|
||||
#ifdef VERBOSE
|
||||
@@ -621,7 +619,7 @@ int slsDetectorUtils::addToMerging(float *p1, float *v1, float *e1, float *mp,
|
||||
|
||||
float binmi=-180., binma;
|
||||
int ibin=0;
|
||||
int imod;
|
||||
// int imod;
|
||||
float ang=0;
|
||||
|
||||
|
||||
@@ -725,8 +723,8 @@ int slsDetectorUtils::addToMerging(float *p1, float *v1, float *e1, float *mp,
|
||||
|
||||
|
||||
|
||||
int ibin=0;
|
||||
int imod;
|
||||
// int ibin=0;
|
||||
// int imod;
|
||||
|
||||
int del=0;
|
||||
|
||||
@@ -759,7 +757,7 @@ int slsDetectorUtils::writeDataFile(string fname, int nch, float *data, float *e
|
||||
|
||||
|
||||
ofstream outfile;
|
||||
int idata;
|
||||
// int idata;
|
||||
if (data==NULL)
|
||||
return FAIL;
|
||||
|
||||
@@ -873,11 +871,11 @@ int slsDetectorUtils::readDataFile(int nch, string fname, float *data, float *er
|
||||
|
||||
|
||||
ifstream infile;
|
||||
int ichan, iline=0;
|
||||
int interrupt=0;
|
||||
float fdata, ferr, fang;
|
||||
int iline=0;//ichan,
|
||||
//int interrupt=0;
|
||||
//float fdata, ferr, fang;
|
||||
int maxchans;
|
||||
int ich;
|
||||
//int ich;
|
||||
string str;
|
||||
|
||||
|
||||
@@ -901,7 +899,7 @@ int slsDetectorUtils::readDataFile(int nch, string fname, float *data, float *er
|
||||
int slsDetectorUtils::readDataFile(int nch, ifstream &infile, float *data, float *err, float *ang, char dataformat, int offset){
|
||||
|
||||
|
||||
int ichan, iline=0;
|
||||
int ichan,iline=0;
|
||||
int interrupt=0;
|
||||
float fdata, ferr, fang;
|
||||
int maxchans;
|
||||
@@ -970,8 +968,8 @@ int slsDetectorUtils::readDataFile(int nch, ifstream &infile, float *data, float
|
||||
int slsDetectorUtils::readDataFile(string fname, int *data, int nch){
|
||||
|
||||
ifstream infile;
|
||||
int ichan, idata, iline=0;
|
||||
int interrupt=0;
|
||||
int iline=0;//ichan, idata,
|
||||
//int interrupt=0;
|
||||
string str;
|
||||
|
||||
#ifdef VERBOSE
|
||||
@@ -1029,8 +1027,8 @@ int slsDetectorUtils::readDataFile(ifstream &infile, int *data, int nch, int off
|
||||
int slsDetectorUtils::readDataFile(string fname, short int *data, int nch){
|
||||
|
||||
ifstream infile;
|
||||
int ichan, iline=0;
|
||||
int interrupt=0;
|
||||
int iline=0;//ichan,
|
||||
//int interrupt=0;
|
||||
string str;
|
||||
|
||||
#ifdef VERBOSE
|
||||
@@ -1639,7 +1637,7 @@ void* slsDetectorUtils::processData(int delflag) {
|
||||
float *ffcdata=NULL, *ffcerr=NULL;
|
||||
float *ang=NULL;
|
||||
float bs=0.004;
|
||||
int imod;
|
||||
// int imod;
|
||||
int nb;
|
||||
int np;
|
||||
detectorData *thisData;
|
||||
@@ -1793,7 +1791,7 @@ void* slsDetectorUtils::processData(int delflag) {
|
||||
|
||||
|
||||
pthread_mutex_lock(&mp);
|
||||
if (currentPositionIndex==(*numberOfPositions) && posfinished==1 && queuesize==1) {
|
||||
if (currentPositionIndex>=(*numberOfPositions) && posfinished==1 && queuesize==1) {
|
||||
|
||||
|
||||
// if ((currentPositionIndex>=(*numberOfPositions)) || (currentPositionIndex==0)) {
|
||||
@@ -1808,7 +1806,7 @@ void* slsDetectorUtils::processData(int delflag) {
|
||||
// pthread_mutex_lock(&mp);
|
||||
// if (currentPositionIndex==(*numberOfPositions) && posfinished==1 && queuesize==1) {
|
||||
|
||||
cout << "PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP Incrementing positon index " << endl;
|
||||
//cout << "PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP Incrementing positon index " << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user