1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
|
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;
|