[vlc-devel] [PATCH] modules: cache: use the same type for reading and writing

Steve Lhomme robux4 at videolabs.io
Tue Oct 11 12:12:29 CEST 2016


sizeof() is used to know the size to read and write. On Windows the stat struct
is not using the same types that are used for writing.
---
 src/modules/cache.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/modules/cache.c b/src/modules/cache.c
index a08496d..196b39d 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -374,14 +374,19 @@ size_t CacheLoad( vlc_object_t *p_this, const char *dir, module_cache_t **r )
             goto error;
         }
 
-        struct stat st;
-
         /* Load common info */
         LOAD_STRING(path);
         if (path == NULL)
             goto error;
-        LOAD_IMMEDIATE(st.st_mtime);
-        LOAD_IMMEDIATE(st.st_size);
+        time_t mtime;
+        off_t  size;
+        LOAD_IMMEDIATE(mtime);
+        LOAD_IMMEDIATE(size);
+
+        struct stat st = {
+            .st_mtime = mtime,
+            .st_size  = size,
+        };
 
         CacheAdd (&cache, &count, path, &st, module);
         free (path);
-- 
2.8.2



More information about the vlc-devel mailing list