Author: stepan Date: 2006-05-17 14:29:24 +0200 (Wed, 17 May 2006) New Revision: 21
Modified: openbios-devel/fs/hfsplus/btree.c openbios-devel/fs/hfsplus/include/swab.h openbios-devel/fs/hfsplus/record.c openbios-devel/fs/hfsplus/volume.c Log: gcc4 fixes.
Modified: openbios-devel/fs/hfsplus/btree.c =================================================================== --- openbios-devel/fs/hfsplus/btree.c 2006-05-17 12:28:27 UTC (rev 20) +++ openbios-devel/fs/hfsplus/btree.c 2006-05-17 12:29:24 UTC (rev 21) @@ -55,6 +55,7 @@ */ static void* btree_readhead(btree* bt, btree_head* head, void *p) { + UInt32 *q; head->depth = bswabU16_inc(p); head->root = bswabU32_inc(p); head->leaf_count = bswabU32_inc(p); @@ -70,8 +71,10 @@ head->reserved2 = bswabU8_inc(p); head->attributes = bswabU32_inc(p); // skip reserved bytes - ((UInt32*) p) += 16; - return p; + q=((UInt32*) p); + // ((UInt32*) p) += 16; + q+=16; + return q; }
/* Priority of the depth of the node compared to LRU value.
Modified: openbios-devel/fs/hfsplus/include/swab.h =================================================================== --- openbios-devel/fs/hfsplus/include/swab.h 2006-05-17 12:28:27 UTC (rev 20) +++ openbios-devel/fs/hfsplus/include/swab.h 2006-05-17 12:29:24 UTC (rev 21) @@ -1,6 +1,7 @@ /* * libhfs - library for reading and writing Macintosh HFS volumes - * Copyright (C) 2000 Klaus Halfmann khalfmann@libra.de + * + * Copyright (C) 2000 Klaus Halfmann klaus.halfmann@feri.de * Original work 1996-1998 Robert Leslie rob@mars.org * * This file defines some byte swapping function. I did not find this @@ -20,25 +21,43 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: swab.h,v 1.3 2000/09/14 05:53:44 hasi Exp $ + * $Id: swab.h,v 1.1.1.1 2002/03/05 19:50:29 klaus Exp $ */
-#ifndef bswap_16 -#define bswap_16(x) \ - ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) -#endif +#include "openbios/config.h" +#include "libc/byteorder.h"
-/* Big endian */ + /* basic fuction: + value = swab_inc(ptr); + ptr is afterwards incremented by sizeof(value) + */
-#define bswabU16_inc(ptr) (*((UInt16*) (ptr))++) -#define bswabU32_inc(ptr) (*((UInt32*) (ptr))++) -#define bswabU64_inc(ptr) (*((UInt64*) (ptr))++) +#ifndef CONFIG_BIG_ENDIAN
-#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = val -#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = val -#define bstoreU64_inc(ptr, val) (*((UInt64*) (ptr))++) = val +#define bswabU16(val) __bswap16(val)
+#define bswabU16_inc(ptr) (__extension__ ({ UInt16 v=__bswap16(*((UInt16*) (ptr))); ptr+=sizeof(UInt16);v;})) +#define bswabU32_inc(ptr) (__extension__ ({ UInt32 v=__bswap32(*((UInt32*) (ptr))); ptr+=sizeof(UInt32);v;})) +#define bswabU64_inc(ptr) (__extension__ ({ UInt64 v=__bswap64(*((UInt64*) (ptr))); ptr+=sizeof(UInt64);v;}))
+#define bstoreU16_inc(ptr, val) do {(*((UInt16*) (ptr))) = __bswap16(val); ptr+=sizeof(UInt16);} while (0) +#define bstoreU32_inc(ptr, val) do {(*((UInt32*) (ptr))) = __bswap32(val); ptr+=sizeof(UInt32);} while (0) +#define bstoreU64_inc(ptr, val) do {(*((UInt64*) (ptr))) = __bswap64(val); ptr+=sizeof(UInt64);} while (0) + +#else // BYTE_ORDER == BIG_ENDIAN + +#define bswabU16(val) val + +#define bswabU16_inc(ptr) (__extension__ ({ UInt16 v=(*((UInt16*) (ptr))); ptr+=sizeof(UInt16);v;})) +#define bswabU32_inc(ptr) (__extension__ ({ UInt32 v=(*((UInt32*) (ptr))); ptr+=sizeof(UInt32);v;})) +#define bswabU64_inc(ptr) (__extension__ ({ UInt64 v=(*((UInt64*) (ptr))); ptr+=sizeof(UInt64);v;})) + +#define bstoreU16_inc(ptr, val) do {(*((UInt16*) (ptr))) = val; ptr+=sizeof(UInt16);} while (0) +#define bstoreU32_inc(ptr, val) do {(*((UInt32*) (ptr))) = val; ptr+=sizeof(UInt32);} while (0) +#define bstoreU64_inc(ptr, val) do {(*((UInt64*) (ptr))) = val; ptr+=sizeof(UInt64);} while (0) + +#endif + /* for the sake of compleetness and readability */ -#define bswabU8_inc(ptr) (*((UInt8*) (ptr))++) -#define bstoreU8_inc(ptr,val) (*((UInt8*) (ptr))++) = val +#define bswabU8_inc(ptr) (__extension__ ({ UInt8 v=(*((UInt8*) (ptr))); ptr+=sizeof(UInt8);v;})) +#define bstoreU8_inc(ptr,val) do {(*((UInt8*) (ptr))) = val; ptr+=sizeof(UInt8);} while (0)
Modified: openbios-devel/fs/hfsplus/record.c =================================================================== --- openbios-devel/fs/hfsplus/record.c 2006-05-17 12:28:27 UTC (rev 20) +++ openbios-devel/fs/hfsplus/record.c 2006-05-17 12:29:24 UTC (rev 21) @@ -146,8 +146,11 @@ /* read extra File info */ static inline void* record_readFXInfo(void *p, FXInfo* xinfo) { + SInt16 *q; xinfo->fdIconID = bswabU16_inc(p); - ((SInt16*) p) += 4; // skip unused + q=(SInt16*) p; + q+=4; // skip unused + p=(void *)q; xinfo->fdComment = bswabU16_inc(p); xinfo->fdPutAway = bswabU32_inc(p); return p;
Modified: openbios-devel/fs/hfsplus/volume.c =================================================================== --- openbios-devel/fs/hfsplus/volume.c 2006-05-17 12:28:27 UTC (rev 20) +++ openbios-devel/fs/hfsplus/volume.c 2006-05-17 12:29:24 UTC (rev 21) @@ -140,7 +140,7 @@ vh->write_count = bswabU32_inc(p); vh->encodings_bmp = bswabU64_inc(p); memcpy(vh->finder_info, p, 32); - ((char*) p) += 32; // So finderinfo must be swapped later, *** + p += 32; // So finderinfo must be swapped later, *** p = volume_readfork(p, &vh->alloc_file ); p = volume_readfork(p, &vh->ext_file ); p = volume_readfork(p, &vh->cat_file ); @@ -180,12 +180,12 @@ UInt16 drAlBlSt; /* first allocation block in volume */ UInt16 embeds, embedl; /* Start/lenght of embedded area in blocks */ - ((char*) p) += 0x12; /* skip unneded HFS vol fields */ + p += 0x12; /* skip unneded HFS vol fields */ drAlBlkSiz = bswabU32_inc(p); /* offset 0x14 */ - ((char*) p) += 0x4; /* skip unneded HFS vol fields */ + p += 0x4; /* skip unneded HFS vol fields */ drAlBlSt = bswabU16_inc(p); /* offset 0x1C */ - ((char*) p) += 0x5E; /* skip unneded HFS vol fields */ + p += 0x5E; /* skip unneded HFS vol fields */ signature = bswabU16_inc(p); /* offset 0x7C, drEmbedSigWord */ if( signature != HFSP_VOLHEAD_SIG) HFSP_ERROR(-1, "This looks like a normal HFS volume");