changeset 2543:e8f1f57215ad libavcodec

do not use a variable before proper initialization
author melanson
date Sun, 06 Mar 2005 06:22:24 +0000
parents a27a580f292e
children 8c426f5a09ae
files alac.c
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/alac.c	Sun Mar 06 00:43:55 2005 +0000
+++ b/alac.c	Sun Mar 06 06:22:24 2005 +0000
@@ -97,7 +97,7 @@
 
 void alac_set_info(alac_file *alac, char *inputbuffer)
 {
-  char *ptr = inputbuffer;
+    unsigned char *ptr = inputbuffer;
 
     ptr += 4; /* size */
     ptr += 4; /* alac */
@@ -134,7 +134,7 @@
     if (alac->input_buffer_index + 2 >= alac->input_buffer_size) {
         av_log(NULL, AV_LOG_INFO, "alac: input buffer went out of bounds (%d >= %d)\n",
             alac->input_buffer_index + 2, alac->input_buffer_size);
-        exit (0);
+//        exit (0);
     }
     result = (alac->input_buffer[alac->input_buffer_index + 0] << 16) |
              (alac->input_buffer[alac->input_buffer_index + 1] << 8) |
@@ -186,7 +186,7 @@
     if (alac->input_buffer_index >= alac->input_buffer_size) {
         av_log(NULL, AV_LOG_INFO, "alac: input buffer went out of bounds (%d >= %d)\n",
             alac->input_buffer_index + 2, alac->input_buffer_size);
-        exit (0);
+//        exit (0);
     }
 
     result = alac->input_buffer[alac->input_buffer_index];
@@ -488,8 +488,8 @@
                     int16_t *buffer_out,
                     int numchannels, int numsamples,
                     uint8_t interlacing_shift,
-                    uint8_t interlacing_leftweight) {
-
+                    uint8_t interlacing_leftweight)
+{
     int i;
     if (numsamples <= 0) return;
 
@@ -546,10 +546,10 @@
 int decode_frame(ALACContext *s, alac_file *alac,
                   unsigned char *inbuffer,
                   int input_buffer_size,
-                  void *outbuffer, int *outputsize){
-
+                  void *outbuffer, int *outputsize)
+{
     int channels;
-    int32_t outputsamples = alac->setinfo_max_samples_per_frame;
+    int32_t outputsamples;
 
     /* initialize from the extradata */
     if (!s->context_initialized) {
@@ -561,7 +561,8 @@
         alac_set_info(s->alac, s->avctx->extradata);
         s->context_initialized = 1;
     }
-    
+
+    outputsamples = alac->setinfo_max_samples_per_frame;
 
     /* setup the stream */
     alac->input_buffer = inbuffer;