mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix check for \r\n
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/freeze-1_4_0@14171 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
74eba72195
commit
1f0424368d
2 changed files with 16 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
2002-07-17 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSString.m (-getLineStart:end:contentsEnd:forRange:): Fix
|
||||
lineEnd and contentEnd check for \r\n (particularly at end of
|
||||
string.
|
||||
|
||||
Tue Jul 16 16:43:59 2002 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Headers/gnustep/base/GSXML.h ([GSXMLNode -setNamespace:]): Added
|
||||
|
|
|
@ -1840,7 +1840,7 @@ handle_printf_atsign (FILE *stream,
|
|||
forRange: (NSRange)aRange
|
||||
{
|
||||
unichar thischar;
|
||||
unsigned start, end, len;
|
||||
unsigned start, end, len, termlen;
|
||||
unichar (*caiImp)(NSString*, SEL, unsigned int);
|
||||
|
||||
len = [self length];
|
||||
|
@ -1903,10 +1903,10 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
if (lineEndIndex || contentsEndIndex)
|
||||
{
|
||||
BOOL found = NO;
|
||||
end = aRange.location + aRange.length;
|
||||
while (end < len)
|
||||
{
|
||||
BOOL done = NO;
|
||||
|
||||
thischar = (*caiImp)(self, caiSel, end);
|
||||
switch (thischar)
|
||||
|
@ -1915,22 +1915,24 @@ handle_printf_atsign (FILE *stream,
|
|||
case (unichar)0x000D:
|
||||
case (unichar)0x2028:
|
||||
case (unichar)0x2029:
|
||||
done = YES;
|
||||
found = YES;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
end++;
|
||||
if (done)
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
termlen = 1;
|
||||
if (lineEndIndex)
|
||||
{
|
||||
if (end < len
|
||||
&& ((*caiImp)(self, caiSel, end) == (unichar)0x000D)
|
||||
&& ((*caiImp)(self, caiSel, end+1) == (unichar)0x000A))
|
||||
&& ((*caiImp)(self, caiSel, end-1) == (unichar)0x000D)
|
||||
&& ((*caiImp)(self, caiSel, end) == (unichar)0x000A))
|
||||
{
|
||||
*lineEndIndex = end+1;
|
||||
termlen = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1939,9 +1941,9 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
if (contentsEndIndex)
|
||||
{
|
||||
if (end < len)
|
||||
if (found)
|
||||
{
|
||||
*contentsEndIndex = end-1;
|
||||
*contentsEndIndex = end-termlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue