Open alexmarie78 opened 5 years ago
To me the clean way to improve it is that sfAssignScanNumbers
returns a status code based on lseek/read return code and that SfOpen2
and SfUpdate
which are calling it check the returned value and in case of error forward it through their int * error
argument.
The conservative handling of lseek/read error event would be to set the returned status as error, skip the current scan but continue the loop.
@t20100
Perhaps it is not necessary to be conservative and one can stop the loop. I guess the returned values were never checked because they were not expected to fail given the fact the scan limits have been previously determined.
Yes sounds reasonable. This case should only occur if the file is clipped in the meantime which should not occur under normal condition.
warning on compilation :
The return of read() and lseek() are not checked. We want to fix this warning, shall we stop the for loop when the return value is -1 (failed) or shall we do something else. The return type of the C function is void. So maybe we need to setup an errno somewhere ?