@@ -1918,7 +1918,7 @@ bool MCStringMapIndices(MCStringRef self, MCBreakIteratorType p_type, MCLocaleRe
19181918 t_end = MCStringGetLength (self);
19191919
19201920 MCRange t_units;
1921- t_units = MCRangeMake (t_start, t_end - t_start );
1921+ t_units = MCRangeMakeMinMax (t_start, t_end);
19221922
19231923 // All done
19241924 r_out_range = t_units;
@@ -1965,7 +1965,7 @@ bool MCStringMapGraphemeIndices(MCStringRef self, MCRange p_grapheme_range, MCRa
19651965 if (t_end == kMCLocaleBreakIteratorDone )
19661966 t_end = MCStringGetLength (self);
19671967
1968- r_cu_range = MCRangeMake (t_start, t_end - t_start );
1968+ r_cu_range = MCRangeMakeMinMax (t_start, t_end);
19691969 return true ;
19701970}
19711971
@@ -2017,7 +2017,7 @@ bool MCStringMapTrueWordIndices(MCStringRef self, MCLocaleRef p_locale, MCRange
20172017 ;
20182018
20192019 MCRange t_units;
2020- t_units = MCRangeMake (t_start, t_word_range . offset + t_word_range . length - t_start );
2020+ t_units = MCRangeMakeMinMax (t_start, t_word_range . offset + t_word_range . length);
20212021
20222022 // All done
20232023 MCLocaleBreakIteratorRelease (t_iter);
@@ -3376,7 +3376,7 @@ bool MCStringFirstIndexOfStringInRange(MCStringRef self, MCStringRef p_needle, M
33763376MC_DLLEXPORT_DEF
33773377bool MCStringFirstIndexOfChar (MCStringRef self, codepoint_t p_needle, uindex_t p_after, MCStringOptions p_options, uindex_t & r_offset)
33783378{
3379- return MCStringFirstIndexOfCharInRange (self, p_needle, MCRangeMake (p_after, self -> char_count - p_after ), p_options, r_offset);
3379+ return MCStringFirstIndexOfCharInRange (self, p_needle, MCRangeMakeMinMax (p_after, self -> char_count), p_options, r_offset);
33803380}
33813381
33823382MC_DLLEXPORT_DEF
@@ -3702,7 +3702,7 @@ bool MCStringDivideAtIndex(MCStringRef self, uindex_t p_offset, MCStringRef& r_h
37023702 return false ;
37033703
37043704 MCStringRef t_tail;
3705- if (!MCStringCopySubstring (self, MCRangeMake (p_offset + 1 , MCStringGetLength (self) - p_offset - 1 ), t_tail))
3705+ if (!MCStringCopySubstring (self, MCRangeMakeMinMax (p_offset + 1 , MCStringGetLength (self)), t_tail))
37063706 {
37073707 MCValueRelease (t_head);
37083708 return false ;
@@ -3808,7 +3808,7 @@ static bool __MCStringSkip(MCStringRef self,
38083808 while (p_count > 0 )
38093809 {
38103810 if (!__MCStringFind (self,
3811- MCRangeMake (t_start, t_finish - t_start ),
3811+ MCRangeMakeMinMax (t_start, t_finish),
38123812 p_needle,
38133813 p_options,
38143814 &t_last))
@@ -3867,7 +3867,7 @@ static uindex_t __MCStringCount(MCStringRef self,
38673867 MCRange t_last;
38683868 t_last = MCRangeMake (t_start, 0 );
38693869 while (__MCStringFind (self,
3870- MCRangeMake (t_start, t_finish - t_start ),
3870+ MCRangeMakeMinMax (t_start, t_finish),
38713871 p_needle,
38723872 p_options,
38733873 &t_last))
@@ -3931,7 +3931,7 @@ static bool __MCStringDelimitedOffset(MCStringRef self,
39313931 // we are done.
39323932 MCRange t_found_range;
39333933 if (!__MCStringFind (self,
3934- MCRangeMake (t_start, t_finish - t_start ),
3934+ MCRangeMakeMinMax (t_start, t_finish),
39353935 p_needle,
39363936 p_options,
39373937 &t_found_range))
@@ -3940,7 +3940,7 @@ static bool __MCStringDelimitedOffset(MCStringRef self,
39403940 // We must now search for delimiters in the substring between the end of the
39413941 // previous delimiter and the start of the found range.
39423942 t_delimiter_count += __MCStringCount (self,
3943- MCRangeMake (t_start, t_found_range . offset - t_start ),
3943+ MCRangeMakeMinMax (t_start, t_found_range . offset),
39443944 p_delimiter,
39453945 p_options,
39463946 &t_prev_delimiter);
0 commit comments