shithub: dumb

Download patch

ref: f5a1c5ec318cd7c17fb54f2ed2cb70d72cd549f6
parent: d31fb2084659b64d07eb0644d9bacfd67059d066
author: Chris Moeller <kode54@gmail.com>
date: Thu Jun 20 18:28:11 EDT 2013

Eliminated all clang compilation warnings

--- a/dumb/src/helpers/resamp3.inc
+++ b/dumb/src/helpers/resamp3.inc
@@ -59,7 +59,7 @@
 
 	done = 0;
 	dt = (int)(delta * 65536.0 + 0.5);
-	if (dt == 0 || dt == 0x80000000) return 0;
+        if (dt == 0 || dt == (int)-0x80000000) return 0;
         inv_dt = (int)(1.0 / delta * 65536.0 + 0.5);
 	SET_VOLUME_VARIABLES;
 
--- a/dumb/src/helpers/tarray.c
+++ b/dumb/src/helpers/tarray.c
@@ -42,17 +42,17 @@
 
 void timekeeping_array_destroy(void * array)
 {
+#ifdef FULL_TIMEKEEPING
 	size_t i;
 	size_t * size = (size_t *) array;
 	DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
 
-#ifdef FULL_TIMEKEEPING
 	for (i = 0; i < *size; i++) {
 		if (s[i].times) free(s[i].times);
 	}
 #endif
 
-	free(size);
+    free(array);
 }
 
 void * timekeeping_array_dup(void * array)
