@@ -6966,7 +6966,7 @@ bool MCStringGetNumericValue(MCStringRef self, double &r_value)
69666966MC_DLLEXPORT bool
69676967MCStringNormalizeLineEndings (MCStringRef p_input,
69686968 MCStringLineEndingStyle p_to_style,
6969- bool p_normalize_ps_ls ,
6969+ MCStringLineEndingOptions p_options ,
69706970 MCStringRef& r_output,
69716971 MCStringLineEndingStyle* r_original_style)
69726972{
@@ -7015,40 +7015,39 @@ MCStringNormalizeLineEndings(MCStringRef p_input,
70157015 }
70167016
70177017 // AL-2014-07-21: [[ Bug 12162 ]] Convert PS to LF, and LS to VT on text import.
7018- if (p_normalize_ps_ls)
7018+ if (((p_options & kMCStringLineEndingOptionNormalizeLSToVT ) != 0 ) &&
7019+ !MCStringFindAndReplaceChar (*t_mutable_input,
7020+ (const codepoint_t )0x2028 ,
7021+ (const codepoint_t )0x0B ,
7022+ kMCStringOptionCompareExact ))
70197023 {
7020- if (!MCStringFindAndReplaceChar (*t_mutable_input,
7021- (const codepoint_t )0x2028 ,
7022- (const codepoint_t )0x0B ,
7023- kMCStringOptionCompareExact ))
7024- {
7025- return false ;
7026- }
7027- if (!MCStringFindAndReplaceChar (*t_mutable_input,
7028- (const codepoint_t )0x2029 ,
7029- (const codepoint_t )0x0A ,
7030- kMCStringOptionCompareExact ))
7031- {
7032- return false ;
7033- }
7024+ return false ;
7025+ }
7026+ if (((p_options & kMCStringLineEndingOptionNormalizePSToLineEnding ) != 0 ) &&
7027+ !MCStringFindAndReplaceChar (*t_mutable_input,
7028+ (const codepoint_t )0x2029 ,
7029+ (const codepoint_t )0x0A ,
7030+ kMCStringOptionCompareExact ))
7031+ {
7032+ return false ;
70347033 }
70357034
70367035 // now convert the line endings to the proper version
7037- if (p_to_style == kMCStringLineEndingStyleCR )
7036+ if ((p_to_style == kMCStringLineEndingStyleCR ) &&
7037+ !MCStringFindAndReplace (*t_mutable_input,
7038+ MCSTR (" \n " ),
7039+ MCSTR (" \r " ),
7040+ kMCStringOptionCompareExact ))
70387041 {
7039- if (!MCStringFindAndReplace (*t_mutable_input, MCSTR (" \n " ),
7040- MCSTR (" \r " ), kMCStringOptionCompareExact ))
7041- {
7042- return false ;
7043- }
7042+ return false ;
70447043 }
7045- else if (p_to_style == kMCStringLineEndingStyleCRLF )
7044+ else if ((p_to_style == kMCStringLineEndingStyleCRLF ) &&
7045+ !MCStringFindAndReplace (*t_mutable_input,
7046+ MCSTR (" \n " ),
7047+ MCSTR (" \r\n " ),
7048+ kMCStringOptionCompareExact ))
70467049 {
7047- if (!MCStringFindAndReplace (*t_mutable_input, MCSTR (" \n " ),
7048- MCSTR (" \r\n " ), kMCStringOptionCompareExact ))
7049- {
7050- return false ;
7051- }
7050+ return false ;
70527051 }
70537052
70547053 if (!t_mutable_input.MakeImmutable ())
0 commit comments