Yeah, I read that VC was unaware of %llu and needs %I64u or %Lu, I was wrong.
Small test taken from thread http://groups.google.de/groups?hl=de&lr=&ie=UTF-8&threadm=LUlA6.63%24fs5.17886%40newsr1.u-net.net&rnum=1&prev=/groups%3Fq%3D%2522%2525I64u%2522%2B%2522%2525Lu%2522%2B%2522%2525llu%2522%2Bprintf%26hl%3Dde%26lr%3D%26ie%3DUTF-8%26selm%3DLUlA6.63%2524fs5.17886%2540newsr1.u-net.net%26rnum%3D1 #include <stdio.h> #include <limits.h> int func(unsigned long long a) { a += 42; printf ("%I64u\n", a); printf ("%I64d\n", a); printf ("%llu\n", a); printf ("%Lu\n", a); printf ("%qu\n", a); return 0; } int main(void) { unsigned long long int a = ULONG_MAX; func (a); } The gcc 3.3.3 and gcc version 2.95.3 outputs are both: 41 41 4294967337 4294967337 4294967337 From VisualC++ 6.0 (substituted unsigned long long against __int64 as defined for Windows in globals-structtypes.h): 4294967337 4294967337 41 41 qu Therefore this patch should be correct, or? (if 64bit are ok for rrdtool) --- ntop/plugins/rrdPlugin.c 2004-11-01 10:11:11.000000000 +0100 +++ ntop-dev/plugins/rrdPlugin.c 2004-11-03 21:42:37.295943288 +0100 @@ -1094,7 +1094,13 @@ if((!createdCounter) && (numRuns == 1)) { return; } else { - safe_snprintf(__FILE__, __LINE__, cmd, sizeof(cmd), "%u:%u", rrdTime, (unsigned long)value); + +#ifdef WIN32 + safe_snprintf(__FILE__, __LINE__, cmd, sizeof(cmd), "%u:%I64u", rrdTime, value); +#else + safe_snprintf(__FILE__, __LINE__, cmd, sizeof(cmd), "%u:%llu", rrdTime, value); +#endif + } argv[argc++] = cmd; Markus __________________________ On Wednesday 03 November 2004 15:08, Burton M. Strauss III wrote: > value is defined as 'Counter value', so the proper mask is %llu not %Lu. > > Otherwise, it seems reasonable provided rrd can parse an llu. > > -----Burton > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Behalf Of Markus Rehbach > > Sent: Tuesday, November 02, 2004 12:43 PM > > To: [EMAIL PROTECTED] > > Subject: [Ntop-dev] Patch for RRD data ranges (now inline...;-) > > > > > > --- ntop/plugins/rrdPlugin.c 2004-11-01 10:11:11.000000000 +0100 > > +++ ntop-dev/plugins/rrdPlugin.c 2004-11-02 > > 19:27:19.175459720 +0100 > > @@ -1094,7 +1094,7 @@ > > if((!createdCounter) && (numRuns == 1)) { > > return; > > } else { > > - safe_snprintf(__FILE__, __LINE__, cmd, sizeof(cmd), "%u:%u", > > rrdTime, (unsigned long)value); > > + safe_snprintf(__FILE__, __LINE__, cmd, sizeof(cmd), > > "%u:%Lu", rrdTime, value); > > } > > > > argv[argc++] = cmd; > > > > > > ---------- Forwarded Message ---------- > > > > Subject: Patch for RRD data ranges > > Date: Tuesday 02 November 2004 19:35 > > From: Markus Rehbach <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > > > Hi all, > > > > on my ntop system there was a constant load of ca. 45MByte/s and the RRD > > graphs for the ethernet and the ip bytes looked weird (sometimes > > zero but my > > snmp interface counters told other things). The attached patch > > fixes it for > > me. > > > > Cheers > > > > Markus > > > > ------------------------------------------------------- > > _______________________________________________ > > Ntop-dev mailing list > > [EMAIL PROTECTED] > > http://listgateway.unipi.it/mailman/listinfo/ntop-dev > > _______________________________________________ > Ntop-dev mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop-dev _______________________________________________ Ntop-dev mailing list [EMAIL PROTECTED] http://listgateway.unipi.it/mailman/listinfo/ntop-dev
