mi4: Correct a build warning/error that pops up on stricter hosts
Change-Id: Ibf549472aa75a1f5e63eccb5ca7974dec506710f
This commit is contained in:
parent
2434b6ca25
commit
ff665a26d6
1 changed files with 6 additions and 6 deletions
12
tools/mi4.c
12
tools/mi4.c
|
@ -118,7 +118,7 @@ int mi4_encode(char *iname, char *oname, int version, int magic,
|
||||||
}
|
}
|
||||||
fseek(file,0,SEEK_END);
|
fseek(file,0,SEEK_END);
|
||||||
length = ftell(file);
|
length = ftell(file);
|
||||||
|
|
||||||
fseek(file,0,SEEK_SET);
|
fseek(file,0,SEEK_SET);
|
||||||
|
|
||||||
/* Add 4 bytes to length (for magic), the 0x200 byte header and
|
/* Add 4 bytes to length (for magic), the 0x200 byte header and
|
||||||
|
@ -150,15 +150,15 @@ int mi4_encode(char *iname, char *oname, int version, int magic,
|
||||||
int2le(length+4, &outbuf[0x2e8]); /* length plus 0xaa55aa55 */
|
int2le(length+4, &outbuf[0x2e8]); /* length plus 0xaa55aa55 */
|
||||||
|
|
||||||
int2le(0xaa55aa55, &outbuf[0x200+length]); /* More Magic */
|
int2le(0xaa55aa55, &outbuf[0x200+length]); /* More Magic */
|
||||||
|
|
||||||
strncpy((char *)outbuf+0x1f8, type, 4); /* type of binary (RBBL, RBOS) */
|
strncpy((char *)outbuf+0x1f8, type, 4); /* type of binary (RBBL, RBOS) */
|
||||||
strncpy((char *)outbuf+0x1fc, model, 4); /* 4 character model id */
|
strncpy((char *)outbuf+0x1fc, model, 4); /* 4 character model id */
|
||||||
|
|
||||||
/* Calculate CRC32 checksum */
|
/* Calculate CRC32 checksum */
|
||||||
chksum_crc32gentab ();
|
chksum_crc32gentab ();
|
||||||
crc = chksum_crc32 (outbuf+0x200,mi4length-0x200);
|
crc = chksum_crc32 (outbuf+0x200,mi4length-0x200);
|
||||||
|
|
||||||
strncpy((char *)outbuf, "PPOS", 4); /* Magic */
|
memcpy(outbuf, "PPOS", 4); /* Magic */
|
||||||
int2le(version, &outbuf[0x04]); /* .mi4 version */
|
int2le(version, &outbuf[0x04]); /* .mi4 version */
|
||||||
int2le(length+4, &outbuf[0x08]); /* Length of firmware plus magic */
|
int2le(length+4, &outbuf[0x08]); /* Length of firmware plus magic */
|
||||||
int2le(crc, &outbuf[0x0c]); /* CRC32 of mi4 file */
|
int2le(crc, &outbuf[0x0c]); /* CRC32 of mi4 file */
|
||||||
|
@ -168,7 +168,7 @@ int mi4_encode(char *iname, char *oname, int version, int magic,
|
||||||
|
|
||||||
/* v3 files require a dummy DSA signature */
|
/* v3 files require a dummy DSA signature */
|
||||||
if (version == 0x00010301) {
|
if (version == 0x00010301) {
|
||||||
outbuf[0x2f]=0x01;
|
outbuf[0x2f]=0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = fopen(oname, "wb");
|
file = fopen(oname, "wb");
|
||||||
|
@ -176,7 +176,7 @@ int mi4_encode(char *iname, char *oname, int version, int magic,
|
||||||
perror(oname);
|
perror(oname);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = fwrite(outbuf, 1, mi4length, file);
|
len = fwrite(outbuf, 1, mi4length, file);
|
||||||
if(len < (size_t)length) {
|
if(len < (size_t)length) {
|
||||||
perror(oname);
|
perror(oname);
|
||||||
|
|
Loading…
Reference in a new issue