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
I wouldn't suggest modifying the C definition as it seems this array is supposed to be indexed by values of the FLAC__StreamMetadata_Picture_Type enum and those values could easily change in the future, right now they go up to 20 so you could argue that this should be an array of 20 elements but I wouldn't set that in stone.
I would argue that having zero sized arrays as the default representation of unsized C arrays is not the most correct thing and maybe bindgen should translate them as pointers instead. But for the meantime, I think your solution is correct. You could wrap such logic in a function to avoid issues in the future
EDIT: it seems these arrays are treated as zero-sized arrays because that was the only way to make them work, see: #683. But yes, accessing the array by using the raw pointer is fine.
Input C/C++ Header
This is the declaration in the header file: https://github.com/xiph/flac/blob/28e4f0528c76b296c561e922ba67d43751990599/include/FLAC/format.h#L764-L771
And here's the definition (which I guess isn't visible to
bindgen
): https://github.com/xiph/flac/blob/28e4f0528c76b296c561e922ba67d43751990599/src/libFLAC/format.c#L185-L207Bindgen Invocation
Actual Results
I have used this in the past to access array elements:
But recently I've been getting this panic (in debug mode):
This is understandable, since it is defined as zero-element array, but it has more than zero elements in the C library ...
I could work around this by using something like:
But is this the right thing to do?
Expected Results
I don't know!
Maybe something has to be changed in the original C definitions?
I'd be grateful for any hints!
The text was updated successfully, but these errors were encountered: