#define _GNU_SOURCE #include #include #include #include #include #include #include "read-png.h" #include "read-cache.h" static void hash_image(FILE *cache, const char *path) { unsigned int width, height, stride; unsigned char *buf; unsigned char hash[SHA_DIGEST_LENGTH]; unsigned int buffer_length; read_png_status_t status; char *path_copy = strdup(path); char *name = basename(path_copy); status = read_png_argb32 (path, &buf, &width, &height, &stride); buffer_length = height * stride; printf("%d %d %d\n", width, height, stride); SHA1(buf, buffer_length, hash); int i; for (i=0; i 1) { /* search in directory of first argument for cache file */ cache = cache_open(argv[1], "w+"); } else { cache = cache_open("test/", "w+"); } if (!cache) { printf("could not open cache\n"); exit(1); } if (argc > 1) { for (i=1; i