Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2012-06-01 10:21:53 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-06-01 23:58:17 +0400
commitc64f4a4265c66e5bcc7fbd621641aeb3a3280fdc (patch)
tree54068a619a4d2c2bc0d32009aa60f15e1bdbd20e /include/opus_multistream.h
parentbcbf40b601683be9512c171c069935c1f26c98db (diff)
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_multistream.h')
-rw-r--r--include/opus_multistream.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/include/opus_multistream.h b/include/opus_multistream.h
index e6562a7e..5e5364a3 100644
--- a/include/opus_multistream.h
+++ b/include/opus_multistream.h
@@ -54,7 +54,7 @@ typedef struct OpusMSDecoder OpusMSDecoder;
/** Allocate and initialize a multistream encoder state object.
* Call opus_multistream_encoder_destroy() to release
* this object when finished. */
-OPUS_EXPORT OpusMSEncoder *opus_multistream_encoder_create(
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSEncoder *opus_multistream_encoder_create(
opus_int32 Fs, /**< Sampling rate of input signal (Hz) */
int channels, /**< Number of channels in the input signal */
int streams, /**< Total number of streams to encode from the input */
@@ -62,7 +62,7 @@ OPUS_EXPORT OpusMSEncoder *opus_multistream_encoder_create(
const unsigned char *mapping, /**< Encoded mapping between channels and streams */
int application, /**< Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO) */
int *error /**< Error code */
-);
+) OPUS_ARG_NONNULL(5);
/** Initialize an already allocated multistream encoder state. */
OPUS_EXPORT int opus_multistream_encoder_init(
@@ -73,30 +73,30 @@ OPUS_EXPORT int opus_multistream_encoder_init(
int coupled_streams, /**< Number of coupled (stereo) streams to encode */
const unsigned char *mapping, /**< Encoded mapping between channels and streams */
int application /**< Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO) */
-);
+) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
/** Returns length of the data payload (in bytes) or a negative error code */
-OPUS_EXPORT int opus_multistream_encode(
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode(
OpusMSEncoder *st, /**< Encoder state */
const opus_int16 *pcm, /**< Input signal as interleaved samples. Length is frame_size*channels */
int frame_size, /**< Number of samples per frame of input signal */
unsigned char *data, /**< Output buffer for the compressed payload (no more than max_data_bytes long) */
opus_int32 max_data_bytes /**< Allocated memory for payload; don't use for controlling bitrate */
-);
+) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
/** Returns length of the data payload (in bytes) or a negative error code. */
-OPUS_EXPORT int opus_multistream_encode_float(
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_encode_float(
OpusMSEncoder *st, /**< Encoder state */
const float *pcm, /**< Input signal interleaved in channel order. length is frame_size*channels */
int frame_size, /**< Number of samples per frame of input signal */
unsigned char *data, /**< Output buffer for the compressed payload (no more than max_data_bytes long) */
opus_int32 max_data_bytes /**< Allocated memory for payload; don't use for controlling bitrate */
- );
+) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(2) OPUS_ARG_NONNULL(4);
/** Gets the size of an OpusMSEncoder structure.
* @returns size
*/
-OPUS_EXPORT opus_int32 opus_multistream_encoder_get_size(
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_encoder_get_size(
int streams, /**< Total number of coded streams */
int coupled_streams /**< Number of coupled (stereo) streams */
);
@@ -105,19 +105,19 @@ OPUS_EXPORT opus_int32 opus_multistream_encoder_get_size(
OPUS_EXPORT void opus_multistream_encoder_destroy(OpusMSEncoder *st);
/** Get or set options on a multistream encoder state */
-OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...);
+OPUS_EXPORT int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...) OPUS_ARG_NONNULL(1);
/** Allocate and initialize a multistream decoder state object.
* Call opus_multistream_decoder_destroy() to release
* this object when finished. */
-OPUS_EXPORT OpusMSDecoder *opus_multistream_decoder_create(
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusMSDecoder *opus_multistream_decoder_create(
opus_int32 Fs, /**< Sampling rate to decode at (Hz) */
int channels, /**< Number of channels to decode */
int streams, /**< Total number of coded streams in the multistream */
int coupled_streams, /**< Number of coupled (stereo) streams in the multistream */
const unsigned char *mapping, /**< Stream to channel mapping table */
int *error /**< Error code */
-);
+) OPUS_ARG_NONNULL(5);
/** Intialize a previously allocated decoder state object. */
OPUS_EXPORT int opus_multistream_decoder_init(
@@ -127,10 +127,10 @@ OPUS_EXPORT int opus_multistream_decoder_init(
int streams, /**< Total number of coded streams */
int coupled_streams, /**< Number of coupled (stereo) streams */
const unsigned char *mapping /**< Stream to channel mapping table */
-);
+) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(6);
/** Returns the number of samples decoded or a negative error code */
-OPUS_EXPORT int opus_multistream_decode(
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode(
OpusMSDecoder *st, /**< Decoder state */
const unsigned char *data, /**< Input payload. Use a NULL pointer to indicate packet loss */
opus_int32 len, /**< Number of bytes in payload */
@@ -138,10 +138,10 @@ OPUS_EXPORT int opus_multistream_decode(
int frame_size, /**< Number of samples per frame of input signal */
int decode_fec /**< Flag (0/1) to request that any in-band forward error correction data be */
/**< decoded. If no such data is available the frame is decoded as if it were lost. */
-);
+) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
/** Returns the number of samples decoded or a negative error code */
-OPUS_EXPORT int opus_multistream_decode_float(
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_multistream_decode_float(
OpusMSDecoder *st, /**< Decoder state */
const unsigned char *data, /**< Input payload buffer. Use a NULL pointer to indicate packet loss */
opus_int32 len, /**< Number of payload bytes in data */
@@ -149,18 +149,18 @@ OPUS_EXPORT int opus_multistream_decode_float(
int frame_size, /**< Number of samples per frame of input signal */
int decode_fec /**< Flag (0/1) to request that any in-band forward error correction data be */
/**< decoded. If no such data is available the frame is decoded as if it were lost. */
-);
+) OPUS_ARG_NONNULL(1) OPUS_ARG_NONNULL(4);
/** Gets the size of an OpusMSDecoder structure.
* @returns size
*/
-OPUS_EXPORT opus_int32 opus_multistream_decoder_get_size(
+OPUS_EXPORT OPUS_WARN_UNUSED_RESULT opus_int32 opus_multistream_decoder_get_size(
int streams, /**< Total number of coded streams */
int coupled_streams /**< Number of coupled (stereo) streams */
);
/** Get or set options on a multistream decoder state */
-OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...);
+OPUS_EXPORT int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) OPUS_ARG_NONNULL(1);
/** Deallocate a multistream decoder state object */
OPUS_EXPORT void opus_multistream_decoder_destroy(OpusMSDecoder *st);