OSDN Git Service

Merge commit 'ca488ad480360dfafcb5766f7bfbb567a0638979'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 24 Jul 2013 08:28:38 +0000 (10:28 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 24 Jul 2013 08:31:10 +0000 (10:31 +0200)
* commit 'ca488ad480360dfafcb5766f7bfbb567a0638979':
  alsdec: Clean up error paths

Conflicts:
libavcodec/alsdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/alsdec.c

@@@ -399,9 -388,9 +399,9 @@@ static av_cold int read_specific_config
      // initialize CRC calculation
      if (sconf->crc_enabled) {
          if (get_bits_left(&gb) < 32)
-             return -1;
+             return AVERROR_INVALIDDATA;
  
 -        if (avctx->err_recognition & AV_EF_CRCCHECK) {
 +        if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) {
              ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
              ctx->crc       = 0xFFFFFFFF;
              ctx->crc_org   = ~get_bits_long(&gb, 32);
@@@ -975,20 -960,18 +975,19 @@@ static int decode_var_block_data(ALSDec
   */
  static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
  {
-     GetBitContext *gb        = &ctx->gb;
 -    int ret = 0;
 +    int ret;
+     GetBitContext *gb        = &ctx->gb;
  
      *bd->shift_lsbs = 0;
      // read block type flag and read the samples accordingly
      if (get_bits1(gb)) {
-         if ((ret = read_var_block_data(ctx, bd)) < 0)
-             return ret;
+         ret = read_var_block_data(ctx, bd);
      } else {
 -        read_const_block_data(ctx, bd);
 +        if ((ret = read_const_block_data(ctx, bd)) < 0)
 +            return ret;
      }
  
-     return 0;
+     return ret;
  }
  
  
@@@ -1189,8 -1176,8 +1192,8 @@@ static int read_channel_data(ALSDecCont
          current->master_channel = get_bits_long(gb, av_ceil_log2(channels));
  
          if (current->master_channel >= channels) {
 -            av_log(ctx->avctx, AV_LOG_ERROR, "Invalid master channel!\n");
 +            av_log(ctx->avctx, AV_LOG_ERROR, "Invalid master channel.\n");
-             return -1;
+             return AVERROR_INVALIDDATA;
          }
  
          if (current->master_channel != c) {
      }
  
      if (entries == channels) {
 -        av_log(ctx->avctx, AV_LOG_ERROR, "Damaged channel data!\n");
 +        av_log(ctx->avctx, AV_LOG_ERROR, "Damaged channel data.\n");
-         return -1;
+         return AVERROR_INVALIDDATA;
      }
  
      align_get_bits(gb);
@@@ -1246,8 -1233,8 +1249,8 @@@ static int revert_channel_correlation(A
      }
  
      if (dep == channels) {
 -        av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel correlation!\n");
 +        av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel correlation.\n");
-         return -1;
+         return AVERROR_INVALIDDATA;
      }
  
      bd->const_block = ctx->const_block + c;
@@@ -1374,8 -1363,8 +1379,8 @@@ static int read_frame_data(ALSDecContex
  
          for (c = 0; c < avctx->channels; c++)
              if (ctx->chan_data[c] < ctx->chan_data_buffer) {
 -                av_log(ctx->avctx, AV_LOG_ERROR, "Invalid channel data!\n");
 +                av_log(ctx->avctx, AV_LOG_ERROR, "Invalid channel data.\n");
-                 return -1;
+                 return AVERROR_INVALIDDATA;
              }
  
          memset(reverted_channels, 0, sizeof(*reverted_channels) * avctx->channels);