Various fixes from Apple Clang static analyzer

This commit is contained in:
Aaron Culliney 2015-11-14 08:03:44 -08:00
parent a61fd339a6
commit 0aacdfa9e5
5 changed files with 14 additions and 11 deletions

View File

@ -992,7 +992,7 @@ static void MB_Update()
unsigned long dwCurrentPlayCursor, dwCurrentWriteCursor; unsigned long dwCurrentPlayCursor, dwCurrentWriteCursor;
#ifdef APPLE2IX #ifdef APPLE2IX
dwCurrentWriteCursor = 0; //dwCurrentWriteCursor = 0;
int hr = MockingboardVoice->GetCurrentPosition(MockingboardVoice, &dwCurrentPlayCursor); int hr = MockingboardVoice->GetCurrentPosition(MockingboardVoice, &dwCurrentPlayCursor);
#else #else
int hr = MockingboardVoice->GetCurrentPosition(&dwCurrentPlayCursor, &dwCurrentWriteCursor); int hr = MockingboardVoice->GetCurrentPosition(&dwCurrentPlayCursor, &dwCurrentWriteCursor);

View File

@ -202,7 +202,9 @@ void playq_destroyPlayQueue(INOUT PlayQueue_s **queue) {
return; return;
} }
playq_drain(*queue); if ((*queue)->Drain) {
(*queue)->Drain(*queue);
}
PQList_s *list = (PQList_s *)((*queue)->_internal); PQList_s *list = (PQList_s *)((*queue)->_internal);
if (list) { if (list) {
@ -224,7 +226,7 @@ PlayQueue_s *playq_createPlayQueue(const long *nodeIdPtr, unsigned long numBuffe
assert(numBuffers <= MAX_PLAYQ_BUFFERS); assert(numBuffers <= MAX_PLAYQ_BUFFERS);
do { do {
playq = malloc(sizeof(PlayQueue_s)); playq = calloc(1, sizeof(PlayQueue_s));
if (!playq) { if (!playq) {
ERRLOG("no memory"); ERRLOG("no memory");
break; break;

View File

@ -37,8 +37,6 @@ long audio_createSoundBuffer(INOUT AudioBuffer_s **audioBuffer) {
return -1; return -1;
} }
AudioSettings_s *settings = &audio_backend->systemSettings;
if (*audioBuffer) { if (*audioBuffer) {
audio_destroySoundBuffer(audioBuffer); audio_destroySoundBuffer(audioBuffer);
} }

View File

@ -496,7 +496,6 @@ GLUE_C_READ(disk_read_write_byte)
// TODO FIXME ... methinks we shouldn't need to reload, but : // TODO FIXME ... methinks we shouldn't need to reload, but :
// * testing shows different intermediate results (SIXBITNIBS, etc) // * testing shows different intermediate results (SIXBITNIBS, etc)
// * could be instability between the {de,}nibblize routines // * could be instability between the {de,}nibblize routines
const uintptr_t niboff = NIB_TRACK_SIZE * (disk6.disk[disk6.drive].phase >> 1);
size_t track_width = load_track_data(disk6.drive); size_t track_width = load_track_data(disk6.drive);
if (track_width != disk6.disk[disk6.drive].track_width) { if (track_width != disk6.disk[disk6.drive].track_width) {
////ERRLOG_THROTTLE("OOPS, problem loading track data"); ////ERRLOG_THROTTLE("OOPS, problem loading track data");
@ -576,15 +575,18 @@ GLUE_C_READ(disk_read_phase)
int phase = (ea>>1)&3; int phase = (ea>>1)&3;
int phase_bit = (1 << phase); int phase_bit = (1 << phase);
char *phase_str = NULL;
if (ea & 1) { if (ea & 1) {
phase_str = "on ";
stepper_phases |= phase_bit; stepper_phases |= phase_bit;
} else { } else {
phase_str = "off";
stepper_phases &= ~phase_bit; stepper_phases &= ~phase_bit;
} }
#if DISK_TRACING #if DISK_TRACING
char *phase_str = NULL;
if (ea & 1) {
phase_str = "on ";
} else {
phase_str = "off";
}
if (test_read_fp) { if (test_read_fp) {
fprintf(test_read_fp, "\ntrack %02X phases %X phase %d %s address $C0E%X\n", disk6.disk[disk6.drive].phase, stepper_phases, phase, phase_str, ea&0xF); fprintf(test_read_fp, "\ntrack %02X phases %X phase %d %s address $C0E%X\n", disk6.disk[disk6.drive].phase, stepper_phases, phase, phase_str, ea&0xF);
} }
@ -726,7 +728,8 @@ const char *disk6_eject(int drive) {
const char *err = NULL; const char *err = NULL;
if (disk6.disk[drive].fd > 0) { if (disk6.disk[drive].fd >= 0) {
assert(disk6.disk[drive].fd != 0);
disk6_flush(drive); disk6_flush(drive);
int ret = -1; int ret = -1;

View File

@ -108,7 +108,7 @@ static inline GLsizei getGLTypeSize(GLenum type) {
case GL_FLOAT: case GL_FLOAT:
return sizeof(GLfloat); return sizeof(GLfloat);
} }
return 0; return sizeof(GLvoid);
} }
#endif //__MODEL_UTIL_H__ #endif //__MODEL_UTIL_H__