mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
gcc4 fixes.
git-svn-id: svn://coreboot.org/openbios/openbios-devel@21 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -55,6 +55,7 @@ static void* btree_readnode(btree* bt, btree_node_desc* node, void *p)
|
||||
*/
|
||||
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 @@ static void* btree_readhead(btree* bt, btree_head* head, void *p)
|
||||
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.
|
||||
|
||||
@@ -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))
|
||||
#include "openbios/config.h"
|
||||
#include "libc/byteorder.h"
|
||||
|
||||
/* basic fuction:
|
||||
value = swab_inc(ptr);
|
||||
ptr is afterwards incremented by sizeof(value)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_BIG_ENDIAN
|
||||
|
||||
#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
|
||||
|
||||
/* Big endian */
|
||||
|
||||
#define bswabU16_inc(ptr) (*((UInt16*) (ptr))++)
|
||||
#define bswabU32_inc(ptr) (*((UInt32*) (ptr))++)
|
||||
#define bswabU64_inc(ptr) (*((UInt64*) (ptr))++)
|
||||
|
||||
#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = val
|
||||
#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = val
|
||||
#define bstoreU64_inc(ptr, val) (*((UInt64*) (ptr))++) = val
|
||||
|
||||
|
||||
/* 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)
|
||||
|
||||
@@ -146,8 +146,11 @@ static inline void* record_readFInfo(void *p, FInfo* info)
|
||||
/* 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;
|
||||
|
||||
@@ -140,7 +140,7 @@ volume_readbuf(volume * vol, hfsp_vh* vh, void* p)
|
||||
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 @@ volume_read_wrapper(volume * vol, hfsp_vh* vh)
|
||||
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");
|
||||
|
||||
Reference in New Issue
Block a user