diff -urN a/src/common.h b/src/common.h --- a/src/common.h Sat Jan 7 21:40:27 2006 +++ b/src/common.h Sat Jan 7 22:00:30 2006 @@ -223,8 +223,11 @@ #if _FILE_OFFSET_BITS == 64 #define OFF_T_SCANF_FMT "%ll" +/* offsets are displayed on 40 bits anyway */ +#define OFF_T_MAX (((1ULL)<<40)-1) #else #define OFF_T_SCANF_FMT "%l" +#define OFF_T_MAX LONG_MAX #endif /* diff -urN a/src/file.c b/src/file.c --- a/src/file.c Sat Jan 7 21:40:27 2006 +++ b/src/file.c Sat Jan 7 21:50:59 2006 @@ -290,15 +290,15 @@ break; } #endif - sprintf( errstr, "Can't get device size, truncating to %ld", -#ifdef LONG_MAX - LONG_MAX); + sprintf( errstr, "Can't get device size, truncating to " OFF_T_SCANF_FMT "d", +#ifdef OFF_T_MAX + OFF_T_MAX); #else 2147483647); #endif lib_alert( errstr, 0); -#ifdef LONG_MAX - vc_filesize = LONG_MAX; +#ifdef OFF_T_MAX + vc_filesize = OFF_T_MAX; #else vc_filesize = 2147483647; #endif @@ -363,15 +363,15 @@ } /* end switch( i) */ if( vc_filesize < 0) { - sprintf( errstr, "Device size too big, truncating to %ld", -#ifdef LONG_MAX - LONG_MAX); + sprintf( errstr, "Device size too big, truncating to " OFF_T_SCANF_FMT "d", +#ifdef OFF_T_MAX + OFF_T_MAX); #else 2147483647); #endif lib_alert( errstr, 0); -#ifdef LONG_MAX - vc_filesize = LONG_MAX; +#ifdef OFF_T_MAX + vc_filesize = OFF_T_MAX; #else vc_filesize = 2147483647; #endif diff -urN a/src/hex.c b/src/hex.c --- a/src/hex.c Sat Jan 7 21:40:27 2006 +++ b/src/hex.c Sat Jan 7 21:52:08 2006 @@ -353,8 +353,8 @@ devices are bigger than LONG_MAX, and we are viewing the end of the file, so I correct bread here */ if( lfpos < 0) -#ifdef LONG_MAX - bread = LONG_MAX - fpos; +#ifdef OFF_T_MAX + bread = OFF_T_MAX - fpos; #else bread = 2147483647 - fpos; #endif