[flac-dev] Are pointers to FLAC__int32 and int interchangeable?

lvqcl lvqcl.mail at gmail.com
Thu Oct 8 09:23:29 PDT 2015

Erik de Castro Lopo wrote:

> Well FLAC__int32 is just a 32 bit integer and on all the platforms/
> architecures/compilers that FLAC supports FLAC__int32 and int are
> the same.
> Personally I think the FLAC__xxxx stuff should go, to be replaced with
> C standard int32_t, uint32_t, int16_t etc, at least for internal code.
> I am slowly doing that when I touch code.
> I don't think this should be done at the API level without an API
> version bump and I don't think that is currently worth it.

IMHO in this case it makes sense to change:
unsigned *val  ->  FLAC__uint32 *val
int *val       ->  FLAC__int32 *val
int vals[]     ->  FLAC__int32 vals[]  or  FLAC__int32* vals:

that is:
     FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, FLAC__uint32 *val);
     FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, FLAC__int32 *val, unsigned parameter);
     FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, FLAC__int32* vals, unsigned nvals, unsigned parameter);

And I hope that there's no need to bump API version because these
functions are declared in src/libFLAC/include/private/bitreader.h

After all the corresponding functions from bitwriter.h use FLAC__int32:

     FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter);
     FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter);

More information about the flac-dev mailing list