Skip to content

Commit

Permalink
avformat/riff: return error code from ff_get_guid()
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Feb 12, 2014
1 parent 8c5fece commit d32926d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libavformat/riff.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static av_always_inline int ff_guidcmp(const void *g1, const void *g2)
return memcmp(g1, g2, sizeof(ff_asf_guid));
}

void ff_get_guid(AVIOContext *s, ff_asf_guid *g);
int ff_get_guid(AVIOContext *s, ff_asf_guid *g);
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g);
const ff_asf_guid *get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid);

Expand Down
7 changes: 5 additions & 2 deletions libavformat/riffdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@
#include "avio_internal.h"
#include "riff.h"

void ff_get_guid(AVIOContext *s, ff_asf_guid *g)
int ff_get_guid(AVIOContext *s, ff_asf_guid *g)
{
av_assert0(sizeof(*g) == 16); //compiler will optimize this out
if (avio_read(s, *g, sizeof(*g)) < (int)sizeof(*g))
if (avio_read(s, *g, sizeof(*g)) < (int)sizeof(*g)) {
memset(*g, 0, sizeof(*g));
return AVERROR_INVALIDDATA;
}
return 0;
}

enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid)
Expand Down

0 comments on commit d32926d

Please sign in to comment.