minor tweaks for XADC code #736
@ -129,7 +129,7 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
|
||||
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
char valstring[MAX_STR_LENGTH] = "";
|
||||
char valstring[MAX_STR_LENGTH]{};
|
||||
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
|
||||
if (returnVal == nullptr) {
|
||||
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
|
||||
@ -139,6 +139,11 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
|
||||
}
|
||||
std::istringstream valSstream(valstring);
|
||||
valSstream >> val;
|
||||
if(valSstream.bad()) {
|
||||
sif::warning << "Xadc: Conversion of value to target type failed" << std::endl;
|
||||
fclose(fp);
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
fclose(fp);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user