=== modified file 'io/bufio.c' --- io/bufio.c 2008-08-01 04:06:55 +0000 +++ io/bufio.c 2010-04-06 19:53:03 +0000 @@ -45,7 +45,7 @@ grub_bufio_t bufio = 0; file = (grub_file_t) grub_malloc (sizeof (*file)); - if (! file) + if (!file) return 0; if (size == 0) @@ -55,10 +55,10 @@ if ((size < 0) || ((unsigned) size > io->size)) size = ((io->size > GRUB_BUFIO_MAX_SIZE) ? GRUB_BUFIO_MAX_SIZE : - io->size); + io->size); bufio = grub_malloc (sizeof (struct grub_bufio) + size); - if (! bufio) + if (!bufio) { grub_free (file); return 0; @@ -84,11 +84,11 @@ grub_file_t io, file; io = grub_file_open (name); - if (! io) + if (!io) return 0; file = grub_bufio_open (io, size); - if (! file) + if (!file) { grub_file_close (io); return 0; @@ -112,12 +112,12 @@ pos = file->offset - bufio->file->offset; n = bufio->buffer_len - pos; if (n > len) - n = len; + n = len; grub_memcpy (buf, &bufio->buffer[pos], n); len -= n; - if (! len) - return res; + if (!len) + return res; buf += n; bufio->file->offset += bufio->buffer_len; @@ -126,45 +126,45 @@ else { bufio->file->offset = grub_divmod64 (file->offset, bufio->block_size, - &pos); + &pos); bufio->file->offset *= bufio->block_size; } if (pos + len >= bufio->block_size) { if (pos) - { - grub_size_t n; - - bufio->file->fs->read (bufio->file, bufio->buffer, - bufio->block_size); - if (grub_errno) - return -1; - - n = bufio->block_size - pos; - grub_memcpy (buf, &bufio->buffer[pos], n); - len -= n; - buf += n; - bufio->file->offset += bufio->block_size; - pos = 0; - } + { + grub_size_t n; + + bufio->file->fs->read (bufio->file, bufio->buffer, + bufio->block_size); + if (grub_errno) + return -1; + + n = bufio->block_size - pos; + grub_memcpy (buf, &bufio->buffer[pos], n); + len -= n; + buf += n; + bufio->file->offset += bufio->block_size; + pos = 0; + } while (len >= bufio->block_size) - { - bufio->file->fs->read (bufio->file, buf, bufio->block_size); - if (grub_errno) - return -1; - - len -= bufio->block_size; - buf += bufio->block_size; - bufio->file->offset += bufio->block_size; - } - - if (! len) - { - bufio->buffer_len = 0; - return res; - } + { + bufio->file->fs->read (bufio->file, buf, bufio->block_size); + if (grub_errno) + return -1; + + len -= bufio->block_size; + buf += bufio->block_size; + bufio->file->offset += bufio->block_size; + } + + if (!len) + { + bufio->buffer_len = 0; + return res; + } } bufio->buffer_len = bufio->file->size - bufio->file->offset; @@ -193,13 +193,12 @@ return grub_errno; } -static struct grub_fs grub_bufio_fs = - { - .name = "bufio", - .dir = 0, - .open = 0, - .read = grub_bufio_read, - .close = grub_bufio_close, - .label = 0, - .next = 0 - }; +static struct grub_fs grub_bufio_fs = { + .name = "bufio", + .dir = 0, + .open = 0, + .read = grub_bufio_read, + .close = grub_bufio_close, + .label = 0, + .next = 0 +};