Skip to content

Commit 9aa2302

Browse files
Monte Gouldingmontegoulding
authored andcommitted
Turn on -Werror=shadow
1 parent d3e6094 commit 9aa2302

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+355
-366
lines changed

config/mac.gypi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
'-Werror=unknown-pragmas',
136136
'-Werror=missing-field-initializers',
137137
'-Werror=objc-literal-compare',
138+
'-Werror=shadow',
138139
],
139140
},
140141
},

engine/src/bitmapeffectblur.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ void MCBitmapEffectBoxBlur::CalculateRows(uint32_t p_pass)
715715
CalculateRows(p_pass - 1);
716716

717717
uint32_t *t_buff_top, *t_buff_bottom;
718-
int32_t t_nextbufferrow = t_y + t_top - 1;
718+
t_nextbufferrow = t_y + t_top - 1;
719719
while (t_nextbufferrow < 0)
720720
t_nextbufferrow += t_prev_pass->buffer_height;
721721
t_buff_top = t_prev_pass->buffer + (t_prev_pass->stride * (t_nextbufferrow % t_prev_pass->buffer_height));

engine/src/block.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,10 +1385,10 @@ void MCBlock::draw(MCDC *dc, coord_t x, coord_t lx, coord_t cx, int2 y, findex_t
13851385
if (IsMacLF() && !f->isautoarm())
13861386
{
13871387
MCPatternRef t_pattern;
1388-
int2 x, y;
1388+
int2 t_x, t_y;
13891389
MCColor fc, hc;
1390-
f->getforecolor(DI_FORE, False, True, fc, t_pattern, x, y, dc -> gettype(), f);
1391-
f->getforecolor(DI_HILITE, False, True, hc, t_pattern, x, y, dc -> gettype(), f);
1390+
f->getforecolor(DI_FORE, False, True, fc, t_pattern, t_x, t_y, dc -> gettype(), f);
1391+
f->getforecolor(DI_HILITE, False, True, hc, t_pattern, t_x, t_y, dc -> gettype(), f);
13921392
if (MCColorGetPixel(hc) == MCColorGetPixel(fc))
13931393
f->setforeground(dc, DI_BACK, False, True);
13941394
else

engine/src/bsdiff_build.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ static bool bsdiffmain(MCBsDiffInputStream *p_old_file, MCBsDiffInputStream *p_n
244244
(close(fd)==-1)) err(1,"%s",argv[1]);*/
245245
if (t_success)
246246
{
247-
uint32_t s;
248-
t_success = p_old_file -> Measure(s);
249-
oldsize = (signed)s;
247+
uint32_t t_size;
248+
t_success = p_old_file -> Measure(t_size);
249+
oldsize = (signed)t_size;
250250
}
251251
if (t_success)
252252
t_success = MCMemoryNewArray(oldsize + 1, old);
@@ -276,9 +276,9 @@ static bool bsdiffmain(MCBsDiffInputStream *p_old_file, MCBsDiffInputStream *p_n
276276
(close(fd)==-1)) err(1,"%s",argv[2]);*/
277277
if (t_success)
278278
{
279-
uint32_t s;
280-
t_success = p_new_file -> Measure(s);
281-
newsize = (signed)s;
279+
uint32_t t_size;
280+
t_success = p_new_file -> Measure(t_size);
281+
newsize = (signed)t_size;
282282
}
283283
if (t_success)
284284
t_success = MCMemoryNewArray(newsize + 1, newp);

engine/src/buttondraw.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
197197
trect = MCU_reduce_rect(trect, 1);
198198
if (state & CS_HILITED)
199199
{
200-
uint2 i;
201-
if (getcindex(DI_HILITE, i) || getpindex(DI_HILITE, i))
200+
uint2 t_index;
201+
if (getcindex(DI_HILITE, t_index) || getpindex(DI_HILITE, t_index))
202202
setforeground(dc, DI_HILITE, False, False);
203203
else
204204
dc->setforeground(dc->getgray());
@@ -445,7 +445,7 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
445445
}
446446

447447
coord_t starty = sy;
448-
uint2 i;
448+
uint2 t_line;
449449
coord_t twidth = 0;
450450

451451
dc->save();
@@ -479,11 +479,11 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
479479
}
480480

481481
uindex_t t_totallen = 0;
482-
for (i = 0 ; i < nlines ; i++)
482+
for (t_line = 0 ; t_line < nlines ; t_line++)
483483
{
484484
// Note: 'lines' is an array of strings
485485
MCValueRef lineval = nil;
486-
/* UNCHECKED */ MCArrayFetchValueAtIndex(*lines, i + 1, lineval);
486+
/* UNCHECKED */ MCArrayFetchValueAtIndex(*lines, t_line + 1, lineval);
487487
MCStringRef line = (MCStringRef)(lineval);
488488
// MM-2014-04-16: [[ Bug 11964 ]] Pass through the transform of the stack to make sure the measurment is correct for scaled text.
489489
twidth = MCFontMeasureTextFloat(m_font, line, getstack() -> getdevicetransform());
@@ -498,7 +498,7 @@ void MCButton::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool
498498
{
499499
case F_ALIGN_LEFT:
500500
case F_ALIGN_JUSTIFY:
501-
if (i == 0)
501+
if (t_line == 0)
502502
{
503503
if (indicator && !(flags & F_SHOW_ICON))
504504
{
@@ -869,7 +869,6 @@ void MCButton::drawradio(MCDC *dc, MCRectangle &srect, Boolean white)
869869
if (!(flags & F_AUTO_ARM) && MCcurtheme &&
870870
MCcurtheme->iswidgetsupported(WTHEME_TYPE_RADIOBUTTON))
871871
{
872-
MCRectangle trect;
873872
if (!IsNativeGTK())
874873
{
875874
trect.x = srect.x + leftmargin - 2;

engine/src/card.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,7 @@ Exec_stat MCCard::relayer(MCControl *optr, uint2 newlayer)
17951795
if (oldparent == this)
17961796
{
17971797
MCObjptr *newoptr = NULL;
1798-
MCObjptr *tptr = objptrs;
1798+
tptr = objptrs;
17991799
do
18001800
{
18011801
if (tptr->getref() == optr)
@@ -2812,7 +2812,7 @@ MCRectangle MCCard::computecrect()
28122812
}
28132813

28142814
void MCCard::updateselection(MCControl *cptr, const MCRectangle &oldrect,
2815-
const MCRectangle &selrect, MCRectangle &drect)
2815+
const MCRectangle &p_selrect, MCRectangle &drect)
28162816
{
28172817
// MW-2008-01-30: [[ Bug 5749 ]] Make sure we check to see if the object is
28182818
// selectable - this will recurse up the object tree as necessary.
@@ -2835,7 +2835,7 @@ void MCCard::updateselection(MCControl *cptr, const MCRectangle &oldrect,
28352835
t_group_oldrect = MCU_intersect_rect(oldrect, t_group_rect);
28362836

28372837
MCRectangle t_group_selrect;
2838-
t_group_selrect = MCU_intersect_rect(selrect, t_group_rect);
2838+
t_group_selrect = MCU_intersect_rect(p_selrect, t_group_rect);
28392839

28402840
do
28412841
{
@@ -2854,7 +2854,7 @@ void MCCard::updateselection(MCControl *cptr, const MCRectangle &oldrect,
28542854
if (MCselectintersect)
28552855
{
28562856
was = cptr->maskrect(oldrect);
2857-
is = cptr->maskrect(selrect);
2857+
is = cptr->maskrect(p_selrect);
28582858

28592859
// AL-2015-10-07:: [[ External Handles ]] If either dimension is 0,
28602860
// recheck the selection intersect
@@ -2867,13 +2867,13 @@ void MCCard::updateselection(MCControl *cptr, const MCRectangle &oldrect,
28672867
was = MCU_line_intersect_rect(oldrect, t_rect);
28682868

28692869
if (!is)
2870-
is = MCU_line_intersect_rect(selrect, t_rect);
2870+
is = MCU_line_intersect_rect(p_selrect, t_rect);
28712871
}
28722872
}
28732873
else
28742874
{
28752875
was = MCU_rect_in_rect(cptr->getrect(), oldrect);
2876-
is = MCU_rect_in_rect(cptr->getrect(), selrect);
2876+
is = MCU_rect_in_rect(cptr->getrect(), p_selrect);
28772877
}
28782878
if (is != was)
28792879
{

engine/src/cmdse.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,9 +1854,7 @@ void MCStop::exec_ctxt(MCExecContext &ctxt)
18541854
}
18551855
else if (target != NULL)
18561856
{
1857-
MCObject *optr;
1858-
uint4 parid;
1859-
if (!target->getobj(ctxt, optr, parid, True)
1857+
if (!target->getobj(ctxt, optr, parid, True)
18601858
|| optr->gettype() != CT_STACK)
18611859
{
18621860
ctxt . LegacyThrow(EE_STOP_BADTARGET);

engine/src/cmdsf.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ MCExport::~MCExport()
521521
Parse_stat MCExport::parse(MCScriptPoint &sp)
522522
{
523523
Symbol_type type;
524-
const LT *te;
524+
const LT *te = NULL;
525525

526526
initpoint(sp);
527527
if (sp.next(type) != PS_NORMAL)
@@ -565,13 +565,13 @@ Parse_stat MCExport::parse(MCScriptPoint &sp)
565565

566566
if (!t_has_rectangle || sp.skip_token(SP_FACTOR, TT_OF) == PS_NORMAL)
567567
{
568-
Symbol_type type;
569-
const LT *te = NULL;
568+
Symbol_type t_type;
569+
const LT *t_te = NULL;
570570

571571
// MW-2006-05-04: Bug 3506 - crash in specific case due to not checking result of sp.lookup
572572
// MW-2007-09-11: [[ Bug 5242 ]] - the alternate of this if used to fail if te == NULL, this
573573
// can happen though if we are looking at a variable chunk.
574-
if (sp.next(type) == PS_NORMAL && sp.lookup(SP_FACTOR, te) == PS_NORMAL && te -> type == TT_CHUNK && te -> which == CT_STACK)
574+
if (sp.next(t_type) == PS_NORMAL && sp.lookup(SP_FACTOR, t_te) == PS_NORMAL && t_te -> type == TT_CHUNK && t_te -> which == CT_STACK)
575575
{
576576
if (sp.parseexp(False, True, &exsstack) != PS_NORMAL)
577577
{
@@ -587,7 +587,7 @@ Parse_stat MCExport::parse(MCScriptPoint &sp)
587587
return PS_ERROR;
588588
}
589589
}
590-
else if (te == NULL || te -> type != TT_TO)
590+
else if (t_te == NULL || t_te -> type != TT_TO)
591591
{
592592
sp . backup();
593593
image = new MCChunk(False);
@@ -1370,7 +1370,7 @@ MCImport::~MCImport()
13701370
Parse_stat MCImport::parse(MCScriptPoint &sp)
13711371
{
13721372
Symbol_type type;
1373-
const LT *te;
1373+
const LT *te = NULL;
13741374

13751375
initpoint(sp);
13761376
if (sp.next(type) != PS_NORMAL)
@@ -1412,11 +1412,11 @@ Parse_stat MCImport::parse(MCScriptPoint &sp)
14121412

14131413
if (!t_has_rectangle || sp.skip_token(SP_FACTOR, TT_OF) == PS_NORMAL)
14141414
{
1415-
Symbol_type type;
1416-
const LT *te = NULL;
1415+
Symbol_type t_type;
1416+
const LT *t_te = NULL;
14171417

14181418
// MW-2006-03-24: Bug 3442 - crash in specific case due to not checking result of sp.lookup
1419-
if (sp.next(type) == PS_NORMAL && sp.lookup(SP_FACTOR, te) == PS_NORMAL && te -> type == TT_CHUNK && te -> which == CT_STACK)
1419+
if (sp.next(t_type) == PS_NORMAL && sp.lookup(SP_FACTOR, t_te) == PS_NORMAL && t_te -> type == TT_CHUNK && t_te -> which == CT_STACK)
14201420
{
14211421
if (sp.parseexp(False, True, &mname) != PS_NORMAL)
14221422
{

engine/src/control.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,11 +1098,11 @@ void MCControl::continuesize(int2 x, int2 y)
10981098
}
10991099
else
11001100
{
1101-
int2 newwidth;
1102-
newwidth = (int2)(newrect.height / aspect);
1101+
int2 t_newwidth;
1102+
t_newwidth = (int2)(newrect.height / aspect);
11031103
if (state & CS_SIZEL)
1104-
newrect.x += newrect.width - newwidth;
1105-
newrect.width = newwidth;
1104+
newrect.x += newrect.width - t_newwidth;
1105+
newrect.width = t_newwidth;
11061106
}
11071107
}
11081108
else if (MCmodifierstate & MS_MOD1)

engine/src/customprinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ bool MCCustomPrinterImageFromMCGImage(MCGImageRef p_image, MCCustomPrinterImage
166166
uint32_t *t_dst_row;
167167
t_dst_row = (uint32_t*)t_dst;
168168

169-
for (uint32_t i = 0; i < t_raster.width; i++)
169+
for (uint32_t j = 0; j < t_raster.width; j++)
170170
*t_dst_row++ = MCGPixelFromNative(kMCCustomPrinterImagePixelFormat, *t_src_row++);
171171

172172
t_src += t_raster.stride;

0 commit comments

Comments
 (0)