From: <pk...@us...> - 2006-11-15 03:28:40
|
Revision: 775 http://svn.sourceforge.net/conky/?rev=775&view=rev Author: pkovacs Date: 2006-11-14 19:28:37 -0800 (Tue, 14 Nov 2006) Log Message: ----------- fix reported memory var overflow by using unsigned long long Modified Paths: -------------- trunk/conky1/ChangeLog trunk/conky1/src/conky.c trunk/conky1/src/conky.h trunk/conky1/src/linux.c Modified: trunk/conky1/ChangeLog =================================================================== --- trunk/conky1/ChangeLog 2006-11-15 01:49:47 UTC (rev 774) +++ trunk/conky1/ChangeLog 2006-11-15 03:28:37 UTC (rev 775) @@ -5,6 +5,8 @@ * Add new timed thread abstraction file. * Convert thread activity to timed threads, including texeci, imap, pop3, audacious. + * Change memory vars from unsigned long to unsigned long long + to fix reported overflow, e.g. swapmax >= 4Gb. 2006-11-13 * Use pthread_cond_timedwait() instead of sleep() in audacious Modified: trunk/conky1/src/conky.c =================================================================== --- trunk/conky1/src/conky.c 2006-11-15 01:49:47 UTC (rev 774) +++ trunk/conky1/src/conky.c 2006-11-15 03:28:37 UTC (rev 775) @@ -3991,12 +3991,12 @@ OBJ(memperc) { if (cur->memmax) { if (!use_spacer) - snprintf(p, p_max_size, "%*lu", + snprintf(p, p_max_size, "%*Lu", pad_percents, (cur->mem * 100) / (cur->memmax)); else - snprintf(p, 4, "%*lu ", + snprintf(p, 4, "%*Lu ", pad_percents, (cur->mem * 100) / (cur->memmax)); @@ -4099,13 +4099,13 @@ strncpy(p, "No swap", 255); } else { if (!use_spacer) - snprintf(p, 255, "%*lu", + snprintf(p, 255, "%*Lu", pad_percents, (cur->swap * 100) / cur->swapmax); else - snprintf(p, 4, "%*lu ", + snprintf(p, 4, "%*Lu ", pad_percents, (cur->swap * 100) / Modified: trunk/conky1/src/conky.h =================================================================== --- trunk/conky1/src/conky.h 2006-11-15 01:49:47 UTC (rev 774) +++ trunk/conky1/src/conky.h 2006-11-15 03:28:37 UTC (rev 775) @@ -242,8 +242,8 @@ double uptime; /* memory information in kilobytes */ - unsigned long mem, memmax, swap, swapmax; - unsigned long bufmem, buffers, cached; + unsigned long long mem, memmax, swap, swapmax; + unsigned long long bufmem, buffers, cached; unsigned short procs; unsigned short run_procs; Modified: trunk/conky1/src/linux.c =================================================================== --- trunk/conky1/src/linux.c 2006-11-15 01:49:47 UTC (rev 774) +++ trunk/conky1/src/linux.c 2006-11-15 03:28:37 UTC (rev 775) @@ -113,17 +113,17 @@ break; if (strncmp(buf, "MemTotal:", 9) == 0) { - sscanf(buf, "%*s %lu", &info.memmax); + sscanf(buf, "%*s %Lu", &info.memmax); } else if (strncmp(buf, "MemFree:", 8) == 0) { - sscanf(buf, "%*s %lu", &info.mem); + sscanf(buf, "%*s %Lu", &info.mem); } else if (strncmp(buf, "SwapTotal:", 10) == 0) { - sscanf(buf, "%*s %lu", &info.swapmax); + sscanf(buf, "%*s %Lu", &info.swapmax); } else if (strncmp(buf, "SwapFree:", 9) == 0) { - sscanf(buf, "%*s %lu", &info.swap); + sscanf(buf, "%*s %Lu", &info.swap); } else if (strncmp(buf, "Buffers:", 8) == 0) { - sscanf(buf, "%*s %lu", &info.buffers); + sscanf(buf, "%*s %Lu", &info.buffers); } else if (strncmp(buf, "Cached:", 7) == 0) { - sscanf(buf, "%*s %lu", &info.cached); + sscanf(buf, "%*s %Lu", &info.cached); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |