Signed-off-by: Moritz Barsnick <barsn...@gmx.net> --- libavformat/hashenc.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c index 394b8a0fce..070d4001b1 100644 --- a/libavformat/hashenc.c +++ b/libavformat/hashenc.c @@ -86,10 +86,10 @@ static int hash_write_header(struct AVFormatContext *s) if (!c->hashes) return AVERROR(ENOMEM); for (i = 0; i < num_hashes; i++) { - res = av_hash_alloc(&c->hashes[i], c->hash_name); - if (res < 0) - goto err; - av_hash_init(c->hashes[i]); + res = av_hash_alloc(&c->hashes[i], c->hash_name); + if (res < 0) + goto err; + av_hash_init(c->hashes[i]); } return 0; err: @@ -111,18 +111,18 @@ static int hash_write_trailer(struct AVFormatContext *s) struct HashContext *c = s->priv_data; int num_hashes = c->per_stream ? s->nb_streams : 1; for (int i = 0; i < num_hashes; i++) { - char buf[AV_HASH_MAX_SIZE*2+128]; - if (c->per_stream) { - snprintf(buf, sizeof(buf) - 200, "%d,%s=", i, av_hash_get_name(c->hashes[i])); - } else { - snprintf(buf, sizeof(buf) - 200, "%s=", av_hash_get_name(c->hashes[i])); - } - av_hash_final_hex(c->hashes[i], buf + strlen(buf), sizeof(buf) - strlen(buf)); - av_strlcatf(buf, sizeof(buf), "\n"); - avio_write(s->pb, buf, strlen(buf)); - avio_flush(s->pb); + char buf[AV_HASH_MAX_SIZE*2+128]; + if (c->per_stream) { + snprintf(buf, sizeof(buf) - 200, "%d,%s=", i, av_hash_get_name(c->hashes[i])); + } else { + snprintf(buf, sizeof(buf) - 200, "%s=", av_hash_get_name(c->hashes[i])); + } + av_hash_final_hex(c->hashes[i], buf + strlen(buf), sizeof(buf) - strlen(buf)); + av_strlcatf(buf, sizeof(buf), "\n"); + avio_write(s->pb, buf, strlen(buf)); + avio_flush(s->pb); - av_hash_freep(&c->hashes[i]); + av_hash_freep(&c->hashes[i]); } av_freep(&c->hashes); return 0; -- 2.20.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".