From 5bb50a3205a2617b8c027fb3fd37f121fed9b9bb Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 3 Jun 2011 06:02:18 +0000 Subject: [PATCH] apply Wolfgangs fix git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33238 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Headers/Foundation/NSThread.h | 2 +- Source/NSString.m | 9 ++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa7fba23c..e45dc0022 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-06-03 Wolfgang Lux + + * Source/NSString.m: [(-getLineStart:end:contentsEnd:forRange:)] + Fix off-by-one error iun reported contents end for DOS style lines. + 2011-06-02 Riccardo Mottola * Source/NSTimeZone.m: Disable use of tzname on OpenBSD too. diff --git a/Headers/Foundation/NSThread.h b/Headers/Foundation/NSThread.h index ad04cd0d0..bf6bde05d 100644 --- a/Headers/Foundation/NSThread.h +++ b/Headers/Foundation/NSThread.h @@ -263,7 +263,7 @@ extern "C" { /** * Invokes -performSelectorOnMainThread:withObject:waitUntilDone:modes: * using the supplied arguments and an array containing common modes.
- * These modes consist of NSRunLoopMode, NSConnectionreplyMode, and if + * These modes consist of NSRunLoopMode, NSConnectionReplyMode, and if * in an application, the NSApplication modes. */ - (void) performSelectorOnMainThread: (SEL)aSelector diff --git a/Source/NSString.m b/Source/NSString.m index 09ace1f57..9d3bd0e01 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -2450,6 +2450,13 @@ handle_printf_atsign (FILE *stream, GS_RANGE_CHECK(aRange, len); caiImp = (unichar (*)())[self methodForSelector: caiSel]; + /* Place aRange.location at the beginning of a CR-LF sequence */ + if (aRange.location > 0 && aRange.location < len + && (*caiImp)(self, caiSel, aRange.location - 1) == (unichar)'\r' + && (*caiImp)(self, caiSel, aRange.location) == (unichar)'\n') + { + aRange.location--; + } start = aRange.location; if (startIndex) @@ -2537,7 +2544,7 @@ handle_printf_atsign (FILE *stream, && ((*caiImp)(self, caiSel, end-1) == (unichar)0x000D) && ((*caiImp)(self, caiSel, end) == (unichar)0x000A)) { - *lineEndIndex = end+1; + *lineEndIndex = ++end; termlen = 2; } else