Bug#300696: luxman: FTBFS (amd64/gcc-4.0): cast from 'char*' to 'unsigned int' loses precision
Package: luxman
Severity: normal
Tags: patch
When building 'luxman' on amd64 with gcc-4.0,
I get the following error:
g++ -Wall -O2 -fomit-frame-pointer -I.. -c -o lf.o lf.cc
lf.cc: In function 'int get_param_name(char*, char*)':
lf.cc:103: error: cast from 'char*' to 'unsigned int' loses precision
lf.cc:103: error: cast from 'char*' to 'unsigned int' loses precision
lf.cc: In function 'char* get_str_param(char*)':
lf.cc:160: error: cast from 'char*' to 'unsigned int' loses precision
lf.cc:160: error: cast from 'char*' to 'unsigned int' loses precision
make[2]: *** [lf.o] Error 1
make[2]: Leaving directory `/luxman-0.41/src'
With the attached patch 'luxman' can be compiled
on amd64 using gcc-4.0.
Regards
Andreas Jochens
diff -urN ../tmp-orig/luxman-0.41/src/lf.cc ./src/lf.cc
--- ../tmp-orig/luxman-0.41/src/lf.cc 1995-03-21 19:09:49.000000000 +0100
+++ ./src/lf.cc 2005-03-21 08:59:22.154305895 +0100
@@ -82,7 +82,7 @@
static int get_param_name( char *dest, char *buf )
{
char *s, *e;
- int n;
+ long n;
s = buf;
@@ -100,7 +100,7 @@
if ( !*e )
return -1;
- n = (unsigned)e - (unsigned)s;
+ n = (unsigned long)e - (unsigned long)s;
strncpy( dest, s, n );
dest[n] = 0;
@@ -137,7 +137,7 @@
static char* get_str_param( char *buf )
{
char *p, *e, *s;
- int n;
+ long n;
p = strchr( buf, '=' );
@@ -157,7 +157,7 @@
while( *e && !strchr( " \t\n\r\b", *e ) )
++e;
- n = (unsigned)e - (unsigned)p;
+ n = (unsigned long)e - (unsigned long)p;
s = (char*)malloc( n+1 );
strncpy( s, p, n );
Reply to: