History

frwu: Employ more meaningful return values.

Paul B Mahol committed 14 years ago

Commit 5ff88021 parent f54ae2f1 file · +11 −9Browse files

Unified · Split

libavcodec/frwu.c+11−9
@@ -28,7 +28,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 27 unmodified lines
2828 {
2929 if (avctx->width & 1) {
3030 av_log(avctx, AV_LOG_ERROR, "FRWU needs even width\n");
31− return -1;
31+ return AVERROR(EINVAL);
3232 }
3333 avctx->pix_fmt = PIX_FMT_UYVY422;
3434
@@ -42,7 +42,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 7 unmodified lines
4242 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
4343 AVPacket *avpkt)
4444 {
45− int field;
45+ int field, ret;
4646 AVFrame *pic = avctx->coded_frame;
4747 const uint8_t *buf = avpkt->data;
4848 const uint8_t *buf_end = buf + avpkt->size;
@@ -52,16 +52,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, · 3 unmodified lines
5252
5353 if (avpkt->size < avctx->width * 2 * avctx->height + 4 + 2*8) {
5454 av_log(avctx, AV_LOG_ERROR, "Packet is too small.\n");
55− return -1;
55+ return AVERROR_INVALIDDATA;
5656 }
5757 if (bytestream_get_le32(&buf) != AV_RL32("FRW1")) {
5858 av_log(avctx, AV_LOG_ERROR, "incorrect marker\n");
59− return -1;
59+ return AVERROR_INVALIDDATA;
6060 }
6161
6262 pic->reference = 0;
63− if (avctx->get_buffer(avctx, pic) < 0)
64− return -1;
63+ if ((ret = avctx->get_buffer(avctx, pic)) < 0) {
64+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
65+ return ret;
66+ }
6567
6668 pic->pict_type = AV_PICTURE_TYPE_I;
6769 pic->key_frame = 1;
@@ -74,16 +76,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, · 6 unmodified lines
7476 int field_size, min_field_size = avctx->width * 2 * field_h;
7577 uint8_t *dst = pic->data[0];
7678 if (buf_end - buf < 8)
77− return -1;
79+ return AVERROR_INVALIDDATA;
7880 buf += 4; // flags? 0x80 == bottom field maybe?
7981 field_size = bytestream_get_le32(&buf);
8082 if (field_size < min_field_size) {
8183 av_log(avctx, AV_LOG_ERROR, "Field size %i is too small (required %i)\n", field_size, min_field_size);
82− return -1;
84+ return AVERROR_INVALIDDATA;
8385 }
8486 if (buf_end - buf < field_size) {
8587 av_log(avctx, AV_LOG_ERROR, "Packet is too small, need %i, have %i\n", field_size, (int)(buf_end - buf));
86− return -1;
88+ return AVERROR_INVALIDDATA;
8789 }
8890 if (field)
8991 dst += pic->linesize[0];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t