From 59354a7742ff0fc182886f2f2567026e516c1eef Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Thu, 8 Mar 2012 12:19:07 -0500
Subject: [PATCH] Fixes int vs opus_int32 compile errors on C5x

---
 include/opus_multistream.h | 8 ++++----
 silk/API.h                 | 2 +-
 silk/enc_API.c             | 2 +-
 src/opus_encoder.c         | 8 ++++----
 src/opus_private.h         | 4 ++--
 src/repacketizer.c         | 2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/opus_multistream.h b/include/opus_multistream.h
index d5217b1db..49b7f8115 100644
--- a/include/opus_multistream.h
+++ b/include/opus_multistream.h
@@ -77,7 +77,7 @@ OPUS_EXPORT int opus_multistream_encode(
     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) */
-    int max_data_bytes          /**< Allocated memory for payload; don't use for controlling bitrate */
+    opus_int32 max_data_bytes   /**< Allocated memory for payload; don't use for controlling bitrate */
 );
 
 /** Returns length of the data payload (in bytes) or a negative error code. */
@@ -86,7 +86,7 @@ OPUS_EXPORT int opus_multistream_encode_float(
       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) */
-      int max_data_bytes        /**< Allocated memory for payload; don't use for controlling bitrate */
+      opus_int32 max_data_bytes /**< Allocated memory for payload; don't use for controlling bitrate */
   );
 
 /** Gets the size of an OpusMSEncoder structure.
@@ -129,7 +129,7 @@ OPUS_EXPORT int opus_multistream_decoder_init(
 OPUS_EXPORT int opus_multistream_decode(
     OpusMSDecoder *st,          /**< Decoder state */
     const unsigned char *data,  /**< Input payload. Use a NULL pointer to indicate packet loss */
-    int len,                    /**< Number of bytes in payload */
+    opus_int32 len,             /**< Number of bytes in payload */
     opus_int16 *pcm,            /**< Output signal, samples interleaved in channel order . length is frame_size*channels */
     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 */
@@ -140,7 +140,7 @@ OPUS_EXPORT int opus_multistream_decode(
 OPUS_EXPORT int opus_multistream_decode_float(
     OpusMSDecoder *st,          /**< Decoder state */
     const unsigned char *data,  /**< Input payload buffer. Use a NULL pointer to indicate packet loss */
-    int len,                    /**< Number of payload bytes in data */
+    opus_int32 len,             /**< Number of payload bytes in data */
     float *pcm,                 /**< Buffer for the output signal (interleaved iin channel order). length is frame_size*channels */
     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 */
diff --git a/silk/API.h b/silk/API.h
index 1bb39adc3..fb84216a6 100644
--- a/silk/API.h
+++ b/silk/API.h
@@ -86,7 +86,7 @@ opus_int silk_Encode(                                   /* O    Returns error co
     const opus_int16                *samplesIn,         /* I    Speech sample input vector                      */
     opus_int                        nSamplesIn,         /* I    Number of samples in input vector               */
     ec_enc                          *psRangeEnc,        /* I/O  Compressor data structure                       */
-    opus_int                        *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
+    opus_int32                      *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
     const opus_int                  prefillFlag         /* I    Flag to indicate prefilling buffers no coding   */
 );
 
diff --git a/silk/enc_API.c b/silk/enc_API.c
index 4eb80f9e3..da23a1bc0 100644
--- a/silk/enc_API.c
+++ b/silk/enc_API.c
@@ -133,7 +133,7 @@ opus_int silk_Encode(                                   /* O    Returns error co
     const opus_int16                *samplesIn,         /* I    Speech sample input vector                      */
     opus_int                        nSamplesIn,         /* I    Number of samples in input vector               */
     ec_enc                          *psRangeEnc,        /* I/O  Compressor data structure                       */
-    opus_int                        *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
+    opus_int32                      *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
     const opus_int                  prefillFlag         /* I    Flag to indicate prefilling buffers no coding   */
 )
 {
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index c00bc2f8a..6ab863ded 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -441,7 +441,7 @@ int opus_encode(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
                 unsigned char *data, opus_int32 out_data_bytes)
 #else
 #define opus_encode_native opus_encode_float
-int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
+opus_int32 opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
                       unsigned char *data, opus_int32 out_data_bytes)
 #endif
 {
@@ -449,7 +449,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
     CELTEncoder *celt_enc;
     int i;
     int ret=0;
-    int nBytes;
+    opus_int32 nBytes;
     ec_enc enc;
     int bytes_target;
     int prefill=0;
@@ -937,7 +937,7 @@ int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
 
         if (prefill)
         {
-            int zero=0;
+            opus_int32 zero=0;
 #ifdef FIXED_POINT
             pcm_silk = st->delay_buffer;
 #else
@@ -1272,7 +1272,7 @@ int opus_encode_float(OpusEncoder *st, const float *pcm, int frame_size,
 #endif
 
 #else
-int opus_encode(OpusEncoder *st, const opus_int16 *pcm, int frame_size,
+opus_int32 opus_encode(OpusEncoder *st, const opus_int16 *pcm, int frame_size,
       unsigned char *data, opus_int32 max_data_bytes)
 {
    int i, ret;
diff --git a/src/opus_private.h b/src/opus_private.h
index 8e6528d61..9394bd56c 100644
--- a/src/opus_private.h
+++ b/src/opus_private.h
@@ -71,7 +71,7 @@ struct OpusRepacketizer {
 
 int encode_size(int size, unsigned char *data);
 
-int opus_decode_native(OpusDecoder *st, const unsigned char *data, int len,
+int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len,
       opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited, int *packet_offset);
 
 /* Make sure everything's aligned to 4 bytes (this may need to be increased
@@ -81,6 +81,6 @@ static inline int align(int i)
     return (i+3)&-4;
 }
 
-int opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited);
+opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited);
 
 #endif /* OPUS_PRIVATE_H */
diff --git a/src/repacketizer.c b/src/repacketizer.c
index dd923a218..36b8b792d 100644
--- a/src/repacketizer.c
+++ b/src/repacketizer.c
@@ -58,7 +58,7 @@ void opus_repacketizer_destroy(OpusRepacketizer *rp)
    opus_free(rp);
 }
 
-int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, int len)
+int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, opus_int32 len)
 {
    unsigned char tmp_toc;
    int curr_nb_frames,ret;
-- 
GitLab