summaryrefslogtreecommitdiff
path: root/libavcodec/pnm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-07 00:38:25 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-07 00:41:06 +0100
commit07f22d0b49332d9616ce5ff94679da5a01c19b0d (patch)
tree00e7f5f81436ddf1e54339661383e8fc6105cfca /libavcodec/pnm.c
parent7b018e5c8d182b0272477322377b8daafa1c970f (diff)
parent57d11e5e28bfe0bc445ad78fc033aafa73068bb4 (diff)
Merge commit '57d11e5e28bfe0bc445ad78fc033aafa73068bb4'
* commit '57d11e5e28bfe0bc445ad78fc033aafa73068bb4': fraps: return meaningful error codes. kgv1dec: return meaningful error codes. kmvc: return meaningful error codes. wnv1: return meaningful error codes. dpx: return meaningful error codes. truemotion1: return meaningful error codes pnm: return meaningful error codes. Conflicts: libavcodec/dpx.c libavcodec/fraps.c libavcodec/kmvc.c libavcodec/pnm.c libavcodec/pnmdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pnm.c')
-rw-r--r--libavcodec/pnm.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 13ecbb057f..8972143eab 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -65,7 +65,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
pnm_get(s, buf1, sizeof(buf1));
s->type= buf1[1]-'0';
if(buf1[0] != 'P')
- return -1;
+ return AVERROR_INVALIDDATA;
if (s->type==1 || s->type==4) {
avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
@@ -103,12 +103,12 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
} else if (!strcmp(buf1, "ENDHDR")) {
break;
} else {
- return -1;
+ return AVERROR_INVALIDDATA;
}
}
/* check that all tags are present */
if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_image_check_size(w, h, 0, avctx) || s->bytestream >= s->bytestream_end)
- return -1;
+ return AVERROR_INVALIDDATA;
avctx->width = w;
avctx->height = h;
@@ -137,18 +137,18 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
avctx->pix_fmt = AV_PIX_FMT_RGBA64BE;
}
} else {
- return -1;
+ return AVERROR_INVALIDDATA;
}
return 0;
} else {
- return -1;
+ return AVERROR_INVALIDDATA;
}
pnm_get(s, buf1, sizeof(buf1));
w = atoi(buf1);
pnm_get(s, buf1, sizeof(buf1));
h = atoi(buf1);
if(w <= 0 || h <= 0 || av_image_check_size(w, h, 0, avctx) || s->bytestream >= s->bytestream_end)
- return -1;
+ return AVERROR_INVALIDDATA;
avctx->width = w;
avctx->height = h;
@@ -168,7 +168,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
} else {
av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n");
avctx->pix_fmt = AV_PIX_FMT_NONE;
- return -1;
+ return AVERROR_INVALIDDATA;
}
}
}else
@@ -176,10 +176,10 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
/* more check if YUV420 */
if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
if ((avctx->width & 1) != 0)
- return -1;
+ return AVERROR_INVALIDDATA;
h = (avctx->height * 2);
if ((h % 3) != 0)
- return -1;
+ return AVERROR_INVALIDDATA;
h /= 3;
avctx->height = h;
}