Package: pearpc
Severity: normal
Tags: patch

When building 'pearpc' on amd64 with gcc-4.0,
I get the following error:

btree.c:122: error: invalid lvalue in increment
btree.c:123: error: invalid lvalue in increment
btree.c:125: error: invalid lvalue in increment
btree.c: In function 'btree_init':
btree.c:396: error: invalid lvalue in assignment
make[7]: *** [btree.o] Error 1
make[7]: Leaving directory `/pearpc-0.3.1+1/src/io/prom/fs/hfsplus'

With the attached patch 'pearpc' can be compiled
on amd64 using gcc-4.0.

Regards
Andreas Jochens

diff -urN ../tmp-orig/pearpc-0.3.1+1/src/io/prom/fs/hfsplus/btree.c 
./src/io/prom/fs/hfsplus/btree.c
--- ../tmp-orig/pearpc-0.3.1+1/src/io/prom/fs/hfsplus/btree.c   2004-05-06 
00:46:14.000000000 +0200
+++ ./src/io/prom/fs/hfsplus/btree.c    2005-04-02 15:44:38.919186784 +0200
@@ -393,7 +393,7 @@
        {
            p = volume_readfromfork(vol, nodebuf, fork, 0, bt->blkpernode,
                 HFSP_EXTENT_DATA, bt->cnid);
-           ((char*) p) += HEADER_RESERVEDOFFSET; // skip header
+           p = ((char*) p) + HEADER_RESERVEDOFFSET; // skip header
        }
        
        bt->alloc_bits = malloc(alloc_size);
diff -urN ../tmp-orig/pearpc-0.3.1+1/src/io/prom/fs/hfsplus/swab.h 
./src/io/prom/fs/hfsplus/swab.h
--- ../tmp-orig/pearpc-0.3.1+1/src/io/prom/fs/hfsplus/swab.h    2004-05-06 
00:45:53.000000000 +0200
+++ ./src/io/prom/fs/hfsplus/swab.h     2005-04-02 15:44:23.858045704 +0200
@@ -39,28 +39,28 @@
 
 #define bswabU16(val) bswap_16(val)
 
-#define bswabU16_inc(ptr) bswap_16(*((UInt16*) (ptr))++)
-#define bswabU32_inc(ptr) bswap_32(*((UInt32*) (ptr))++)
-#define bswabU64_inc(ptr) bswap_64(*((APPLEUInt64*) (ptr))++)
-
-#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = bswap_16(val)
-#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = bswap_32(val)
-#define bstoreU64_inc(ptr, val) (*((APPLEUInt64*) (ptr))++) = bswap_64(val)
+#define bswabU16_inc(ptr) bswap_16(*((UInt16*) (ptr))); ptr = (UInt16*)ptr + 1
+#define bswabU32_inc(ptr) bswap_32(*((UInt32*) (ptr))); ptr = (UInt32*)ptr + 1
+#define bswabU64_inc(ptr) bswap_64(*((APPLEUInt64*) (ptr))); ptr = 
(APPLEUInt64*)ptr + 1
+
+#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))) = bswap_16(val); ptr = 
(UInt16*)ptr + 1
+#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))) = bswap_32(val); ptr = 
(UInt32*)ptr + 1
+#define bstoreU64_inc(ptr, val) (*((APPLEUInt64*) (ptr))) = bswap_64(val); ptr 
= (APPLEUInt64*)ptr + 1
 
 /*#else // BYTE_ORDER == BIG_ENDIAN
 
 #define bswabU16(val) val
 
-#define bswabU16_inc(ptr) (*((UInt16*) (ptr))++)
-#define bswabU32_inc(ptr) (*((UInt32*) (ptr))++)
-#define bswabU64_inc(ptr) (*((APPLEUInt64*) (ptr))++)
-
-#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = val
-#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = val
-#define bstoreU64_inc(ptr, val) (*((APPLEUInt64*) (ptr))++) = val
+#define bswabU16_inc(ptr) (*((UInt16*) (ptr))); ptr = (UInt16*)ptr + 1
+#define bswabU32_inc(ptr) (*((UInt32*) (ptr))); ptr = (UInt32*)ptr + 1
+#define bswabU64_inc(ptr) (*((APPLEUInt64*) (ptr))); ptr = (APPLEUInt64*)ptr + 
1
+
+#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))) = val; ptr = (UInt16*)ptr 
+ 1
+#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))) = val; ptr = (UInt32*)ptr 
+ 1
+#define bstoreU64_inc(ptr, val) (*((APPLEUInt64*) (ptr))) = val; ptr = 
(APPLEUInt64*)ptr + 1
 
 #endif*/
 
 /* for the sake of completeness and readability */
-#define bswabU8_inc(ptr)       (*((UInt8*) (ptr))++)
-#define bstoreU8_inc(ptr,val)  (*((UInt8*) (ptr))++) = val
+#define bswabU8_inc(ptr)       ptr = (UInt8*)ptr + 1
+#define bstoreU8_inc(ptr,val)  (*((UInt8*) (ptr))) = val; ptr = (UInt8*)ptr + 1
diff -urN ../tmp-orig/pearpc-0.3.1+1/src/io/prom/fs/hfsplus/volume.c 
./src/io/prom/fs/hfsplus/volume.c
--- ../tmp-orig/pearpc-0.3.1+1/src/io/prom/fs/hfsplus/volume.c  2004-05-11 
18:11:12.000000000 +0200
+++ ./src/io/prom/fs/hfsplus/volume.c   2005-04-02 15:47:02.154989287 +0200
@@ -324,7 +324,8 @@
  */
 static int volume_readbuf(hfsp_vh* vh, void* p)
 {
-    if ( (vh->signature        = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG) 
+    int v = bswabU16_inc(p);
+    if ( (vh->signature        = v) != HFSP_VOLHEAD_SIG) 
        HFSP_ERROR(-1, "This is not a HFS+ volume");
     vh->version                = bswabU16_inc(p);
     vh->attributes     = bswabU32_inc(p); 
@@ -346,7 +347,7 @@
     vh->write_count    = bswabU32_inc(p);
     vh->encodings_bmp  = bswabU64_inc(p);
     memcpy(vh->finder_info, p, 32); 
-    ((char*) p) += 32; // finderinfo is not used by now
+    p = ((char*) p) + 32; // finderinfo is not used by now
     p = volume_readfork(p, &vh->alloc_file );
     p = volume_readfork(p, &vh->ext_file   );
     p = volume_readfork(p, &vh->cat_file   );
@@ -382,7 +383,7 @@
     bstoreU32_inc(p, vh->write_count   );
     bstoreU64_inc(p, vh->encodings_bmp );
     memcpy(p, vh->finder_info, 32); 
-    ((char*) p) += 32; // finderinfo is not used by now
+    p = ((char*) p) + 32; // finderinfo is not used by now
     p = volume_writefork(p, &vh->alloc_file );
     p = volume_writefork(p, &vh->ext_file   );
     p = volume_writefork(p, &vh->cat_file   );
@@ -418,12 +419,12 @@
   
        UInt16  embeds, embedl;         /* Start/lenght of embedded area in 
blocks */
        
-       ((char*) p) += 0x12;            /* skip unneeded HFS vol fields */
+       p = ((char*) p) + 0x12;         /* skip unneeded HFS vol fields */
        drAlBlkSiz = bswabU32_inc(p);   /* offset 0x14 */
-       ((char*) p) += 0x4;             /* skip unneeded HFS vol fields */
+       p = ((char*) p) + 0x4;          /* skip unneeded HFS vol fields */
        drAlBlSt    = bswabU16_inc(p);  /* offset 0x1C */
        
-       ((char*) p) += 0x5E;            /* skip unneeded HFS vol fields */
+       p = ((char*) p) + 0x5E;         /* skip unneeded 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");


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to