Bug#282669: dpkg: FTBFS with gcc-4.0: invalid lvalue in assignment
Package: dpkg
Severity: normal
Tags: patch
When building 'dpkg' with gcc-4.0 I get the following error:
gcc -g -O2 -Wall -Wwrite-strings -Wpointer-arith -Wimplicit -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wbad-function-cast -Wcast-qual -Wcast-align -Winline -Wmissing-noreturn -Wsign-compare -DHAVE_CONFIG_H -D_GNU_SOURCE -DLOCALEDIR=\"/usr/share/locale\" -I../../intl -I../intl -I../../include -I../.. -I../../lib -I../include -I.. -I. -I../../optlib -DUSE_ZLIB -DUSE_BZ2LIB -DCOPYINGFILE=\"/usr/share/doc/dpkg/copyright\" -c ../../lib/mlib.c
../../lib/mlib.c: In function 'buffer_write':
../../lib/mlib.c:179: warning: pointer targets in passing argument 1 of 'sprintf' differ in signedness
../../lib/mlib.c:192: error: invalid lvalue in assignment
make[3]: *** [mlib.o] Error 1
make[3]: Leaving directory `/dpkg-1.10.25/build/lib'
With the attached patch 'dpkg' can be compiled using gcc-4.0.
Regards
Andreas Jochens
diff -urN ../tmp-orig/dpkg-1.10.25/lib/mlib.c ./lib/mlib.c
--- ../tmp-orig/dpkg-1.10.25/lib/mlib.c 2004-11-11 20:10:03.000000000 +0000
+++ ./lib/mlib.c 2004-11-23 10:33:08.000000000 +0000
@@ -189,7 +189,7 @@
switch(data->type) {
case BUFFER_WRITE_BUF:
memcpy(data->data.ptr, buf, length);
- (char*)data->data.ptr += length;
+ data->data.ptr = (char*)data->data.ptr + length;
break;
case BUFFER_WRITE_VBUF:
varbufaddbuf((struct varbuf *)data->data.ptr, buf, length);
Reply to: