input/ffmpeg: use "auto"

This commit is contained in:
Max Kellermann 2014-08-18 09:47:28 +02:00
parent 9b9d189a33
commit 12ba1957d0

View File

@ -101,9 +101,9 @@ input_ffmpeg_open(const char *uri,
return nullptr;
AVIOContext *h;
int ret = avio_open(&h, uri, AVIO_FLAG_READ);
if (ret != 0) {
error.Set(ffmpeg_domain, ret,
auto result = avio_open(&h, uri, AVIO_FLAG_READ);
if (result != 0) {
error.Set(ffmpeg_domain, result,
"libavformat failed to open the URI");
return nullptr;
}
@ -114,17 +114,17 @@ input_ffmpeg_open(const char *uri,
size_t
FfmpegInputStream::Read(void *ptr, size_t read_size, Error &error)
{
int ret = avio_read(h, (unsigned char *)ptr, read_size);
if (ret <= 0) {
if (ret < 0)
auto result = avio_read(h, (unsigned char *)ptr, read_size);
if (result <= 0) {
if (result < 0)
error.Set(ffmpeg_domain, "avio_read() failed");
eof = true;
return false;
}
offset += ret;
return (size_t)ret;
offset += result;
return (size_t)result;
}
bool
@ -136,9 +136,9 @@ FfmpegInputStream::IsEOF()
bool
FfmpegInputStream::Seek(offset_type new_offset, Error &error)
{
int64_t ret = avio_seek(h, new_offset, SEEK_SET);
auto result = avio_seek(h, new_offset, SEEK_SET);
if (ret >= 0) {
if (result >= 0) {
eof = false;
return true;
} else {