diff -Nru wmmon-1.1+20120402/COPYING wmmon-1.1+20131205/COPYING --- wmmon-1.1+20120402/COPYING 2012-04-16 10:47:01.000000000 +0000 +++ wmmon-1.1+20131205/COPYING 2013-12-06 19:22:17.000000000 +0000 @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,8 +55,8 @@ The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE + + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -110,7 +110,7 @@ License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -255,7 +255,7 @@ of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -291,7 +291,7 @@ the "copyright" line and a pointer to where the full notice is found. - Copyright (C) 19yy + Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -303,16 +303,16 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -335,5 +335,5 @@ This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff -Nru wmmon-1.1+20120402/debian/changelog wmmon-1.1+20131205/debian/changelog --- wmmon-1.1+20120402/debian/changelog 2012-04-18 19:09:11.000000000 +0000 +++ wmmon-1.1+20131205/debian/changelog 2013-12-06 21:08:11.000000000 +0000 @@ -1,3 +1,14 @@ +wmmon (1.1+20131205-1) unstable; urgency=low + + * New upstream version. + * Bumped Debian Policy to 3.9.5. + * debian/compat is now version 9. + * debian/control: Build depends, debhelper version >= 9. + * New patch debian/patches/01-cppflags.patch + * This flag includes de CPPFLAGS in Makefile, to allow hardening. + + -- Rodolfo García Peñas (kix) Fri, 06 Dec 2013 20:27:13 +0100 + wmmon (1.1+20120402-1) unstable; urgency=low * New upstream version. diff -Nru wmmon-1.1+20120402/debian/compat wmmon-1.1+20131205/debian/compat --- wmmon-1.1+20120402/debian/compat 2012-04-16 10:48:00.000000000 +0000 +++ wmmon-1.1+20131205/debian/compat 2013-12-06 19:28:26.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru wmmon-1.1+20120402/debian/control wmmon-1.1+20131205/debian/control --- wmmon-1.1+20120402/debian/control 2012-04-16 11:01:19.000000000 +0000 +++ wmmon-1.1+20131205/debian/control 2013-12-06 19:35:54.000000000 +0000 @@ -1,9 +1,9 @@ Source: wmmon Section: x11 Priority: optional -Maintainer: Rodolfo García Peñas (kix) -Standards-Version: 3.9.3 -Build-Depends: debhelper (>= 7.0.50~), libx11-dev, libxpm-dev, libxext-dev +Maintainer: Rodolfo García Peñas (kix) +Standards-Version: 3.9.5 +Build-Depends: debhelper (>= 9), libx11-dev, libxpm-dev, libxext-dev Homepage: http://repo.or.cz/w/dockapps.git Package: wmmon diff -Nru wmmon-1.1+20120402/debian/patches/01-cppflags.patch wmmon-1.1+20131205/debian/patches/01-cppflags.patch --- wmmon-1.1+20120402/debian/patches/01-cppflags.patch 1970-01-01 00:00:00.000000000 +0000 +++ wmmon-1.1+20131205/debian/patches/01-cppflags.patch 2013-12-06 21:07:13.000000000 +0000 @@ -0,0 +1,14 @@ +Description: Include CPPFLAGS in Makefile to allow hardening +Author: Rodolfo García Peñas (kix) +Last-Update: 2013-12-06 +--- a/wmmon/Makefile ++++ b/wmmon/Makefile +@@ -10,7 +10,7 @@ + + + .c.o: +- $(CC) $(CFLAGS) -c -Wall $< -o $*.o ++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -Wall $< -o $*.o + + wmmon: $(OBJS) + $(CC) $(LDFLAGS) -o wmmon $^ $(LIBDIR) $(LIBS) diff -Nru wmmon-1.1+20120402/debian/patches/series wmmon-1.1+20131205/debian/patches/series --- wmmon-1.1+20120402/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ wmmon-1.1+20131205/debian/patches/series 2013-12-06 20:09:07.000000000 +0000 @@ -0,0 +1 @@ +01-cppflags.patch diff -Nru wmmon-1.1+20120402/wmgeneral/list.c wmmon-1.1+20131205/wmgeneral/list.c --- wmmon-1.1+20120402/wmgeneral/list.c 2012-04-16 10:47:01.000000000 +0000 +++ wmmon-1.1+20131205/wmgeneral/list.c 2013-12-06 19:22:17.000000000 +0000 @@ -21,8 +21,8 @@ You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301 USA. */ /* As a special exception, if you link this library with files compiled with GCC to produce an executable, this does not cause the resulting executable diff -Nru wmmon-1.1+20120402/wmgeneral/list.h wmmon-1.1+20131205/wmgeneral/list.h --- wmmon-1.1+20120402/wmgeneral/list.h 2012-04-16 10:47:01.000000000 +0000 +++ wmmon-1.1+20131205/wmgeneral/list.h 2013-12-06 19:22:17.000000000 +0000 @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301 USA. */ /* As a special exception, if you link this library with files compiled with GCC to produce an executable, this does not cause the resulting executable diff -Nru wmmon-1.1+20120402/wmgeneral/misc.c wmmon-1.1+20131205/wmgeneral/misc.c --- wmmon-1.1+20120402/wmgeneral/misc.c 2012-04-16 10:47:01.000000000 +0000 +++ wmmon-1.1+20131205/wmgeneral/misc.c 2013-12-06 19:22:17.000000000 +0000 @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include diff -Nru wmmon-1.1+20120402/wmmon/wmmon.1 wmmon-1.1+20131205/wmmon/wmmon.1 --- wmmon-1.1+20120402/wmmon/wmmon.1 2012-04-16 10:47:01.000000000 +0000 +++ wmmon-1.1+20131205/wmmon/wmmon.1 2013-12-06 19:22:17.000000000 +0000 @@ -14,7 +14,7 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with this program; if not, write to the Free Software -.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. .\" .TH wmmon 1 "May 1998" "WMMON 1.0b2" diff -Nru wmmon-1.1+20120402/wmmon/wmmon.c wmmon-1.1+20131205/wmmon/wmmon.c --- wmmon-1.1+20120402/wmmon/wmmon.c 2012-04-16 10:47:01.000000000 +0000 +++ wmmon-1.1+20131205/wmmon/wmmon.c 2013-12-06 19:22:17.000000000 +0000 @@ -28,6 +28,8 @@ Changes: ---- + 17/06/2012 (Rodolfo García Peñas (kix), ) + * Code style. 13/3/2012 (Barry Kelly (wbk), ) * Fixed get_statistics() I/O features to work with newer /proc/diskstats instead of the old /proc/stat. @@ -115,55 +117,42 @@ /***********/ /* Defines */ /***********/ - -/* wbk - see notes below (search on these preprocessor variables). - * TODO: remove if causing no problems. This was probably used to - * hardcode test cases. - */ -/*#define LEFT_ACTION (NULL) -#define RIGHT_ACTION (NULL) -#define MIDDLE_ACTION (NULL)*/ - #define WMMON_VERSION "1.2.b2" - #define HISTORY_ENTRIES 55 - #define HISTORY_ENTRIES 55 +#define MAX_CPU (10) /* depends on graph height */ +#define MAX_STAT_DEVICES (4) /********************/ /* Global Variables */ /********************/ - -int stat_current = 0; /* now global */ -int mode_cycling = 1; /* Allow mode-cycling */ -int cpu_avg_max = 0; /* CPU stress meter with average and max for SMP */ +int stat_current = 0; /* now global */ +int mode_cycling = 1; /* Allow mode-cycling */ +int cpu_avg_max = 0; /* CPU stress meter with average and max for SMP */ int show_buffers = 0; /* wbk adding per Gentoo -b enhancement. */ -FILE *fp_meminfo; -FILE *fp_stat; -FILE *fp_loadavg; -FILE *fp_diskstats; /* wbk new io stats API */ +FILE *fp_meminfo; +FILE *fp_stat; +FILE *fp_loadavg; +FILE *fp_diskstats; /* wbk new io stats API */ /* functions */ void usage(char*); void printversion(void); void DrawStats(int *, int, int, int, int); void DrawStats_io(int *, int, int, int, int); - void wmmon_routine(int, char **); -int main(int argc, char *argv[]) { - - int i; - char *name = argv[0]; - +int main(int argc, char *argv[]) +{ + int i; + char *name = argv[0]; /* Parse Command Line */ - - for (i=1; i 32) j = 32; copyXPMArea(32, 64, j, 12, 28+64, 4); + /*--------------------- swap? ------------------*/ j = stat_device[3].rt_idle; - if (j != 0) { + if (j != 0) j = (stat_device[3].rt_stat * 100) / j; - } + j = j * 0.32; if (j > 32) j = 32; copyXPMArea(32, 64, j, 12, 28+64, 18); /*----------- online tijd neerzetten! ----------*/ - cnt_time = time(0) - ref_time + online_time; /* cnt_time = uptime in seconden */ @@ -498,7 +469,6 @@ copyXPMArea(40 + (i / 10)*7, 78, 6, 9, 70, 47); /* De rest is dagen! 5x7*/ - i = cnt_time; copyXPMArea(66 + (i % 10)*6, 66, 5, 7, 88, 35); i /= 10; @@ -513,22 +483,22 @@ nexttime+=10; if (curtime > nexttime) /* dont let APM suspends make this crazy */ - nexttime = curtime; + nexttime = curtime; for (i=0; ihis[HISTORY_ENTRIES-1]) sd->his[HISTORY_ENTRIES-1] /= sd->hisaddcnt; - for (j = 1; j < HISTORY_ENTRIES; j++) { + for (j = 1; j < HISTORY_ENTRIES; j++) sd->his[j-1] = sd->his[j]; - } if (i == stat_current) { if (i == 0) - DrawStats(sd->his, HISTORY_ENTRIES-1, 40, 5, 58); - else if (i == 1) - DrawStats_io(sd->his, HISTORY_ENTRIES-1, 40, 5, 58); + DrawStats(sd->his, HISTORY_ENTRIES - 1, 40, 5, 58); + else if (i == 1) + DrawStats_io(sd->his, HISTORY_ENTRIES - 1, 40, 5, 58); } sd->his[HISTORY_ENTRIES-1] = 0; sd->hisaddcnt = 0; @@ -552,7 +522,7 @@ break; case ButtonRelease: i = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y); - if (but_stat == i && but_stat >= 0 && mode_cycling) { + if (but_stat == i && but_stat >= 0) { switch (but_stat) { case 0: switch (Event.xbutton.button) { @@ -569,41 +539,45 @@ execCommand(right_action); break; } + break; case 1: - stat_current++; - if (stat_current == stat_online) - stat_current = 0; - - DrawActive(stat_device[stat_current].name); - if (stat_current == 0) { - DrawStats(stat_device[stat_current].his, - HISTORY_ENTRIES-1, 40, 5, 58); - } - if (stat_current == 1) { - DrawStats_io(stat_device[stat_current].his, - HISTORY_ENTRIES-1, 40, 5, 58); - } - if (stat_current == 2) { - xpm_X = 64; - setMaskXY(-64, 0); - } else { - xpm_X = 0; - setMaskXY(0, 0); + if (mode_cycling) { + stat_current++; + if (stat_current == stat_online) + stat_current = 0; + + DrawActive(stat_device[stat_current].name); + if (stat_current == 0) + DrawStats(stat_device[stat_current].his, + HISTORY_ENTRIES-1, 40, 5, 58); + + if (stat_current == 1) + DrawStats_io(stat_device[stat_current].his, + HISTORY_ENTRIES-1, 40, 5, 58); + + if (stat_current == 2) { + xpm_X = 64; + setMaskXY(-64, 0); + } else { + xpm_X = 0; + setMaskXY(0, 0); + } + RedrawWindowXY(xpm_X, xpm_Y); } - RedrawWindowXY(xpm_X, xpm_Y); break; } } break; } } - usleep(250000L); } } -void update_stat_cpu(stat_dev *st, long *istat2, long *idle2) { - long k, istat, idle; + +void update_stat_cpu(stat_dev *st, long *istat2, long *idle2) +{ + long k, istat, idle; get_statistics(st->name, &k, &istat, &idle, istat2, idle2); @@ -625,7 +599,10 @@ st->cpu_last[cpu] = istat2[cpu]; j = st->cpu_stat[cpu] + st->idle_stat[cpu]; - if (j != 0) j = (st->cpu_stat[cpu] << 7) / j; + + if (j != 0) + j = (st->cpu_stat[cpu] << 7) / j; + if (j > max) { max = j; cpu_max = cpu; @@ -637,14 +614,15 @@ st->hisaddcnt += 1; } -void update_stat_io(stat_dev *st) { - long j, k, istat, idle; +void update_stat_io(stat_dev *st) +{ + long j, k, istat, idle; /* Periodically re-sample. Sometimes we get anomalously high readings; * this discards them. */ static int stalemax = 300; - static long maxdiskio = 0; + static long maxdiskio = 0; if (--stalemax <= 0) { maxdiskio = 0; stalemax = 300; @@ -658,11 +636,11 @@ st->rt_stat = istat - st->statlast; st->statlast = istat; - /* remember peak for scaling of upper-right meter. */ + /* remember peak for scaling of upper-right meter. */ j = st->rt_stat; - if (maxdiskio < j) { + if (maxdiskio < j) maxdiskio = j; - } + /* Calculate scaling factor for upper-right meter. "/ 5" will clip * the highest peaks, but makes moderate values more visible. We are * compensating for wild fluctuations which are probably caused by @@ -676,8 +654,9 @@ st->hisaddcnt += 1; } -void update_stat_mem(stat_dev *st, stat_dev *st2) { +void update_stat_mem(stat_dev *st, stat_dev *st2) +{ static char *line = NULL; static size_t line_size = 0; @@ -701,27 +680,20 @@ * older kernels, too, since the new format has been available for * ages. */ - if (strstr(line, "MemTotal:")) { + if (strstr(line, "MemTotal:")) sscanf(line, "MemTotal: %ld", &st->rt_idle); - } - else if (strstr(line, "MemFree:")) { + else if (strstr(line, "MemFree:")) sscanf(line, "MemFree: %ld", &free); - } - else if (strstr(line, "MemShared:")) { + else if (strstr(line, "MemShared:")) sscanf(line, "MemShared: %ld", &shared); - } - else if (strstr(line, "Buffers:")) { + else if (strstr(line, "Buffers:")) sscanf(line, "Buffers: %ld", &buffers); - } - else if (strstr(line, "Cached:")) { + else if (strstr(line, "Cached:")) sscanf(line, "Cached: %ld", &cached); - } - else if (strstr(line, "SwapTotal:")) { + else if (strstr(line, "SwapTotal:")) sscanf(line, "SwapTotal: %ld", &st2->rt_idle); - } - else if (strstr(line, "SwapFree:")) { + else if (strstr(line, "SwapFree:")) sscanf(line, "SwapFree: %ld", &swapfree); - } } /* memory use - rt_stat is the amount used, it seems, and this isn't @@ -739,8 +711,8 @@ st2->rt_stat = st2->rt_idle - swapfree; } -void update_stat_swp(stat_dev *st) { - +void update_stat_swp(stat_dev *st) +{ static char *line = NULL; static size_t line_size = 0; unsigned long swapfree; @@ -749,28 +721,25 @@ while ((getline(&line, &line_size, fp_meminfo)) > 0) { /* As with update_stat_mem(), the format change to /proc/meminfo has * forced some changes here. */ - if (strstr(line, "SwapTotal:")) { + if (strstr(line, "SwapTotal:")) sscanf(line, "SwapTotal: %ld", &st->rt_idle); - } - else if (strstr(line, "SwapFree:")) { + else if (strstr(line, "SwapFree:")) sscanf(line, "SwapFree: %ld", &swapfree); - } } st->rt_stat = st->rt_idle - swapfree; } /*******************************************************************************\ -|* get_statistics *| +|* get_statistics *| \*******************************************************************************/ - void get_statistics(char *devname, long *is, long *ds, long *idle, long *ds2, long *idle2) { - int i; + int i; static char *line = NULL; static size_t line_size = 0; - char *p; - char *tokens = " \t\n"; - float f; + char *p; + char *tokens = " \t\n"; + float f; *is = 0; *ds = 0; @@ -841,68 +810,44 @@ p = strtok(NULL, tokens); *ds += atol(p); - /* Field 11 looks tailor made for a simple load monitor. In - * practice, it doesn't show much unless the system is - * hammered. Feel free to uncomment as a command line option. */ - /*for (i=1; i<14; i++) - p = strtok(NULL, tokens); - ds += atol(p);*/ } - - /* wbk 20120308 as far as I know, this code would only work with - * very old kernels (early 2.4.x). If the above change does not - * work on your system, we will need to add logic to check - * /proc/stat OR /proc/diskstats. (This was a Debian patch) */ - /*else if (strstr(line, "disk_io")) { - int val; - unsigned int a, b, c, d, e, h, g; - p = strtok(line, tokens); - while ((p = strtok(NULL, tokens))) { - val = sscanf (p, "(%d,%d):(%d,%d,%d,%d,%d)", - &a, &b, &c, &d, &e, &h, - &g); - if (val != 7) - continue; - *ds += d; - *ds += h; - } - } - */ - } /* end while */ - } /* end if i/o */ + } + } } + /*******************************************************************************\ -|* getWidth *| +|* getWidth *| \*******************************************************************************/ - -unsigned long getWidth(long actif, long idle) { +unsigned long getWidth(long actif, long idle) +{ /* wbk - work with a decimal value so we don't round < 1 down to zero. */ double j = 0; unsigned long r = 0; j = (actif + idle); - if (j != 0) { + if (j != 0) j = (actif * 100) / j; - } + j = j * 0.32; /* round up very low positive values so they are visible. */ if (actif > 0 && j < 2) - j = 2; + j = 2; + if (j > 32) - j = 32; + j = 32; - r = (unsigned long)j; + r = (unsigned long) j; return r; } /*******************************************************************************\ -|* getNbCPU *| +|* getNbCPU *| \*******************************************************************************/ - -int getNbCPU(void) { +int getNbCPU(void) +{ static char *line = NULL; static size_t line_size = 0; int cpu = 0; @@ -918,11 +863,9 @@ /*******************************************************************************\ -|* checksysdevs *| +|* checksysdevs *| \*******************************************************************************/ - int checksysdevs(void) { - strcpy(stat_device[0].name, "cpu0"); strcpy(stat_device[1].name, "i/o"); strcpy(stat_device[2].name, "sys"); @@ -932,10 +875,10 @@ /*******************************************************************************\ -|* void DrawActive(char *) *| +|* void DrawActive(char *) *| \*******************************************************************************/ - -void DrawActive(char *name) { +void DrawActive(char *name) +{ /* Alles op X,77 CPU: 0 @@ -945,27 +888,23 @@ Destinatie: 5,5 */ - if (name[0] == 'c') { + if (name[0] == 'c') copyXPMArea(0, 77, 19, 10, 5, 5); - } else if (name[0] == 'i') { + else if (name[0] == 'i') copyXPMArea(19, 77, 19, 10, 5, 5); - } - } + /*******************************************************************************\ |* DrawStats *| \*******************************************************************************/ - -void DrawStats(int *his, int num, int size, int x_left, int y_bottom) { - - int pixels_per_byte; - int j,k; - int *p; - int d; +void DrawStats(int *his, int num, int size, int x_left, int y_bottom) +{ + int pixels_per_byte, j, k, *p, d; pixels_per_byte = 100; p = his; + for (j=0; j pixels_per_byte) pixels_per_byte += 100; @@ -978,7 +917,6 @@ d = (1.0 * p[0] / pixels_per_byte) * size; for (j=0; j io_scale) io_scale = p[j]; - } pixels_per_byte = 1.0 * io_scale / size; - if (pixels_per_byte == 0) pixels_per_byte = 1; + if (pixels_per_byte == 0) + pixels_per_byte = 1; for (k=0; k