X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fcrypto.c;h=1d4514e0f27f5c74a9189e4ecea7ceba1d05b6cb;hb=b334fd39c9c00c739faeece87fa81c980c148a16;hp=9a48f2e6f512ce8047ff39fdac221816f22c3e40;hpb=f32d2939555706365ad1d39aadd5ee7ce1d9fa4f;p=ffmpeg diff --git a/libavformat/crypto.c b/libavformat/crypto.c index 9a48f2e6f51..1d4514e0f27 100644 --- a/libavformat/crypto.c +++ b/libavformat/crypto.c @@ -252,21 +252,17 @@ static int64_t crypto_seek(URLContext *h, int64_t pos, int whence) case SEEK_CUR: pos = pos + c->position; break; - case SEEK_END: { - int64_t newpos = ffurl_seek( c->hd, pos, AVSEEK_SIZE ); + case SEEK_END: + newpos = ffurl_seek( c->hd, pos, AVSEEK_SIZE ); if (newpos < 0) { av_log(h, AV_LOG_ERROR, "Crypto: seek_end - can't get file size (pos=%lld)\r\n", (long long int)pos); return newpos; } pos = newpos - pos; - } - break; - case AVSEEK_SIZE: { - int64_t newpos = ffurl_seek( c->hd, pos, AVSEEK_SIZE ); - return newpos; - } break; + case AVSEEK_SIZE: + return ffurl_seek( c->hd, pos, AVSEEK_SIZE ); default: av_log(h, AV_LOG_ERROR, "Crypto: no support for seek where 'whence' is %d\r\n", whence); @@ -385,8 +381,7 @@ static int crypto_close(URLContext *h) ret = ffurl_write(c->hd, out_buf, BLOCKSIZE); } - if (c->hd) - ffurl_close(c->hd); + ffurl_closep(&c->hd); av_freep(&c->aes_decrypt); av_freep(&c->aes_encrypt); av_freep(&c->write_buf);