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

Commit 9452084

Browse files
committed
Updates after feedback #1
1 parent b101ddc commit 9452084

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

engine/src/uidc.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,8 +1200,9 @@ void MCUIDC::siguser()
12001200
Boolean MCUIDC::lookupcolor(MCStringRef s, MCColor *color)
12011201
{
12021202
uint4 slength = MCStringGetLength(s);
1203-
char *startptr = new char[slength + 1];
1204-
char *sptr = startptr;
1203+
MCAutoPointer<char> startptr;
1204+
startptr = new char[slength + 1];
1205+
char *sptr = *startptr;
12051206
MCU_lower(sptr, MCStringGetOldString(s));
12061207
sptr[slength] = '\0';
12071208
if (*sptr == '#')
@@ -1229,10 +1230,7 @@ Boolean MCUIDC::lookupcolor(MCStringRef s, MCColor *color)
12291230
if (c >= 'a' && c <= 'f')
12301231
b |= c - ('a' - 10);
12311232
else
1232-
{
1233-
delete startptr;
12341233
return False;
1235-
}
12361234
}
12371235
}
12381236
while (*sptr != '\0');
@@ -1256,7 +1254,6 @@ Boolean MCUIDC::lookupcolor(MCStringRef s, MCColor *color)
12561254
shiftbits -= goodbits;
12571255
}
12581256
color->flags = DoRed | DoGreen | DoBlue;
1259-
delete startptr;
12601257
return True;
12611258
}
12621259
char *tptr = sptr;
@@ -1283,11 +1280,9 @@ Boolean MCUIDC::lookupcolor(MCStringRef s, MCColor *color)
12831280
color->green = (color_table[mid].green << 8) + color_table[mid].green;
12841281
color->blue = (color_table[mid].blue << 8) + color_table[mid].blue;
12851282
color->flags = DoRed | DoGreen | DoBlue;
1286-
delete startptr;
12871283
return True;
12881284
}
12891285
}
1290-
delete startptr;
12911286
return False;
12921287
}
12931288

0 commit comments

Comments
 (0)