bugGNUstep - Bugs: bug #33464, NSString...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #33464: NSString -getLineStart:end:contentsEnd:forRange: returns incorrect results

Submitted by:  Wolfgang Lux <wlux>
Submitted on:  Thu 02 Jun 2011 06:10:11 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sat 04 Jun 2011 03:16:15 PM UTC, comment #2:

Thanks ... I applied your patch.

Richard Frith-Macdonald <CaS>
Project Member
Thu 02 Jun 2011 06:36:53 PM UTC, comment #1:

And the attached patch fixes both issues.

(file #23498)

Wolfgang Lux <wlux>
Thu 02 Jun 2011 06:10:11 PM UTC, original submission:

This happens (only) for strings with DOS-style line ending (\r\n).
For instance, the attached test program yields the following output for the string 'abc\r\ndef\r\n'.

  1. -> start=0 end=2/5

1 -> start=0 end=2/5
2 -> start=0 end=2/5
3 -> start=0 end=2/5
4 -> start=4 end=4/5
5 -> start=5 end=7/10
6 -> start=5 end=7/10
7 -> start=5 end=7/10
8 -> start=5 end=7/10
9 -> start=9 end=9/10
The expected output (generated on OS X) is

  1. -> start=0 end=3/5

1 -> start=0 end=3/5
2 -> start=0 end=3/5
3 -> start=0 end=3/5
4 -> start=0 end=3/5
5 -> start=5 end=8/10
6 -> start=5 end=8/10
7 -> start=5 end=8/10
8 -> start=5 end=8/10
9 -> start=5 end=8/10
Note that contents end is 2/7 rather than 3/8 for the first four characters of each line and 4/9 instead of 3/8 for the last character.

Wolfgang Lux <wlux>

 

Attached Files
file #23498:  NSString.patch added by wlux (863B - text/x-patch)
file #23497:  test.m added by wlux (499B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by wlux (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 04 Jun 2011 03:16:15 PM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Thu 02 Jun 2011 06:36:53 PM UTCwluxAttached File-=>Added NSString.patch, #23498
    Thu 02 Jun 2011 06:10:11 PM UTCwluxAttached File-=>Added test.m, #23497

    Back to the top


    Powered by Savane 3.1-cleanup1