[PATCH 1/3] [MTD-UTILS] Unified reading from standard input and from file
Artem Bityutskiy
dedekind at infradead.org
Wed Jun 10 12:03:34 EDT 2009
On Tue, 2009-06-09 at 16:04 -0700, Jehan Bing wrote:
> - readlen = meminfo.writesize;
>
> - if (ifd != STDIN_FILENO) {
> - int tinycnt = 0;
> -
> - if (pad && (imglen < readlen))
> - {
> - readlen = imglen;
> - erase_buffer(writebuf + readlen, meminfo.writesize - readlen);
> - }
> + {
> + readlen = meminfo.writesize;
>
Err, why do you need these spare { } ?
> - /* Read Page Data from input file */
> - while(tinycnt < readlen) {
> - cnt = read(ifd, writebuf + tinycnt, readlen - tinycnt);
> - if (cnt == 0) { // EOF
> - break;
> - } else if (cnt < 0) {
> - perror ("File I/O error on input file");
> - goto closeall;
> - }
> - tinycnt += cnt;
> - }
> - } else {
> int tinycnt = 0;
Err, is it normal C do do stuff like
{
readlen = meminfo.writesize;
int tinycnt += cnt;
? I think this is C++.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
More information about the linux-mtd
mailing list