$OpenBSD: patch-libavcodec_faad_c,v 1.1 2007/06/29 06:15:52 jakemsr Exp $
--- libavcodec/faad.c.orig	Thu May 31 16:09:10 2007
+++ libavcodec/faad.c	Thu May 31 16:22:30 2007
@@ -73,21 +73,21 @@ typedef struct {
                                 short *sample_buffer,
                                 unsigned long *samples);
 #else
-        unsigned char FAADAPI (*faacDecSetConfiguration)(faacDecHandle hDecoder,
+        uint8_t FAADAPI (*faacDecSetConfiguration)(faacDecHandle hDecoder,
                                                      faacDecConfigurationPtr config);
-        long FAADAPI (*faacDecInit)(faacDecHandle hDecoder,
-                                   unsigned char *buffer,
-                                 unsigned long buffer_size,
-                                 unsigned long *samplerate,
-                                 unsigned char *channels);
-        char FAADAPI (*faacDecInit2)(faacDecHandle hDecoder, unsigned char *pBuffer,
-                                 unsigned long SizeOfDecoderSpecificInfo,
-                                 unsigned long *samplerate, unsigned char *channels);
+        int32_t FAADAPI (*faacDecInit)(faacDecHandle hDecoder,
+                                   uint8_t *buffer,
+                                 uint32_t buffer_size,
+                                 uint32_t *samplerate,
+                                 uint8_t *channels);
+        int8_t FAADAPI (*faacDecInit2)(faacDecHandle hDecoder, uint8_t *pBuffer,
+                                 uint32_t SizeOfDecoderSpecificInfo,
+                                 uint32_t *samplerate, uint8_t *channels);
         void *FAADAPI (*faacDecDecode)(faacDecHandle hDecoder,
                                          faacDecFrameInfo *hInfo,
-                                         unsigned char *buffer,
-                                                                 unsigned long buffer_size);
-        char* FAADAPI (*faacDecGetErrorMessage)(unsigned char errcode);
+                                         uint8_t *buffer,
+                                         uint32_t buffer_size);
+        char* FAADAPI (*faacDecGetErrorMessage)(uint8_t errcode);
 #endif
 
     void FAADAPI (*faacDecClose)(faacDecHandle hDecoder);
@@ -95,7 +95,7 @@ typedef struct {
 
 } FAACContext;
 
-static const unsigned long faac_srates[] =
+static const uint32_t faac_srates[] =
 {
     96000, 88200, 64000, 48000, 44100, 32000,
     24000, 22050, 16000, 12000, 11025, 8000
@@ -104,11 +104,11 @@ static const unsigned long faac_srates[] =
 static int faac_init_mp4(AVCodecContext *avctx)
 {
     FAACContext *s = avctx->priv_data;
-    unsigned long samplerate;
+    uint32_t samplerate;
 #ifndef FAAD2_VERSION
     unsigned long channels;
 #else
-    unsigned char channels;
+    uint8_t channels;
 #endif
     int r = 0;
 
@@ -119,7 +119,7 @@ static int faac_init_mp4(AVCodecContext *avctx)
         if (r < 0){
             av_log(avctx, AV_LOG_ERROR,
                    "faacDecInit2 failed r:%d   sr:%ld  ch:%ld  s:%d\n",
-                   r, samplerate, (long)channels, avctx->extradata_size);
+                   r, (long)samplerate, (long)channels, avctx->extradata_size);
         } else {
             avctx->sample_rate = samplerate;
             avctx->channels = channels;
@@ -160,8 +160,8 @@ static int faac_decode_frame(AVCodecContext *avctx,
 #else
 
     if(!s->init){
-        unsigned long srate;
-        unsigned char channels;
+        uint32_t srate;
+        uint8_t channels;
         int r = s->faacDecInit(s->faac_handle, buf, buf_size, &srate, &channels);
         if(r < 0){
             av_log(avctx, AV_LOG_ERROR, "faac: codec init failed: %s\n",
@@ -173,7 +173,7 @@ static int faac_decode_frame(AVCodecContext *avctx,
         s->init = 1;
     }
 
-    out = s->faacDecDecode(s->faac_handle, &frame_info, (unsigned char*)buf, (unsigned long)buf_size);
+    out = s->faacDecDecode(s->faac_handle, &frame_info, buf, buf_size);
 
     if (frame_info.error > 0) {
         av_log(avctx, AV_LOG_ERROR, "faac: frame decoding failed: %s\n",
@@ -242,16 +242,16 @@ static int faac_decode_init(AVCodecContext *avctx)
         dfaac(Decode, (int FAADAPI (*)(faacDecHandle, unsigned char*,
                              unsigned long*, short*, unsigned long*)));
 #else
-        dfaac(SetConfiguration, (unsigned char FAADAPI (*)(faacDecHandle,
+        dfaac(SetConfiguration, (uint8_t FAADAPI (*)(faacDecHandle,
                                                            faacDecConfigurationPtr)));
-        dfaac(Init, (long FAADAPI (*)(faacDecHandle, unsigned char*,
-                                     unsigned long, unsigned long*, unsigned char*)));
-        dfaac(Init2, (char FAADAPI (*)(faacDecHandle, unsigned char*,
-                                       unsigned long, unsigned long*,
-                                       unsigned char*)));
+        dfaac(Init, (int32_t FAADAPI (*)(faacDecHandle, uint8_t*,
+                                     uint32_t, uint32_t*, uint8_t*)));
+        dfaac(Init2, (int8_t FAADAPI (*)(faacDecHandle, uint8_t*,
+                                       uint32_t, uint32_t*,
+                                       uint8_t*)));
         dfaac(Decode, (void *FAADAPI (*)(faacDecHandle, faacDecFrameInfo*,
-                             unsigned char*, unsigned long)));
-        dfaac(GetErrorMessage, (char* FAADAPI (*)(unsigned char)));
+                             uint8_t*, uint32_t)));
+        dfaac(GetErrorMessage, (int8_t* FAADAPI (*)(uint8_t)));
 #endif
 #undef dfacc
 
