Buildfixes

This commit is contained in:
twinaphex 2017-08-04 23:53:38 +02:00
parent 34af7f301d
commit aa4d68760b
3 changed files with 35 additions and 34 deletions

66
deps/ibxm/ibxm.c vendored
View File

@ -215,7 +215,7 @@ static void sample_ping_pong( struct sample *sample ) {
int loop_length = sample->loop_length; int loop_length = sample->loop_length;
int loop_end = loop_start + loop_length; int loop_end = loop_start + loop_length;
short *sample_data = sample->data; short *sample_data = sample->data;
short *new_data = calloc( loop_end + loop_length + 1, sizeof( short ) ); short *new_data = (short*)calloc( loop_end + loop_length + 1, sizeof( short ) );
if( new_data ) { if( new_data ) {
memcpy( new_data, sample_data, loop_end * sizeof( short ) ); memcpy( new_data, sample_data, loop_end * sizeof( short ) );
for( idx = 0; idx < loop_length; idx++ ) { for( idx = 0; idx < loop_length; idx++ ) {
@ -266,7 +266,7 @@ static struct module* module_load_xm( struct data *data, char *message ) {
char ascii[ 16 ], *pattern_data; char ascii[ 16 ], *pattern_data;
struct instrument *instrument; struct instrument *instrument;
struct sample *sample; struct sample *sample;
struct module *module = calloc( 1, sizeof( struct module ) ); struct module *module = (struct module*)calloc( 1, sizeof( struct module ) );
if( module ) { if( module ) {
if( data_u16le( data, 58 ) != 0x0104 ) { if( data_u16le( data, 58 ) != 0x0104 ) {
strcpy( message, "XM format version must be 0x0104!" ); strcpy( message, "XM format version must be 0x0104!" );
@ -287,7 +287,7 @@ static struct module* module_load_xm( struct data *data, char *message ) {
module->default_tempo = data_u16le( data, 78 ); module->default_tempo = data_u16le( data, 78 );
module->c2_rate = 8363; module->c2_rate = 8363;
module->gain = 64; module->gain = 64;
module->default_panning = calloc( module->num_channels, sizeof( unsigned char ) ); module->default_panning = (unsigned char*)calloc( module->num_channels, sizeof( unsigned char ) );
if( !module->default_panning ) { if( !module->default_panning ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -295,7 +295,7 @@ static struct module* module_load_xm( struct data *data, char *message ) {
for( idx = 0; idx < module->num_channels; idx++ ) { for( idx = 0; idx < module->num_channels; idx++ ) {
module->default_panning[ idx ] = 128; module->default_panning[ idx ] = 128;
} }
module->sequence = calloc( module->sequence_len, sizeof( unsigned char ) ); module->sequence = (unsigned char*)calloc( module->sequence_len, sizeof( unsigned char ) );
if( !module->sequence ) { if( !module->sequence ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -304,7 +304,7 @@ static struct module* module_load_xm( struct data *data, char *message ) {
entry = data_u8( data, 80 + idx ); entry = data_u8( data, 80 + idx );
module->sequence[ idx ] = entry < module->num_patterns ? entry : 0; module->sequence[ idx ] = entry < module->num_patterns ? entry : 0;
} }
module->patterns = calloc( module->num_patterns, sizeof( struct pattern ) ); module->patterns = (struct pattern*)calloc( module->num_patterns, sizeof( struct pattern ) );
if( !module->patterns ) { if( !module->patterns ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -323,7 +323,7 @@ static struct module* module_load_xm( struct data *data, char *message ) {
offset += data_u32le( data, offset ); offset += data_u32le( data, offset );
next_offset = offset + pat_data_len; next_offset = offset + pat_data_len;
num_notes = num_rows * module->num_channels; num_notes = num_rows * module->num_channels;
pattern_data = calloc( num_notes, 5 ); pattern_data = (char*)calloc( num_notes, 5 );
if( !pattern_data ) { if( !pattern_data ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -357,13 +357,13 @@ static struct module* module_load_xm( struct data *data, char *message ) {
} }
offset = next_offset; offset = next_offset;
} }
module->instruments = calloc( module->num_instruments + 1, sizeof( struct instrument ) ); module->instruments = (struct instrument*)calloc( module->num_instruments + 1, sizeof( struct instrument ) );
if( !module->instruments ) { if( !module->instruments ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
} }
instrument = &module->instruments[ 0 ]; instrument = &module->instruments[ 0 ];
instrument->samples = calloc( 1, sizeof( struct sample ) ); instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) );
if( !instrument->samples ) { if( !instrument->samples ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -373,7 +373,7 @@ static struct module* module_load_xm( struct data *data, char *message ) {
data_ascii( data, offset + 4, 22, instrument->name ); data_ascii( data, offset + 4, 22, instrument->name );
num_samples = data_u16le( data, offset + 27 ); num_samples = data_u16le( data, offset + 27 );
instrument->num_samples = ( num_samples > 0 ) ? num_samples : 1; instrument->num_samples = ( num_samples > 0 ) ? num_samples : 1;
instrument->samples = calloc( instrument->num_samples, sizeof( struct sample ) ); instrument->samples = (struct sample*)calloc( instrument->num_samples, sizeof( struct sample ) );
if( !instrument->samples ) { if( !instrument->samples ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -451,7 +451,7 @@ static struct module* module_load_xm( struct data *data, char *message ) {
} }
sample->loop_start = sam_loop_start; sample->loop_start = sam_loop_start;
sample->loop_length = sam_loop_length; sample->loop_length = sam_loop_length;
sample->data = calloc( sam_data_samples + 1, sizeof( short ) ); sample->data = (short*)calloc( sam_data_samples + 1, sizeof( short ) );
if( sample->data ) { if( sample->data ) {
if( sixteen_bit ) { if( sixteen_bit ) {
data_sam_s16le( data, offset, sam_data_samples, sample->data ); data_sam_s16le( data, offset, sam_data_samples, sample->data );
@ -489,7 +489,7 @@ static struct module* module_load_s3m( struct data *data, char *message ) {
char *pattern_data; char *pattern_data;
struct instrument *instrument; struct instrument *instrument;
struct sample *sample; struct sample *sample;
struct module *module = calloc( 1, sizeof( struct module ) ); struct module *module = (struct module*)calloc( 1, sizeof( struct module ) );
if( module ) { if( module ) {
data_ascii( data, 0, 28, module->name ); data_ascii( data, 0, 28, module->name );
module->sequence_len = data_u16le( data, 32 ); module->sequence_len = data_u16le( data, 32 );
@ -517,7 +517,7 @@ static struct module* module_load_s3m( struct data *data, char *message ) {
channel_map[ idx ] = module->num_channels++; channel_map[ idx ] = module->num_channels++;
} }
} }
module->sequence = calloc( module->sequence_len, sizeof( unsigned char ) ); module->sequence = (unsigned char*)calloc( module->sequence_len, sizeof( unsigned char ) );
if( !module->sequence ){ if( !module->sequence ){
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -526,14 +526,14 @@ static struct module* module_load_s3m( struct data *data, char *message ) {
module->sequence[ idx ] = data_u8( data, 96 + idx ); module->sequence[ idx ] = data_u8( data, 96 + idx );
} }
module_data_idx = 96 + module->sequence_len; module_data_idx = 96 + module->sequence_len;
module->instruments = calloc( module->num_instruments + 1, sizeof( struct instrument ) ); module->instruments = (struct instrument*)calloc( module->num_instruments + 1, sizeof( struct instrument ) );
if( !module->instruments ) { if( !module->instruments ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
} }
instrument = &module->instruments[ 0 ]; instrument = &module->instruments[ 0 ];
instrument->num_samples = 1; instrument->num_samples = 1;
instrument->samples = calloc( 1, sizeof( struct sample ) ); instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) );
if( !instrument->samples ) { if( !instrument->samples ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -541,7 +541,7 @@ static struct module* module_load_s3m( struct data *data, char *message ) {
for( ins = 1; ins <= module->num_instruments; ins++ ) { for( ins = 1; ins <= module->num_instruments; ins++ ) {
instrument = &module->instruments[ ins ]; instrument = &module->instruments[ ins ];
instrument->num_samples = 1; instrument->num_samples = 1;
instrument->samples = calloc( 1, sizeof( struct sample ) ); instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) );
if( !instrument->samples ) { if( !instrument->samples ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -576,7 +576,7 @@ static struct module* module_load_s3m( struct data *data, char *message ) {
tune = ( log_2( data_u32le( data, inst_offset + 32 ) ) - log_2( module->c2_rate ) ) * 12; tune = ( log_2( data_u32le( data, inst_offset + 32 ) ) - log_2( module->c2_rate ) ) * 12;
sample->rel_note = tune >> FP_SHIFT; sample->rel_note = tune >> FP_SHIFT;
sample->fine_tune = ( tune & FP_MASK ) >> ( FP_SHIFT - 7 ); sample->fine_tune = ( tune & FP_MASK ) >> ( FP_SHIFT - 7 );
sample->data = calloc( sample_length + 1, sizeof( short ) ); sample->data = (short*)calloc( sample_length + 1, sizeof( short ) );
if( sample->data ) { if( sample->data ) {
if( sixteen_bit ) { if( sixteen_bit ) {
data_sam_s16le( data, sample_offset, sample_length, sample->data ); data_sam_s16le( data, sample_offset, sample_length, sample->data );
@ -595,7 +595,7 @@ static struct module* module_load_s3m( struct data *data, char *message ) {
} }
} }
} }
module->patterns = calloc( module->num_patterns, sizeof( struct pattern ) ); module->patterns = (struct pattern*)calloc( module->num_patterns, sizeof( struct pattern ) );
if( !module->patterns ) { if( !module->patterns ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -603,7 +603,7 @@ static struct module* module_load_s3m( struct data *data, char *message ) {
for( idx = 0; idx < module->num_patterns; idx++ ) { for( idx = 0; idx < module->num_patterns; idx++ ) {
module->patterns[ idx ].num_channels = module->num_channels; module->patterns[ idx ].num_channels = module->num_channels;
module->patterns[ idx ].num_rows = 64; module->patterns[ idx ].num_rows = 64;
pattern_data = calloc( module->num_channels * 64, 5 ); pattern_data = (char*)calloc( module->num_channels * 64, 5 );
if( !pattern_data ) { if( !pattern_data ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -659,7 +659,7 @@ static struct module* module_load_s3m( struct data *data, char *message ) {
} }
module_data_idx += 2; module_data_idx += 2;
} }
module->default_panning = calloc( module->num_channels, sizeof( unsigned char ) ); module->default_panning = (unsigned char*)calloc( module->num_channels, sizeof( unsigned char ) );
if( module->default_panning ) { if( module->default_panning ) {
for( chan = 0; chan < 32; chan++ ) { for( chan = 0; chan < 32; chan++ ) {
if( channel_map[ chan ] >= 0 ) { if( channel_map[ chan ] >= 0 ) {
@ -694,7 +694,7 @@ static struct module* module_load_mod( struct data *data, char *message ) {
char *pattern_data; char *pattern_data;
struct instrument *instrument; struct instrument *instrument;
struct sample *sample; struct sample *sample;
struct module *module = calloc( 1, sizeof( struct module ) ); struct module *module = (struct module*)calloc( 1, sizeof( struct module ) );
if( module ) { if( module ) {
data_ascii( data, 0, 20, module->name ); data_ascii( data, 0, 20, module->name );
module->sequence_len = data_u8( data, 950 ) & 0x7F; module->sequence_len = data_u8( data, 950 ) & 0x7F;
@ -702,7 +702,7 @@ static struct module* module_load_mod( struct data *data, char *message ) {
if( module->restart_pos >= module->sequence_len ) { if( module->restart_pos >= module->sequence_len ) {
module->restart_pos = 0; module->restart_pos = 0;
} }
module->sequence = calloc( 128, sizeof( unsigned char ) ); module->sequence = (unsigned char*)calloc( 128, sizeof( unsigned char ) );
if( !module->sequence ){ if( !module->sequence ){
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -741,7 +741,7 @@ static struct module* module_load_mod( struct data *data, char *message ) {
module->default_gvol = 64; module->default_gvol = 64;
module->default_speed = 6; module->default_speed = 6;
module->default_tempo = 125; module->default_tempo = 125;
module->default_panning = calloc( module->num_channels, sizeof( unsigned char ) ); module->default_panning = (unsigned char*)calloc( module->num_channels, sizeof( unsigned char ) );
if( !module->default_panning ) { if( !module->default_panning ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -753,7 +753,7 @@ static struct module* module_load_mod( struct data *data, char *message ) {
} }
} }
module_data_idx = 1084; module_data_idx = 1084;
module->patterns = calloc( module->num_patterns, sizeof( struct pattern ) ); module->patterns = (struct pattern*)calloc( module->num_patterns, sizeof( struct pattern ) );
if( !module->patterns ) { if( !module->patterns ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -762,7 +762,7 @@ static struct module* module_load_mod( struct data *data, char *message ) {
for( pat = 0; pat < module->num_patterns; pat++ ) { for( pat = 0; pat < module->num_patterns; pat++ ) {
module->patterns[ pat ].num_channels = module->num_channels; module->patterns[ pat ].num_channels = module->num_channels;
module->patterns[ pat ].num_rows = 64; module->patterns[ pat ].num_rows = 64;
pattern_data = calloc( 1, pat_data_len ); pattern_data = (char*)calloc( 1, pat_data_len );
if( !pattern_data ) { if( !pattern_data ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -796,14 +796,14 @@ static struct module* module_load_mod( struct data *data, char *message ) {
} }
} }
module->num_instruments = 31; module->num_instruments = 31;
module->instruments = calloc( module->num_instruments + 1, sizeof( struct instrument ) ); module->instruments = (struct instrument*)calloc( module->num_instruments + 1, sizeof( struct instrument ) );
if( !module->instruments ) { if( !module->instruments ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
} }
instrument = &module->instruments[ 0 ]; instrument = &module->instruments[ 0 ];
instrument->num_samples = 1; instrument->num_samples = 1;
instrument->samples = calloc( 1, sizeof( struct sample ) ); instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) );
if( !instrument->samples ) { if( !instrument->samples ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -811,7 +811,7 @@ static struct module* module_load_mod( struct data *data, char *message ) {
for( ins = 1; ins <= module->num_instruments; ins++ ) { for( ins = 1; ins <= module->num_instruments; ins++ ) {
instrument = &module->instruments[ ins ]; instrument = &module->instruments[ ins ];
instrument->num_samples = 1; instrument->num_samples = 1;
instrument->samples = calloc( 1, sizeof( struct sample ) ); instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) );
if( !instrument->samples ) { if( !instrument->samples ) {
dispose_module( module ); dispose_module( module );
return NULL; return NULL;
@ -836,7 +836,7 @@ static struct module* module_load_mod( struct data *data, char *message ) {
} }
sample->loop_start = loop_start; sample->loop_start = loop_start;
sample->loop_length = loop_length; sample->loop_length = loop_length;
sample->data = calloc( sample_length + 1, sizeof( short ) ); sample->data = (short*)calloc( sample_length + 1, sizeof( short ) );
if( sample->data ) { if( sample->data ) {
data_sam_s8( data, module_data_idx, sample_length, sample->data ); data_sam_s8( data, module_data_idx, sample_length, sample->data );
sample->data[ loop_start + loop_length ] = sample->data[ loop_start ]; sample->data[ loop_start + loop_length ] = sample->data[ loop_start ];
@ -1801,9 +1801,9 @@ void replay_set_sequence_pos( struct replay *replay, int pos ) {
free( replay->play_count[ 0 ] ); free( replay->play_count[ 0 ] );
free( replay->play_count ); free( replay->play_count );
} }
replay->play_count = calloc( module->sequence_len, sizeof( char * ) ); replay->play_count = (char**)calloc( module->sequence_len, sizeof( char * ) );
if( replay->play_count ) { if( replay->play_count ) {
replay->play_count[ 0 ] = calloc( module_init_play_count( module, NULL ), sizeof( char ) ); replay->play_count[ 0 ] = (char*)calloc( module_init_play_count( module, NULL ), sizeof( char ) );
module_init_play_count( module, replay->play_count ); module_init_play_count( module, replay->play_count );
} }
for( idx = 0; idx < module->num_channels; idx++ ) { for( idx = 0; idx < module->num_channels; idx++ ) {
@ -1826,13 +1826,13 @@ void dispose_replay( struct replay *replay ) {
/* Allocate and initialize a replay with the specified sampling rate and interpolation. */ /* Allocate and initialize a replay with the specified sampling rate and interpolation. */
struct replay* new_replay( struct module *module, int sample_rate, int interpolation ) { struct replay* new_replay( struct module *module, int sample_rate, int interpolation ) {
struct replay *replay = calloc( 1, sizeof( struct replay ) ); struct replay *replay = (struct replay*)calloc( 1, sizeof( struct replay ) );
if( replay ) { if( replay ) {
replay->module = module; replay->module = module;
replay->sample_rate = sample_rate; replay->sample_rate = sample_rate;
replay->interpolation = interpolation; replay->interpolation = interpolation;
replay->ramp_buf = calloc( 128, sizeof( int ) ); replay->ramp_buf = (int*)calloc( 128, sizeof( int ) );
replay->channels = calloc( module->num_channels, sizeof( struct channel ) ); replay->channels = (struct channel*)calloc( module->num_channels, sizeof( struct channel ) );
if( replay->ramp_buf && replay->channels ) { if( replay->ramp_buf && replay->channels ) {
replay_set_sequence_pos( replay, 0 ); replay_set_sequence_pos( replay, 0 );
} else { } else {

2
deps/ibxm/ibxm.h vendored
View File

@ -4,7 +4,7 @@
#ifndef __IBXM_H__ #ifndef __IBXM_H__
#define __IBXM_H__ #define __IBXM_H__
const char *IBXM_VERSION; extern const char *IBXM_VERSION;
struct data { struct data {
char *buffer; char *buffer;

View File

@ -30,6 +30,7 @@
#include <rthreads/rthreads.h> #include <rthreads/rthreads.h>
#endif #endif
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>