AlexR
AlexR

Reputation: 5634

Core Plot 1.1: Compile error when compiling Core Plot Examples

When trying to compile the following CorePlot 1.1 examples in Xcode 4.6, I get an compiler error.

Compiler error in CPTUtilities.m: Operand of ? changes signedness: 'int' to 'NSUInteger' (aka 'unsigned int')

NSRange CPTExpandedRange(NSRange range, NSInteger expandBy)
{
    NSUInteger loc = MAX(0, (NSInteger)range.location - expandBy);
    NSUInteger lowerExpsion = range.location - loc; // Here is the error
    NSUInteger length = (NSUInteger)( (NSInteger)(range.length + lowerExpansion) + expandBy);

    return NSMakeRange(loc, length);
}

Upvotes: 4

Views: 1591

Answers (3)

user1812853
user1812853

Reputation: 61

Yes, the answer is placed there, simply only changes the function, I left a copy that how is the right code:

    NSRange CPTExpandedRange(NSRange range, NSInteger expandBy)

//NSUInteger loc            = MAX(0, (NSInteger)range.location - expandBy);
//NSUInteger lowerExpansion = range.location - loc;
//NSUInteger length         = (NSUInteger)( (NSInteger)(range.length + lowerExpansion) + expandBy );

NSInteger loc            = MAX(0, (NSInteger)range.location - expandBy);
NSInteger lowerExpansion = (NSInteger)range.location - loc;
NSInteger length         = MAX(0, (NSInteger)range.length + lowerExpansion + expandBy);

//return NSMakeRange(loc, length);
return NSMakeRange( (NSUInteger)loc, (NSUInteger)length );

Upvotes: 6

Sorry, but i cannot found how is fixed this compiler error. I'm on the same situation as Alex. Trying to compile the examples and get the same error. Running on XCode 4.6 and Mountain Lion. CorePlot 1.1 and tried targets 5.1,6.0 and 6.1

Thanks for any help.

Upvotes: 1

AlexR
AlexR

Reputation: 5634

This issue (issue #501) has now been fixed by the Core Plot team:

Issue 501 fixed

Upvotes: 3

Related Questions