mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-06-10 03:57:28 +00:00
Fix valgrind warnings (#806)
* SDL_Event::timestamp must be initialized to zero or current time. Zero the complete struct to be safe. * Avoid ::strcpy of uninitialized WorldContainer::m_key * Initialize members to avoid uninitialized member accesses
This commit is contained in:
parent
fdbe9a8705
commit
68a6460407
@ -72,6 +72,7 @@ class LegoOmni : public MxOmni {
|
|||||||
WorldContainer()
|
WorldContainer()
|
||||||
{
|
{
|
||||||
m_id = e_undefined;
|
m_id = e_undefined;
|
||||||
|
m_key[0] = '\0';
|
||||||
m_atomId = NULL;
|
m_atomId = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ class LegoOmni : public MxOmni {
|
|||||||
quit.type = SDL_EVENT_QUIT;
|
quit.type = SDL_EVENT_QUIT;
|
||||||
quit.timestamp = SDL_GetTicksNS();
|
quit.timestamp = SDL_GetTicksNS();
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event = {};
|
||||||
event.quit = quit;
|
event.quit = quit;
|
||||||
|
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
|
|||||||
@ -130,6 +130,7 @@ LegoCarBuild::LegoCarBuild()
|
|||||||
m_destLocation = LegoGameState::e_undefined;
|
m_destLocation = LegoGameState::e_undefined;
|
||||||
m_playingActorScript = DS_NOT_A_STREAM;
|
m_playingActorScript = DS_NOT_A_STREAM;
|
||||||
m_alreadyFinished = 0;
|
m_alreadyFinished = 0;
|
||||||
|
m_lastActorScript = 0;
|
||||||
NotificationManager()->Register(this);
|
NotificationManager()->Register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -331,6 +331,8 @@ LegoAnimationManager::LegoAnimationManager()
|
|||||||
m_animState = NULL;
|
m_animState = NULL;
|
||||||
m_unk0x424 = NULL;
|
m_unk0x424 = NULL;
|
||||||
|
|
||||||
|
::memset(m_extras, 0, sizeof(m_extras));
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
NotificationManager()->Register(this);
|
NotificationManager()->Register(this);
|
||||||
|
|||||||
@ -592,7 +592,7 @@ void EnableAnimations(MxBool p_enable)
|
|||||||
// FUNCTION: LEGO1 0x1003ef40
|
// FUNCTION: LEGO1 0x1003ef40
|
||||||
void SetAppCursor(Cursor p_cursor)
|
void SetAppCursor(Cursor p_cursor)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event = {};
|
||||||
event.user.type = g_legoSdlEvents.m_windowsMessage;
|
event.user.type = g_legoSdlEvents.m_windowsMessage;
|
||||||
event.user.code = WM_ISLE_SETCURSOR;
|
event.user.code = WM_ISLE_SETCURSOR;
|
||||||
event.user.data1 = (void*) p_cursor;
|
event.user.data1 = (void*) p_cursor;
|
||||||
|
|||||||
@ -439,10 +439,11 @@ void LegoWorldPresenter::ParseExtra()
|
|||||||
extraCopy[extraLength] = '\0';
|
extraCopy[extraLength] = '\0';
|
||||||
|
|
||||||
char output[1024];
|
char output[1024];
|
||||||
|
output[0] = '\0';
|
||||||
if (KeyValueStringParse(output, g_strWORLD, extraCopy)) {
|
if (KeyValueStringParse(output, g_strWORLD, extraCopy)) {
|
||||||
char* worldKey = strtok(output, g_parseExtraTokens);
|
char* worldKey = strtok(output, g_parseExtraTokens);
|
||||||
LoadWorld(worldKey, (LegoWorld*) m_entity);
|
LoadWorld(worldKey, static_cast<LegoWorld*>(m_entity));
|
||||||
((LegoWorld*) m_entity)->SetWorldId(Lego()->GetWorldId(worldKey));
|
static_cast<LegoWorld*>(m_entity)->SetWorldId(Lego()->GetWorldId(worldKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,9 +80,9 @@ MxResult Hospital::Create(MxDSAction& p_dsAction)
|
|||||||
|
|
||||||
SetIsWorldActive(FALSE);
|
SetIsWorldActive(FALSE);
|
||||||
|
|
||||||
m_hospitalState = (HospitalState*) GameState()->GetState("HospitalState");
|
m_hospitalState = static_cast<HospitalState*>(GameState()->GetState("HospitalState"));
|
||||||
if (!m_hospitalState) {
|
if (!m_hospitalState) {
|
||||||
m_hospitalState = (HospitalState*) GameState()->CreateState("HospitalState");
|
m_hospitalState = static_cast<HospitalState*>(GameState()->CreateState("HospitalState"));
|
||||||
m_hospitalState->m_state = HospitalState::e_newState;
|
m_hospitalState->m_state = HospitalState::e_newState;
|
||||||
}
|
}
|
||||||
else if (m_hospitalState->m_state == HospitalState::e_unknown4) {
|
else if (m_hospitalState->m_state == HospitalState::e_unknown4) {
|
||||||
@ -676,6 +676,7 @@ MxBool Hospital::Escape()
|
|||||||
// FUNCTION: LEGO1 0x10076370
|
// FUNCTION: LEGO1 0x10076370
|
||||||
HospitalState::HospitalState()
|
HospitalState::HospitalState()
|
||||||
{
|
{
|
||||||
|
m_state = e_newState;
|
||||||
m_stateActor = 0;
|
m_stateActor = 0;
|
||||||
m_statePepper = 0;
|
m_statePepper = 0;
|
||||||
m_stateMama = 0;
|
m_stateMama = 0;
|
||||||
|
|||||||
@ -66,7 +66,7 @@ class MxPresenter : public MxCore {
|
|||||||
m_previousTickleStates |= 1 << (MxU8) m_currentTickleState;
|
m_previousTickleStates |= 1 << (MxU8) m_currentTickleState;
|
||||||
m_currentTickleState = p_tickleState;
|
m_currentTickleState = p_tickleState;
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event = {};
|
||||||
event.user.type = g_legoSdlEvents.m_presenterProgress;
|
event.user.type = g_legoSdlEvents.m_presenterProgress;
|
||||||
event.user.code = m_currentTickleState;
|
event.user.code = m_currentTickleState;
|
||||||
event.user.data1 = (void*) m_action;
|
event.user.data1 = (void*) m_action;
|
||||||
|
|||||||
@ -15,6 +15,8 @@ DECOMP_SIZE_ASSERT(MxDiskStreamController, 0xc8);
|
|||||||
// FUNCTION: LEGO1 0x100c7120
|
// FUNCTION: LEGO1 0x100c7120
|
||||||
MxDiskStreamController::MxDiskStreamController()
|
MxDiskStreamController::MxDiskStreamController()
|
||||||
{
|
{
|
||||||
|
m_unk0xc4 = FALSE;
|
||||||
|
m_unk0x70 = FALSE;
|
||||||
m_unk0x8c = 0;
|
m_unk0x8c = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -234,10 +234,10 @@ HRESULT FrameBufferImpl::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_palette = lpDDPalette;
|
m_palette = lpDDPalette;
|
||||||
SDL_SetSurfacePalette(m_transferBuffer->m_surface, ((DirectDrawPaletteImpl*) m_palette)->m_palette);
|
SDL_SetSurfacePalette(m_transferBuffer->m_surface, static_cast<DirectDrawPaletteImpl*>(m_palette)->m_palette);
|
||||||
|
|
||||||
if (DDRenderer) {
|
if (DDRenderer) {
|
||||||
DDRenderer->SetPalette(((DirectDrawPaletteImpl*) m_palette)->m_palette);
|
DDRenderer->SetPalette(static_cast<DirectDrawPaletteImpl*>(m_palette)->m_palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
|
|||||||
@ -84,10 +84,10 @@ class OpenGLES2Renderer : public Direct3DRMRenderer {
|
|||||||
SDL_GLContext m_context;
|
SDL_GLContext m_context;
|
||||||
float m_anisotropic;
|
float m_anisotropic;
|
||||||
GLuint m_fbo;
|
GLuint m_fbo;
|
||||||
GLuint m_colorTarget;
|
GLuint m_colorTarget = 0;
|
||||||
GLuint m_depthTarget;
|
GLuint m_depthTarget = 0;
|
||||||
GLuint m_shaderProgram;
|
GLuint m_shaderProgram = 0;
|
||||||
GLuint m_dummyTexture;
|
GLuint m_dummyTexture = 0;
|
||||||
GLint m_posLoc;
|
GLint m_posLoc;
|
||||||
GLint m_normLoc;
|
GLint m_normLoc;
|
||||||
GLint m_texLoc;
|
GLint m_texLoc;
|
||||||
|
|||||||
@ -93,13 +93,13 @@ class OpenGLES3Renderer : public Direct3DRMRenderer {
|
|||||||
SDL_GLContext m_context;
|
SDL_GLContext m_context;
|
||||||
uint32_t m_msaa;
|
uint32_t m_msaa;
|
||||||
float m_anisotropic;
|
float m_anisotropic;
|
||||||
GLuint m_fbo;
|
GLuint m_fbo = 0;
|
||||||
GLuint m_resolveFBO;
|
GLuint m_resolveFBO = 0;
|
||||||
GLuint m_colorTarget;
|
GLuint m_colorTarget = 0;
|
||||||
GLuint m_resolveColor = 0;
|
GLuint m_resolveColor = 0;
|
||||||
GLuint m_depthTarget;
|
GLuint m_depthTarget = 0;
|
||||||
GLuint m_shaderProgram;
|
GLuint m_shaderProgram = 0;
|
||||||
GLuint m_dummyTexture;
|
GLuint m_dummyTexture = 0;
|
||||||
GLint m_posLoc;
|
GLint m_posLoc;
|
||||||
GLint m_normLoc;
|
GLint m_normLoc;
|
||||||
GLint m_texLoc;
|
GLint m_texLoc;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user