gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Range from String / String from Range problem


From: Fred Kiefer
Subject: Re: Range from String / String from Range problem
Date: Fri, 13 Nov 2015 00:15:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

Am 12.11.2015 um 16:32 schrieb Riccardo Mottola:
> Hi,
> 
> on FreeBSD/Clang I noticed that ProjectCenter is not scrolling to the
> classes / methods parsed. Strange, since I extra fixed the parser! Also,
> on my Linux computer it works.
> 
> The code, in PCEditor, is fairly simple:
> 
>   classNameRange = NSMakeRange(0, 0);
>   enumerator = [parserClasses objectEnumerator];
>   while ((class = [enumerator nextObject]))
>     {
>       if ([[class objectForKey:@"ClassName"] isEqualToString:className])
>     {
>           NSLog(@"range string: %@",[class
> objectForKey:@"ClassNameRange"]);
>       classNameRange =
>         NSRangeFromString([class objectForKey:@"ClassNameRange"]);
>       break;
>     }
>     }
> 
>   NSLog(@"classNameRange: %@", NSStringFromRange(classNameRange));
> 
> the range is re-created from they dictionary value which is a string.
> Perhaps it is not the most efficient way to put ranges in a Dictionary?
> In any case I suppose it should work. Here is the output of the two NSLogs:
> 
> 2015-11-12 15:25:01.236 ProjectCenter[3684:100116] SCROLL to class:
> "@AppController"
> 2015-11-12 15:25:01.237 ProjectCenter[3684:100116] range string:
> {location=256, length=13}
> 2015-11-12 15:25:01.237 ProjectCenter[3684:100116] classNameRange:
> {location=34359738624, length=34359738381}
> 
> This means that the parser worked and that the value inside the
> dictionary is sane. However, once a String is re-extracted and
> re-printed, the value is havoc.
> A breakpoint in the debugger doesn't work, strangely... I will
> investigate futher with a test program.
> Do we have a testcase for this in base I can eventually extend?

The scanner in NSRangeFromString uses the method scanInt:, this is wrong
for 64bit systems. You could try to use scanInteger: instead and report
back. Just leave the method caching out while trying this if you have
problems with it.

Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]