@@ -269,38 +269,33 @@ bool MCParseParameters(MCParameter*& p_parameters, const char *p_format, ...)
269269
270270bool MCSystemPick (MCStringRef p_options, bool p_use_checkmark, uint32_t p_initial_index, uint32_t & r_chosen_index, MCRectangle p_button_rect)
271271{
272- // Split the string on new lines
273- MCAutoArrayRef t_options_arrayref;
274- uindex_t noptions = 0 ;
275272 r_chosen_index = 0 ;
276273
277274 MCStringRef *t_options_array = nil;
278275 MCPickList *t_pick_list = nil;
279276
277+ MCAutoProperListRef t_options_list;
278+ uindex_t t_count = 0 ;
279+
280+ // Split the string on new lines
280281 bool t_success = true ;
281- t_success = MCStringSplit (p_options, MCSTR ( " \n " ), nil, kMCCompareExact , &t_options_arrayref );
282+ t_success = MCStringSplitByDelimiter (p_options, kMCLineEndString , kMCStringOptionCompareExact , &t_options_list );
282283
283284 if (t_success)
284285 {
285- noptions = MCArrayGetCount (*t_options_arrayref);
286+ t_count = MCProperListGetLength (*t_options_list);
287+ t_success = MCMemoryNewArray (t_count, t_options_array);
286288
287- t_success = MCMemoryNewArray (noptions, t_options_array);
288-
289- for (uindex_t i = 0 ; t_success && i < noptions ; i++)
290- {
291- // Note: 't_options' is an array of strings
292- MCValueRef t_optionval = nil;
293- t_success = MCArrayFetchValueAtIndex (*t_options_arrayref, i + 1 , t_optionval);
294- t_options_array[i] = MCValueRetain ((MCStringRef)t_optionval);
295- }
289+ for (uindex_t i = 0 ; t_success && i < t_count; i++)
290+ t_options_array[i] = static_cast <MCStringRef>(MCProperListFetchElementAtIndex (*t_options_list, i));
296291 }
297292
298293 if (t_success)
299294 {
300295 t_success = MCMemoryNew (t_pick_list);
301296
302297 t_pick_list -> options = t_options_array;
303- t_pick_list -> option_count = noptions ;
298+ t_pick_list -> option_count = t_count ;
304299 t_pick_list -> initial = p_initial_index;
305300 }
306301
@@ -319,11 +314,6 @@ bool MCSystemPick(MCStringRef p_options, bool p_use_checkmark, uint32_t p_initia
319314 if (t_success)
320315 {
321316 // cleanup
322- for (uindex_t i = 0 ; i < noptions; i++)
323- {
324- MCValueRelease (t_options_array[i]);
325- }
326-
327317 MCMemoryDeleteArray (t_options_array);
328318 MCMemoryDelete (t_pick_list);
329319 }
0 commit comments