Make mksyshdr safe for 64bits platforms (#1504)
authorFlorian Fainelli <florian@openwrt.org>
Fri, 23 Mar 2007 12:50:43 +0000 (12:50 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Fri, 23 Mar 2007 12:50:43 +0000 (12:50 +0000)
SVN-Revision: 6646

tools/firmware-utils/src/mksyshdr.c

index 9c6888e7736d202aa5228674cf7c35a5853248f6..9c1cd14336d40bdaaf9f53ecd6534e2ea10e6e2d 100644 (file)
@@ -1,11 +1,13 @@
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
+
 int main(int argc, char* argv[])
 {
        FILE* fp;
-       long  nImgSize;
+       uint32_t  nImgSize;
        char* pHeader1 = "CSYS";
-       long  nHeader2 = 0x80500000;
+       uint32_t  nHeader2 = 0x80500000;
 
        if (argc != 3)
        {
@@ -23,8 +25,8 @@ int main(int argc, char* argv[])
                if (fp != NULL)
                {
                        fwrite(pHeader1,  sizeof(char), 4, fp);
-                       fwrite(&nHeader2, sizeof(long), 1, fp);
-                       fwrite(&nImgSize, sizeof(long), 1, fp);
+                       fwrite(&nHeader2, sizeof(nHeader2), 1, fp);
+                       fwrite(&nImgSize, sizeof(nImgSize), 1, fp);
                        fclose(fp);
                }
                else