ftp://ftp.uni-heidelberg.de/pub/X11/contrib/applications/xscreensaver-1.27.tar.Z
[xscreensaver] / hacks / helix.c
index 9e6d905ba712e0d1ae06cd2f8604d0cc47579eb4..84c4fd8ca42340e49b3cc9f7e29f60ba7eae01cc 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992 Jamie Zawinski <jwz@lucid.com>
+/* xscreensaver, Copyright (c) 1992, 1995 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -9,11 +9,8 @@
  * implied warranty.
  */
 
-#include "screenhack.h"
 #include <math.h>
-#if __STDC__
-#include <values.h>
-#endif
+#include "screenhack.h"
 
 static double sins [360];
 static double coss [360];
@@ -130,7 +127,7 @@ random_helix (dpy, window)
   factor3 = 2;
   factor4 = 2;
 
-  divisor = ((frand (3.0) + 1) * (((random() % 1) * 2) - 1));
+  divisor = ((frand (3.0) + 1) * (((random() & 1) * 2) - 1));
 
   if ((random () & 1) == 0)
     {
@@ -147,8 +144,8 @@ random_helix (dpy, window)
     d_angle = random () % 360;
 
 #define random_factor()                                \
-  (((random() % 7) ? ((random() % 1) + 1) : 3) \
-   * (((random() % 1) * 2) - 1))
+  (((random() % 7) ? ((random() & 1) + 1) : 3) \
+   * (((random() & 1) * 2) - 1))
 
   while (gcd (gcd (gcd (factor1, factor2), factor3), factor4) != 1)
     {
@@ -164,7 +161,7 @@ random_helix (dpy, window)
     {
       hsv_to_rgb (random () % 360, frand (1.0), frand (0.5) + 0.5,
                  &color.red, &color.green, &color.blue);
-      if (got_color = XAllocColor (dpy, cmap, &color))
+      if ((got_color = XAllocColor (dpy, cmap, &color)))
        XSetForeground (dpy, draw_gc, color.pixel);
       else
        XSetForeground (dpy, draw_gc, default_fg_pixel);
@@ -193,11 +190,11 @@ random_helix (dpy, window)
 char *progclass = "Helix";
 
 char *defaults [] = {
-  "*background: black",
+  "Helix.background: black",           /* to placate SGI */
   0
 };
 
-XrmOptionDescRec options [] = { 0 };
+XrmOptionDescRec options [] = { { 0, } };
 int options_size = 0;
 
 void