changeset 17:c60e531d19cd

Some misc. cleanups and minor warning removals.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 22 May 2010 20:32:49 +0300
parents e3b0773ba1be
children 56848f781b4c
files pwplib/X11.c pwplib/decterm.c pwplib/pwplib-unix.c pwplib/pwplib.h pwplib/sdl.c pwplib/setup.c pwplib/snd-hpux.c pwplib/snd-oss.c pwplib/snd-sdl.c pwplib/snd-w32.c pwplib/tty.c pwplib/tty.h
diffstat 12 files changed, 31 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/pwplib/X11.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/X11.c	Sat May 22 20:32:49 2010 +0300
@@ -261,7 +261,7 @@
 
  	pwp_X11_openwindow();
 
-	pwp_regdestr(pwp_X11_close);
+	pwplib_regdestr(pwp_X11_close);
 
 /* shared memory buffer */
 	#ifdef DRIVE_X11SHM
--- a/pwplib/decterm.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/decterm.c	Sat May 22 20:32:49 2010 +0300
@@ -303,7 +303,7 @@
 
 void tty_vt_initstring()
 {
-   pwp_regdestr(tty_vt_restore);
+   pwplib_regdestr(tty_vt_restore);
 
    tty_write(
       "\33[0;37;40m"  /* attributes off, assert colors */
--- a/pwplib/pwplib-unix.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/pwplib-unix.c	Sat May 22 20:32:49 2010 +0300
@@ -18,18 +18,20 @@
 
 /******************** random stuff *************************/
 
-#ifdef DRIVE_SDL
 static int sdl_init = 0;
-#endif
 
 extern void pwplib_dummy();
 #define pwp_dummy pwplib_dummy
 
-void pwpwrite(char*z)
+void pwpwrite(const char *fmt, ...)
 {
   if(!pwplib.setup[SETUP_SHUTUP])
   {
-     fprintf(stderr,"%s",z);
+     va_list ap;
+     va_start(ap, fmt);
+     vfprintf(stderr, fmt, ap);
+     va_end(ap);
+
      usleep(1000*pwplib.set.infodelay);
   }
 }
--- a/pwplib/pwplib.h	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/pwplib.h	Sat May 22 20:32:49 2010 +0300
@@ -14,6 +14,8 @@
 void    pwplib_shutdown();
 void    pwplib_startup();
 
+void    pwplib_regdestr(void(*func)());
+
 #define pwplib_buf  pwplib.videobuf.d
 #define pwplib_bufw pwplib.videobuf.width
 #define pwplib_bufh pwplib.videobuf.height
@@ -50,6 +52,9 @@
 #include <time.h>
 #include <sys/time.h>
 
+#include <stdarg.h>
+void pwpwrite(const char *, ...);
+
 #ifdef __POSIX__
 
 #include <unistd.h>
--- a/pwplib/sdl.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/sdl.c	Sat May 22 20:32:49 2010 +0300
@@ -97,7 +97,7 @@
 
 int pwp_SDL_init(void)
 {
-    int pal[PWP_NCOLORS * 3], i;
+    int i;
 
     /* Assume these settings for now */
     pwp_SDL.vflags = 0;
--- a/pwplib/setup.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/setup.c	Sat May 22 20:32:49 2010 +0300
@@ -73,7 +73,7 @@
 
 void(*pwp_destr[DESTRUCTORS])();
 
-void pwp_regdestr(void(*func)())
+void pwplib_regdestr(void(*func)())
 {
    static int curr=0;
    pwp_destr[curr++]=func;
--- a/pwplib/snd-hpux.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/snd-hpux.c	Sat May 22 20:32:49 2010 +0300
@@ -62,7 +62,7 @@
   pwplib.loopflush=hpuxsnd_loopflush;
   gb_init(pwp_hpuxsnd.freq);
 
-  pwp_regdestr(hpuxsnd_restore);
+  pwplib_regdestr(hpuxsnd_restore);
 
   return 1;
 }
--- a/pwplib/snd-oss.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/snd-oss.c	Sat May 22 20:32:49 2010 +0300
@@ -53,7 +53,7 @@
   pwplib.loopflush=oss_loopflush;
   gb_init(pwp_oss.freq);
 
-  pwp_regdestr(oss_restore);
+  pwplib_regdestr(oss_restore);
 
   return 1;
 }
--- a/pwplib/snd-sdl.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/snd-sdl.c	Sat May 22 20:32:49 2010 +0300
@@ -25,8 +25,9 @@
 extern void gb_sound(int, int, int, int);
 
 
-static void pwp_sdlaudio_fill(void *udata, Uint8 * buf, int len)
+static void pwp_sdlaudio_fill(void * udata, Uint8 * buf, int len)
 {
+    (void) udata;
     while (len > 0) {
         if (pwp_sdlaudio_curr > len) {
             pwp_sdlaudio_curr -= len;
@@ -83,7 +84,7 @@
     pwplib.loopflush = pwp_sdlaudio_start;
     gb_init(fmt.freq);
 
-//    pwp_regdestr(pwp_sdlaudio_close);
+//    pwplib_regdestr(pwp_sdlaudio_close);
 
     return 1;
 }
--- a/pwplib/snd-w32.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/snd-w32.c	Sat May 22 20:32:49 2010 +0300
@@ -133,7 +133,7 @@
     if(r) { printf("ERROR\n"); }
    }
 
-   pwp_regdestr(win32snd_restore);
+   pwplib_regdestr(win32snd_restore);
 
 //   pwp_w32snd.buffersize = waveFormat.nAvgBytesPerSec/TIMERHZ;
 
--- a/pwplib/tty.c	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/tty.c	Sat May 22 20:32:49 2010 +0300
@@ -11,12 +11,12 @@
 
 #ifdef HAVE_TTYSTUFF
 
-void tty_restore_termios()
+void tty_restore_termios(void)
 {
    tcsetattr(STDIN,TCSADRAIN,&pwp_tty.setup);
 }
 
-void tty_init_termios()
+void tty_init_termios(void)
 {
    struct termios t;
    tcgetattr(STDIN,&t);
@@ -29,10 +29,10 @@
    t.c_cc[VTIME]=0;
    tcsetattr(STDIN,TCSADRAIN,&t);
 
-   pwp_regdestr(tty_restore_termios);
+   pwplib_regdestr(tty_restore_termios);
 }
 
-void tty_getwinsize()
+void tty_getwinsize(void)
 {
 #  ifdef TIOCGWINSZ
   {struct winsize wsz;
@@ -61,7 +61,7 @@
 
 /******************************************************************/
 
-void tty_probe_raw()
+void tty_probe_raw(void)
 {
    fd_set fdset;
    struct timeval timeout;
@@ -150,7 +150,7 @@
 
 /******************************************************************/
 
-int tty_probe()
+int tty_probe(void)
 {
    char*tt;
 
@@ -204,7 +204,7 @@
 
 /******************************************************************/
 
-int tty_init()
+int tty_init(void)
 {
 #ifdef HAVE_TTYSTUFF
 
@@ -283,5 +283,3 @@
 }
 
 #endif
-      
-  
--- a/pwplib/tty.h	Sat May 22 18:12:51 2010 +0300
+++ b/pwplib/tty.h	Sat May 22 20:32:49 2010 +0300
@@ -40,3 +40,6 @@
  
   TTY_VT2XX          /* vtnnn where nnn>=200 */
 };
+
+void tty_write(u8*data,int lgt);
+