[Yaffs] [PATCH 3/3] Fix wrong file size for build on 32bits …

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: tristan
Date:  
To: yaffs
CC: Tristan Lelong
Subject: [Yaffs] [PATCH 3/3] Fix wrong file size for build on 32bits machines.
From: Tristan Lelong <>

In in 32 bits, if sizeof(long) == 4 then
(long)var >> 32 == var
So we need to check for that specific case

Signed-off-by: Tristan Lelong <>
---

without this, the size of the files on the target are huge...

 utils/mkyaffs2image.c |    4 ++++
 1 file changed, 4 insertions(+)


diff --git a/utils/mkyaffs2image.c b/utils/mkyaffs2image.c
index b46f285..7fe4f68 100644
--- a/utils/mkyaffs2image.c
+++ b/utils/mkyaffs2image.c
@@ -302,7 +302,11 @@ static int write_object_header(int id, enum yaffs_obj_type t, struct stat *s, in
     if(t == YAFFS_OBJECT_TYPE_FILE)
     {
         oh->file_size_low = s->st_size;
+#if __SIZEOF_LONG__ == __SIZE_OF_INT__
+        oh->file_size_high = 0;
+#else
         oh->file_size_high = (s->st_size >> 32);
+#endif
     }

    
     if(t == YAFFS_OBJECT_TYPE_HARDLINK)
-- 
618FE3EF