changeset 11296:87a7fdd3ffcc

[gaim-migrate @ 13496] Handle non-unix text files. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 18 Aug 2005 04:59:16 +0000
parents ee1b890760be
children 84d3f47e6258
files plugins/spellchk.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/spellchk.c	Thu Aug 18 04:57:47 2005 +0000
+++ b/plugins/spellchk.c	Thu Aug 18 04:59:16 2005 +0000
@@ -506,14 +506,18 @@
 	if (pos == len)
 		return 0;
 
-	while (ibuf[pos++] != '\n') {
+	while (!(ibuf[pos] == '\n' ||
+	         (ibuf[pos] == '\r' && ibuf[pos + 1] != '\n')))
+	{
+		pos++;
 		if (pos == len)
 			return 0;
 	}
 
-	pos--;
+	if (pos != 0 && ibuf[pos] == '\n' && ibuf[pos - 1] == '\r')
+		ibuf[pos - 1] = '\0';
 
-	ibuf[pos] = 0;
+	ibuf[pos] = '\0';
 	*buf = &ibuf[spos];
 
 	pos++;