Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 921cfa3

Browse files
Warning fixes - and chiefly, Mac IDE works again
1 parent c35885b commit 921cfa3

18 files changed

+75
-70
lines changed

engine/src/button.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,7 +2812,7 @@ void MCButton::resetfontindex(MCStack *oldstack)
28122812
bdata = tptr;
28132813
while (bptr != NULL)
28142814
{
2815-
MCCdata *tptr = (MCCdata *)bptr->remove(bptr);
2815+
tptr = (MCCdata *)bptr->remove(bptr);
28162816
delete tptr;
28172817
}
28182818
}
@@ -3588,9 +3588,9 @@ void MCButton::openmenu(Boolean grab)
35883588
return;
35893589
}
35903590
#endif
3591-
MCStack *sptr = menumode == WM_CASCADE ? getstack() : MCmousestackptr;
3591+
MCStack *cascade_sptr = menumode == WM_CASCADE ? getstack() : MCmousestackptr;
35923592
if (flags & F_TRAVERSAL_ON && !(state & CS_KFOCUSED)
3593-
&& sptr->getmode() < WM_PULLDOWN)
3593+
&& cascade_sptr->getmode() < WM_PULLDOWN)
35943594
{
35953595
MCmousestackptr->kfocusset(this);
35963596
if (menu == NULL && !findmenu())

engine/src/cmdsc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3787,7 +3787,7 @@ void MCSelect::compile(MCSyntaxFactoryRef ctxt)
37873787
uindex_t t_count;
37883788
t_count = 0;
37893789

3790-
for (MCChunk *chunkptr = targets; chunkptr != nil; chunkptr -> next)
3790+
for (MCChunk *chunkptr = targets; chunkptr != nil; chunkptr = chunkptr -> next)
37913791
{
37923792
chunkptr -> compile_object_ptr(ctxt);
37933793
t_count++;

engine/src/coretextfonts.cpp

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -217,19 +217,23 @@ void *coretext_font_create_with_name_size_and_style(MCStringRef p_name, uint32_t
217217
return (void *)t_font;
218218
}
219219

220-
void coretext_font_destroy(void *p_font)
220+
bool coretext_font_destroy(void *p_font)
221221
{
222222
if (p_font != NULL)
223223
CFRelease((CTFontRef) p_font);
224+
225+
return true;
224226
}
225227

226-
void coretext_font_get_metrics(void *p_font, float& r_ascent, float& r_descent)
228+
bool coretext_font_get_metrics(void *p_font, float& r_ascent, float& r_descent)
227229
{
228230
r_ascent = CTFontGetAscent((CTFontRef) p_font);
229231
r_descent = CTFontGetDescent((CTFontRef) p_font);
232+
233+
return true;
230234
}
231235

232-
void coretext_get_font_names(MCListRef &r_names)
236+
bool coretext_get_font_names(MCListRef &r_names)
233237
{
234238
CTFontCollectionRef t_fonts;
235239
t_fonts = CTFontCollectionCreateFromAvailableFonts(NULL);
@@ -241,8 +245,10 @@ void coretext_get_font_names(MCListRef &r_names)
241245
MCListCreateMutable('\n', &t_names);
242246

243247
char t_cstring_font_name[256];
248+
bool t_success;
249+
t_success = true;
244250

245-
for(CFIndex i = 0; i < CFArrayGetCount(t_descriptors); i++)
251+
for(CFIndex i = 0; t_success && i < CFArrayGetCount(t_descriptors); i++)
246252
{
247253
CTFontDescriptorRef t_font;
248254
t_font = (CTFontDescriptorRef)CFArrayGetValueAtIndex(t_descriptors, i);
@@ -252,7 +258,7 @@ void coretext_get_font_names(MCListRef &r_names)
252258

253259
if (t_font_name != NULL && CFStringGetCString(t_font_name, t_cstring_font_name, 256, kCFStringEncodingMacRoman) &&
254260
t_cstring_font_name[0] != '%' && t_cstring_font_name[0] != '.')
255-
/* UNCHECKED */ MCListAppendCString(*t_names, t_cstring_font_name);
261+
t_success = MCListAppendCString(*t_names, t_cstring_font_name);
256262

257263
if (t_font_name != NULL)
258264
CFRelease(t_font_name);
@@ -263,38 +269,46 @@ void coretext_get_font_names(MCListRef &r_names)
263269
if (t_fonts != NULL)
264270
CFRelease(t_fonts);
265271

266-
/* UNCHECKED */ MCListCopy(*t_names, r_names);
272+
if (t_success)
273+
t_success = MCListCopy(*t_names, r_names);
274+
return t_success;
267275
}
268276

269-
void core_text_get_font_styles(MCStringRef p_name, uint32_t p_size, MCListRef &r_styles)
277+
bool core_text_get_font_styles(MCStringRef p_name, uint32_t p_size, MCListRef &r_styles)
270278
{
271279
CTFontRef t_font_family;
272280
t_font_family = (CTFontRef)coretext_font_create_with_name_and_size(p_name, p_size);
273281

274282
MCAutoListRef t_styles;
275283
/* UNCHECKED */ MCListCreateMutable('\n', &t_styles);
284+
285+
bool t_success;
286+
t_success = true;
276287

277288
if (t_font_family != NULL)
278289
{
279290
CTFontSymbolicTraits t_traits;
280291
t_traits = CTFontGetSymbolicTraits(t_font_family);
281292

282-
/* UNCHECKED */ MCListAppendCString(*t_styles, "plain");
293+
t_success = MCListAppendCString(*t_styles, "plain");
283294

284-
if (t_traits & kCTFontBoldTrait)
285-
/* UNCHECKED */ MCListAppendCString(*t_styles, "bold");
295+
if (t_success && t_traits & kCTFontBoldTrait)
296+
t_success = MCListAppendCString(*t_styles, "bold");
286297

287-
if (t_traits & kCTFontItalicTrait)
288-
/* UNCHECKED */ MCListAppendCString(*t_styles, "italic");
298+
if (t_success && t_traits & kCTFontItalicTrait)
299+
t_success = MCListAppendCString(*t_styles, "italic");
289300

290-
if (t_traits & kCTFontBoldTrait && t_traits & kCTFontItalicTrait)
291-
/* UNCHECKED */ MCListAppendCString(*t_styles, "bold-italic");
301+
if (t_success && t_traits & kCTFontBoldTrait && t_traits & kCTFontItalicTrait)
302+
t_success = MCListAppendCString(*t_styles, "bold-italic");
292303
}
293304

294305
if (t_font_family != NULL)
295306
CFRelease(t_font_family);
296307

297-
/* UNCHECKED */ MCListCopy(*t_styles, r_styles);
308+
if (t_success)
309+
t_success = MCListCopy(*t_styles, r_styles);
310+
311+
return t_success;
298312
}
299313

300314
bool coretext_font_load_from_path(MCStringRef p_path, bool p_globally)

engine/src/date.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,10 +1184,6 @@ bool MCD_convert_to_datetime(MCExecContext &ctxt, MCValueRef p_input, Convert_fo
11841184

11851185
t_date_valid = false;
11861186
t_time_valid = false;
1187-
1188-
MCAutoStringRef t_string;
1189-
if (!ctxt.ConvertToString(p_input, &t_string))
1190-
return false;
11911187

11921188
uindex_t t_length;
11931189
t_length = MCStringGetLength(*t_string);

engine/src/desktop-menu.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ class MCMenuBuilderCallback: public IParseMenuCallback
354354
////////////////////////////////////////////////////////////////////////////////
355355

356356
static MCStringRef s_popup_menupick = nil;
357-
static uindex_t s_popup_menuitem = 0;
357+
static int2 s_popup_menuitem = 0;
358358

359359
void MCButton::macopenmenu(void)
360360
{
@@ -411,7 +411,7 @@ void MCButton::macopenmenu(void)
411411
Exec_stat es = message_with_valueref_args(MCM_menu_pick, s_popup_menupick);
412412

413413
MCValueRelease(s_popup_menupick);
414-
s_popup_menuitem = NULL;
414+
s_popup_menupick = nil;
415415

416416
if (es == ES_NOT_HANDLED || es == ES_PASS)
417417
message_with_args(MCM_mouse_up, menubutton);
@@ -431,7 +431,7 @@ void MCButton::macopenmenu(void)
431431
Exec_stat es = message_with_valueref_args(MCM_menu_pick, s_popup_menupick);
432432

433433
MCValueRelease(s_popup_menupick);
434-
s_popup_menuitem = NULL;
434+
s_popup_menupick = NULL;
435435

436436
if (es == ES_NOT_HANDLED || es == ES_PASS)
437437
message_with_args(MCM_mouse_up, menubutton);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ template<typename T> void SetCharPropOfCharChunkOfParagraph(MCExecContext& ctxt,
896896
if (t_blocks_changed)
897897
p_paragraph -> setDirty();
898898

899-
if (T::need_layout || t_blocks_changed)
899+
if (T::need_layout() || t_blocks_changed)
900900
p_paragraph -> layoutchanged();
901901
}
902902

@@ -1019,7 +1019,7 @@ template<typename T> void SetCharPropOfCharChunk(MCExecContext& ctxt, MCField *p
10191019
&& t_block_index + t_block_length < t_ei);
10201020

10211021
// avoid relayout for certain block attributes
1022-
t_need_layout = T::need_layout;
1022+
t_need_layout = T::need_layout();
10231023

10241024
// MP-2013-09-02: [[ FasterField ]] If attributes on existing blocks needing layout changed,
10251025
// or the blocks themselves changed, we need layout.
@@ -1190,7 +1190,7 @@ template<typename T> void SetArrayCharPropOfCharChunk(MCExecContext& ctxt, MCFie
11901190
&& t_block_index + t_block_length < t_ei);
11911191

11921192
// avoid relayout for certain block attributes
1193-
t_need_layout = T::need_layout;
1193+
t_need_layout = T::need_layout();
11941194

11951195
// MP-2013-09-02: [[ FasterField ]] If attributes on existing blocks needing layout changed,
11961196
// or the blocks themselves changed, we need layout.

engine/src/field.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,7 +2293,7 @@ void MCField::undo(Ustruct *us)
22932293
ei = si;
22942294
if (us->type == UT_DELETE_TEXT)
22952295
{
2296-
MCParagraph *pgptr = indextoparagraph(paragraphs, si, ei);
2296+
pgptr = indextoparagraph(paragraphs, si, ei);
22972297
pgptr->setselectionindex(si, si, False, False);
22982298
focusedparagraph = pgptr;
22992299
if (us->ud.text.data != NULL)
@@ -2321,7 +2321,7 @@ void MCField::undo(Ustruct *us)
23212321
}
23222322
else
23232323
{
2324-
MCParagraph *pgptr = us->ud.text.data;
2324+
pgptr = us->ud.text.data;
23252325
do
23262326
{
23272327
ei += pgptr->gettextlengthcr();
@@ -2510,7 +2510,7 @@ void MCField::resetfontindex(MCStack *oldstack)
25102510
fdata = tptr;
25112511
while (fptr != NULL)
25122512
{
2513-
MCCdata *tptr = fptr->remove(fptr);
2513+
tptr = fptr->remove(fptr);
25142514
delete tptr;
25152515
}
25162516
}
@@ -3122,8 +3122,7 @@ void MCField::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool p
31223122
frect = getfrect();
31233123
if (flags & F_SHADOW)
31243124
{
3125-
MCRectangle trect = rect;
3126-
drawshadow(dc, trect, shadowoffset);
3125+
drawshadow(dc, rect, shadowoffset);
31273126
}
31283127

31293128
if (state & CS_KFOCUSED && borderwidth != 0

engine/src/fieldf.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -450,21 +450,21 @@ void MCField::gettabaligns(intenum_t *&a, uint16_t &n)
450450

451451
void MCField::getlisttabs(int32_t& r_first, int32_t& r_second)
452452
{
453-
uint2 *tabs;
454-
uint2 ntabs;
453+
uint2 *t_tabs;
454+
uint2 t_ntabs;
455455
Boolean fixed;
456-
gettabs(tabs, ntabs, fixed);
456+
gettabs(t_tabs, t_ntabs, fixed);
457457

458458
int32_t t_first_tab, t_second_tab;
459-
if (ntabs == 1)
459+
if (t_ntabs == 1)
460460
{
461-
t_first_tab = tabs[0];
462-
t_second_tab = tabs[0] * 2;
461+
t_first_tab = t_tabs[0];
462+
t_second_tab = t_tabs[0] * 2;
463463
}
464464
else
465465
{
466-
t_first_tab = tabs[0];
467-
t_second_tab = tabs[1];
466+
t_first_tab = t_tabs[0];
467+
t_second_tab = t_tabs[1];
468468
}
469469

470470
r_first = t_first_tab;
@@ -1079,22 +1079,22 @@ void MCField::drawrect(MCDC *dc, const MCRectangle &dirty)
10791079
t_delta = getcontentx() - 1;
10801080

10811081
uint2 ct = 0;
1082-
int4 x;
1083-
x = t_delta + t[0];
1082+
int4 t_x;
1083+
t_x = t_delta + t[0];
10841084

1085-
while (x <= grect.x + grect.width)
1085+
while (t_x <= grect.x + grect.width)
10861086
{
10871087
// MW-2012-05-03: [[ Bug 10200 ]] If set at the field level, the vGrid should start
10881088
// just inside the border for backwards compatibility.
1089-
if (x >= grect.x)
1090-
dc->drawline(x, grect.y, x, grect.y + grect.height);
1089+
if (t_x >= grect.x)
1090+
dc->drawline(t_x, grect.y, t_x, grect.y + grect.height);
10911091

10921092
if (ct < nt - 1)
1093-
x = t_delta + t[++ct];
1093+
t_x = t_delta + t[++ct];
10941094
else if (nt == 1)
1095-
x += t[0];
1095+
t_x += t[0];
10961096
else
1097-
x += t[nt - 1] - t[nt - 2];
1097+
t_x += t[nt - 1] - t[nt - 2];
10981098

10991099
// MW-2012-03-19: [[ FixedTable ]] If we have reached the final tab in fixed
11001100
// table mode, we are done.

engine/src/fields.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ Exec_stat MCField::settext(uint4 parid, MCStringRef p_text, Boolean formatted)
551551
if (formatted)
552552
while (t_pos < t_text_length)
553553
{
554-
uindex_t t_pos;
555554
if (MCStringFirstIndexOfChar(p_text, '\n', t_pos, kMCStringOptionCompareExact, t_pos))
556555
{
557556
if (MCStringGetCharAtIndex(p_text, t_pos + 1) == '\n')

engine/src/globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ void X_clear_globals(void)
676676
MCscriptfont = MCValueRetain(kMCEmptyString);
677677
MCscriptsize = 0;
678678
MCscrollbarwidth = DEFAULT_SB_WIDTH;
679-
uint2 MCfocuswidth = 2;
679+
MCfocuswidth = 2;
680680
MCsizewidth = 8;
681681
MCminsize = 8;
682682
MCcloneoffset = 32;

0 commit comments

Comments
 (0)