kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=ae01ddf0b29f0dd08048e574fb4e15e2e43f3085

commit ae01ddf0b29f0dd08048e574fb4e15e2e43f3085
Author: Kim Woelders <[email protected]>
Date:   Mon Oct 4 09:21:20 2021 +0200

    Introduce im->fsize
---
 src/lib/image.c | 7 +++++++
 src/lib/image.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/src/lib/image.c b/src/lib/image.c
index e825827..6617e15 100644
--- a/src/lib/image.c
+++ b/src/lib/image.c
@@ -594,8 +594,10 @@ __imlib_LoadEmbedded(ImlibLoader * l, ImlibImage * im, 
const char *file,
                      int load_data)
 {
    int                 rc;
+   struct stat         st;
    char               *file_save;
    FILE               *fp_save;
+   off_t               fsize_save;
 
    if (!l || !im)
       return 0;
@@ -605,12 +607,16 @@ __imlib_LoadEmbedded(ImlibLoader * l, ImlibImage * im, 
const char *file,
    im->real_file = strdup(file);
    fp_save = im->fp;
    im->fp = NULL;
+   fsize_save = im->fsize;
+   __imlib_FileStat(file, &st);
+   im->fsize = st.st_size;
 
    rc = __imlib_LoadImageWrapper(l, im, load_data);
 
    im->fp = fp_save;
    free(im->real_file);
    im->real_file = file_save;
+   im->fsize = fsize_save;
 
    return rc;
 }
@@ -703,6 +709,7 @@ __imlib_LoadImage(const char *file, FILE * fp, 
ImlibProgressFunction progress,
    /* so produce a new one and load an image into that */
    im = __imlib_ProduceImage();
    im->file = strdup(file);
+   im->fsize = st.st_size;
    im->real_file = im_file ? im_file : im->file;
    im->key = im_key;
 
diff --git a/src/lib/image.h b/src/lib/image.h
index 410dcdb..dd1ed8c 100644
--- a/src/lib/image.h
+++ b/src/lib/image.h
@@ -67,6 +67,7 @@ struct _imlibimage {
    ImlibImageDataMemoryFunction data_memory_func;
    ImlibLdCtx         *lc;
    FILE               *fp;
+   off_t               fsize;
 };
 
 #ifdef BUILD_X11

-- 


Reply via email to