diff options
Diffstat (limited to 'iup/src/iup_str.c')
-rwxr-xr-x | iup/src/iup_str.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/iup/src/iup_str.c b/iup/src/iup_str.c index 5f5b85d..6ca8c1b 100755 --- a/iup/src/iup_str.c +++ b/iup/src/iup_str.c @@ -558,36 +558,25 @@ void iupStrToUnix(char* str) *pstr = *str; } -char* iupStrToMac(const char* str) +void iupStrToMac(char* str) { - int at_start = 1; - char* pstr, *new_str; - - if (!str) return NULL; - - if (iupStrLineCount(str) == 1) - return (char*)str; + char* pstr = str; - new_str = iupStrDup(str); - str = new_str; - pstr = new_str; + if (!str) return; while (*str) { - if (*str == '\n') + if (*str == '\r') { - if (!at_start && *(str-1) != '\r') /* UNIX line end */ - *pstr++ = '\r'; - str++; + if (*(++str) == '\n') /* DOS line end */ + str++; + *pstr++ = '\r'; } else *pstr++ = *str++; - at_start = 0; } *pstr = *str; - - return new_str; } char* iupStrToDos(const char* str) |