From aa4d68760bd44d688f668f528874b7ef1ade23a6 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 4 Aug 2017 23:53:38 +0200 Subject: [PATCH] Buildfixes --- deps/ibxm/ibxm.c | 66 ++++++++++++++--------------- deps/ibxm/ibxm.h | 2 +- libretro-common/audio/audio_mixer.c | 1 + 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/deps/ibxm/ibxm.c b/deps/ibxm/ibxm.c index b7c1786e4a..6dff819bd9 100644 --- a/deps/ibxm/ibxm.c +++ b/deps/ibxm/ibxm.c @@ -215,7 +215,7 @@ static void sample_ping_pong( struct sample *sample ) { int loop_length = sample->loop_length; int loop_end = loop_start + loop_length; 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 ) { memcpy( new_data, sample_data, loop_end * sizeof( short ) ); 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; struct instrument *instrument; struct sample *sample; - struct module *module = calloc( 1, sizeof( struct module ) ); + struct module *module = (struct module*)calloc( 1, sizeof( struct module ) ); if( module ) { if( data_u16le( data, 58 ) != 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->c2_rate = 8363; 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 ) { dispose_module( module ); 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++ ) { 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 ) { dispose_module( module ); return NULL; @@ -304,7 +304,7 @@ static struct module* module_load_xm( struct data *data, char *message ) { entry = data_u8( data, 80 + idx ); 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 ) { dispose_module( module ); return NULL; @@ -323,7 +323,7 @@ static struct module* module_load_xm( struct data *data, char *message ) { offset += data_u32le( data, offset ); next_offset = offset + pat_data_len; num_notes = num_rows * module->num_channels; - pattern_data = calloc( num_notes, 5 ); + pattern_data = (char*)calloc( num_notes, 5 ); if( !pattern_data ) { dispose_module( module ); return NULL; @@ -357,13 +357,13 @@ static struct module* module_load_xm( struct data *data, char *message ) { } 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 ) { dispose_module( module ); return NULL; } instrument = &module->instruments[ 0 ]; - instrument->samples = calloc( 1, sizeof( struct sample ) ); + instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) ); if( !instrument->samples ) { dispose_module( module ); 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 ); num_samples = data_u16le( data, offset + 27 ); 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 ) { dispose_module( module ); 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_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( sixteen_bit ) { 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; struct instrument *instrument; struct sample *sample; - struct module *module = calloc( 1, sizeof( struct module ) ); + struct module *module = (struct module*)calloc( 1, sizeof( struct module ) ); if( module ) { data_ascii( data, 0, 28, module->name ); 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++; } } - module->sequence = calloc( module->sequence_len, sizeof( unsigned char ) ); + module->sequence = (unsigned char*)calloc( module->sequence_len, sizeof( unsigned char ) ); if( !module->sequence ){ dispose_module( module ); 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_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 ) { dispose_module( module ); return NULL; } instrument = &module->instruments[ 0 ]; instrument->num_samples = 1; - instrument->samples = calloc( 1, sizeof( struct sample ) ); + instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) ); if( !instrument->samples ) { dispose_module( module ); 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++ ) { instrument = &module->instruments[ ins ]; instrument->num_samples = 1; - instrument->samples = calloc( 1, sizeof( struct sample ) ); + instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) ); if( !instrument->samples ) { dispose_module( module ); 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; sample->rel_note = tune >> FP_SHIFT; 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( sixteen_bit ) { 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 ) { dispose_module( module ); 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++ ) { module->patterns[ idx ].num_channels = module->num_channels; 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 ) { dispose_module( module ); return NULL; @@ -659,7 +659,7 @@ static struct module* module_load_s3m( struct data *data, char *message ) { } 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 ) { for( chan = 0; chan < 32; chan++ ) { if( channel_map[ chan ] >= 0 ) { @@ -694,7 +694,7 @@ static struct module* module_load_mod( struct data *data, char *message ) { char *pattern_data; struct instrument *instrument; struct sample *sample; - struct module *module = calloc( 1, sizeof( struct module ) ); + struct module *module = (struct module*)calloc( 1, sizeof( struct module ) ); if( module ) { data_ascii( data, 0, 20, module->name ); 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 ) { module->restart_pos = 0; } - module->sequence = calloc( 128, sizeof( unsigned char ) ); + module->sequence = (unsigned char*)calloc( 128, sizeof( unsigned char ) ); if( !module->sequence ){ dispose_module( module ); return NULL; @@ -741,7 +741,7 @@ static struct module* module_load_mod( struct data *data, char *message ) { module->default_gvol = 64; module->default_speed = 6; 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 ) { dispose_module( module ); return NULL; @@ -753,7 +753,7 @@ static struct module* module_load_mod( struct data *data, char *message ) { } } 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 ) { dispose_module( module ); 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++ ) { module->patterns[ pat ].num_channels = module->num_channels; module->patterns[ pat ].num_rows = 64; - pattern_data = calloc( 1, pat_data_len ); + pattern_data = (char*)calloc( 1, pat_data_len ); if( !pattern_data ) { dispose_module( module ); return NULL; @@ -796,14 +796,14 @@ static struct module* module_load_mod( struct data *data, char *message ) { } } 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 ) { dispose_module( module ); return NULL; } instrument = &module->instruments[ 0 ]; instrument->num_samples = 1; - instrument->samples = calloc( 1, sizeof( struct sample ) ); + instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) ); if( !instrument->samples ) { dispose_module( module ); 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++ ) { instrument = &module->instruments[ ins ]; instrument->num_samples = 1; - instrument->samples = calloc( 1, sizeof( struct sample ) ); + instrument->samples = (struct sample*)calloc( 1, sizeof( struct sample ) ); if( !instrument->samples ) { dispose_module( module ); return NULL; @@ -836,7 +836,7 @@ static struct module* module_load_mod( struct data *data, char *message ) { } sample->loop_start = loop_start; 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 ) { data_sam_s8( data, module_data_idx, sample_length, sample->data ); 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 ); } - replay->play_count = calloc( module->sequence_len, sizeof( char * ) ); + replay->play_count = (char**)calloc( module->sequence_len, sizeof( char * ) ); 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 ); } 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. */ 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 ) { replay->module = module; replay->sample_rate = sample_rate; replay->interpolation = interpolation; - replay->ramp_buf = calloc( 128, sizeof( int ) ); - replay->channels = calloc( module->num_channels, sizeof( struct channel ) ); + replay->ramp_buf = (int*)calloc( 128, sizeof( int ) ); + replay->channels = (struct channel*)calloc( module->num_channels, sizeof( struct channel ) ); if( replay->ramp_buf && replay->channels ) { replay_set_sequence_pos( replay, 0 ); } else { diff --git a/deps/ibxm/ibxm.h b/deps/ibxm/ibxm.h index 980403b39f..0949b2c6ca 100644 --- a/deps/ibxm/ibxm.h +++ b/deps/ibxm/ibxm.h @@ -4,7 +4,7 @@ #ifndef __IBXM_H__ #define __IBXM_H__ -const char *IBXM_VERSION; +extern const char *IBXM_VERSION; struct data { char *buffer; diff --git a/libretro-common/audio/audio_mixer.c b/libretro-common/audio/audio_mixer.c index 073ba59d76..599dd13c39 100644 --- a/libretro-common/audio/audio_mixer.c +++ b/libretro-common/audio/audio_mixer.c @@ -30,6 +30,7 @@ #include #endif +#include #include #include #include