From 2bf61a980bb1a3ef2fafdec1783e3582a75096f3 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 5 May 2010 21:19:55 +0200 Subject: [PATCH] * video/readers/jpeg.c: Indented. --- ChangeLog | 4 +++ video/readers/jpeg.c | 84 ++++++++++++++++++++++---------------------- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3b2b44d1..76b1de28f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-05-05 Vladimir Serbinenko + + * video/readers/jpeg.c: Indented. + 2010-05-05 Vladimir Serbinenko Various jpeg cleanups. diff --git a/video/readers/jpeg.c b/video/readers/jpeg.c index f46b7f83f..9d88163bd 100644 --- a/video/readers/jpeg.c +++ b/video/readers/jpeg.c @@ -182,41 +182,41 @@ grub_jpeg_decode_huff_table (struct grub_jpeg_data *data) while (data->file->offset + sizeof (count) + 1 <= next_marker) { - id = grub_jpeg_get_byte (data); + id = grub_jpeg_get_byte (data); ac = (id >> 4) & 1; - id &= 0xF; - if (id > 1) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: too many huffman tables"); + id &= 0xF; + if (id > 1) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: too many huffman tables"); - if (grub_file_read (data->file, &count, sizeof (count)) != - sizeof (count)) - return grub_errno; + if (grub_file_read (data->file, &count, sizeof (count)) != + sizeof (count)) + return grub_errno; - n = 0; - for (i = 0; i < ARRAY_SIZE (count); i++) - n += count[i]; + n = 0; + for (i = 0; i < ARRAY_SIZE (count); i++) + n += count[i]; - id += ac * 2; - data->huff_value[id] = grub_malloc (n); - if (grub_errno) - return grub_errno; + id += ac * 2; + data->huff_value[id] = grub_malloc (n); + if (grub_errno) + return grub_errno; - if (grub_file_read (data->file, data->huff_value[id], n) != n) - return grub_errno; + if (grub_file_read (data->file, data->huff_value[id], n) != n) + return grub_errno; - base = 0; - ofs = 0; - for (i = 0; i < ARRAY_SIZE (count); i++) - { - base += count[i]; - ofs += count[i]; + base = 0; + ofs = 0; + for (i = 0; i < ARRAY_SIZE (count); i++) + { + base += count[i]; + ofs += count[i]; - data->huff_maxval[id][i] = base; - data->huff_offset[id][i] = ofs - base; + data->huff_maxval[id][i] = base; + data->huff_offset[id][i] = ofs - base; - base <<= 1; - } + base <<= 1; + } } if (data->file->offset != next_marker) @@ -234,21 +234,22 @@ grub_jpeg_decode_quan_table (struct grub_jpeg_data *data) next_marker = data->file->offset; next_marker += grub_jpeg_get_word (data); - while (data->file->offset + sizeof (data->quan_table[id]) + 1 <= next_marker) + while (data->file->offset + sizeof (data->quan_table[id]) + 1 + <= next_marker) { - id = grub_jpeg_get_byte (data); - if (id >= 0x10) /* Upper 4-bit is precision. */ - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: only 8-bit precision is supported"); + id = grub_jpeg_get_byte (data); + if (id >= 0x10) /* Upper 4-bit is precision. */ + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: only 8-bit precision is supported"); - if (id > 1) - return grub_error (GRUB_ERR_BAD_FILE_TYPE, - "jpeg: too many quantization tables"); + if (id > 1) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, + "jpeg: too many quantization tables"); - if (grub_file_read (data->file, &data->quan_table[id], - sizeof (data->quan_table[id])) - != sizeof (data->quan_table[id])) - return grub_errno; + if (grub_file_read (data->file, &data->quan_table[id], + sizeof (data->quan_table[id])) + != sizeof (data->quan_table[id])) + return grub_errno; } @@ -712,7 +713,7 @@ grub_video_reader_jpeg (struct grub_video_bitmap **bitmap, #if defined(JPEG_DEBUG) static grub_err_t grub_cmd_jpegtest (grub_command_t cmd __attribute__ ((unused)), - int argc, char **args) + int argc, char **args) { struct grub_video_bitmap *bitmap = 0; @@ -747,8 +748,7 @@ GRUB_MOD_INIT (jpeg) grub_video_bitmap_reader_register (&jpeg_reader); #if defined(JPEG_DEBUG) cmd = grub_register_command ("jpegtest", grub_cmd_jpegtest, - "FILE", - "Tests loading of JPEG bitmap."); + "FILE", "Tests loading of JPEG bitmap."); #endif }