Re: NSScanner under Mac OS X 10.2 Jaguar and Mac OS X 10.1.x
Re: NSScanner under Mac OS X 10.2 Jaguar and Mac OS X 10.1.x
- Subject: Re: NSScanner under Mac OS X 10.2 Jaguar and Mac OS X 10.1.x
- From: Nicholas Riley <email@hidden>
- Date: Sun, 10 Nov 2002 11:06:53 -0600
- Mail-followup-to: Simone Manganelli <email@hidden>, email@hidden
On Sun, Nov 10, 2002 at 12:44:09AM -0800, Simone Manganelli wrote:
>
My application uses an NSScanner class to parse some command line output
>
into data that gets put into a table view. On Mac OS X 10.2 Jaguar, my
>
application works as expected. However, under Mac OS X 10.1.x, any data
>
that got parsed via an NSScanner class does not display correctly in the
>
NSTableView it displays the wrong parts of the strings that should
>
have been parsed. However, data that was parsed simply via the NSString
>
methods do not exhibit this problem under Mac OS X 10.1.x only
>
NSScanner parsed data has this problem.
>
>
Is there any way to fix this problem and make my application work under
>
both operating systems? Any help would be greatly appreciated. If
>
there's another way to accomplish what NSScanner does, that would be
>
acceptable too, as long as it works under both Mac OS X 10.1.x and
>
10.2.x Jaguar.
I don't know whether this was your problem, but this is what I needed
to do to get my NSScanner code working under 10.2:
NSScanner *scanner = [NSScanner scannerWithString: format];
int formatLength = [format length];
NSRange range;
[...]
while ([scanner scanUpToString: @"%" intoString: nil] || ![scanner isAtEnd]) {
range.location = [scanner scanLocation];
// XXX works fine without keeping track of length in 10.1.5; in 10.2, [scanner scanUptoString:intoString:] still returns YES even when scanner is at end and there's nothing left to scan
if (range.location >= formatLength) break;
This change in behavior was actually causing my app to crash. (And of
course this code is actually in the workaround code for date format
issues that exist in 10.2 still, which I wrote about...) I'll file a
bug on it later today.
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.