You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling libhdhomerun with a recent gcc one may receive warnings of the form:
hdhomerun_discover.c: In function ‘hdhomerun_discover_sock_add_ipv6’:
hdhomerun_discover.c:123:99: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
123 | struct hdhomerun_discover_sock_t *dss = (struct hdhomerun_discover_sock_t *)calloc(sizeof(struct hdhomerun_discover_sock_t), 1);
| ^~~~~~
hdhomerun_discover.c:123:99: note: earlier argument should specify number of elements, later size of each element
Both hdhomerun_discover.c and hdhomerun_sock_netdevice.c have the reversed order of the parameters (other uses in the library call calloc correctly)
In practice the resulting buffer will be the same size (n elements of size 1, and 1 element of size n, should end up with the same number of bytes), but recent gcc's can detect the misuse when the -Wcalloc-transposed-args is used.
Thanks. Obviously low priority in the grand scheme of things.
TBH, I didn't catch anything (and I probably would not have on my own as I usually use others packages), but gcc did as part of my initial/early/preliminary builds of packages for (the future) CentOS Stream 10 that I find of interest at this time, and it was a warning that I could easily understand how to address.
Compile warning due to calloc parameter reversal
When compiling libhdhomerun with a recent gcc one may receive warnings of the form:
Both hdhomerun_discover.c and hdhomerun_sock_netdevice.c have the reversed order of the parameters (other uses in the library call calloc correctly)
In practice the resulting buffer will be the same size (n elements of size 1, and 1 element of size n, should end up with the same number of bytes), but recent gcc's can detect the misuse when the -Wcalloc-transposed-args is used.
Proposed fix (compile tested only):
The text was updated successfully, but these errors were encountered: