mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
incorrect check for fwrite fail (#541)
This commit is contained in:
parent
d73d8994c0
commit
4913c9c0b0
@ -103,13 +103,10 @@ void BinaryDataFile::WriteToFile(char *imageData, sls_receiver_header &header,
|
||||
}
|
||||
|
||||
// if write error
|
||||
if (ret != imageSize + sizeof(sls_receiver_header)) {
|
||||
throw RuntimeError(
|
||||
std::to_string(index) +
|
||||
" : Write to file failed for image number " +
|
||||
std::to_string(currentFrameNumber) + ". Wrote " +
|
||||
std::to_string(ret) + " bytes instead of " +
|
||||
std::to_string(imageSize + sizeof(sls_receiver_header)));
|
||||
if (ret != 1) {
|
||||
throw RuntimeError(std::to_string(index) +
|
||||
" : Write to file failed for image number " +
|
||||
std::to_string(currentFrameNumber));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,7 @@ std::string CreateMasterBinaryFile(const std::string &filePath,
|
||||
rapidjson::StringBuffer s;
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(s);
|
||||
attr->GetBinaryAttributes(&writer);
|
||||
if (fwrite(s.GetString(), 1, strlen(s.GetString()), fd) !=
|
||||
strlen(s.GetString())) {
|
||||
if (fwrite(s.GetString(), strlen(s.GetString()), 1, fd) != 1) {
|
||||
throw RuntimeError(
|
||||
"Master binary file incorrect number of bytes written to file");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user