From 25e76a5db6404e5e0f41b58d4b5647ac216444e7 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Wed, 2 Apr 2014 02:13:32 +0200 Subject: [PATCH] Remove template read/write --- src/img/template.c | 76 ---------------------------------------------- 1 file changed, 76 deletions(-) diff --git a/src/img/template.c b/src/img/template.c index 68d06f89e..043e535c0 100644 --- a/src/img/template.c +++ b/src/img/template.c @@ -2,82 +2,6 @@ #include "xalloc.h" #include "imlib.h" #include - -int imlib_save_template(struct image *image, const char *path) -{ - UINT n_out; - - FIL fp; - FRESULT res=FR_OK; - - res = f_open(&fp, path, FA_READ|FA_WRITE|FA_OPEN_ALWAYS); - if (res != FR_OK) { - return res; - } - - /* write template width */ - res = f_write(&fp, &image->w, sizeof(image->w), &n_out); - if (res != FR_OK || n_out != sizeof(image->w)) { - goto error; - } - - /* write template height */ - res = f_write(&fp, &image->h, sizeof(image->h), &n_out); - if (res != FR_OK || n_out != sizeof(image->h)) { - goto error; - } - - /* write template data */ - res = f_write(&fp, image->data, image->w*image->h*sizeof(*image->data), &n_out); - if (res != FR_OK || n_out != image->w*image->h*sizeof(*image->data)) { - goto error; - } - -error: - f_close(&fp); - return res; -} - -int imlib_load_template(struct image *image, const char *path) -{ - UINT n_out; - - FIL fp; - FRESULT res=FR_OK; - - res = f_open(&fp, path, FA_READ|FA_OPEN_EXISTING); - if (res != FR_OK) { - return res; - } - - /* read template width */ - res = f_read(&fp, &image->w, sizeof(image->w), &n_out); - if (res != FR_OK || n_out != sizeof(image->w)) { - goto error; - } - - /* read template height */ - res = f_read(&fp, &image->h, sizeof(image->h), &n_out); - if (res != FR_OK || n_out != sizeof(image->h)) { - goto error; - } - - printf("loading template:%dx%d \n", image->w, image->h); - image->data = xalloc(sizeof(*image->data)*image->w*image->h); - if (image->data == NULL) { - goto error; - } - /* read template data */ - res = f_read(&fp, image->data, image->w*image->h*sizeof(*image->data), &n_out); - if (res != FR_OK || n_out != image->w*image->h*sizeof(*image->data)) { - goto error; - } - -error: - f_close(&fp); - return res; -} - float imlib_template_match(struct image *f, struct image *t_orig, struct rectangle *r) { int x,y,u,v;