X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utils%2Fcolors.c;h=2e10b55b428f478b425d3fa749ca82edc926a01e;hb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;hp=94d6acbd9672d9efb3038c3f21dc73a07d6f583d;hpb=3d9140a05b5272fed0883a0af0a71e30ef44d47f;p=xscreensaver diff --git a/utils/colors.c b/utils/colors.c index 94d6acbd..2e10b55b 100644 --- a/utils/colors.c +++ b/utils/colors.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1997 Jamie Zawinski +/* xscreensaver, Copyright (c) 1997, 2002 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -480,6 +480,7 @@ make_smooth_colormap (Display *dpy, Visual *visual, Colormap cmap, double total_s = 0; double total_v = 0; Screen *screen = (dpy ? DefaultScreenOfDisplay(dpy) : 0); /* #### WRONG! */ + int loop = 0; if (*ncolorsP <= 0) return; @@ -495,6 +496,7 @@ make_smooth_colormap (Display *dpy, Visual *visual, Colormap cmap, for (i = 0; i < npoints; i++) { REPICK_THIS_COLOR: + if (++loop > 10000) abort(); h[i] = random() % 360; s[i] = frand(1.0); v[i] = frand(0.8) + 0.2; @@ -578,7 +580,7 @@ make_uniform_colormap (Display *dpy, Visual *visual, Colormap cmap, 0, S, V, 359, S, V, colors, &ncolors, - False, True, + False, allocate_p, (writable_pP && *writable_pP)); /* If we tried for writable cells and got none, try for non-writable. */