[MPlayer-cvslog] CVS: main/osdep getch2.c, 1.23, 1.24 getch2.h, 1.2, 1.3 timer-lx.c, 1.11, 1.12 timer.h, 1.6, 1.7

Dominik Mierzejewski CVS syncmail at mplayerhq.hu
Thu Feb 9 15:08:04 CET 2006


CVS change done by Dominik Mierzejewski CVS

Update of /cvsroot/mplayer/main/osdep
In directory mail:/var2/tmp/cvs-serv31671/osdep

Modified Files:
	getch2.c getch2.h timer-lx.c timer.h 
Log Message:
Patch by Stefan Huehner / stefan % huehner ! org \

patch replaces '()' for the correct '(void)' in function
declarations/prototypes which have no parameters. The '()' syntax tell
thats there is a variable list of arguments, so that the compiler cannot
check this. The extra CFLAG '-Wstrict-declarations' shows those cases.

Comments about a similar patch applied to ffmpeg:

That in C++ these mean the same, but in ANSI C the semantics are
different; function() is an (obsolete) K&R C style forward declaration,
it basically means that the function can have any number and any types
of parameters, effectively completely preventing the compiler from doing
any sort of type checking. -- Erik Slagter

Defining functions with unspecified arguments is allowed but bad.
With arguments unspecified the compiler can't report an error/warning
if the function is called with incorrect arguments. -- Måns Rullgård



Index: getch2.c
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/getch2.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- getch2.c	29 Dec 2005 18:01:22 -0000	1.23
+++ getch2.c	9 Feb 2006 14:08:01 -0000	1.24
@@ -118,7 +118,7 @@
 
 #endif
 
-void get_screen_size(){
+void get_screen_size(void){
 #ifdef USE_IOCTL
   struct winsize ws;
   if (ioctl(0, TIOCGWINSZ, &ws) < 0 || !ws.ws_row || !ws.ws_col) return;
@@ -217,7 +217,7 @@
 
 static int getch2_status=0;
 
-void getch2_enable(){
+void getch2_enable(void){
 #ifdef HAVE_TERMIOS
 struct termios tio_new;
 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__) || defined(_AIX)
@@ -242,7 +242,7 @@
     getch2_status=1;
 }
 
-void getch2_disable(){
+void getch2_disable(void){
     if(!getch2_status) return; // already disabled / never enabled
 #ifdef HAVE_TERMIOS
 #if defined(__NetBSD__) || defined(__svr4__) || defined(__CYGWIN__) || defined(__OS2__) || defined(__GLIBC__) || defined(_AIX)

Index: getch2.h
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/getch2.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- getch2.h	25 Dec 2005 18:26:35 -0000	1.2
+++ getch2.h	9 Feb 2006 14:08:01 -0000	1.3
@@ -9,14 +9,14 @@
 extern char * erase_to_end_of_line;
 
 /* Get screen-size using IOCTL call. */
-extern void get_screen_size();
+extern void get_screen_size(void);
 
 /* Load key definitions from the TERMCAP database. 'termtype' can be NULL */
 extern int load_termcap(char *termtype);
 
 /* Enable and disable STDIN line-buffering */
-extern void getch2_enable();
-extern void getch2_disable();
+extern void getch2_enable(void);
+extern void getch2_disable(void);
 
 /* Read a character or a special key code (see keycodes.h) */
 extern int getch2(int halfdelay_time);

Index: timer-lx.c
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/timer-lx.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- timer-lx.c	14 Nov 2005 00:28:03 -0000	1.11
+++ timer-lx.c	9 Feb 2006 14:08:01 -0000	1.12
@@ -29,7 +29,7 @@
 }
 
 // Returns current time in microseconds
-unsigned int GetTimer(){
+unsigned int GetTimer(void){
   struct timeval tv;
   struct timezone tz;
 //  float s;
@@ -39,7 +39,7 @@
 }  
 
 // Returns current time in milliseconds
-unsigned int GetTimerMS(){
+unsigned int GetTimerMS(void){
   struct timeval tv;
   struct timezone tz;
 //  float s;
@@ -51,7 +51,7 @@
 static unsigned int RelativeTime=0;
 
 // Returns time spent between now and last call in seconds
-float GetRelativeTime(){
+float GetRelativeTime(void){
 unsigned int t,r;
   t=GetTimer();
 //  t*=16;printf("time=%ud\n",t);
@@ -61,7 +61,7 @@
 }
 
 // Initialize timer, must be called at least once at start
-void InitTimer(){
+void InitTimer(void){
   GetRelativeTime();
 }
 

Index: timer.h
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/timer.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- timer.h	4 Aug 2004 15:48:43 -0000	1.6
+++ timer.h	9 Feb 2006 14:08:01 -0000	1.7
@@ -3,11 +3,11 @@
 
 extern const char *timer_name;
 
-void InitTimer();
-unsigned int GetTimer();
-unsigned int GetTimerMS();
+void InitTimer(void);
+unsigned int GetTimer(void);
+unsigned int GetTimerMS(void);
 //int uGetTimer();
-float GetRelativeTime();
+float GetRelativeTime(void);
 
 int usec_sleep(int usec_delay);
 




More information about the MPlayer-cvslog mailing list