From: Stefano Sabatini Date: Sat, 3 Apr 2010 14:15:00 +0000 (+0000) Subject: Replace all remaining occurrences of AVERROR_NOMEM with X-Git-Tag: v0.6~334 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2874c81cc80b7f1005073748e8f1877055bf97a7;p=coroid%2Flibav_saccubus.git Replace all remaining occurrences of AVERROR_NOMEM with AVERROR(ENOMEM). AVERROR_NOMEM is deprecated and will be dropped at the next libavutil major bump. Originally committed as revision 22791 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 9b1aeecea..182e4fbcb 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -216,7 +216,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) if (avctx->error_recognition >= FF_ER_CAREFUL) { s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); if (!s->input_buffer) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } avctx->sample_fmt = SAMPLE_FMT_S16; diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index ce0be4bae..e5a908ea2 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -288,11 +288,11 @@ static int tgv_decode_frame(AVCodecContext *avctx, /* allocate additional 12 bytes to accomodate av_memcpy_backptr() OUTBUF_PADDED optimisation */ s->frame.data[0] = av_malloc(s->width*s->height + 12); if (!s->frame.data[0]) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); s->frame.data[1] = av_malloc(AVPALETTE_SIZE); if (!s->frame.data[1]) { av_freep(&s->frame.data[0]); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } } memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 33d8133a3..89d40d5ac 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -352,7 +352,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) /* initialize MD5 context */ s->md5ctx = av_malloc(av_md5_size); if(!s->md5ctx) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); av_md5_init(s->md5ctx); streaminfo = av_malloc(FLAC_STREAMINFO_SIZE); diff --git a/libavcodec/gif.c b/libavcodec/gif.c index c04f8bbc1..5114b8922 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -133,10 +133,10 @@ static av_cold int gif_encode_init(AVCodecContext *avctx) avctx->coded_frame = &s->picture; s->lzw = av_mallocz(ff_lzw_encode_state_size); if (!s->lzw) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); s->buf = av_malloc(avctx->width*avctx->height*2); if (!s->buf) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); return 0; } diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 9f54494c8..47b51456d 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -284,7 +284,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) st = av_new_stream(s, 0); if(!st) { vfw_read_close(s); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } /* Set video format */ @@ -294,7 +294,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) bi = av_malloc(bisize); if(!bi) { vfw_read_close(s); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } ret = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, bisize, (LPARAM) bi); if(!ret) diff --git a/libavformat/ape.c b/libavformat/ape.c index 102e191a3..91acf7240 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -248,7 +248,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) } ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame)); if(!ape->frames) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength; ape->currentframe = 0; @@ -351,7 +351,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) nblocks = ape->blocksperframe; 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 + 4, ape->frames[ape->currentframe].skip); diff --git a/libavformat/apetag.c b/libavformat/apetag.c index d8cad855b..d30c13222 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -56,7 +56,7 @@ static int ape_tag_read_field(AVFormatContext *s) return -1; value = av_malloc(size+1); if (!value) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); get_buffer(pb, value, size); value[size] = 0; av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 720a49a89..3fe4eab5c 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s) /* new audio stream */ st = av_new_stream(s, 0); if (!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); /* parse format description */ st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 02ae8ae62..2ceef964e 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -67,7 +67,7 @@ static int flac_read_header(AVFormatContext *s, case FLAC_METADATA_TYPE_VORBIS_COMMENT: buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!buffer) { - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) { av_freep(&buffer); diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index adb94af95..f05e3314e 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -433,7 +433,7 @@ static int mpegts_write_header(AVFormatContext *s) st->codec->extradata_size > 0) { ts_st->adts = av_mallocz(sizeof(*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, st->codec->extradata_size) < 0) return -1; @@ -836,7 +836,7 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) return -1; data = av_malloc(new_size); if (!data) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); ff_adts_write_frame_header(adts, data, pkt->size, adts->pce_size); if (adts->pce_size) { memcpy(data+ADTS_HEADER_SIZE, adts->pce_data, adts->pce_size); diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index 5b498e925..e5488718b 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -77,7 +77,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) st = av_new_stream(ctx, 0); if(!st) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); codec = st->codec; codec->codec_type = AVMEDIA_TYPE_VIDEO; diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 10fe20d04..36ea21cd4 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -121,7 +121,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, oggstream->header[0] = av_mallocz(51); // per ogg flac specs p = oggstream->header[0]; if (!p) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); bytestream_put_byte(&p, 0x7F); bytestream_put_buffer(&p, "FLAC", 4); bytestream_put_byte(&p, 1); // major version @@ -135,7 +135,7 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, // second packet: VorbisComment p = ogg_write_vorbiscomment(4, bitexact, &oggstream->header_len[1], m); if (!p) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); oggstream->header[1] = p; bytestream_put_byte(&p, 0x84); // last metadata block and vorbis comment bytestream_put_be24(&p, oggstream->header_len[1] - 4); @@ -157,7 +157,7 @@ static int ogg_build_speex_headers(AVCodecContext *avctx, // first packet: Speex header p = av_mallocz(SPEEX_HEADER_SIZE); if (!p) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); oggstream->header[0] = p; oggstream->header_len[0] = SPEEX_HEADER_SIZE; bytestream_put_buffer(&p, avctx->extradata, SPEEX_HEADER_SIZE); @@ -166,7 +166,7 @@ static int ogg_build_speex_headers(AVCodecContext *avctx, // second packet: VorbisComment p = ogg_write_vorbiscomment(0, bitexact, &oggstream->header_len[1], m); if (!p) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); oggstream->header[1] = p; return 0; diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index b8abcfc0b..8fc0d96df 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -106,7 +106,7 @@ static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned return -1; avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); avctx->extradata_size = get_buffer(pb, avctx->extradata, size); memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); if (avctx->extradata_size != size) diff --git a/libavformat/rtpdec_amr.c b/libavformat/rtpdec_amr.c index 38399c666..a7b36c7ab 100644 --- a/libavformat/rtpdec_amr.c +++ b/libavformat/rtpdec_amr.c @@ -83,7 +83,7 @@ static int amr_handle_packet(AVFormatContext *ctx, /* Everything except the codec mode request byte should be output. */ if (av_new_packet(pkt, len - 1)) { av_log(ctx, AV_LOG_ERROR, "Out of memory\n"); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } pkt->stream_index = st->index; ptr = pkt->data; diff --git a/libavformat/rtpdec_h263.c b/libavformat/rtpdec_h263.c index 3d5925e9a..19de6eca2 100644 --- a/libavformat/rtpdec_h263.c +++ b/libavformat/rtpdec_h263.c @@ -78,7 +78,7 @@ static int h263_handle_packet(AVFormatContext *ctx, if (av_new_packet(pkt, len + startcode)) { av_log(ctx, AV_LOG_ERROR, "Out of memory\n"); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } pkt->stream_index = st->index; ptr = pkt->data; diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c index 302f9858d..1c6eef7d9 100644 --- a/libavformat/rtpdec_xiph.c +++ b/libavformat/rtpdec_xiph.c @@ -134,7 +134,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, if (av_new_packet(pkt, data_len)) { av_log(ctx, AV_LOG_ERROR, "Out of memory.\n"); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } pkt->stream_index = st->index; @@ -189,7 +189,7 @@ static int xiph_handle_packet(AVFormatContext * ctx, if (av_new_packet(pkt, frame_size)) { av_log(ctx, AV_LOG_ERROR, "Out of memory.\n"); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } memcpy(pkt->data, xiph_data, frame_size); @@ -272,7 +272,7 @@ parse_packed_headers(const uint8_t * packed_headers, ptr = codec->extradata = av_malloc(extradata_alloc); if (!ptr) { av_log(codec, AV_LOG_ERROR, "Out of memory\n"); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } *ptr++ = 2; ptr += av_xiphlacing(ptr, length1); @@ -331,7 +331,7 @@ static int xiph_parse_fmtp_pair(AVCodecContext * codec, } else { av_log(codec, AV_LOG_ERROR, "Out of memory while decoding SDP configuration.\n"); - result = AVERROR_NOMEM; + result = AVERROR(ENOMEM); } } else { 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, if (!(value = av_malloc(value_size))) { av_log(codec, AV_LOG_ERROR, "Out of memory\n"); - return AVERROR_NOMEM; + return AVERROR(ENOMEM); } if (av_strstart(line, "fmtp:", &p)) { diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 413887357..a91df1b03 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -186,7 +186,7 @@ static int wc3_read_header(AVFormatContext *s, /* load up the name */ buffer = av_malloc(size+1); if (!buffer) - return AVERROR_NOMEM; + return AVERROR(ENOMEM); if ((ret = get_buffer(pb, buffer, size)) != size) return AVERROR(EIO); buffer[size] = 0;