X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=utils%2Fcolors.c;h=94d6acbd9672d9efb3038c3f21dc73a07d6f583d;hp=71e56daa7a036dc0d0dc1d23674259c121f5a2c4;hb=3d9140a05b5272fed0883a0af0a71e30ef44d47f;hpb=ebc241816cc8e3eec7270a594bb1a607df32bcd6 diff --git a/utils/colors.c b/utils/colors.c index 71e56daa..94d6acbd 100644 --- a/utils/colors.c +++ b/utils/colors.c @@ -77,16 +77,18 @@ static void complain (int wanted_colors, int got_colors, Bool wanted_writable, Bool got_writable) { - if (wanted_writable && !got_writable) - fprintf(stderr, - "%s: wanted %d writable colors; got %d read-only colors.\n", - progname, wanted_colors, got_colors); - - else if (wanted_colors > (got_colors + 10)) + if (got_colors > wanted_colors - 10) /* don't bother complaining if we're within ten pixels. */ - fprintf(stderr, "%s: wanted %d%s colors; got %d.\n", - progname, wanted_colors, (got_writable ? " writable" : ""), - got_colors); + return; + + if (wanted_writable && !got_writable) + fprintf (stderr, + "%s: wanted %d writable colors; got %d read-only colors.\n", + progname, wanted_colors, got_colors); + else + fprintf (stderr, "%s: wanted %d%s colors; got %d.\n", + progname, wanted_colors, (got_writable ? " writable" : ""), + got_colors); } @@ -477,7 +479,7 @@ make_smooth_colormap (Display *dpy, Visual *visual, Colormap cmap, double v[MAXPOINTS]; double total_s = 0; double total_v = 0; - Screen *screen = DefaultScreenOfDisplay(dpy); /* #### WRONG! */ + Screen *screen = (dpy ? DefaultScreenOfDisplay(dpy) : 0); /* #### WRONG! */ if (*ncolorsP <= 0) return; @@ -560,7 +562,7 @@ make_uniform_colormap (Display *dpy, Visual *visual, Colormap cmap, { int ncolors = *ncolorsP; Bool wanted_writable = (allocate_p && writable_pP && *writable_pP); - Screen *screen = DefaultScreenOfDisplay(dpy); /* #### WRONG! */ + Screen *screen = (dpy ? DefaultScreenOfDisplay(dpy) : 0); /* #### WRONG! */ double S = ((double) (random() % 34) + 66) / 100.0; /* range 66%-100% */ double V = ((double) (random() % 34) + 66) / 100.0; /* range 66%-100% */ @@ -606,7 +608,7 @@ make_random_colormap (Display *dpy, Visual *visual, Colormap cmap, Bool wanted_writable = (allocate_p && writable_pP && *writable_pP); int ncolors = *ncolorsP; int i; - Screen *screen = DefaultScreenOfDisplay(dpy); /* #### WRONG! */ + Screen *screen = (dpy ? DefaultScreenOfDisplay(dpy) : 0); /* #### WRONG! */ if (*ncolorsP <= 0) return;