summaryrefslogtreecommitdiff
path: root/board/netstar/crcit.c
diff options
context:
space:
mode:
authorLadislav Michl <Ladislav.Michl@seznam.cz>2010-01-27 11:12:23 -0500
committerTom Rix <Tom.Rix@windriver.com>2010-02-12 12:31:54 -0600
commit89e94d81eda9af2e1c35e97125b0c049335c70fc (patch)
tree67fc46e6427544d84cd976c9231f3d77f2586004 /board/netstar/crcit.c
parent3843e7dc934d8ef7c592f5a2106885efe32eac7f (diff)
downloadu-boot-imx-89e94d81eda9af2e1c35e97125b0c049335c70fc.zip
u-boot-imx-89e94d81eda9af2e1c35e97125b0c049335c70fc.tar.gz
u-boot-imx-89e94d81eda9af2e1c35e97125b0c049335c70fc.tar.bz2
NetStar: make crcit utility more readable
This patch makes the crcit utility more readable Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Diffstat (limited to 'board/netstar/crcit.c')
-rw-r--r--board/netstar/crcit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/board/netstar/crcit.c b/board/netstar/crcit.c
index e0cea9b..0eef41a 100644
--- a/board/netstar/crcit.c
+++ b/board/netstar/crcit.c
@@ -56,13 +56,14 @@ static int do_crc(char *path, unsigned version)
fprintf(stderr, "File too large\n");
return EXIT_FAILURE;
}
- size = (size + 3) & ~3; /* round up to 4 bytes */
- data[0] = size + 4; /* add size of version field */
+ size = (size + 3) & ~3; /* round up to 4 bytes */
+ size += 4; /* add size of version field */
+ data[0] = size;
data[1] = version;
- data[2 + (size >> 2)] = crc32(0, (unsigned char *)(data + 1), data[0]);
+ data[size/4 + 1] = crc32(0, (unsigned char *)(data + 1), size);
close(fd);
- if (write(STDOUT_FILENO, data, size + 3*4) == -1) {
+ if (write(STDOUT_FILENO, data, size + 4 /*size*/ + 4 /*crc*/) == -1) {
perror("Error writing file");
return EXIT_FAILURE;
}