@@ -527,10 +527,12 @@ IO_stat MCDispatch::readstartupstack(IO_handle stream, MCStack*& r_stack)
527527 uint32_t version;
528528 uint1 charset, type;
529529 char *newsf;
530+
531+ // MW-2013-11-19: [[ UnicodeFileFormat ]] newsf is no longer used.
530532 if (readheader (stream, version) != IO_NORMAL
531533 || IO_read_uint1 (&charset, stream) != IO_NORMAL
532534 || IO_read_uint1 (&type, stream) != IO_NORMAL
533- || IO_read_string (newsf, stream) != IO_NORMAL)
535+ || IO_read_cstring_legacy (newsf, stream, 2 ) != IO_NORMAL)
534536 return IO_ERROR;
535537
536538 // MW-2008-10-20: [[ ParentScripts ]] Set the boolean flag that tells us whether
@@ -618,12 +620,13 @@ IO_stat MCDispatch::doreadfile(MCStringRef p_openpath, MCStringRef p_name, IO_ha
618620 // MW-2008-10-20: [[ ParentScripts ]] Set the boolean flag that tells us whether
619621 // parentscript resolution is required to false.
620622 s_loaded_parent_script_reference = false ;
621-
623+
624+ // MW-2013-11-19: [[ UnicodeFileFormat ]] newsf is no longer used.
622625 uint1 charset, type;
623626 char *newsf;
624627 if (IO_read_uint1 (&charset, stream) != IO_NORMAL
625628 || IO_read_uint1 (&type, stream) != IO_NORMAL
626- || IO_read_string (newsf, stream) != IO_NORMAL)
629+ || IO_read_cstring_legacy (newsf, stream, 2 ) != IO_NORMAL)
627630 {
628631 MCresult->sets (" stack is corrupted, check for ~ backup file" );
629632 return IO_ERROR;
@@ -641,10 +644,12 @@ IO_stat MCDispatch::doreadfile(MCStringRef p_openpath, MCStringRef p_name, IO_ha
641644
642645 if (MCModeCanLoadHome () && type == OT_HOME)
643646 {
647+ // MW-2013-11-19: [[ UnicodeFileFormat ]] These strings are never written out, so
648+ // legacy.
644649 char *lstring = NULL ;
645650 char *cstring = NULL ;
646- IO_read_string (lstring, stream);
647- IO_read_string (cstring, stream);
651+ IO_read_cstring_legacy (lstring, stream, 2 );
652+ IO_read_cstring_legacy (cstring, stream, 2 );
648653 delete lstring;
649654 delete cstring;
650655 }
@@ -941,9 +946,11 @@ IO_stat MCDispatch::dosavestack(MCStack *sptr, const MCStringRef p_fname)
941946 cleanup (stream, *t_linkname, *t_backup);
942947 return IO_ERROR;
943948 }
944-
949+
950+ // MW-2013-11-19: [[ UnicodeFileFormat ]] Writing out for backwards-compatibility,
951+ // so legacy.
945952 if (IO_write_uint1 (OT_NOTHOME, stream) != IO_NORMAL
946- || IO_write_string (NULL , stream) != IO_NORMAL)
953+ || IO_write_cstring_legacy (NULL , stream, 2 ) != IO_NORMAL)
947954 { // was stackfiles
948955 MCresult->sets (errstring);
949956 cleanup (stream, *t_linkname, *t_backup);
0 commit comments