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;
#ifdef APPLE2IX
dwCurrentWriteCursor = 0;
//dwCurrentWriteCursor = 0;
int hr = MockingboardVoice->GetCurrentPosition(MockingboardVoice, &dwCurrentPlayCursor);
#else
int hr = MockingboardVoice->GetCurrentPosition(&dwCurrentPlayCursor, &dwCurrentWriteCursor);

View File

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

View File

@ -37,8 +37,6 @@ long audio_createSoundBuffer(INOUT AudioBuffer_s **audioBuffer) {
return -1;
}
AudioSettings_s *settings = &audio_backend->systemSettings;
if (*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 :
// * testing shows different intermediate results (SIXBITNIBS, etc)
// * 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);
if (track_width != disk6.disk[disk6.drive].track_width) {
////ERRLOG_THROTTLE("OOPS, problem loading track data");
@ -576,15 +575,18 @@ GLUE_C_READ(disk_read_phase)
int phase = (ea>>1)&3;
int phase_bit = (1 << phase);
char *phase_str = NULL;
if (ea & 1) {
phase_str = "on ";
stepper_phases |= phase_bit;
} else {
phase_str = "off";
stepper_phases &= ~phase_bit;
}
#if DISK_TRACING
char *phase_str = NULL;
if (ea & 1) {
phase_str = "on ";
} else {
phase_str = "off";
}
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);
}
@ -726,7 +728,8 @@ const char *disk6_eject(int drive) {
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);
int ret = -1;

View File

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