[FFmpeg-cvslog] tools/ffhash: use av_hash_final_hex().
Nicolas George
git at videolan.org
Tue Apr 29 19:43:48 CEST 2014
ffmpeg | branch: master | Nicolas George <george at nsup.org> | Mon Apr 21 17:22:22 2014 +0200| [3926a30b58f6245c733d28102278b6917ec1bbf5] | committer: Nicolas George
tools/ffhash: use av_hash_final_hex().
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3926a30b58f6245c733d28102278b6917ec1bbf5
---
tools/ffhash.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/tools/ffhash.c b/tools/ffhash.c
index 086d48a..9a8f2aa 100644
--- a/tools/ffhash.c
+++ b/tools/ffhash.c
@@ -40,7 +40,6 @@
#define SIZE 65536
static struct AVHashContext *hash;
-static uint8_t *res;
static void usage(void)
{
@@ -60,12 +59,10 @@ static void usage(void)
static void finish(void)
{
- int i, len = av_hash_get_size(hash);
+ char res[2 * AV_HASH_MAX_SIZE + 1];
- printf("%s=0x", av_hash_get_name(hash));
- av_hash_final(hash, res);
- for (i = 0; i < len; i++)
- printf("%02x", res[i]);
+ av_hash_final_hex(hash, res, sizeof(res));
+ printf("%s=0x%s", av_hash_get_name(hash), res);
}
static int check(char *file)
@@ -130,11 +127,6 @@ int main(int argc, char **argv)
}
return 1;
}
- res = av_malloc(av_hash_get_size(hash));
- if (!res) {
- printf("%s\n", strerror(errno));
- return 1;
- }
for (i = 2; i < argc; i++)
ret |= check(argv[i]);
@@ -143,7 +135,6 @@ int main(int argc, char **argv)
ret |= check(NULL);
av_hash_freep(&hash);
- av_freep(&res);
return ret;
}
More information about the ffmpeg-cvslog
mailing list