@@ -119,10 +119,12 @@
 
 void timekeeping_array_push(void * array, size_t index, LONG_LONG time)
 {
+#ifdef FULL_TIMEKEEPING
 	size_t i;
-	size_t * size = (size_t *) array;
+    size_t time_count;
+#endif
+    size_t * size = (size_t *) array;
 	DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
-	size_t time_count;
 
 	if (index >= *size) return;
 
@@ -140,7 +142,6 @@
 
 void timekeeping_array_bump(void * array, size_t index)
 {
-	size_t i;
 	size_t * size = (size_t *) array;
 	DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
 
@@ -151,7 +152,6 @@
 
 unsigned int timekeeping_array_get_count(void * array, size_t index)
 {
-	size_t i;
 	size_t * size = (size_t *) array;
 	DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
 
@@ -162,7 +162,6 @@
 
 LONG_LONG timekeeping_array_get_item(void * array, size_t index)
 {
-	size_t i;
 	size_t * size = (size_t *) array;
 	DUMB_IT_ROW_TIME * s = (DUMB_IT_ROW_TIME *)(size + 1);
 
--- a/dumb/src/it/itread.c
+++ b/dumb/src/it/itread.c
@@ -323,7 +323,7 @@
 	// XXX
 	dumbfile_skip(f, 4);
 
-	dumbfile_getnc(instrument->filename, 13, f);
+    dumbfile_getnc((char *)instrument->filename, 13, f);
 	instrument->filename[13] = 0;
 
 	instrument->volume_envelope.flags = dumbfile_getc(f);
@@ -352,7 +352,7 @@
 	 */
 	dumbfile_skip(f, 4);
 
-	dumbfile_getnc(instrument->name, 26, f);
+    dumbfile_getnc((char *)instrument->name, 26, f);
 	instrument->name[26] = 0;
 
 	/* Skip unused bytes following the Instrument Name. */
@@ -438,7 +438,7 @@
 
 	dumbfile_skip(f, 4);
 
-	dumbfile_getnc(instrument->filename, 13, f);
+    dumbfile_getnc((char *)instrument->filename, 13, f);
 	instrument->filename[13] = 0;
 
 	instrument->new_note_action = dumbfile_getc(f);
@@ -457,7 +457,7 @@
 	 */
 	dumbfile_skip(f, 4);
 
-	dumbfile_getnc(instrument->name, 26, f);
+    dumbfile_getnc((char *)instrument->name, 26, f);
 	instrument->name[26] = 0;
 
 	instrument->filter_cutoff = dumbfile_getc(f);
@@ -541,7 +541,7 @@
 		}
 	}
 
-	dumbfile_getnc(sample->filename, 13, f);
+    dumbfile_getnc((char *)sample->filename, 13, f);
 	sample->filename[13] = 0;
 
 	sample->global_volume = dumbfile_getc(f);
@@ -548,7 +548,7 @@
 	sample->flags = dumbfile_getc(f);
 	sample->default_volume = dumbfile_getc(f);
 
-	dumbfile_getnc(sample->name, 26, f);
+    dumbfile_getnc((char *)sample->name, 26, f);
 	sample->name[26] = 0;
 
 	*convert = dumbfile_getc(f);
@@ -618,7 +618,7 @@
 	long n, len, delta;
 	signed char * ptr, * end;
 	signed char compression_table[16];
-	if (dumbfile_getnc(compression_table, 16, f) != 16)
+    if (dumbfile_getnc((char *)compression_table, 16, f) != 16)
         return -1;
 	ptr = (signed char *) sample->data;
 	delta = 0;
@@ -777,7 +777,7 @@
 		return -1;
 
 	/* Read in the pattern data. */
-	dumbfile_getnc(buffer, buflen, f);
+    dumbfile_getnc((char *)buffer, buflen, f);
 
 	if (dumbfile_error(f))
 		return -1;
@@ -966,7 +966,7 @@
 	sigdata->midi = NULL;
 	sigdata->checkpoint = NULL;
 
-	dumbfile_getnc(sigdata->name, 26, f);
+    dumbfile_getnc((char *)sigdata->name, 26, f);
 	sigdata->name[26] = 0;
 
 	/* Skip pattern row highlight info. */
@@ -999,8 +999,8 @@
 	/* Skip Reserved. */
 	dumbfile_skip(f, 4);
 
-	dumbfile_getnc(sigdata->channel_pan, DUMB_IT_N_CHANNELS, f);
-	dumbfile_getnc(sigdata->channel_volume, DUMB_IT_N_CHANNELS, f);
+    dumbfile_getnc((char *)sigdata->channel_pan, DUMB_IT_N_CHANNELS, f);
+    dumbfile_getnc((char *)sigdata->channel_volume, DUMB_IT_N_CHANNELS, f);
 
 	// XXX sample count
 	if (dumbfile_error(f) || sigdata->n_orders <= 0 || sigdata->n_instruments > 256 || sigdata->n_samples > 4000 || sigdata->n_patterns > 256) {
@@ -1042,7 +1042,7 @@
 			sigdata->pattern[n].entry = NULL;
 	}
 
-	dumbfile_getnc(sigdata->order, sigdata->n_orders, f);
+    dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
 	sigdata->restart_position = 0;
 
 	component = malloc(769 * sizeof(*component));
@@ -1132,7 +1132,7 @@
 		for (i = 0; i < 16; i++) {
 			unsigned char len = 0;
 			int j, leftdigit = -1;
-			if (dumbfile_getnc(mididata, 32, f) < 32) {
+            if (dumbfile_getnc((char *)mididata, 32, f) < 32) {
 				free(component);
 				_dumb_it_unload_sigdata(sigdata);
 				return NULL;
@@ -1164,7 +1164,7 @@
 		for (i = 0; i < 128; i++) {
 			unsigned char len = 0;
 			int j, leftdigit = -1;
-			dumbfile_getnc(mididata, 32, f);
+            dumbfile_getnc((char *)mididata, 32, f);
 			for (j = 0; j < 32; j++) {
 				if (leftdigit >= 0) {
 					if (mididata[j] == 0) {
@@ -1239,7 +1239,7 @@
 				}
 				sigdata->song_message = malloc(message_length + 1);
 				if (sigdata->song_message) {
-					if (dumbfile_getnc(sigdata->song_message, message_length, f) < message_length) {
+                    if (dumbfile_getnc((char *)sigdata->song_message, message_length, f) < message_length) {
 						free(buffer);
 						free(component);
 						_dumb_it_unload_sigdata(sigdata);
@@ -1403,7 +1403,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "IT";
 		return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
--- a/dumb/src/it/itrender.c
+++ b/dumb/src/it/itrender.c
@@ -1268,7 +1268,7 @@
 
 static void update_effects(DUMB_IT_SIGRENDERER *sigrenderer)
 {
-	int i, j;
+    int i;
 
 	if (sigrenderer->globalvolslide) {
 		sigrenderer->globalvolume += sigrenderer->globalvolslide;
@@ -4231,7 +4231,7 @@
 							return 1;
 						bit_array_reset(sigrenderer->played);
 						if (sigrenderer->speed == 0)
-							goto speed0; /* I love goto *
+                            goto speed0; I love goto
 					}
 				}
 				*/
@@ -4257,7 +4257,7 @@
 							{
 								if ((sigdata->flags & (IT_WAS_AN_XM|IT_WAS_A_MOD)) == IT_WAS_AN_XM)
 								{
-									/* joy, was XM, pattern loop bug triggered break to row in same order 
+                                    joy, was XM, pattern loop bug triggered break to row in same order
 									bit_array_mask(sigrenderer->played, channel->played_patjump, sigrenderer->order * 256);
 								}
 								bit_array_destroy(channel->played_patjump);
@@ -4641,6 +4641,7 @@
 /* Note: if a click remover is provided, and store_end_sample is set, then
  * the end point will be computed twice. This situation should not arise.
  */
+#if 0
 static long render_playing(DUMB_IT_SIGRENDERER *sigrenderer, IT_PLAYING *playing, float volume, float main_delta, float delta, long pos, long size, sample_t **samples, int store_end_sample, int *left_to_mix, int cr_record_which)
 {
 	int bits;
@@ -4762,6 +4763,7 @@
 
 	return size_rendered;
 }
+#endif
 
 #ifdef END_RAMPING
 #if 1
--- a/dumb/src/it/read669.c
+++ b/dumb/src/it/read669.c
@@ -35,7 +35,7 @@
 
 	pattern->n_rows = 64;
 
-	if (dumbfile_getnc(buffer, 64 * 3 * 8, f) < 64 * 3 * 8)
+    if (dumbfile_getnc((char *)buffer, 64 * 3 * 8, f) < 64 * 3 * 8)
 		return -1;
 
 	/* compute number of entries */
@@ -156,7 +156,7 @@
 
 static int it_669_read_sample_header(IT_SAMPLE *sample, DUMBFILE *f)
 {
-	dumbfile_getnc(sample->name, 13, f);
+    dumbfile_getnc((char *)sample->name, 13, f);
 	sample->name[13] = 0;
 
 	sample->filename[0] = 0;
@@ -268,7 +268,7 @@
 		return NULL;
 	}
 
-	if (dumbfile_getnc(sigdata->name, 36, f) < 36) {
+    if (dumbfile_getnc((char *)sigdata->name, 36, f) < 36) {
 		free(sigdata);
 		return NULL;
 	}
@@ -288,13 +288,13 @@
 		free(sigdata);
 		return NULL;
 	}
-	if (dumbfile_getnc(sigdata->song_message, 36, f) < 36) {
+    if (dumbfile_getnc((char *)sigdata->song_message, 36, f) < 36) {
 		_dumb_it_unload_sigdata(sigdata);
 		return NULL;
 	}
 	sigdata->song_message[36] = 13;
 	sigdata->song_message[36 + 1] = 10;
-	if (dumbfile_getnc(sigdata->song_message + 38, 36, f) < 36) {
+    if (dumbfile_getnc((char *)sigdata->song_message + 38, 36, f) < 36) {
 		_dumb_it_unload_sigdata(sigdata);
 		return NULL;
 	}
@@ -314,7 +314,7 @@
 		_dumb_it_unload_sigdata(sigdata);
 		return NULL;
 	}
-	if (dumbfile_getnc(sigdata->order, 128, f) < 128) {
+    if (dumbfile_getnc((char *)sigdata->order, 128, f) < 128) {
 		_dumb_it_unload_sigdata(sigdata);
 		return NULL;
 	}
@@ -332,12 +332,12 @@
 	}
 	sigdata->n_orders = i;
 
-	if (dumbfile_getnc(tempolist, 128, f) < 128) {
+    if (dumbfile_getnc((char *)tempolist, 128, f) < 128) {
 		_dumb_it_unload_sigdata(sigdata);
 		return NULL;
 	}
 
-	if (dumbfile_getnc(breaklist, 128, f) < 128) {
+    if (dumbfile_getnc((char *)breaklist, 128, f) < 128) {
 		_dumb_it_unload_sigdata(sigdata);
 		return NULL;
 	}
@@ -439,7 +439,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = ext ? "669 Extended" : "669";
 		return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
--- a/dumb/src/it/readam.c
+++ b/dumb/src/it/readam.c
@@ -45,7 +45,7 @@
 
 		header_length = 0x38;
 
-        dumbfile_getnc( sample->name, 28, f );
+        dumbfile_getnc( (char *) sample->name, 28, f );
 		sample->name[ 28 ] = 0;
 
         default_pan = dumbfile_getc( f );
@@ -69,7 +69,7 @@
         start += 4;
 		len -= 4;
 
-        dumbfile_getnc( sample->name, 32, f );
+        dumbfile_getnc( (char *) sample->name, 32, f );
 
         default_pan = dumbfile_igetw( f );
         default_volume = dumbfile_igetw( f );
@@ -281,7 +281,7 @@
 
 	found = 0;
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch( c->type )
@@ -302,7 +302,7 @@
             o = dumbfile_getc( f );
             if ( o >= sigdata->n_patterns ) sigdata->n_patterns = o + 1;
             o = dumbfile_igetl( f );
-			if ( o + 5 > c->size ) goto error_sd;
+            if ( (unsigned)o + 5 > c->size ) goto error_sd;
 			break;
 
 		case DUMB_ID( 'I', 'N', 'S', 'T' ):
@@ -353,7 +353,7 @@
 		sigdata->channel_pan[n+3] = 16;
 	}
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch ( c->type )
@@ -360,7 +360,7 @@
 		{
 		case DUMB_ID( 'M', 'A', 'I', 'N' ):
             if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
-            dumbfile_getnc( sigdata->name, 64, f );
+            dumbfile_getnc( (char *) sigdata->name, 64, f );
 			sigdata->name[ 64 ] = 0;
 			sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_AN_S3M;
             o = dumbfile_getc( f );
@@ -374,7 +374,7 @@
 
             sigdata->global_volume = dumbfile_getc( f );
 
-			if ( c->size < 0x48 + sigdata->n_pchannels ) goto error_usd;
+            if ( c->size < 0x48 + (unsigned)sigdata->n_pchannels ) goto error_usd;
 
 			for ( o = 0; o < sigdata->n_pchannels; ++o )
 			{
@@ -404,7 +404,7 @@
 		sample->name[ 0 ] = 0;
 	}
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch ( c->type )
@@ -412,10 +412,10 @@
 		case DUMB_ID( 'O', 'R', 'D', 'R' ):
             if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
             sigdata->n_orders = dumbfile_getc( f ) + 1;
-			if ( sigdata->n_orders + 1 > c->size ) goto error_usd;
+            if ( (unsigned)sigdata->n_orders + 1 > c->size ) goto error_usd;
 			sigdata->order = malloc( sigdata->n_orders );
 			if ( ! sigdata->order ) goto error_usd;
-            dumbfile_getnc( sigdata->order, sigdata->n_orders, f );
+            dumbfile_getnc( (char *) sigdata->order, sigdata->n_orders, f );
 			break;
 
 		case DUMB_ID( 'P', 'A', 'T', 'T' ):
@@ -441,7 +441,7 @@
                     }
 				}
                 dumbfile_seek( f, c->offset + 2, DFS_SEEK_SET );
-                dumbfile_getnc( sample->name, 28, f );
+                dumbfile_getnc( (char *) sample->name, 28, f );
                 sample->name[ 28 ] = 0;
             }
 			break;
@@ -480,7 +480,7 @@
 
 	found = 0;
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch( c->type )
@@ -501,7 +501,7 @@
             o = dumbfile_getc( f );
             if ( o >= sigdata->n_patterns ) sigdata->n_patterns = o + 1;
             o = dumbfile_igetl( f );
-			if ( o + 5 > c->size ) goto error_sd;
+            if ( (unsigned)o + 5 > c->size ) goto error_sd;
 			break;
 
 		case DUMB_ID( 'R', 'I', 'F', 'F' ):
@@ -510,7 +510,7 @@
 				switch ( str->type )
 				{
 				case DUMB_ID( 'A', 'I', ' ', ' ' ):
-					for ( o = 0; o < str->chunk_count; ++o )
+                    for ( o = 0; (unsigned)o < str->chunk_count; ++o )
 					{
 						struct riff_chunk * chk = str->chunks + o;
 						switch( chk->type )
@@ -532,7 +532,7 @@
 								{
 									if ( temp->type == DUMB_ID( 'A', 'S', ' ', ' ' ) )
 									{
-										for ( p = 0; p < temp->chunk_count; ++p )
+                                        for ( p = 0; (unsigned)p < temp->chunk_count; ++p )
 										{
 											if ( temp->chunks[ p ].type == DUMB_ID( 'S', 'A', 'M', 'P' ) )
 											{
@@ -584,7 +584,7 @@
 		sigdata->channel_pan[n+3] = 16;
 	}
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch ( c->type )
@@ -591,7 +591,7 @@
 		{
 		case DUMB_ID( 'I', 'N', 'I', 'T' ):
             if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
-            dumbfile_getnc( sigdata->name, 64, f );
+            dumbfile_getnc( (char *) sigdata->name, 64, f );
 			sigdata->name[ 64 ] = 0;
 			sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_AN_S3M;
             o = dumbfile_getc( f );
@@ -605,7 +605,7 @@
 
             sigdata->global_volume = dumbfile_getc( f );
 
-			if ( c->size < 0x48 + sigdata->n_pchannels ) goto error_usd;
+            if ( c->size < 0x48 + (unsigned)sigdata->n_pchannels ) goto error_usd;
 
 			for ( o = 0; o < sigdata->n_pchannels; ++o )
 			{
@@ -638,7 +638,7 @@
 		sample->name[ 0 ] = 0;
 	}
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch ( c->type )
@@ -646,10 +646,10 @@
 		case DUMB_ID( 'O', 'R', 'D', 'R' ):
             if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
             sigdata->n_orders = dumbfile_getc( f ) + 1;
-			if ( sigdata->n_orders + 1 > c->size ) goto error_usd;
+            if ( (unsigned)sigdata->n_orders + 1 > c->size ) goto error_usd;
 			sigdata->order = malloc( sigdata->n_orders );
 			if ( ! sigdata->order ) goto error_usd;
-            dumbfile_getnc( sigdata->order, sigdata->n_orders, f );
+            dumbfile_getnc( (char *) sigdata->order, sigdata->n_orders, f );
 			break;
 
 		case DUMB_ID( 'P', 'A', 'T', 'T' ):
@@ -665,7 +665,7 @@
 				switch ( str->type )
 				{
 				case DUMB_ID('A', 'I', ' ', ' '):
-					for ( o = 0; o < str->chunk_count; ++o )
+                    for ( o = 0; (unsigned)o < str->chunk_count; ++o )
 					{
 						struct riff_chunk * chk = str->chunks + o;
 						switch( chk->type )
@@ -687,7 +687,7 @@
 								{
 									if ( temp->type == DUMB_ID( 'A', 'S', ' ', ' ' ) )
 									{
-										for ( p = 0; p < temp->chunk_count; ++p )
+                                        for ( p = 0; (unsigned)p < temp->chunk_count; ++p )
 										{
 											struct riff_chunk * c = temp->chunks + p;
 											if ( c->type == DUMB_ID( 'S', 'A', 'M', 'P' ) )
@@ -716,7 +716,7 @@
 								if ( ! sample_found )
 								{
                                     dumbfile_seek( f, chk->offset + 6, DFS_SEEK_SET );
-                                    dumbfile_getnc( sample->name, 32, f );
+                                    dumbfile_getnc( (char *) sample->name, 32, f );
 									sample->name[ 32 ] = 0;
 								}
 							}
@@ -758,7 +758,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "RIFF AMFF";
 		return make_duh( length, 2, ( const char * const (*) [ 2 ] ) tag, 1, & descptr, & sigdata );
@@ -779,7 +779,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "RIFF AM";
 		return make_duh( -1, 2, ( const char * const (*) [ 2 ] ) tag, 1, & descptr, & sigdata );
--- a/dumb/src/it/readamf.c
+++ b/dumb/src/it/readamf.c
@@ -171,10 +171,10 @@
 
 	exists = dumbfile_getc( f );
 
-	dumbfile_getnc( sample->name, 32, f );
+    dumbfile_getnc( (char *) sample->name, 32, f );
 	sample->name[32] = 0;
 
-	dumbfile_getnc( sample->filename, 13, f );
+    dumbfile_getnc( (char *) sample->filename, 13, f );
 	sample->filename[13] = 0;
 
 	*offset = dumbfile_igetl( f );
@@ -272,7 +272,7 @@
 		return NULL;
 	}
 
-	dumbfile_getnc( sigdata->name, 32, f );
+    dumbfile_getnc( (char *) sigdata->name, 32, f );
 	sigdata->name[ 32 ] = 0;
 	sigdata->n_samples = dumbfile_getc( f );
 	sigdata->n_orders = dumbfile_getc( f );
@@ -415,7 +415,7 @@
 		track[ i ][ 0 ] = tracksize & 255;
 		track[ i ][ 1 ] = ( tracksize >> 8 ) & 255;
 		track[ i ][ 2 ] = ( tracksize >> 16 ) & 255;
-		if ( dumbfile_getnc( track[ i ] + 3, tracksize * 3, f ) != tracksize * 3 ) {
+        if ( dumbfile_getnc( (char *) track[ i ] + 3, tracksize * 3, f ) != tracksize * 3 ) {
 			goto error_all;
 		}
 	}
@@ -510,7 +510,7 @@
 		const char *tag[2][2];
 		char ver_string[14];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		memcpy( ver_string, "DSMI AMF v", 10 );
 		ver_string[10] = '0' + version / 10;
--- a/dumb/src/it/readany.c
+++ b/dumb/src/it/readany.c
@@ -38,7 +38,7 @@
 
     signature_size = dumbfile_get_size(f);
 
-    signature_size = dumbfile_getnc( signature, maximum_signature_size, f );
+    signature_size = dumbfile_getnc( (char *)signature, maximum_signature_size, f );
     dumbfile_seek( f, 0, DFS_SEEK_SET );
 
     if (signature_size >= 4 &&
--- a/dumb/src/it/readasy.c
+++ b/dumb/src/it/readasy.c
@@ -35,7 +35,7 @@
 
 	pattern->n_rows = 64;
 
-	if ( dumbfile_getnc( buffer, 64 * 8 * 4, f ) != 64 * 8 * 4 )
+    if ( dumbfile_getnc( (char *) buffer, 64 * 8 * 4, f ) != 64 * 8 * 4 )
 		return -1;
 
 	/* compute number of entries */
@@ -101,7 +101,7 @@
 the sample name begins with a '#' character (ASCII $23 (35)) then this is
 assumed not to be an instrument name, and is probably a message.
 */
-	dumbfile_getnc( sample->name, 22, f );
+    dumbfile_getnc( (char *) sample->name, 22, f );
 	sample->name[22] = 0;
 
 	sample->filename[0] = 0;
@@ -212,7 +212,7 @@
 		return NULL;
 	}
 
-	if ( dumbfile_getnc( sigdata->order, sigdata->n_orders, f ) != sigdata->n_orders ||
+    if ( dumbfile_getnc( (char *) sigdata->order, sigdata->n_orders, f ) != sigdata->n_orders ||
 		dumbfile_skip( f, 256 - sigdata->n_orders ) ) {
 		free( sigdata->order );
 		free( sigdata );
@@ -323,7 +323,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "ASYLUM Music Format";
 		return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
--- a/dumb/src/it/readdsmf.c
+++ b/dumb/src/it/readdsmf.c
@@ -28,7 +28,7 @@
 {
 	int flags;
 
-    dumbfile_getnc( sample->filename, 13, f );
+    dumbfile_getnc( (char *) sample->filename, 13, f );
 	sample->filename[ 14 ] = 0;
 	
     flags = dumbfile_igetw( f );
@@ -39,7 +39,7 @@
     dumbfile_skip( f, 32 - 28 );
     sample->C5_speed = dumbfile_igetw( f ) * 2;
     dumbfile_skip( f, 36 - 34 );
-    dumbfile_getnc( sample->name, 28, f );
+    dumbfile_getnc( (char *) sample->name, 28, f );
 	sample->name[ 28 ] = 0;
 
 	/*if ( data[ 0x38 ] || data[ 0x39 ] || data[ 0x3A ] || data[ 0x3B ] )
@@ -229,7 +229,7 @@
 
 	found = 0;
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch( c->type )
@@ -278,7 +278,7 @@
 		sigdata->channel_pan[n+3] = 16;
 	}
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch ( c->type )
@@ -285,7 +285,7 @@
 		{
 		case DUMB_ID( 'S', 'O', 'N', 'G' ):
             if ( dumbfile_seek( f, c->offset, DFS_SEEK_SET ) ) goto error_usd;
-            dumbfile_getnc( sigdata->name, 28, f );
+            dumbfile_getnc( (char *) sigdata->name, 28, f );
 			sigdata->name[ 28 ] = 0;
 			sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX;
             dumbfile_skip( f, 36 - 28 );
@@ -306,7 +306,7 @@
 
 			sigdata->order = malloc( 128 );
 			if ( ! sigdata->order ) goto error_usd;
-            dumbfile_getnc( sigdata->order, 128, f );
+            dumbfile_getnc( (char *) sigdata->order, 128, f );
 
 			break;
 		}
@@ -328,7 +328,7 @@
 	sigdata->n_samples = 0;
 	sigdata->n_patterns = 0;
 
-	for ( n = 0; n < stream->chunk_count; ++n )
+    for ( n = 0; (unsigned)n < stream->chunk_count; ++n )
 	{
 		struct riff_chunk * c = stream->chunks + n;
 		switch ( c->type )
@@ -374,7 +374,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "RIFF DSMF";
 		return make_duh( -1, 2, ( const char * const (*) [ 2 ] ) tag, 1, & descptr, & sigdata );
--- a/dumb/src/it/readmod.c
+++ b/dumb/src/it/readmod.c
@@ -38,14 +38,14 @@
 	if (n_channels == 0) {
 		/* Read the first four channels, leaving gaps for the rest. */
 		for (pos = 0; pos < 64*8*4; pos += 8*4)
-			dumbfile_getnc(buffer + pos, 4*4, f);
+            dumbfile_getnc((char *)buffer + pos, 4*4, f);
 		/* Read the other channels into the gaps we left. */
 		for (pos = 4*4; pos < 64*8*4; pos += 8*4)
-			dumbfile_getnc(buffer + pos, 4*4, f);
+            dumbfile_getnc((char *)buffer + pos, 4*4, f);
 
 		n_channels = 8;
 	} else
-		dumbfile_getnc(buffer, 64 * n_channels * 4, f);
+        dumbfile_getnc((char *)buffer, 64 * n_channels * 4, f);
 
 	if (dumbfile_error(f))
 		return -1;
@@ -131,7 +131,7 @@
 the sample name begins with a '#' character (ASCII $23 (35)) then this is
 assumed not to be an instrument name, and is probably a message.
 */
-	dumbfile_getnc(sample->name, 22, f);
+    dumbfile_getnc((char *)sample->name, 22, f);
 	sample->name[22] = 0;
 
 	sample->filename[0] = 0;
@@ -300,7 +300,7 @@
                              full 20 chars in length, it will be null-
                              terminated.
 	*/
-	if (dumbfile_getnc(sigdata->name, 20, f) < 20) {
+    if (dumbfile_getnc((char *)sigdata->name, 20, f) < 20) {
 		free(sigdata);
         return NULL;
 	}
@@ -435,7 +435,7 @@
 		_dumb_it_unload_sigdata(sigdata);
         return NULL;
 	}
-	if (dumbfile_getnc(sigdata->order, 128, f) < 128) {
+    if (dumbfile_getnc((char *)sigdata->order, 128, f) < 128) {
 		_dumb_it_unload_sigdata(sigdata);
         return NULL;
 	}
@@ -477,7 +477,7 @@
         while (dumbfile_pos(f) > offset && sample_number >= 0) {
             if (sigdata->sample[sample_number].flags & IT_SAMPLE_EXISTS) {
                 if ( dumbfile_seek(f, -((sigdata->sample[sample_number].length + 1) / 2 + 5 + 16), DFS_SEEK_CUR) ||
-                     dumbfile_getnc(buffer, 5, f) < 5 ) {
+                     dumbfile_getnc((char *)buffer, 5, f) < 5 ) {
                     _dumb_it_unload_sigdata(sigdata);
                     return NULL;
                 }
@@ -623,7 +623,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "MOD";
 		return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
--- a/dumb/src/it/readmtm.c
+++ b/dumb/src/it/readmtm.c
@@ -96,7 +96,7 @@
 {
 	int finetune, flags;
 
-	dumbfile_getnc(sample->name, 22, f);
+    dumbfile_getnc((char *)sample->name, 22, f);
 	sample->name[22] = 0;
 
 	sample->filename[0] = 0;
@@ -195,7 +195,7 @@
 	sigdata = malloc(sizeof(*sigdata));
 	if (!sigdata) goto error;
 
-	dumbfile_getnc(sigdata->name, 20, f);
+    dumbfile_getnc((char *)sigdata->name, 20, f);
 	sigdata->name[20] = 0;
 
 	n_tracks = dumbfile_igetw(f);
@@ -216,7 +216,7 @@
 
 	memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
 
-	if (dumbfile_getnc(sigdata->channel_pan, 32, f) < 32) goto error_sd;
+    if (dumbfile_getnc((char *)sigdata->channel_pan, 32, f) < 32) goto error_sd;
 
 	for (n = 0; n < 32; n++) {
 		if (sigdata->channel_pan[n] <= 15) {
@@ -268,7 +268,7 @@
 	sigdata->order = malloc(sigdata->n_orders);
 	if (!sigdata->order) goto error_usd;
 
-	if (dumbfile_getnc(sigdata->order, sigdata->n_orders, f) < sigdata->n_orders) goto error_usd;
+    if (dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f) < sigdata->n_orders) goto error_usd;
 	if (sigdata->n_orders < 128)
 		if (dumbfile_skip(f, 128 - sigdata->n_orders)) goto error_usd;
 
@@ -275,7 +275,7 @@
 	track = malloc(192 * n_tracks);
 	if (!track) goto error_usd;
 
-	if (dumbfile_getnc(track, 192 * n_tracks, f) < 192 * n_tracks) goto error_ft;
+    if (dumbfile_getnc((char *)track, 192 * n_tracks, f) < 192 * n_tracks) goto error_ft;
 
 	sigdata->pattern = malloc(sigdata->n_patterns * sizeof(*sigdata->pattern));
 	if (!sigdata->pattern) goto error_ft;
@@ -395,7 +395,7 @@
 		char version[16];
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		version[0] = 'M';
 		version[1] = 'T';
--- a/dumb/src/it/readokt.c
+++ b/dumb/src/it/readokt.c
@@ -322,8 +322,8 @@
 static DUMB_IT_SIGDATA *it_okt_load_sigdata(DUMBFILE *f)
 {
 	DUMB_IT_SIGDATA *sigdata;
-	unsigned n_channels;
-	unsigned i, j, k, l;
+    int n_channels;
+    int i, j, k, l;
 	IFF_CHUNKED *mod;
 	const IFF_CHUNK *chunk;
 
@@ -431,7 +431,7 @@
 	}
 
 	chunk = get_chunk_by_type(mod, DUMB_ID('P','A','T','T'), 0);
-	if (!chunk || chunk->size < sigdata->n_orders) {
+    if (!chunk || chunk->size < (unsigned)sigdata->n_orders) {
 		_dumb_it_unload_sigdata(sigdata);
 		free_okt(mod);
 		return NULL;
--- a/dumb/src/it/readoldpsm.c
+++ b/dumb/src/it/readoldpsm.c
@@ -44,7 +44,7 @@
 	buffer = malloc(count * 64);
 	if (!buffer) goto error;
 
-	if (dumbfile_getnc(buffer, count * 64, f) < count * 64) goto error_fb;
+    if (dumbfile_getnc((char *)buffer, count * 64, f) < count * 64) goto error_fb;
 
 	true_num = 0;
 
@@ -192,7 +192,7 @@
 	return -1;
 }
 
-static int it_old_psm_read_patterns(IT_PATTERN * pattern, DUMBFILE * f, int num, int size, int pchans, int sflags)
+static int it_old_psm_read_patterns(IT_PATTERN * pattern, DUMBFILE * f, int num, int size, int pchans)
 {
 	int n, offset, psize, rows, chans, row, flags, channel;
 
@@ -203,7 +203,7 @@
 	buffer = malloc(size);
 	if (!buffer) goto error;
 
-	if (dumbfile_getnc(buffer, size, f) < size) goto error_fb;
+    if (dumbfile_getnc((char *)buffer, size, f) < size) goto error_fb;
 
 	offset = 0;
 
@@ -511,7 +511,7 @@
 	sigdata = malloc(sizeof(*sigdata));
 	if (!sigdata) goto error;
 
-	if (dumbfile_getnc(sigdata->name, 60, f) < 60 ||
+    if (dumbfile_getnc((char *)sigdata->name, 60, f) < 60 ||
 		sigdata->name[59] != 0x1A) goto error_sd;
 	sigdata->name[59] = 0;
 
@@ -613,7 +613,7 @@
 		switch (component[n].type) {
 
 			case PSM_COMPONENT_ORDERS:
-                if (dumbfile_getnc(sigdata->order, sigdata->n_orders, f) < sigdata->n_orders) goto error_fc;
+                if (dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f) < sigdata->n_orders) goto error_fc;
 				if (n_orders > sigdata->n_orders)
 					if (dumbfile_skip(f, n_orders - sigdata->n_orders))
                         goto error_fc;
@@ -621,7 +621,7 @@
 				break;
 
 			case PSM_COMPONENT_PANPOS:
-                if (dumbfile_getnc(sigdata->channel_pan, sigdata->n_pchannels, f) < sigdata->n_pchannels) goto error_fc;
+                if (dumbfile_getnc((char *)sigdata->channel_pan, sigdata->n_pchannels, f) < sigdata->n_pchannels) goto error_fc;
 				for (o = 0; o < sigdata->n_pchannels; o++) {
 					sigdata->channel_pan[o] -= (sigdata->channel_pan[o] & 8) >> 3;
 					sigdata->channel_pan[o] = ((int)sigdata->channel_pan[o] << 5) / 7;
@@ -629,7 +629,7 @@
 				break;
 
 			case PSM_COMPONENT_PATTERNS:
-                if (it_old_psm_read_patterns(sigdata->pattern, f, sigdata->n_patterns, total_pattern_size, sigdata->n_pchannels, flags)) goto error_fc;
+                if (it_old_psm_read_patterns(sigdata->pattern, f, sigdata->n_patterns, total_pattern_size, sigdata->n_pchannels)) goto error_fc;
 				break;
 
 			case PSM_COMPONENT_SAMPLE_HEADERS:
@@ -641,7 +641,7 @@
 					o = dumbfile_igetw(f);
 					if (o > 0) {
 						sigdata->song_message = malloc(o + 1);
-                        if (dumbfile_getnc(sigdata->song_message, o, f) < o) goto error_fc;
+                        if (dumbfile_getnc((char *)sigdata->song_message, o, f) < o) goto error_fc;
 						sigdata->song_message[o] = 0;
 					}
 				}
@@ -680,7 +680,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "PSM (old)";
 		return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
--- a/dumb/src/it/readpsm.c
+++ b/dumb/src/it/readpsm.c
@@ -500,7 +500,7 @@
 		if (n) {
 			ptr = malloc(n);
 			if (!ptr) goto error_fc;
-			if (dumbfile_getnc(ptr, n, f) < n)
+            if (dumbfile_getnc((char *)ptr, n, f) < n)
 			{
 				free(ptr);
 				goto error_fc;
@@ -541,7 +541,7 @@
 			break;
 
 		case DUMB_ID('T','I','T','L'):
-			length = min(sizeof(sigdata->name) - 1, c->len);
+            length = min(sizeof(sigdata->name) - 1, (unsigned)c->len);
 			memcpy(sigdata->name, c->data, length);
 			sigdata->name[length] = 0;
 		}
@@ -642,7 +642,7 @@
 		found != 940903 &&
 		found != 940914 &&
 		found != 941213 &&
-		found != 800211)   /* WTF?
+        found != 800211)    WTF?
 		goto error_sc;
 	*/
 
@@ -986,6 +986,7 @@
 	return 0;
 }
 
+/*
 static int it_optimize_compare(const void *e1, const void *e2) {
 	if (((const IT_ENTRY *)e1)->channel < ((const IT_ENTRY *)e2)->channel)
 		return -1;
@@ -995,6 +996,7 @@
 
 	return 0;
 }
+*/
 
 static int it_entry_compare(const IT_ENTRY * e1, const IT_ENTRY * e2) {
 	if (IT_IS_END_ROW(e1) && IT_IS_END_ROW(e2)) return 1;
@@ -1080,7 +1082,7 @@
 static void dumb_it_optimize_orders(DUMB_IT_SIGDATA * sigdata) {
 	int n, o, p;
 
-	int last_invalid = (sigdata->flags & IT_WAS_AN_XM) ? 255 : 253;
+    /*int last_invalid = (sigdata->flags & IT_WAS_AN_XM) ? 255 : 253;*/
 
 	unsigned char * order_list;
 	int n_patterns;
@@ -1208,7 +1210,7 @@
 /* Eww */
 int pattcmp( const unsigned char * a, const unsigned char * b, size_t l )
 {
-	int i, j, na, nb;
+    size_t i, j, na, nb;
 	char * p;
 
 	i = memcmp( a, b, l );
@@ -1266,7 +1268,7 @@
 		char version[16];
 		const char *tag[3][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "PSM";
 		if ( ver )
--- a/dumb/src/it/readptm.c
+++ b/dumb/src/it/readptm.c
@@ -32,7 +32,7 @@
 
 	flags = dumbfile_getc(f);
 
-	dumbfile_getnc(sample->filename, 12, f);
+    dumbfile_getnc((char *)sample->filename, 12, f);
 	sample->filename[12] = 0;
 
 	sample->default_volume = dumbfile_getc(f);
@@ -50,7 +50,7 @@
 	/* GUSBegin, GUSLStart, GUSLEnd, GUSLoop, reserverd */
 	dumbfile_skip(f, 4+4+4+1+1);
 
-	dumbfile_getnc(sample->name, 28, f);
+    dumbfile_getnc((char *)sample->name, 28, f);
 	sample->name[28] = 0;
 
 	/*
@@ -178,7 +178,7 @@
 		pattern->n_entries++;
 		if (b) {
 			if (buflen + used[b] >= 65536) return -1;
-			dumbfile_getnc(buffer + buflen, used[b], f);
+            dumbfile_getnc((char *)buffer + buflen, used[b], f);
 			buflen += used[b];
 		} else {
 			/* End of row */
@@ -334,7 +334,7 @@
 	if (!sigdata) return NULL;
 
 	/* Skip song name. */
-	dumbfile_getnc(sigdata->name, 28, f);
+    dumbfile_getnc((char *)sigdata->name, 28, f);
 	sigdata->name[28] = 0;
 
 	if (dumbfile_getc(f) != 0x1A || dumbfile_igetw(f) != 0x203) {
@@ -429,7 +429,7 @@
 	}
 
 	/* Orders, byte each, length = sigdata->n_orders (should be even) */
-	dumbfile_getnc(sigdata->order, sigdata->n_orders, f);
+    dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
 	sigdata->restart_position = 0;
 
 	component = malloc(768*sizeof(*component));
@@ -529,12 +529,6 @@
 	return sigdata;
 }
 
-static char hexdigit(int in)
-{
-	if (in < 10) return in + '0';
-	else return in + 'A' - 10;
-}
-
 DUH *dumb_read_ptm_quick(DUMBFILE *f)
 {
 	sigdata_t *sigdata;
@@ -549,7 +543,7 @@
 	{
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "PTM";
 		return make_duh(-1, 2, (const char *const (*)[2])tag, 1, &descptr, &sigdata);
--- a/dumb/src/it/reads3m.c
+++ b/dumb/src/it/reads3m.c
@@ -31,13 +31,13 @@
 
 	type = dumbfile_getc(f);
 
-	dumbfile_getnc(sample->filename, 12, f);
+    dumbfile_getnc((char *)sample->filename, 12, f);
 	sample->filename[12] = 0;
 
 	if (type > 1) {
 		/** WARNING: no adlib support */
 		dumbfile_skip(f, 3 + 12 + 1 + 1 + 2 + 2 + 2 + 12);
-		dumbfile_getnc(sample->name, 28, f);
+        dumbfile_getnc((char *)sample->name, 28, f);
 		sample->name[28] = 0;
 		dumbfile_skip(f, 4);
 		sample->flags &= ~IT_SAMPLE_EXISTS;
@@ -72,7 +72,7 @@
 	/* Skip four unused bytes and three internal variables. */
 	dumbfile_skip(f, 4+2+2+4);
 
-	dumbfile_getnc(sample->name, 28, f);
+    dumbfile_getnc((char *)sample->name, 28, f);
 	sample->name[28] = 0;
 
 	if (type == 0 || sample->length <= 0) {
@@ -253,7 +253,7 @@
 		if (b) {
 			if (buflen + used[b] >= 65536) return -1;
 			if (buflen + used[b] <= length)
-				dumbfile_getnc(buffer + buflen, used[b], f);
+                dumbfile_getnc((char *)buffer + buflen, used[b], f);
 			else
 				memset(buffer + buflen, 0, used[b]);
 			buflen += used[b];
@@ -453,7 +453,7 @@
 	sigdata = malloc(sizeof(*sigdata));
 	if (!sigdata) return NULL;
 
-	dumbfile_getnc(sigdata->name, 28, f);
+    dumbfile_getnc((char *)sigdata->name, 28, f);
 	sigdata->name[28] = 0;
 
 	n = dumbfile_getc(f);
@@ -573,7 +573,7 @@
 	}
 
 	/* Orders, byte each, length = sigdata->n_orders (should be even) */
-	dumbfile_getnc(sigdata->order, sigdata->n_orders, f);
+    dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
 	sigdata->restart_position = 0;
 
 	component = malloc(768*sizeof(*component));
@@ -749,7 +749,7 @@
 		char version[8];
 		const char *tag[3][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		tag[1][1] = "S3M";
 		tag[2][0] = "TRACKERVERSION";
--- a/dumb/src/it/readstm.c
+++ b/dumb/src/it/readstm.c
@@ -33,7 +33,7 @@
 
 static int it_stm_read_sample_header( IT_SAMPLE *sample, DUMBFILE *f, unsigned short *offset )
 {
-	dumbfile_getnc( sample->filename, 12, f );
+    dumbfile_getnc( (char *) sample->filename, 12, f );
 	sample->filename[12] = 0;
 
 	memcpy( sample->name, sample->filename, 13 );
@@ -105,7 +105,7 @@
 
 	pattern->n_rows = 64;
 
-	if ( dumbfile_getnc( buffer, 64 * 4 * 4, f ) != 64 * 4 * 4 )
+    if ( dumbfile_getnc( (char *) buffer, 64 * 4 * 4, f ) != 64 * 4 * 4 )
 		return -1;
 
 	pattern->n_entries = 64;
@@ -198,7 +198,7 @@
 	if (!sigdata) return NULL;
 
 	/* Skip song name. */
-	dumbfile_getnc(sigdata->name, 20, f);
+    dumbfile_getnc((char *)sigdata->name, 20, f);
 	sigdata->name[20] = 0;
 
 	dumbfile_getnc(tracker_name, 8, f);
@@ -294,7 +294,7 @@
 	}
 
 	/* Orders, byte each, length = sigdata->n_orders (should be even) */
-	dumbfile_getnc( sigdata->order, *version >= 0x200 ? 128 : 64, f );
+    dumbfile_getnc( (char *) sigdata->order, *version >= 0x200 ? 128 : 64, f );
 	if (*version < 0x200) memset( sigdata->order + 64, 0xFF, 64 );
 	sigdata->restart_position = 0;
 
@@ -364,7 +364,7 @@
 		char version[16];
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		version[0] = 'S';
 		version[1] = 'T';
--- a/dumb/src/it/readxm.c
+++ b/dumb/src/it/readxm.c
@@ -221,7 +221,7 @@
 		return -1;
 	}
 
-	if (dumbfile_getnc(buffer, size, f) < size)
+    if (dumbfile_getnc((char *)buffer, size, f) < size)
 		return -1;
 
 	/* compute number of entries */
@@ -386,7 +386,7 @@
 			memset( buffered + lx->allocated, 0, n - lx->allocated );
 			lx->allocated = n;
 		}
-		if ( dumbfile_getnc( lx->buffered, n, lx->remaining ) < n ) return -1;
+        if ( dumbfile_getnc( (char *)lx->buffered, n, lx->remaining ) < n ) return -1;
 	} else if (!n) {
 		if ( lx->buffered ) free( lx->buffered );
 		lx->buffered = NULL;
@@ -457,6 +457,8 @@
 /* These two can be stubs since this implementation doesn't use seeking */
 static int limit_xm_seek(void *f, long n)
 {
+    (void)f;
+    (void)n;
     return 1;
 }
 
@@ -464,6 +466,7 @@
 
 static long limit_xm_get_size(void *f)
 {
+    (void)f;
     return 0;
 }
 
@@ -517,9 +520,9 @@
 
 	if ( limit_xm_resize( f, size - 4 ) < 0 ) return -1;
 
-	dumbfile_getnc(instrument->name, 22, f);
+    dumbfile_getnc((char *)instrument->name, 22, f);
 	instrument->name[22] = 0;
-	trim_whitespace(instrument->name, 22);
+    trim_whitespace((char *)instrument->name, 22);
 	instrument->filename[0] = 0;
 	dumbfile_skip(f, 1);  /* Instrument type. Should be 0, but seems random. */
 	extra->n_samples = dumbfile_igetw(f);
@@ -675,12 +678,11 @@
 	sample->default_pan    = dumbfile_getc(f); /* 0-255 */
 	relative_note_number   = (signed char)dumbfile_getc(f);
 
-	/*dumbfile_skip(f, 1);  /* reserved */
 	reserved = dumbfile_getc(f);
 
-	dumbfile_getnc(sample->name, 22, f);
+    dumbfile_getnc((char *)sample->name, 22, f);
 	sample->name[22] = 0;
-	trim_whitespace(sample->name, 22);
+    trim_whitespace((char *)sample->name, 22);
 
 	sample->filename[0] = 0;
 
@@ -841,12 +843,12 @@
 		return NULL;
 
 	/* song name */
-	if (dumbfile_getnc(sigdata->name, 20, f) < 20) {
+    if (dumbfile_getnc((char *)sigdata->name, 20, f) < 20) {
 		free(sigdata);
 		return NULL;
 	}
 	sigdata->name[20] = 0;
-	trim_whitespace(sigdata->name, 20);
+    trim_whitespace((char *)sigdata->name, 20);
 
 	if (dumbfile_getc(f) != 0x1A) {
 		TRACE("XM error: 0x1A not found\n");
@@ -919,7 +921,7 @@
 		_dumb_it_unload_sigdata(sigdata);
 		return NULL;
 	}
-	dumbfile_getnc(sigdata->order, sigdata->n_orders, f);
+    dumbfile_getnc((char *)sigdata->order, sigdata->n_orders, f);
 	dumbfile_skip(f, i - sigdata->n_orders);
 
 	if (dumbfile_error(f)) {
@@ -1405,7 +1407,7 @@
 		char version[16];
 		const char *tag[2][2];
 		tag[0][0] = "TITLE";
-		tag[0][1] = ((DUMB_IT_SIGDATA *)sigdata)->name;
+        tag[0][1] = (const char *)(((DUMB_IT_SIGDATA *)sigdata)->name);
 		tag[1][0] = "FORMAT";
 		version[0] = 'X';
 		version[1] = 'M';