diff options
author | Gregory Maxwell <greg@xiph.org> | 2012-06-01 02:21:53 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-06-01 15:58:17 -0400 |
commit | c64f4a4265c66e5bcc7fbd621641aeb3a3280fdc (patch) | |
tree | 54068a619a4d2c2bc0d32009aa60f15e1bdbd20e /include/opus_custom.h | |
parent | bcbf40b601683be9512c171c069935c1f26c98db (diff) | |
download | libopus-c64f4a4265c66e5bcc7fbd621641aeb3a3280fdc.tar.gz |
Update headers to cause warnings on unused returns and null args.
In places where an ignored return or a null-arg is a sure indication
of a bug add the GCC warning attributes. The null arg annotation
is not enable for Opus itself because it will cause the compiler
to optimize out some null checks. I don't trust our callers
quite that much.
Diffstat (limited to 'include/opus_custom.h')
-rw-r--r-- | include/opus_custom.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/opus_custom.h b/include/opus_custom.h index 201b1b7e..e78f8d4c 100644 --- a/include/opus_custom.h +++ b/include/opus_custom.h @@ -81,7 +81,7 @@ typedef struct OpusCustomMode OpusCustomMode; @param error Returned error code (if NULL, no error will be returned) @return A newly created mode */ -OPUS_CUSTOM_EXPORT OpusCustomMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error); +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomMode *opus_custom_mode_create(opus_int32 Fs, int frame_size, int *error); /** Destroys a mode struct. Only call this after all encoders and decoders using this mode are destroyed as well. @@ -91,7 +91,7 @@ OPUS_CUSTOM_EXPORT void opus_custom_mode_destroy(OpusCustomMode *mode); /* Encoder */ -OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_get_size(const OpusCustomMode *mode, int channels); +OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_encoder_get_size(const OpusCustomMode *mode, int channels); /** Creates a new encoder state. Each stream needs its own encoder state (can't be shared across simultaneous streams). @@ -102,7 +102,7 @@ OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_get_size(const OpusCustomMode @param error Returns an error code @return Newly created encoder state. */ -OPUS_CUSTOM_EXPORT OpusCustomEncoder *opus_custom_encoder_create(const OpusCustomMode *mode, int channels, int *error); +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encoder_create(const OpusCustomMode *mode, int channels, int *error); OPUS_CUSTOM_EXPORT_STATIC int opus_custom_encoder_init(OpusCustomEncoder *st, const OpusCustomMode *mode, int channels); @@ -129,7 +129,7 @@ OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(OpusCustomEncoder *st); * the length returned be somehow transmitted to the decoder. Otherwise, no * decoding is possible. */ -OPUS_CUSTOM_EXPORT int opus_custom_encode_float(OpusCustomEncoder *st, const float *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes); +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode_float(OpusCustomEncoder *st, const float *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes); /** Encodes a frame of audio. @param st Encoder state @@ -145,7 +145,7 @@ OPUS_CUSTOM_EXPORT int opus_custom_encode_float(OpusCustomEncoder *st, const flo * the length returned be somehow transmitted to the decoder. Otherwise, no * decoding is possible. */ -OPUS_CUSTOM_EXPORT int opus_custom_encode(OpusCustomEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes); +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_encode(OpusCustomEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *compressed, int maxCompressedBytes); /** Query and set encoder parameters @param st Encoder state @@ -157,7 +157,7 @@ OPUS_CUSTOM_EXPORT int opus_custom_encoder_ctl(OpusCustomEncoder * restrict st, /* Decoder */ -OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_get_size(const OpusCustomMode *mode, int channels); +OPUS_CUSTOM_EXPORT_STATIC OPUS_WARN_UNUSED_RESULT int opus_custom_decoder_get_size(const OpusCustomMode *mode, int channels); /** Creates a new decoder state. Each stream needs its own decoder state (can't be shared across simultaneous streams). @@ -167,7 +167,7 @@ OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_get_size(const OpusCustomMode @param error Returns an error code @return Newly created decoder state. */ -OPUS_CUSTOM_EXPORT OpusCustomDecoder *opus_custom_decoder_create(const OpusCustomMode *mode, int channels, int *error); +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decoder_create(const OpusCustomMode *mode, int channels, int *error); OPUS_CUSTOM_EXPORT_STATIC int opus_custom_decoder_init(OpusCustomDecoder *st, const OpusCustomMode *mode, int channels); @@ -185,7 +185,7 @@ OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(OpusCustomDecoder *st); returned here in float format. @return Error code. */ -OPUS_CUSTOM_EXPORT int opus_custom_decode_float(OpusCustomDecoder *st, const unsigned char *data, int len, float *pcm, int frame_size); +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode_float(OpusCustomDecoder *st, const unsigned char *data, int len, float *pcm, int frame_size); /** Decodes a frame of audio. @param st Decoder state @@ -196,7 +196,7 @@ OPUS_CUSTOM_EXPORT int opus_custom_decode_float(OpusCustomDecoder *st, const uns returned here in 16-bit PCM format (native endian). @return Error code. */ -OPUS_CUSTOM_EXPORT int opus_custom_decode(OpusCustomDecoder *st, const unsigned char *data, int len, opus_int16 *pcm, int frame_size); +OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT int opus_custom_decode(OpusCustomDecoder *st, const unsigned char *data, int len, opus_int16 *pcm, int frame_size); /** Query and set decoder parameters @param st Decoder state |