Harry Felder
2003-May-14 06:26 UTC
Patch: Allow statistics to specify xferred bytes greater than MAXLONG
Hi all: Below is a patch against 2.5.6 which fixes a problem when more than MAXLONG (2147483648) bytes are in the file system when statistics are output (and the compiler supports long long). Before the patch, I would get a core dump during statistics generation on large f. Now I can get statistics like: wrote 1139440 bytes read 20 bytes 17666.50 bytes/sec total size is 2154562788 speedup is 1890.86 (This is tested on a Solaris 8 system, using Sun's Forte 6.2 compiler.) hf --------- patch below ------ % diff -c lib/snprintf.c~ lib/snprintf.c *** lib/snprintf.c~ Mon May 7 02:59:38 2001 --- lib/snprintf.c Tue May 13 15:41:31 2003 *************** *** 88,94 **** #define LDOUBLE double #endif ! #ifdef HAVE_LONG_LONG #define LLONG long long #else #define LLONG long --- 88,94 ---- #define LDOUBLE double #endif ! #ifdef HAVE_LONGLONG #define LLONG long long #else #define LLONG long *************** *** 555,566 **** static double my_modf(double x0, double *iptr) { int i; ! long l; double x = x0; double f = 1.0; for (i=0;i<100;i++) { ! l = (long)x; if (l <= (x+1) && l >= (x-1)) break; x *= 0.1; f *= 10.0; --- 555,566 ---- static double my_modf(double x0, double *iptr) { int i; ! LLONG l; double x = x0; double f = 1.0; for (i=0;i<100;i++) { ! l = (LLONG)x; if (l <= (x+1) && l >= (x-1)) break; x *= 0.1; f *= 10.0;