Skip to content

Commit

Permalink
audio/libfishsound: Fix build with Clang 16 and remove the workaround
Browse files Browse the repository at this point in the history
flac.c:253:8: error: incompatible function pointer types passing 'FLAC__StreamDecoderReadStatus (const FLAC__StreamDecoder *, FLAC__byte *, unsigned int *, void *)' (aka 'FLAC__StreamDecoderReadStatus (const FLAC__StreamDecoder *, unsigned char *, unsigned int *, void *)') to parameter of type 'FLAC__StreamDecoderReadCallback' (aka 'FLAC__StreamDecoderReadStatus (*)(const FLAC__StreamDecoder *, unsigned char *, unsigned long *, void *)') [-Wincompatible-function-pointer-types]
       fs_flac_read_callback,
       ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/FLAC/stream_decoder.h:1092:34: note: passing argument to parameter 'read_callback' here
        FLAC__StreamDecoderReadCallback read_callback,
                                        ^
flac.c:597:8: error: incompatible function pointer types passing 'FLAC__StreamEncoderWriteStatus (const FLAC__StreamEncoder *, const FLAC__byte *, unsigned int, unsigned int, unsigned int, void *)' (aka 'FLAC__StreamEncoderWriteStatus (const FLAC__StreamEncoder *, const unsigned char *, unsigned int, unsigned int, unsigned int, void *)') to parameter of type 'FLAC__StreamEncoderWriteCallback' (aka 'FLAC__StreamEncoderWriteStatus (*)(const FLAC__StreamEncoder *, const unsigned char *, unsigned long, unsigned int, unsigned int, void *)') [-Wincompatible-function-pointer-types]
       fs_flac_enc_write_callback,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/FLAC/stream_encoder.h:1532:136: note: passing argument to parameter 'write_callback' here
FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data);

16 warnings and 2 errors generated.

Tested on:	14.0-CURRENT (1400093)
  • Loading branch information
sunpoet committed Aug 21, 2023
1 parent 860b655 commit d19fe7f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
6 changes: 0 additions & 6 deletions audio/libfishsound/Makefile
Expand Up @@ -29,12 +29,6 @@ DOXYGEN_IMPLIES=DOCS

DOXYGEN_BUILD_DEPENDS= doxygen:devel/doxygen

.include <bsd.port.options.mk>

.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400091 || ( ${OSVERSION} >= 1302507 && ${OSVERSION} < 1400000 ))
CFLAGS+= -Wno-error=incompatible-function-pointer-types
.endif

post-patch-DOCS-off:
@${REINPLACE_CMD} -e '/^SUBDIRS = / s| doc||' ${WRKSRC}/Makefile.in

Expand Down
22 changes: 22 additions & 0 deletions audio/libfishsound/files/patch-src-libfishsound-flac.c
@@ -0,0 +1,22 @@
--- src/libfishsound/flac.c.orig 2010-02-03 13:34:02 UTC
+++ src/libfishsound/flac.c
@@ -106,7 +106,7 @@ fs_flac_command (FishSound * fsound, int command, void
#if FS_DECODE
static FLAC__StreamDecoderReadStatus
fs_flac_read_callback(const FLAC__StreamDecoder *decoder,
- FLAC__byte buffer[], unsigned int *bytes,
+ FLAC__byte buffer[], size_t *bytes,
void *client_data)
{
FishSound* fsound = (FishSound*)client_data;
@@ -346,8 +346,8 @@ dec_err:
#if FS_ENCODE
static FLAC__StreamEncoderWriteStatus
fs_flac_enc_write_callback(const FLAC__StreamEncoder *encoder,
- const FLAC__byte buffer[], unsigned bytes,
- unsigned samples, unsigned current_frame,
+ const FLAC__byte buffer[], size_t bytes,
+ uint32_t samples, uint32_t current_frame,
void *client_data)
{
FishSound* fsound = (FishSound*)client_data;

0 comments on commit d19fe7f

Please sign in to comment.