Bug#287864: openh323: FTBFS (amd64/gcc-4.0): cast from 'const unsigned char*' to 'int' loses precision

Andreas Jochens Andreas Jochens <aj@andaco.de>, 287864@bugs.debian.org
Thu, 30 Dec 2004 17:14:51 +0100


Package: openh323
Severity: normal
Tags: patch

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

g++ -Ivic  -DP_USE_PRAGMA -ffunction-sections -fdata-sections -D_REENTRANT -Wall  -DP_64BIT -g -D_DEBUG -DNDEBUG -DPTRACING -I/openh323-1.13.5.4/include -DHAS_OSS -DPTRACING -I/usr/share/pwlib//include  -fPIC -DPIC -c vic/p64.cxx -o /openh323-1.13.5.4/lib/obj_linux_x86_64_d/p64.o
vic/p64.cxx: In member function 'virtual BOOL P64Decoder::decode(const unsigned char*, int, BOOL)':
vic/p64.cxx:1128: error: cast from 'const unsigned char*' to 'int' loses precision
make[4]: *** [/openh323-1.13.5.4/lib/obj_linux_x86_64_d/p64.o] Error 1
make[4]: Leaving directory `/openh323-1.13.5.4/src'

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

Regards
Andreas Jochens

diff -urN ../tmp-orig/openh323-1.13.5.4/src/vic/p64.cxx ./src/vic/p64.cxx
--- ../tmp-orig/openh323-1.13.5.4/src/vic/p64.cxx	2003-03-14 08:25:55.000000000 +0100
+++ ./src/vic/p64.cxx	2004-12-30 16:45:33.388829064 +0100
@@ -1125,7 +1125,7 @@
 	 * If input buffer not aligned, prime bit-buffer
 	 * with 8 bits; otherwise, prime it with a 16.
 	 */
-	if ((int)bp & 1) {
+	if ((long)bp & 1) {
 		bs_ = (u_short*)(bp + 1);
 		bb_ = *bp;
 		nbb_ = 8 - sbit;