Closed picca closed 4 months ago
@jonwright I managed to fix the warning about fgets
, but I have no clue about the sscanf
... especially what is the rational of *(clabels+32)
where clabels
is an array of char of 32 elements. Since you wrote this piece of code, could you please give me some hint on the reason why you did that ?
In practice, I didn't know anyone using this code, so maybe the sensible thing is just to remove it.
In ImageD11 we have https://github.com/jonwright/ImageD11/blob/master/ImageD11/columnfile.py and we are trying to move these data into hdf5 anyway.
What I interpret the code is doing:
ncols=sscanf_s(line,hdr_ctl,repeat16_inc(clabels,0),repeat16_inc(clabels,16),*(clabels+32));
/* ncols will be set to the number of items read */
/* hdr_ctl is a format string # %s %s ... repeated 34 times (so a few too many) */
/* repeat16_inc(clabels[0]) expands to tell sscanf to read the strings into the clabels array by giving blocks of 16 args */
To fix I think the string hdr_ctl needs max 32 entries and then the last argument *(clabels+32)
could be deleted. But if we don't have test coverage it makes more sense to get rid of all of it...
There is a draft pull request / diff over here https://github.com/jonwright/fabio/tree/jonwright-patch-1 , but the option to just remove it all seems to make more sense. What do you think?
Thanks, I took your modifications into #572. If someone is using this code and it breaks, he will complain an provide material for a non regression test.
Hello, I report here a bunch of warning observed during the Debian build
Cheers