Description: fix FTBFS with clang [-Wreturn-type]
Author: Nicolas Sévelin-Radiguet <nicosr@free.fr>
Last-Update: 2014-09-06
Index: gramophone2-0.8.13a/midifile.c
===================================================================
--- gramophone2-0.8.13a.orig/midifile.c
+++ gramophone2-0.8.13a/midifile.c
@@ -78,6 +78,17 @@ static int read16bit();
 static int to16bit();
 static char *msg();
 
+int mferror(char *);
+int readheader();
+int readtrack();
+int chanmessage(int, int, int);
+int msginit();
+int msgadd(int);
+int metaevent(int);
+int sysex();
+int msgleng();
+int badbyte(int);
+
 /*
  * Write multi-length bytes to MIDI format files
  */
@@ -104,7 +115,7 @@ unsigned long value;
 	}
 }/* end of WriteVarLen */
 
-mfread()	 	/* The only non-static function in this file. */
+int mfread()	 	/* The only non-static function in this file. */
 {
 	if ( Mf_getc == NULLFUNC )
 		mferror("mfread() called without setting Mf_getc"); 
@@ -112,16 +123,17 @@ mfread()	 	/* The only non-static functi
 	readheader();
 	while ( readtrack() )
 		;
+	return 0;
 }
 
 /* for backward compatibility with the original lib */
-midifile()
+int midifile()
 {
-    mfread();
+    return mfread();
 }
 
 //static
-readmt(s)		/* read through the "MThd" or "MTrk" header string */
+int readmt(s)		/* read through the "MThd" or "MTrk" header string */
 char *s;
 {
 	int n = 0;
@@ -140,7 +152,7 @@ char *s;
 }
 
 //static
-egetc()			/* read a single character and abort on EOF */
+int egetc()			/* read a single character and abort on EOF */
 {
 	int c = (*Mf_getc)();
 
@@ -151,12 +163,12 @@ egetc()			/* read a single character and
 }
 
 //static
-readheader()		/* read a header chunk */
+int readheader()		/* read a header chunk */
 {
 	int format, ntrks, division;
 
 	if ( readmt("MThd") == EOF )
-		return;
+		return -1;
 
 	Mf_toberead = read32bit();
 	format = read16bit();
@@ -169,10 +181,12 @@ readheader()		/* read a header chunk */
 	/* flush any extra stuff, in case the length of header is not 6 */
 	while ( Mf_toberead > 0 )
 		(void) egetc();
+
+	return 0;
 }
 
 //static
-readtrack()		 /* read a track chunk */
+int readtrack()		 /* read a track chunk */
 {
 	/* This array is indexed by the high half of a status byte.  It's */
 	/* value is either the number of bytes needed (1 or 2) for a channel */
@@ -287,17 +301,18 @@ readtrack()		 /* read a track chunk */
 }
 
 //static
-badbyte(c)
+int badbyte(c)
 int c;
 {
 	char buff[32];
 
 	(void) sprintf(buff,"unexpected byte: 0x%02x",c);
 	mferror(buff);
+	return 0;
 }
 
 //static
-metaevent(type)
+int metaevent(int type)
 {
 	int leng = msgleng();
 	char *m = msg();
@@ -354,17 +369,19 @@ metaevent(type)
 		if ( Mf_metamisc )
 			(*Mf_metamisc)(type,leng,m);
 	}
+	return 0;
 }
 
 //static
-sysex()
+int sysex()
 {
 	if ( Mf_sysex )
 		(*Mf_sysex)(msgleng(),msg());
+	return 0;
 }
 
 //static
-chanmessage(status,c1,c2)
+int chanmessage(status,c1,c2)
 int status;
 int c1, c2;
 {
@@ -400,6 +417,7 @@ int c1, c2;
 			(*Mf_chanpressure)(chan,c1);
 		break;
 	}
+	return 0;
 }
 
 /* readvarinum - read a varying-length number, and return the */
@@ -424,7 +442,7 @@ readvarinum()
 }
 
 static long
-to32bit(c1,c2,c3,c4)
+to32bit(int c1,int c2,int c3,int c4)
 {
 	long value = 0L;
 
@@ -435,7 +453,7 @@ to32bit(c1,c2,c3,c4)
 	return (value);
 }
 
-static
+static int
 to16bit(c1,c2)
 int c1, c2;
 {
@@ -455,7 +473,7 @@ read32bit()
 }
 
 static
-read16bit()
+int read16bit()
 {
 	int c1, c2;
 	c1 = egetc();
@@ -464,7 +482,7 @@ read16bit()
 }
 
 /* static */
-mferror(s)
+int mferror(s)
 char *s;
 {
 	if ( Mf_error )
@@ -482,9 +500,10 @@ static int Msgsize = 0;		/* Size of curr
 static int Msgindex = 0;	/* index of next available location in Msg */
 
 //static
-msginit()
+int msginit()
 {
 	Msgindex = 0;
+	return 0;
 }
 
 static char *
@@ -494,23 +513,24 @@ msg()
 }
 
 //static
-msgleng()
+int msgleng()
 {
 	return(Msgindex);
 }
 
 //static
-msgadd(c)
+int msgadd(c)
 int c;
 {
 	/* If necessary, allocate larger message buffer. */
 	if ( Msgindex >= Msgsize )
 		biggermsg();
 	Msgbuff[Msgindex++] = c;
+	return 0;
 }
 
 //static
-biggermsg()
+int biggermsg()
 {
 /* 	char *malloc(); */
 	char *newmess;
@@ -534,6 +554,7 @@ biggermsg()
 		free(oldmess);
 	}
 	Msgbuff = newmess;
+	return 0;
 }
 
 /*
@@ -847,7 +868,7 @@ int data;
 }
 
 /* write a single character and abort on error */
-eputc(c)			
+int eputc(c)			
 unsigned char c;
 {
 	int return_val;
