1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

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
This commit is contained in:
Stefano Sabatini 2010-04-03 14:15:00 +00:00
parent 0e64218889
commit 2874c81cc8
17 changed files with 29 additions and 29 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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)) {

View File

@ -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;