bugfix: returning pointer to local variable, char* to string in function definition

This commit is contained in:
2018-02-07 10:14:52 +01:00
parent 618f6291cf
commit ecf1e9fac1
6 changed files with 11 additions and 11 deletions

View File

@@ -524,13 +524,13 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
/**
returns currently the loaded trimfile/settingsfile name
*/
const char *getSettingsFile(){\
string getSettingsFile(){\
string s(thisDetector->settingsFile); \
if (s.length()>6) {\
if (s.substr(s.length()-6,3)==string(".sn") && s.substr(s.length()-3)!=string("xxx") ) \
return s.substr(0,s.length()-6).c_str(); \
return s.substr(0,s.length()-6); \
} \
return thisDetector->settingsFile;\
return string(thisDetector->settingsFile);\
};

View File

@@ -4508,8 +4508,8 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
} else if (action==PUT_ACTION) {
myDet->loadSettingsFile(sval,-1);
}
}//cout<<"settingsfile:"<<myDet->getSettingsFile()<<endl;
return string(myDet->getSettingsFile());
}
return myDet->getSettingsFile();
} else if (cmd=="trim") {
if (action==GET_ACTION)
return string("cannot get!");

View File

@@ -255,7 +255,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/**
returns currently the loaded trimfile/settingsfile name
*/
virtual const char *getSettingsFile()=0;
virtual string getSettingsFile()=0;
/**