Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.

Commit 532ac6a

Browse files
committed
Updates after feedback #1
1 parent 96d1358 commit 532ac6a

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

engine/src/fieldhtml.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,22 +1854,23 @@ static void import_html_parse_paragraph_attrs(import_html_tag_t& p_tag, MCFieldP
18541854
r_style . space_below = atoi(t_value);
18551855
break;
18561856
case kImportHtmlAttrTabStops:
1857+
{
18571858
if (r_style . has_tabs)
18581859
{
18591860
delete r_style . tabs;
18601861
r_style . tabs = nil;
18611862
r_style . has_tabs = false;
18621863
}
1863-
MCStringRef t_value_str;
1864-
/* UNCHECKED */ MCStringCreateWithCString(t_value, t_value_str);
1865-
if (MCField::parsetabstops(P_TAB_STOPS, t_value_str, r_style . tabs, r_style . tab_count))
1864+
MCAutoStringRef t_value_str;
1865+
/* UNCHECKED */ MCStringCreateWithCString(t_value, &t_value_str);
1866+
if (MCField::parsetabstops(P_TAB_STOPS, *t_value_str, r_style . tabs, r_style . tab_count))
18661867
{
18671868
r_style . has_tabs = true;
1868-
MCValueRelease(t_value_str);
18691869
}
1870+
}
18701871
break;
18711872
case kImportHtmlAttrBgColor:
1872-
{
1873+
{
18731874
MCAutoStringRef t_value_str;
18741875
/* UNCHECKED */ MCStringCreateWithCString(t_value, &t_value_str);
18751876
MCColor t_color;
@@ -1879,15 +1880,15 @@ static void import_html_parse_paragraph_attrs(import_html_tag_t& p_tag, MCFieldP
18791880
r_style . has_background_color = true;
18801881
r_style . background_color = t_color . pixel;
18811882
}
1882-
}
1883+
}
18831884
break;
18841885
case kImportHtmlAttrBorderWidth:
1886+
18851887
r_style . has_border_width = true;
18861888
r_style . border_width = atoi(t_value);
1887-
18881889
break;
18891890
case kImportHtmlAttrBorderColor:
1890-
{
1891+
{
18911892
MCAutoStringRef t_value_str;
18921893
/* UNCHECKED */ MCStringCreateWithCString(t_value, &t_value_str);
18931894
MCColor t_color;
@@ -1897,7 +1898,7 @@ static void import_html_parse_paragraph_attrs(import_html_tag_t& p_tag, MCFieldP
18971898
r_style . has_border_color = true;
18981899
r_style . border_color = t_color . pixel;
18991900
}
1900-
}
1901+
}
19011902
break;
19021903
case kImportHtmlAttrPadding:
19031904
r_style . has_padding = true;

engine/src/stack2.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,11 +2538,14 @@ void MCStack::getstackfiles(MCExecPoint &ep)
25382538
}
25392539
}
25402540

2541-
void MCStack::stringtostackfiles(MCStringRef d, MCStackfile **sf, uint2 &nf)
2541+
void MCStack::stringtostackfiles(MCStringRef d_strref, MCStackfile **sf, uint2 &nf)
25422542
{
25432543
MCStackfile *newsf = NULL;
25442544
uint2 nnewsf = 0;
2545-
char *eptr = strdup(MCStringGetCString(d));
2545+
// This ensures the coy is freed when the method ends
2546+
MCAutoPointer<char> d;
2547+
/* UNCHECKED */ d = strdup(MCStringGetCString(d_strref));
2548+
char *eptr = *d;
25462549
while ((eptr = strtok(eptr, "\n")) != NULL)
25472550
{
25482551
char *cptr = strchr(eptr, ',');
@@ -2568,9 +2571,7 @@ void MCStack::setstackfiles(MCStringRef s)
25682571
MCValueRelease(stackfiles[nstackfiles].filename);
25692572
}
25702573
delete stackfiles;
2571-
MCAutoStringRef t_copy;
2572-
/* UNCHECKED */ MCStringCopy(s, &t_copy);
2573-
stringtostackfiles(*t_copy, &stackfiles, nstackfiles);
2574+
stringtostackfiles(s, &stackfiles, nstackfiles);
25742575
}
25752576

25762577
char *MCStack::getstackfile(const MCString &s)

0 commit comments

Comments
 (0)