lkml.org 
[lkml]   [2005]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 9/10] squashfs: remove some more casts
    Jörn

    --
    Ninety percent of everything is crap.
    -- Sturgeon's Law


    Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
    ---

    fs/squashfs/inode.c | 32 ++++++++++++++------------------
    1 files changed, 14 insertions(+), 18 deletions(-)

    --- linux-2.6.12-rc3cow/fs/squashfs/inode.c~squashfs_cu9 2005-04-22 08:53:27.741921536 +0200
    +++ linux-2.6.12-rc3cow/fs/squashfs/inode.c 2005-04-22 09:17:39.795175888 +0200
    @@ -124,39 +124,35 @@ static struct buffer_head *get_block_len
    squashfs_sb_info *msBlk = s->s_fs_info;
    unsigned short temp;
    struct buffer_head *bh;
    + unsigned char *data;

    if (!(bh = sb_bread(s, *cur_index)))
    return NULL;

    if (msBlk->devblksize - *offset == 1) {
    + data = bh->b_data;
    if (msBlk->swap)
    - ((unsigned char *) &temp)[1] = *((unsigned char *)
    - (bh->b_data + *offset));
    + ((unsigned char *) &temp)[1] = data[*offset];
    else
    - ((unsigned char *) &temp)[0] = *((unsigned char *)
    - (bh->b_data + *offset));
    + ((unsigned char *) &temp)[0] = data[*offset];
    brelse(bh);
    if (!(bh = sb_bread(s, ++(*cur_index))))
    return NULL;
    + data = bh->b_data;
    if (msBlk->swap)
    - ((unsigned char *) &temp)[0] = *((unsigned char *)
    - bh->b_data);
    + ((unsigned char *) &temp)[0] = data[0];
    else
    - ((unsigned char *) &temp)[1] = *((unsigned char *)
    - bh->b_data);
    + ((unsigned char *) &temp)[1] = data[0];
    *c_byte = temp;
    *offset = 1;
    } else {
    + data = bh->b_data;
    if (msBlk->swap) {
    - ((unsigned char *) &temp)[1] = *((unsigned char *)
    - (bh->b_data + *offset));
    - ((unsigned char *) &temp)[0] = *((unsigned char *)
    - (bh->b_data + *offset + 1));
    + ((unsigned char *) &temp)[1] = data[*offset];
    + ((unsigned char *) &temp)[0] = data[*offset + 1];
    } else {
    - ((unsigned char *) &temp)[0] = *((unsigned char *)
    - (bh->b_data + *offset));
    - ((unsigned char *) &temp)[1] = *((unsigned char *)
    - (bh->b_data + *offset + 1));
    + ((unsigned char *) &temp)[0] = data[*offset];
    + ((unsigned char *) &temp)[1] = data[*offset + 1];
    }
    *c_byte = temp;
    *offset += 2;
    @@ -169,8 +165,8 @@ static struct buffer_head *get_block_len
    return NULL;
    *offset = 0;
    }
    - if (*((unsigned char *) (bh->b_data + *offset)) !=
    - SQUASHFS_MARKER_BYTE) {
    + data = bh->b_data;
    + if (data[*offset] != SQUASHFS_MARKER_BYTE) {
    ERROR("Metadata block marker corrupt @ %x\n",
    *cur_index);
    brelse(bh);
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-04-22 09:32    [W:2.560 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site