Skip to content

Commit 8549c03

Browse files
committed
[[ Cleanup ]] Fix maybe-uninitialized warnings in release build
1 parent 8f941d2 commit 8549c03

24 files changed

+80
-43
lines changed

engine/src/exec-engine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ static void MCEngineSplitScriptIntoMessageAndParameters(MCExecContext& ctxt, MCS
11921192
t_offset++;
11931193

11941194
MCerrorlock++;
1195-
unichar_t t_char;
1195+
unichar_t t_char = '\0';
11961196
uindex_t t_start_offset;
11971197
t_start_offset = t_offset;
11981198

engine/src/exec-extension.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ bool MCEngineAddExtensionFromModule(MCScriptModuleRef p_module)
124124
}
125125

126126
MCLoadedExtension *t_ext;
127-
/* UNCHECKED */ MCMemoryNew(t_ext);
127+
if (!MCMemoryNew(t_ext))
128+
{
129+
return false;
130+
}
128131

129132
t_ext -> module_name = MCValueRetain(MCScriptGetNameOfModule(p_module));
130133
t_ext -> module = MCScriptRetainModule(p_module);

engine/src/exec-files.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ void MCFilesExecPerformReadUnicodeFor(MCExecContext& ctxt, IO_handle p_stream, i
15461546

15471547
while (t_progress < p_count)
15481548
{
1549-
uint4 t_new_boundary;
1549+
uint4 t_new_boundary = 0;
15501550
// SN-2014-06-18 [[ Bug 12538 ]] Read from process until empty
15511551
// We need to allow a reading to return nothing, without being stuck in a waiting loop for data
15521552
if (!MCFilesExecPerformReadChunk(ctxt, p_index, p_encoding, false, p_unit_type, t_last_char_boundary, t_duration, p_stream, *t_output, t_new_boundary,t_stat))
@@ -1606,7 +1606,7 @@ void MCFilesExecPerformReadTextUntil(MCExecContext& ctxt, IO_handle p_stream, in
16061606

16071607
while (p_count)
16081608
{
1609-
uint4 t_new_char_boundary;
1609+
uint4 t_new_char_boundary = 0;
16101610
if (!MCFilesExecPerformReadChunk(ctxt, p_index, p_encoding, t_empty_allowed, FU_CODEPOINT, t_last_char_boundary, t_duration, p_stream, *t_output, t_new_char_boundary, t_stat))
16111611
// error occurred while reading a codepoint
16121612
break;

engine/src/exec-filters.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,8 +842,10 @@ void MCFiltersEvalBinaryEncode(MCExecContext& ctxt, MCStringRef p_format, MCValu
842842
MCAutoStringRefAsNativeChars t_auto_native;
843843
const char_t* t_native;
844844
uindex_t t_length;
845-
/* UNCHECKED */ t_auto_native . Lock(*t_string, t_native, t_length);
846-
845+
t_success = t_auto_native . Lock(*t_string, t_native, t_length);
846+
if (!t_success)
847+
break;
848+
847849
switch (cmd)
848850
{
849851
case 'a':

engine/src/exec-interface-field-chunk.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ template<typename T> void GetParagraphPropOfCharChunk(MCExecContext& ctxt, MCFie
557557
do
558558
{
559559
typename T::stack_type t_new_value;
560+
T::init(t_new_value);
560561
T::getter(ctxt, sptr, p_getter, t_new_value);
561562
if (ctxt . HasError())
562563
return;

engine/src/exec-interface2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ void MCInterfaceGetCursor(MCExecContext& ctxt, uinteger_t*& r_value)
12271227

12281228
void MCInterfaceSetCursor(MCExecContext& ctxt, uinteger_t* p_value)
12291229
{
1230-
MCCursorRef t_cursor;
1230+
MCCursorRef t_cursor = nullptr;
12311231

12321232
uinteger_t t_cursor_id;
12331233
if (p_value == NULL)
@@ -1255,7 +1255,7 @@ void MCInterfaceGetDefaultCursor(MCExecContext& ctxt, uinteger_t& r_value)
12551255

12561256
void MCInterfaceSetDefaultCursor(MCExecContext& ctxt, uinteger_t p_value)
12571257
{
1258-
MCCursorRef t_cursor;
1258+
MCCursorRef t_cursor = nullptr;
12591259
MCInterfaceSetCursor(ctxt, p_value, true, t_cursor);
12601260

12611261
// PM-2015-06-17: [[ Bug 15200 ]] Default cursor should reset when set to empty, thus t_cursor *can* be nil

engine/src/exec-strings.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,8 +1045,12 @@ void MCStringsEvalFormat(MCExecContext& ctxt, MCStringRef p_format, MCValueRef*
10451045
uindex_t t_cformat_length;
10461046
const char_t* t_cstart;
10471047

1048-
/* UNCHECKED */ MCStringCreateWithChars(t_unicode_start, format - t_start, &t_substring);
1049-
/* UNCHECKED */ t_auto_native . Lock(*t_substring, t_native_format, t_cformat_length);
1048+
if (!MCStringCreateWithChars(t_unicode_start, format - t_start, &t_substring) ||
1049+
!t_auto_native . Lock(*t_substring, t_native_format, t_cformat_length))
1050+
{
1051+
ctxt.LegacyThrow(EE_NO_MEMORY);
1052+
return;
1053+
}
10501054
t_cstart = t_native_format;
10511055

10521056
char newFormat[40];

engine/src/exec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3132,7 +3132,7 @@ void MCExecStoreProperty(MCExecContext& ctxt, const MCPropertyInfo *prop, void *
31323132
{
31333133
MCAutoStringRef t_input;
31343134
MCPoint *t_value;
3135-
uindex_t t_count;
3135+
uindex_t t_count = 0;
31363136

31373137
MCExecTypeConvertAndReleaseAlways(ctxt, p_value . type, &p_value, kMCExecValueTypeStringRef, &(&t_input));
31383138

engine/src/itransform.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ static void resize_seq_32_32( const uint1* const src_data, const int src_n, cons
116116
const real8 k = (real8)(src_n-1) / dst_n;
117117
const real8 _1_k = 1.0 / k;
118118

119-
real8 v1, v2; // current value, next value
119+
real8 v1 = 0.0; // current value,
120+
real8 v2 = 0.0; // next value
120121
real8 a, b, c, d; // polynom coefs
121-
real8 t; // polynom argument
122+
a = b = c = d = 0.0;
123+
real8 t = 0.0; // polynom argument
122124

123125
curs = src_data, curd = dst_data;
124126

engine/src/lnxdc.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,10 @@ bool MCScreenDC::device_getdisplays(bool p_effective, MCDisplay * &r_displays, u
325325

326326
// Allocate the list of monitors
327327
MCDisplay *t_displays;
328-
MCMemoryNewArray(t_monitor_count, t_displays);
328+
if (!MCMemoryNewArray(t_monitor_count, t_displays))
329+
{
330+
return false;
331+
}
329332

330333
// Get the geometry of each monitor
331334
for (gint i = 0; i < t_monitor_count; i++)

0 commit comments

Comments
 (0)