Commit 803a532c authored by stefano's avatar stefano

Replace all remaining occurrences of AVERROR_NOMEM with

AVERROR(ENOMEM).

AVERROR_NOMEM is deprecated and will be dropped at the next libavutil
major bump.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22791 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 4d84d05a
...@@ -216,7 +216,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) ...@@ -216,7 +216,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
if (avctx->error_recognition >= FF_ER_CAREFUL) { if (avctx->error_recognition >= FF_ER_CAREFUL) {
s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
if (!s->input_buffer) if (!s->input_buffer)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
avctx->sample_fmt = SAMPLE_FMT_S16; avctx->sample_fmt = SAMPLE_FMT_S16;
......
...@@ -288,11 +288,11 @@ static int tgv_decode_frame(AVCodecContext *avctx, ...@@ -288,11 +288,11 @@ static int tgv_decode_frame(AVCodecContext *avctx,
/* allocate additional 12 bytes to accomodate av_memcpy_backptr() OUTBUF_PADDED optimisation */ /* allocate additional 12 bytes to accomodate av_memcpy_backptr() OUTBUF_PADDED optimisation */
s->frame.data[0] = av_malloc(s->width*s->height + 12); s->frame.data[0] = av_malloc(s->width*s->height + 12);
if (!s->frame.data[0]) if (!s->frame.data[0])
return AVERROR_NOMEM; return AVERROR(ENOMEM);
s->frame.data[1] = av_malloc(AVPALETTE_SIZE); s->frame.data[1] = av_malloc(AVPALETTE_SIZE);
if (!s->frame.data[1]) { if (!s->frame.data[1]) {
av_freep(&s->frame.data[0]); av_freep(&s->frame.data[0]);
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
} }
memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
......
...@@ -352,7 +352,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) ...@@ -352,7 +352,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
/* initialize MD5 context */ /* initialize MD5 context */
s->md5ctx = av_malloc(av_md5_size); s->md5ctx = av_malloc(av_md5_size);
if(!s->md5ctx) if(!s->md5ctx)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
av_md5_init(s->md5ctx); av_md5_init(s->md5ctx);
streaminfo = av_malloc(FLAC_STREAMINFO_SIZE); streaminfo = av_malloc(FLAC_STREAMINFO_SIZE);
......
...@@ -133,10 +133,10 @@ static av_cold int gif_encode_init(AVCodecContext *avctx) ...@@ -133,10 +133,10 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
avctx->coded_frame = &s->picture; avctx->coded_frame = &s->picture;
s->lzw = av_mallocz(ff_lzw_encode_state_size); s->lzw = av_mallocz(ff_lzw_encode_state_size);
if (!s->lzw) if (!s->lzw)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
s->buf = av_malloc(avctx->width*avctx->height*2); s->buf = av_malloc(avctx->width*avctx->height*2);
if (!s->buf) if (!s->buf)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
return 0; return 0;
} }
......
...@@ -284,7 +284,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -284,7 +284,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
st = av_new_stream(s, 0); st = av_new_stream(s, 0);
if(!st) { if(!st) {
vfw_read_close(s); vfw_read_close(s);
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
/* Set video format */ /* Set video format */
...@@ -294,7 +294,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -294,7 +294,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
bi = av_malloc(bisize); bi = av_malloc(bisize);
if(!bi) { if(!bi) {
vfw_read_close(s); vfw_read_close(s);
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
ret = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, bisize, (LPARAM) bi); ret = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, bisize, (LPARAM) bi);
if(!ret) if(!ret)
......
...@@ -248,7 +248,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) ...@@ -248,7 +248,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
} }
ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame)); ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame));
if(!ape->frames) if(!ape->frames)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength; ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength;
ape->currentframe = 0; ape->currentframe = 0;
...@@ -351,7 +351,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) ...@@ -351,7 +351,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
nblocks = ape->blocksperframe; nblocks = ape->blocksperframe;
if (av_new_packet(pkt, ape->frames[ape->currentframe].size + extra_size) < 0) if (av_new_packet(pkt, ape->frames[ape->currentframe].size + extra_size) < 0)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
AV_WL32(pkt->data , nblocks); AV_WL32(pkt->data , nblocks);
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip); AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
......
...@@ -56,7 +56,7 @@ static int ape_tag_read_field(AVFormatContext *s) ...@@ -56,7 +56,7 @@ static int ape_tag_read_field(AVFormatContext *s)
return -1; return -1;
value = av_malloc(size+1); value = av_malloc(size+1);
if (!value) if (!value)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
get_buffer(pb, value, size); get_buffer(pb, value, size);
value[size] = 0; value[size] = 0;
av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL);
......
...@@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s) ...@@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s)
/* new audio stream */ /* new audio stream */
st = av_new_stream(s, 0); st = av_new_stream(s, 0);
if (!st) if (!st)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
/* parse format description */ /* parse format description */
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
...@@ -67,7 +67,7 @@ static int flac_read_header(AVFormatContext *s, ...@@ -67,7 +67,7 @@ static int flac_read_header(AVFormatContext *s,
case FLAC_METADATA_TYPE_VORBIS_COMMENT: case FLAC_METADATA_TYPE_VORBIS_COMMENT:
buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE); buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!buffer) { if (!buffer) {
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) { if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) {
av_freep(&buffer); av_freep(&buffer);
......
...@@ -433,7 +433,7 @@ static int mpegts_write_header(AVFormatContext *s) ...@@ -433,7 +433,7 @@ static int mpegts_write_header(AVFormatContext *s)
st->codec->extradata_size > 0) { st->codec->extradata_size > 0) {
ts_st->adts = av_mallocz(sizeof(*ts_st->adts)); ts_st->adts = av_mallocz(sizeof(*ts_st->adts));
if (!ts_st->adts) if (!ts_st->adts)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
if (ff_adts_decode_extradata(s, ts_st->adts, st->codec->extradata, if (ff_adts_decode_extradata(s, ts_st->adts, st->codec->extradata,
st->codec->extradata_size) < 0) st->codec->extradata_size) < 0)
return -1; return -1;
...@@ -836,7 +836,7 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -836,7 +836,7 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
return -1; return -1;
data = av_malloc(new_size); data = av_malloc(new_size);
if (!data) if (!data)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
ff_adts_write_frame_header(adts, data, pkt->size, adts->pce_size); ff_adts_write_frame_header(adts, data, pkt->size, adts->pce_size);
if (adts->pce_size) { if (adts->pce_size) {
memcpy(data+ADTS_HEADER_SIZE, adts->pce_data, adts->pce_size); memcpy(data+ADTS_HEADER_SIZE, adts->pce_data, adts->pce_size);
......
...@@ -77,7 +77,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) ...@@ -77,7 +77,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
st = av_new_stream(ctx, 0); st = av_new_stream(ctx, 0);
if(!st) if(!st)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
codec = st->codec; codec = st->codec;
codec->codec_type = AVMEDIA_TYPE_VIDEO; codec->codec_type = AVMEDIA_TYPE_VIDEO;
......
...@@ -121,7 +121,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, ...@@ -121,7 +121,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx,
oggstream->header[0] = av_mallocz(51); // per ogg flac specs oggstream->header[0] = av_mallocz(51); // per ogg flac specs
p = oggstream->header[0]; p = oggstream->header[0];
if (!p) if (!p)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
bytestream_put_byte(&p, 0x7F); bytestream_put_byte(&p, 0x7F);
bytestream_put_buffer(&p, "FLAC", 4); bytestream_put_buffer(&p, "FLAC", 4);
bytestream_put_byte(&p, 1); // major version bytestream_put_byte(&p, 1); // major version
...@@ -135,7 +135,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, ...@@ -135,7 +135,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx,
// second packet: VorbisComment // second packet: VorbisComment
p = ogg_write_vorbiscomment(4, bitexact, &oggstream->header_len[1], m); p = ogg_write_vorbiscomment(4, bitexact, &oggstream->header_len[1], m);
if (!p) if (!p)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
oggstream->header[1] = p; oggstream->header[1] = p;
bytestream_put_byte(&p, 0x84); // last metadata block and vorbis comment bytestream_put_byte(&p, 0x84); // last metadata block and vorbis comment
bytestream_put_be24(&p, oggstream->header_len[1] - 4); bytestream_put_be24(&p, oggstream->header_len[1] - 4);
...@@ -157,7 +157,7 @@ static int ogg_build_speex_headers(AVCodecContext *avctx, ...@@ -157,7 +157,7 @@ static int ogg_build_speex_headers(AVCodecContext *avctx,
// first packet: Speex header // first packet: Speex header
p = av_mallocz(SPEEX_HEADER_SIZE); p = av_mallocz(SPEEX_HEADER_SIZE);
if (!p) if (!p)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
oggstream->header[0] = p; oggstream->header[0] = p;
oggstream->header_len[0] = SPEEX_HEADER_SIZE; oggstream->header_len[0] = SPEEX_HEADER_SIZE;
bytestream_put_buffer(&p, avctx->extradata, SPEEX_HEADER_SIZE); bytestream_put_buffer(&p, avctx->extradata, SPEEX_HEADER_SIZE);
...@@ -166,7 +166,7 @@ static int ogg_build_speex_headers(AVCodecContext *avctx, ...@@ -166,7 +166,7 @@ static int ogg_build_speex_headers(AVCodecContext *avctx,
// second packet: VorbisComment // second packet: VorbisComment
p = ogg_write_vorbiscomment(0, bitexact, &oggstream->header_len[1], m); p = ogg_write_vorbiscomment(0, bitexact, &oggstream->header_len[1], m);
if (!p) if (!p)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
oggstream->header[1] = p; oggstream->header[1] = p;
return 0; return 0;
......
...@@ -106,7 +106,7 @@ static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned ...@@ -106,7 +106,7 @@ static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned
return -1; return -1;
avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata) if (!avctx->extradata)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
avctx->extradata_size = get_buffer(pb, avctx->extradata, size); avctx->extradata_size = get_buffer(pb, avctx->extradata, size);
memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
if (avctx->extradata_size != size) if (avctx->extradata_size != size)
......
...@@ -83,7 +83,7 @@ static int amr_handle_packet(AVFormatContext *ctx, ...@@ -83,7 +83,7 @@ static int amr_handle_packet(AVFormatContext *ctx,
/* Everything except the codec mode request byte should be output. */ /* Everything except the codec mode request byte should be output. */
if (av_new_packet(pkt, len - 1)) { if (av_new_packet(pkt, len - 1)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory\n"); av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
pkt->stream_index = st->index; pkt->stream_index = st->index;
ptr = pkt->data; ptr = pkt->data;
......
...@@ -78,7 +78,7 @@ static int h263_handle_packet(AVFormatContext *ctx, ...@@ -78,7 +78,7 @@ static int h263_handle_packet(AVFormatContext *ctx,
if (av_new_packet(pkt, len + startcode)) { if (av_new_packet(pkt, len + startcode)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory\n"); av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
pkt->stream_index = st->index; pkt->stream_index = st->index;
ptr = pkt->data; ptr = pkt->data;
......
...@@ -134,7 +134,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, ...@@ -134,7 +134,7 @@ static int xiph_handle_packet(AVFormatContext * ctx,
if (av_new_packet(pkt, data_len)) { if (av_new_packet(pkt, data_len)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n"); av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
pkt->stream_index = st->index; pkt->stream_index = st->index;
...@@ -189,7 +189,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, ...@@ -189,7 +189,7 @@ static int xiph_handle_packet(AVFormatContext * ctx,
if (av_new_packet(pkt, frame_size)) { if (av_new_packet(pkt, frame_size)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n"); av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
memcpy(pkt->data, xiph_data, frame_size); memcpy(pkt->data, xiph_data, frame_size);
...@@ -272,7 +272,7 @@ parse_packed_headers(const uint8_t * packed_headers, ...@@ -272,7 +272,7 @@ parse_packed_headers(const uint8_t * packed_headers,
ptr = codec->extradata = av_malloc(extradata_alloc); ptr = codec->extradata = av_malloc(extradata_alloc);
if (!ptr) { if (!ptr) {
av_log(codec, AV_LOG_ERROR, "Out of memory\n"); av_log(codec, AV_LOG_ERROR, "Out of memory\n");
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
*ptr++ = 2; *ptr++ = 2;
ptr += av_xiphlacing(ptr, length1); ptr += av_xiphlacing(ptr, length1);
...@@ -331,7 +331,7 @@ static int xiph_parse_fmtp_pair(AVCodecContext * codec, ...@@ -331,7 +331,7 @@ static int xiph_parse_fmtp_pair(AVCodecContext * codec,
} else { } else {
av_log(codec, AV_LOG_ERROR, av_log(codec, AV_LOG_ERROR,
"Out of memory while decoding SDP configuration.\n"); "Out of memory while decoding SDP configuration.\n");
result = AVERROR_NOMEM; result = AVERROR(ENOMEM);
} }
} else { } else {
av_log(codec, AV_LOG_ERROR, "Packet too large\n"); av_log(codec, AV_LOG_ERROR, "Packet too large\n");
...@@ -356,7 +356,7 @@ static int xiph_parse_sdp_line(AVFormatContext *s, int st_index, ...@@ -356,7 +356,7 @@ static int xiph_parse_sdp_line(AVFormatContext *s, int st_index,
if (!(value = av_malloc(value_size))) { if (!(value = av_malloc(value_size))) {
av_log(codec, AV_LOG_ERROR, "Out of memory\n"); av_log(codec, AV_LOG_ERROR, "Out of memory\n");
return AVERROR_NOMEM; return AVERROR(ENOMEM);
} }
if (av_strstart(line, "fmtp:", &p)) { if (av_strstart(line, "fmtp:", &p)) {
......
...@@ -186,7 +186,7 @@ static int wc3_read_header(AVFormatContext *s, ...@@ -186,7 +186,7 @@ static int wc3_read_header(AVFormatContext *s,
/* load up the name */ /* load up the name */
buffer = av_malloc(size+1); buffer = av_malloc(size+1);
if (!buffer) if (!buffer)
return AVERROR_NOMEM; return AVERROR(ENOMEM);
if ((ret = get_buffer(pb, buffer, size)) != size) if ((ret = get_buffer(pb, buffer, size)) != size)
return AVERROR(EIO); return AVERROR(EIO);
buffer[size] = 0; buffer[size] = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment