From: Ladislav Michl <Ladislav.Michl@seznam.cz>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] NetStar: make crcit utility more readable.
Date: Wed, 30 Dec 2009 18:22:28 +0100 [thread overview]
Message-ID: <20091230172228.GA2549@localhost.localdomain> (raw)
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
board/netstar/crcit.c | 9 +++++----
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;
}
--
1.5.3.8
next reply other threads:[~2009-12-30 17:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-30 17:22 Ladislav Michl [this message]
2010-01-26 22:02 ` [U-Boot] [PATCH] NetStar: make crcit utility more readable Paulraj, Sandeep
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091230172228.GA2549@localhost.localdomain \
--to=ladislav.michl@seznam.cz \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox