Silence a number of spurious compiler warnings

- Existing warnings are now a good proxy for areas of code smell ;-)
This commit is contained in:
Aaron Culliney 2016-01-10 11:54:49 -08:00
parent 1dc08f4a25
commit 8626215205
12 changed files with 26 additions and 29 deletions

View File

@ -28,15 +28,6 @@
* finding an appropriate buffer format, and getting readable strings for
* channel configs and sample types. */
#ifdef __APPLE__
#import <OpenAL/al.h>
#import <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#endif
#include "common.h"
#include "audio/alhelpers.h"

View File

@ -1,6 +1,15 @@
#ifndef ALHELPERS_H
#define ALHELPERS_H
#ifdef __APPLE__
# import <OpenAL/al.h>
# import <OpenAL/alc.h>
#else
# include <AL/al.h>
# include <AL/alc.h>
# include <AL/alext.h>
#endif
#ifndef _WIN32
#include <unistd.h>
#else

View File

@ -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);
}
}
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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",

View File

@ -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();

View File

@ -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;
}

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;