From http://www.jwz.org/xscreensaver/xscreensaver-5.30.tar.gz
[xscreensaver] / hacks / glx / starwars.c
index de3833c5d74f7357a4c3de75150db5317174a5db..1398c159c9bd28da58ef4664ae64c8e04059d69f 100644 (file)
@@ -1,4 +1,4 @@
-/* starwars, Copyright (c) 1998-2012 Jamie Zawinski <jwz@jwz.org> and
+/* starwars, Copyright (c) 1998-2014 Jamie Zawinski <jwz@jwz.org> and
  * Claudio Matsuoka <claudio@helllabs.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
@@ -36,7 +36,6 @@
 # include <unistd.h>
 #endif
 
-
 #include "starwars.h"
 #define DEFAULTS "*delay:    40000     \n" \
                 "*showFPS:  False     \n" \
@@ -282,7 +281,7 @@ latin1_to_ascii (char *s)
 
 
 static int
-string_width (sws_configuration *sc, const char *s)
+sw_string_width (sws_configuration *sc, const char *s)
 {
   if (textures_p)
     return texture_string_width (sc->texfont, s, 0);
@@ -296,7 +295,7 @@ char_width (sws_configuration *sc, char c)
   char s[2];
   s[0] = c;
   s[1] = 0;
-  return string_width (sc, s);
+  return sw_string_width (sc, s);
 }
 
 
@@ -319,10 +318,10 @@ get_more_lines (sws_configuration *sc)
    */
   while (target > 0)
     {
-      char c = textclient_getc (sc->tc);
+      int c = textclient_getc (sc->tc);
       if (c <= 0)
         break;
-      sc->buf[sc->buf_tail++] = c;
+      sc->buf[sc->buf_tail++] = (char) c;
       sc->buf[sc->buf_tail] = 0;
       target--;
     }
@@ -445,7 +444,7 @@ draw_string (sws_configuration *sc, GLfloat x, GLfloat y, const char *s)
       while (*s)
         {
           *c = *s++;
-          w = string_width (sc, c);
+          w = sw_string_width (sc, c);
           glBegin (GL_LINE_LOOP);
           glVertex3f (0, 0, 0);
           glVertex3f (w, 0, 0);
@@ -1001,7 +1000,7 @@ draw_sws (ModeInfo *mi)
 
           if (alignment >= 0)
             {
-              int n = string_width (sc, line);
+              int n = sw_string_width (sc, line);
               xoff = 1.0 - (n * sc->font_scale);
             }
 
@@ -1046,6 +1045,12 @@ release_sws (ModeInfo *mi)
 }
 
 
+#ifdef __GNUC__
+ __extension__ /* don't warn about "string length is greater than the length
+                  ISO C89 compilers are required to support" when including
+                  "starwars.txt" in the defaults... */
+#endif
+
 XSCREENSAVER_MODULE_2 ("StarWars", starwars, sws)
 
 #endif /* USE_GL */