@@ -459,11 +459,11 @@ MCParagraph *MCField::parsestyledtextappendparagraph(MCArrayRef p_style, MCNameR
459459 return t_new_paragraph;
460460}
461461
462- void MCField::parsestyledtextappendblock (MCParagraph *p_paragraph, MCArrayRef p_style, MCStringRef p_initial, MCStringRef p_final, MCStringRef p_metadata, bool p_is_unicode)
462+ void MCField::parsestyledtextappendblock (MCParagraph *p_paragraph, MCArrayRef p_style, const char * p_initial, const char * p_final, MCStringRef p_metadata, bool p_is_unicode)
463463{
464464 // Make sure we don't try and append any more than 64K worth of bytes.
465465 uint32_t t_text_length;
466- t_text_length = MCMin (MCStringGetCString ( p_final) - MCStringGetCString ( p_initial) , 65534 - p_paragraph -> textsize);
466+ t_text_length = MCMin (p_final - p_initial, 65534 - p_paragraph -> textsize);
467467
468468 // If we are unicode and the text length is odd, chop off the last char.
469469 if (p_is_unicode && (t_text_length & 1 ) != 0 )
@@ -500,7 +500,7 @@ void MCField::parsestyledtextappendblock(MCParagraph *p_paragraph, MCArrayRef p_
500500 t_block -> size = t_text_length;
501501
502502 // Copy across the bytes of the text.
503- memcpy (p_paragraph -> text + t_block -> index, MCStringGetCString ( p_initial) , t_block -> size);
503+ memcpy (p_paragraph -> text + t_block -> index, p_initial, t_block -> size);
504504 p_paragraph -> textsize += t_block -> size;
505505
506506 // Now set the block styles.
@@ -685,10 +685,7 @@ void MCField::parsestyledtextblockarray(MCArrayRef p_block_value, MCParagraph*&
685685 }
686686
687687 // We now add the range initial...final as a block.
688- MCAutoStringRef t_initial_str, t_final_str;
689- /* UNCHECKED */ MCStringCreateWithCString (t_text_initial_ptr, &t_initial_str);
690- /* UNCHECKED */ MCStringCreateWithCString (t_text_final_ptr, &t_final_str);
691- parsestyledtextappendblock (t_paragraph, *t_style_entry, *t_initial_str, *t_final_str, *t_metadata, t_is_unicode);
688+ parsestyledtextappendblock (t_paragraph, *t_style_entry, t_text_initial_ptr, t_text_final_ptr, *t_metadata, t_is_unicode);
692689
693690 // And, if we need a new paragraph, add it.
694691 if (t_add_paragraph)
0 commit comments