Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

  • DatePlot
  • CPTTestApp - iPad

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);
}
like image 607
AlexR Avatar asked Dec 26 '22 10:12

AlexR


1 Answers

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 );
like image 88
user1812853 Avatar answered Jan 21 '23 16:01

user1812853