http://ftp.nluug.nl/pub/os/Linux/distr/pardusrepo/sources/xscreensaver-5.02.tar.gz
[xscreensaver] / driver / demo-Xm.c
index f8d0de286ee7efc80cf79123b40f045f28b22fef..65216b3c6d048667a850826adc22eaf1eb6f5a9e 100644 (file)
@@ -1,5 +1,5 @@
 /* demo-Xm.c --- implements the interactive demo-mode and options dialogs.
- * xscreensaver, Copyright (c) 1993-2003 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1993-2003, 2005 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -385,10 +385,11 @@ doc_menu_cb (Widget button, XtPointer client_data, XtPointer ignored)
     }
 
   help_command = (char *) malloc (strlen (p->load_url_command) +
-                                 (strlen (p->help_url) * 2) + 20);
+                                 (strlen (p->help_url) * 4) + 20);
   strcpy (help_command, "( ");
   sprintf (help_command + strlen(help_command),
-           p->load_url_command, p->help_url, p->help_url);
+           p->load_url_command,
+           p->help_url, p->help_url, p->help_url, p->help_url);
   strcat (help_command, " ) &");
   system (help_command);
   free (help_command);
@@ -467,6 +468,11 @@ await_xscreensaver (Widget widget)
               "\n");
 
       if (root_p)
+# ifdef __GNUC__
+        __extension__     /* don't warn about "string length is greater than
+                             the length ISO C89 compilers are required to
+                             support" in the following expression... */
+# endif
         strcat (buf,
             "You are running as root.  This usually means that xscreensaver\n"
             "was unable to contact your X server because access control is\n"
@@ -599,7 +605,7 @@ apply_changes_and_save (Widget widget)
   else if (!strcasecmp (visual, "greyscale"))          visual = "GrayScale";
   else if (!strcasecmp (visual, "pseudocolor"))        visual = "PseudoColor";
   else if (!strcasecmp (visual, "directcolor"))        visual = "DirectColor";
-  else if (1 == sscanf (visual, " %ld %c", &id, &c))   ;
+  else if (1 == sscanf (visual, " %lu %c", &id, &c))   ;
   else if (1 == sscanf (visual, " 0x%lx %c", &id, &c)) ;
   else
     {
@@ -669,7 +675,7 @@ manual_cb (Widget button, XtPointer client_data, XtPointer ignored)
   cmd = get_string_resource ("manualCommand", "ManualCommand");
   if (cmd)
     {
-      char *cmd2 = (char *) malloc (strlen (cmd) + strlen (name2) + 100);
+      char *cmd2 = (char *) malloc (strlen (cmd) + (strlen (name2) * 4) + 100);
       strcpy (cmd2, "( ");
       sprintf (cmd2 + strlen (cmd2),
                cmd,
@@ -917,7 +923,7 @@ scroll_to_current_hack (Widget toplevel, prefs_pair *pair)
   Atom type;
   int format;
   unsigned long nitems, bytesafter;
-  CARD32 *data = 0;
+  unsigned char *data = 0;
   Display *dpy = XtDisplay (toplevel);
   int which = 0;
   Widget list;
@@ -926,7 +932,7 @@ scroll_to_current_hack (Widget toplevel, prefs_pair *pair)
                           XA_SCREENSAVER_STATUS,
                           0, 3, False, XA_INTEGER,
                           &type, &format, &nitems, &bytesafter,
-                          (unsigned char **) &data)
+                          &data)
       == Success
       && type == XA_INTEGER
       && nitems >= 3
@@ -1677,8 +1683,15 @@ demo_ehandler (Display *dpy, XErrorEvent *error)
 
 
 
+#ifdef __GNUC__
+ __extension__     /* shut up about "string length is greater than the length
+                      ISO C89 compilers are required to support" when including
+                      the .ad file... */
+#endif
+
 static char *defaults[] = {
 #include "XScreenSaver_ad.h"
+#include "XScreenSaver_Xm_ad.h"
  0
 };