diff --git a/src/audio/alhelpers.c b/src/audio/alhelpers.c index 31910d3f..c11bff09 100644 --- a/src/audio/alhelpers.c +++ b/src/audio/alhelpers.c @@ -28,15 +28,6 @@ * finding an appropriate buffer format, and getting readable strings for * channel configs and sample types. */ -#ifdef __APPLE__ -#import -#import -#else -#include -#include -#include -#endif - #include "common.h" #include "audio/alhelpers.h" diff --git a/src/audio/alhelpers.h b/src/audio/alhelpers.h index 665715c7..e8fffb00 100644 --- a/src/audio/alhelpers.h +++ b/src/audio/alhelpers.h @@ -1,6 +1,15 @@ #ifndef ALHELPERS_H #define ALHELPERS_H +#ifdef __APPLE__ +# import +# import +#else +# include +# include +# include +#endif + #ifndef _WIN32 #include #else diff --git a/src/audio/speaker.c b/src/audio/speaker.c index f181ff9c..564b11ae 100644 --- a/src/audio/speaker.c +++ b/src/audio/speaker.c @@ -193,7 +193,7 @@ static void _speaker_update(/*bool toggled*/) { if (UNLIKELY(samples_buffer_idx > channelsSampleRateHz)) { ////assert(samples_buffer_idx == channelsSampleRateHz && "should be at exactly the end, no further"); if (UNLIKELY(samples_buffer_idx > channelsSampleRateHz)) { - ERRLOG("OOPS, possible overflow in speaker samples buffer ... samples_buffer_idx:%lu channelsSampleRateHz:%lu", samples_buffer_idx, channelsSampleRateHz); + ERRLOG("OOPS, possible overflow in speaker samples buffer ... samples_buffer_idx:%lu channelsSampleRateHz:%lu", (unsigned long)samples_buffer_idx, channelsSampleRateHz); } } } diff --git a/src/disk.c b/src/disk.c index bda16996..a0db1c5a 100644 --- a/src/disk.c +++ b/src/disk.c @@ -969,7 +969,7 @@ bool disk6_saveState(StateHelper_s *helper) { break; } - if (!helper->save(fd, disk6.disk[i].file_name, namelen)) { + if (!helper->save(fd, (const uint8_t *)disk6.disk[i].file_name, namelen)) { break; } @@ -1081,7 +1081,7 @@ bool disk6_loadState(StateHelper_s *helper) { if (namelen) { unsigned long gzlen = (_GZLEN+1); char *namebuf = MALLOC(namelen+gzlen+1); - if (!helper->load(fd, namebuf, namelen)) { + if (!helper->load(fd, (uint8_t *)namebuf, namelen)) { FREE(namebuf); break; } diff --git a/src/display.c b/src/display.c index 43f94fb5..6f4ea406 100644 --- a/src/display.c +++ b/src/display.c @@ -1090,7 +1090,7 @@ const uint8_t * const video_current_framebuffer(void) { } void video_clear(void) { - uint8_t *current_fb = video_current_framebuffer(); + uint8_t *current_fb = (uint8_t *)video_current_framebuffer(); memset(current_fb, 0x0, sizeof(uint8_t)*SCANWIDTH*SCANHEIGHT); video_setDirty(); } diff --git a/src/interface.c b/src/interface.c index 3c94d57c..ca094bd0 100644 --- a/src/interface.c +++ b/src/interface.c @@ -558,11 +558,9 @@ void c_interface_select_diskette( int drive ) } else if ((ch == 13) || (toupper(ch) == 'W')) { - if (disk_path) { - size_t pathlen = strlen(disk_path); - if (pathlen && disk_path[pathlen-1] == '/') { - disk_path[pathlen-1] = '\0'; - } + size_t pathlen = strlen(disk_path); + if (pathlen && disk_path[pathlen-1] == '/') { + disk_path[pathlen-1] = '\0'; } snprintf(temp, PATH_MAX, "%s/%s", diff --git a/src/meta/debugger.c b/src/meta/debugger.c index 1b70c04c..1b11090f 100644 --- a/src/meta/debugger.c +++ b/src/meta/debugger.c @@ -1125,7 +1125,6 @@ static int begin_cpu_stepping() { // kludgey set max CPU speed... double saved_scale = cpu_scale_factor; double saved_altscale = cpu_altscale_factor; - bool saved_fullspeed = is_fullspeed; cpu_scale_factor = CPU_SCALE_FASTEST; cpu_altscale_factor = CPU_SCALE_FASTEST; timing_initialize(); diff --git a/src/misc.c b/src/misc.c index 6963d9b8..8fa9727f 100644 --- a/src/misc.c +++ b/src/misc.c @@ -85,7 +85,7 @@ bool emulator_saveState(const char * const path) { assert(fd != 0 && "crazy platform"); // save header - if (!_save_state(fd, SAVE_MAGICK, SAVE_MAGICK_LEN)) { + if (!_save_state(fd, (const uint8_t *)SAVE_MAGICK, SAVE_MAGICK_LEN)) { break; } diff --git a/src/timing.c b/src/timing.c index 0a5b3532..e3dd56d6 100644 --- a/src/timing.c +++ b/src/timing.c @@ -78,7 +78,7 @@ static bool emul_resume_audio = false; #endif static bool cpu_shutting_down = false; pthread_t cpu_thread_id = 0; -pthread_mutex_t interface_mutex = { 0 }; +pthread_mutex_t interface_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t dbg_thread_cond = PTHREAD_COND_INITIALIZER; pthread_cond_t cpu_thread_cond = PTHREAD_COND_INITIALIZER; @@ -266,12 +266,13 @@ static void *cpu_thread(void *dummyptr) { LOG("cpu_thread : initialized..."); - struct timespec deltat; + struct timespec deltat = { 0 }; #if !MOBILE_DEVICE - struct timespec disk_motor_time; + struct timespec disk_motor_time = { 0 }; #endif - struct timespec t0; // the target timer - struct timespec ti, tj; // actual time samples + struct timespec t0 = { 0 }; // the target timer + struct timespec ti = { 0 }; // actual before time sample + struct timespec tj = { 0 }; // actual after time sample bool negative = false; long drift_adj_nsecs = 0; // generic drift adjustment between target and actual diff --git a/src/video/glalert.c b/src/video/glalert.c index cdf1a504..c90708e0 100644 --- a/src/video/glalert.c +++ b/src/video/glalert.c @@ -17,7 +17,7 @@ #define MODEL_DEPTH -0.0625 static bool isEnabled = true; -static pthread_mutex_t messageMutex = { 0 }; +static pthread_mutex_t messageMutex = PTHREAD_MUTEX_INITIALIZER; static char *nextMessage = NULL; static unsigned int nextMessageCols = 0; static unsigned int nextMessageRows = 0; diff --git a/src/video/glvideo.c b/src/video/glvideo.c index fc12a83c..fa6f2cf7 100644 --- a/src/video/glvideo.c +++ b/src/video/glvideo.c @@ -33,7 +33,7 @@ GLuint mainShaderProgram = UNINITIALIZED_GL; bool hackAroundBrokenAdreno200 = false; bool hackAroundBrokenAdreno205 = false; -extern GLfloat mvpIdentity[16] = { 0 }; +GLfloat mvpIdentity[16] = { 0 }; static GLint uniformMVPIdx = UNINITIALIZED_GL; static GLModel *crtModel = NULL; diff --git a/src/video_util/modelUtil.h b/src/video_util/modelUtil.h index 2d745eea..0a9af0b5 100644 --- a/src/video_util/modelUtil.h +++ b/src/video_util/modelUtil.h @@ -24,7 +24,7 @@ enum { #endif }; -typedef struct GLModel; +struct GLModel; #define MODEL_CLASS(CLS, ...) \ typedef struct CLS { \ @@ -82,7 +82,6 @@ typedef struct GLModel { GLuint elementBufferName; // Custom -#warning FIXME TODO : investigate whether we can just MACRO-inherit from GLModel rather than use custom pointer GLCustom *custom; } GLModel;