http://svn.poeml.de/viewvc/ppc/src-unpacked/xscreensaver/xscreensaver-4.12.tar.bz2...
[xscreensaver] / hacks / metaballs.c
index 5d0f63dbc67c237b693023f9605c39dfe25384c2..cc8047936b79cfc6224c0978ca6d73c0d6c0e136 100644 (file)
@@ -225,7 +225,7 @@ static void Initialize( Display *pDisplay, Window Win, GC *pGC, XImage **ppImage
 
        /* Find the preferred bits-per-pixel. (jwz) */
        {
-               int i, pfvc = 0;
+               int pfvc = 0;
                XPixmapFormatValues *pfv = XListPixmapFormats( pDisplay, &pfvc );
                for( i=0; i<pfvc; i++ )
                        if( pfv[ i ].depth == XWinAttribs.depth )
@@ -265,6 +265,8 @@ static void Initialize( Display *pDisplay, Window Win, GC *pGC, XImage **ppImage
          radius = 100;
        
        radius = (radius / 100.0) * (iWinHeight >> 3);
+        if (radius >= 128) /* should use UCHAR_MAX? */
+          radius = 127; /* dradius should fit in u_char */
 
        dradius = radius * 2;
        sradius = radius * radius;