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