summaryrefslogtreecommitdiff
path: root/hfsplusutils/hfsplusutils-1.0.4-gcc4.patch
blob: 6f633454d3d5d29c59a4d7cff602e00323c2e33e (plain)
    1 --- a/libhfsp/src/btree.c
    2 +++ b/libhfsp/src/btree.c
    3 @@ -393,7 +393,7 @@ static int btree_init(btree* bt, volume*
    4  	{
    5  	    p = volume_readfromfork(vol, nodebuf, fork, 0, bt->blkpernode,
    6  		 HFSP_EXTENT_DATA, bt->cnid);
    7 -	    ((char*) p) += HEADER_RESERVEDOFFSET; // skip header
    8 +	    p += HEADER_RESERVEDOFFSET; // skip header
    9  	}
   10  	
   11  	bt->alloc_bits = malloc(alloc_size);
   12 --- a/libhfsp/src/swab.h
   13 +++ b/libhfsp/src/swab.h
   14 @@ -36,28 +36,28 @@
   15  
   16  #define bswabU16(val) bswap_16(val)
   17  
   18 -#define bswabU16_inc(ptr) bswap_16(*((UInt16*) (ptr))++)
   19 -#define bswabU32_inc(ptr) bswap_32(*((UInt32*) (ptr))++)
   20 -#define bswabU64_inc(ptr) bswap_64(*((UInt64*) (ptr))++)
   21 -
   22 -#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = bswap_16(val)
   23 -#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = bswap_32(val)
   24 -#define bstoreU64_inc(ptr, val) (*((UInt64*) (ptr))++) = bswap_64(val)
   25 +#define bswabU16_inc(ptr) bswap_16(*(*((UInt16**) (void *)(&ptr)))++)
   26 +#define bswabU32_inc(ptr) bswap_32(*(*((UInt32**) (void *)(&ptr)))++)
   27 +#define bswabU64_inc(ptr) bswap_64(*(*((UInt64**) (void *)(&ptr)))++)
   28 +
   29 +#define bstoreU16_inc(ptr, val) (*(*((UInt16**) (void *)(&ptr)))++) = bswap_16(val)
   30 +#define bstoreU32_inc(ptr, val) (*(*((UInt32**) (void *)(&ptr)))++) = bswap_32(val)
   31 +#define bstoreU64_inc(ptr, val) (*(*((UInt64**) (void *)(&ptr)))++) = bswap_64(val)
   32  
   33  #else // BYTE_ORDER == BIG_ENDIAN
   34  
   35  #define bswabU16(val) val
   36  
   37 -#define bswabU16_inc(ptr) (*((UInt16*) (ptr))++)
   38 -#define bswabU32_inc(ptr) (*((UInt32*) (ptr))++)
   39 -#define bswabU64_inc(ptr) (*((UInt64*) (ptr))++)
   40 -
   41 -#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = val
   42 -#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = val
   43 -#define bstoreU64_inc(ptr, val) (*((UInt64*) (ptr))++) = val
   44 +#define bswabU16_inc(ptr) (*(*((UInt16**) (void *)(&ptr)))++)
   45 +#define bswabU32_inc(ptr) (*(*((UInt32**) (void *)(&ptr)))++)
   46 +#define bswabU64_inc(ptr) (*(*((UInt64**) (void *)(&ptr)))++)
   47 +
   48 +#define bstoreU16_inc(ptr, val) (*(*((UInt16**) (void *)(&ptr)))++) = val
   49 +#define bstoreU32_inc(ptr, val) (*(*((UInt32**) (void *)(&ptr)))++) = val
   50 +#define bstoreU64_inc(ptr, val) (*(*((UInt64**) (void *)(&ptr)))++) = val
   51  
   52  #endif
   53  
   54  /* for the sake of compleetness and readability */
   55 -#define bswabU8_inc(ptr)	(*((UInt8*) (ptr))++)
   56 -#define bstoreU8_inc(ptr,val)	(*((UInt8*) (ptr))++) = val
   57 +#define bswabU8_inc(ptr)	(*(*((UInt8**) (void *)(&ptr)))++)
   58 +#define bstoreU8_inc(ptr,val)	(*(*((UInt8**) (void *)(&ptr)))++) = val
   59 --- a/libhfsp/src/btreecheck.c
   60 +++ b/libhfsp/src/btreecheck.c
   61 @@ -264,7 +264,7 @@ static int fscheck_btree_init(btree* bt,
   62  	{
   63  	    p = volume_readfromfork(vol, nodebuf, fork, 0, bt->blkpernode,
   64  		 HFSP_EXTENT_DATA, bt->cnid);
   65 -	    ((char*) p) += HEADER_RESERVEDOFFSET; // skip header
   66 +	    p += HEADER_RESERVEDOFFSET; // skip header
   67  	}
   68  	
   69  	bt->alloc_bits = malloc(alloc_size);
   70 --- a/libhfsp/src/fscheck.c
   71 +++ b/libhfsp/src/fscheck.c
   72 @@ -230,7 +230,7 @@ static int fscheck_volume_readbuf(volume
   73      vh->write_count	= bswabU32_inc(p);
   74      vh->encodings_bmp	= bswabU64_inc(p);
   75      memcpy(vh->finder_info, p, 32); 
   76 -    ((char*) p) += 32; // So finderinfo must be swapped later, ***
   77 +    p += 32; // So finderinfo must be swapped later, ***
   78      p = volume_readfork(p, &vh->alloc_file );
   79      p = volume_readfork(p, &vh->ext_file   );
   80      p = volume_readfork(p, &vh->cat_file   );
   81 @@ -277,12 +277,12 @@ static int fscheck_read_wrapper(volume *
   82  	    printf("Volume is wrapped in HFS volume "
   83  		   " (use hfsck to check this)\n");
   84  
   85 -	((char*) p) += 0x12;		/* skip unneded HFS vol fields */
   86 +	p += 0x12;		/* skip unneded HFS vol fields */
   87  	drAlBlkSiz = bswabU32_inc(p);	/* offset 0x14 */
   88 -	((char*) p) += 0x4;		/* skip unneded HFS vol fields */
   89 +	p += 0x4;		/* skip unneded HFS vol fields */
   90  	drAlBlSt    = bswabU16_inc(p);	/* offset 0x1C */
   91  	
   92 -	((char*) p) += 0x5E;		/* skip unneded HFS vol fields */
   93 +	p += 0x5E;		/* skip unneded HFS vol fields */
   94  	signature = bswabU16_inc(p);	/* offset 0x7C, drEmbedSigWord */
   95  	if (signature != HFSP_VOLHEAD_SIG)
   96  	    HFSP_ERROR(-1, "This looks like a normal HFS volume");
   97 --- a/libhfsp/src/volume.c
   98 +++ b/libhfsp/src/volume.c
   99 @@ -345,7 +345,7 @@ static int volume_readbuf(hfsp_vh* vh, v
  100      vh->write_count	= bswabU32_inc(p);
  101      vh->encodings_bmp	= bswabU64_inc(p);
  102      memcpy(vh->finder_info, p, 32); 
  103 -    ((char*) p) += 32; // finderinfo is not used by now
  104 +    p += 32; // finderinfo is not used by now
  105      p = volume_readfork(p, &vh->alloc_file );
  106      p = volume_readfork(p, &vh->ext_file   );
  107      p = volume_readfork(p, &vh->cat_file   );
  108 @@ -381,7 +381,7 @@ static int volume_writebuf(hfsp_vh* vh, 
  109      bstoreU32_inc(p, vh->write_count	);
  110      bstoreU64_inc(p, vh->encodings_bmp	);
  111      memcpy(p, vh->finder_info, 32); 
  112 -    ((char*) p) += 32; // finderinfo is not used by now
  113 +    p += 32; // finderinfo is not used by now
  114      p = volume_writefork(p, &vh->alloc_file );
  115      p = volume_writefork(p, &vh->ext_file   );
  116      p = volume_writefork(p, &vh->cat_file   );
  117 @@ -417,12 +417,12 @@ static int volume_read_wrapper(volume * 
  118    
  119  	UInt16	embeds, embedl;		/* Start/lenght of embedded area in blocks */
  120  	
  121 -	((char*) p) += 0x12;		/* skip unneeded HFS vol fields */
  122 +	p += 0x12;		/* skip unneeded HFS vol fields */
  123  	drAlBlkSiz = bswabU32_inc(p);	/* offset 0x14 */
  124 -	((char*) p) += 0x4;		/* skip unneeded HFS vol fields */
  125 +	p += 0x4;		/* skip unneeded HFS vol fields */
  126  	drAlBlSt    = bswabU16_inc(p);	/* offset 0x1C */
  127  	
  128 -	((char*) p) += 0x5E;		/* skip unneeded HFS vol fields */
  129 +	p += 0x5E;		/* skip unneeded HFS vol fields */
  130  	signature = bswabU16_inc(p);	/* offset 0x7C, drEmbedSigWord */
  131  	if (signature != HFSP_VOLHEAD_SIG)
  132  	    HFSP_ERROR(-1, "This looks like a normal HFS volume");

Generated by cgit