-
Notifications
You must be signed in to change notification settings - Fork 498
Description
The calloc function call in the fir_filter.c file uses the arguments in an incorrect order, causing a compilation error with the message:
error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=callc- transposed-args]
This error occurs because calloc expects the number of elements as the first argument and the size of each element as the second argument. However, the existing code has these reversed.
Affected File:
Path: bladeRF/host/utilities/bladeRF-fsk/c/src/fir_filter.c
Line: 227
Proposed Fix
The arguments to calloc should be reordered to correctly reflect the expected signature of calloc(num_elements, element_size). The corrected line of code is:
outbuf = calloc(chunk_size, sizeof(struct complex_sample));
This change ensures that the chunk_size (the number of elements) is passed as the first argument and the sizeof(struct complex_sample) (the size of each element) is passed as the second argument.
Steps to Reproduce:
- Compile the affected file with a strict compiler that treats warnings as errors.
- Observe the compilation error due to the transposed arguments in the calloc function.