Skip to content

Commit af168b5

Browse files
committed
Updated certain format placeholders which did not work well on 64-bit systems.
1 parent c0d7fa6 commit af168b5

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

framework/Source/CPTColor.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ -(void)encodeWithCoder:(NSCoder *)coder
352352
const CGFloat *colorComponents = CGColorGetComponents(theColor);
353353

354354
for ( size_t i = 0; i < numberOfComponents; i++ ) {
355-
NSString *newKey = [[NSString alloc] initWithFormat:@"CPTColor.component[%u]", i];
355+
NSString *newKey = [[NSString alloc] initWithFormat:@"CPTColor.component[%zu]", i];
356356
[coder encodeCGFloat:colorComponents[i] forKey:newKey];
357357
[newKey release];
358358
}
@@ -368,7 +368,7 @@ -(id)initWithCoder:(NSCoder *)coder
368368
CGFloat *colorComponents = malloc( numberOfComponents * sizeof(CGFloat) );
369369

370370
for ( size_t i = 0; i < numberOfComponents; i++ ) {
371-
NSString *newKey = [[NSString alloc] initWithFormat:@"CPTColor.component[%u]", i];
371+
NSString *newKey = [[NSString alloc] initWithFormat:@"CPTColor.component[%zu]", i];
372372
colorComponents[i] = [coder decodeCGFloatForKey:newKey];
373373
[newKey release];
374374
}

framework/Source/CPTGradient.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ -(CPTGradient *)removeColorStopAtIndex:(NSUInteger)index
700700
CPTGradientElement removedElement = [newGradient removeElementAtIndex:index];
701701

702702
if ( isnan(removedElement.position) ) {
703-
[NSException raise:NSRangeException format:@"-[%@ removeColorStopAtIndex:]: index (%i) beyond bounds", [self class], index];
703+
[NSException raise:NSRangeException format:@"-[%@ removeColorStopAtIndex:]: index (%li) beyond bounds", [self class], index];
704704
}
705705

706706
return [newGradient autorelease];
@@ -727,7 +727,7 @@ -(CGColorRef)newColorStopAtIndex:(NSUInteger)index
727727
#endif
728728
}
729729

730-
[NSException raise:NSRangeException format:@"-[%@ colorStopAtIndex:]: index (%i) beyond bounds", [self class], index];
730+
[NSException raise:NSRangeException format:@"-[%@ colorStopAtIndex:]: index (%li) beyond bounds", [self class], (long)index];
731731

732732
return NULL;
733733
}

framework/Source/CPTMutableNumericData.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ -(void)commonInitWithData:(NSData *)newData
119119

120120
if ( prod != self.numberOfSamples ) {
121121
[NSException raise:CPTNumericDataException
122-
format:@"Shape product (%u) does not match data size (%u)", prod, self.numberOfSamples];
122+
format:@"Shape product (%lu) does not match data size (%lu)", (unsigned long)prod, (unsigned long)self.numberOfSamples];
123123
}
124124

125125
shape = [shapeArray copy];

framework/Source/CPTNumericData.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ -(void)commonInitWithData:(NSData *)newData
268268

269269
if ( prod != self.numberOfSamples ) {
270270
[NSException raise:CPTNumericDataException
271-
format:@"Shape product (%u) does not match data size (%u)", prod, self.numberOfSamples];
271+
format:@"Shape product (%lu) does not match data size (%lu)", (unsigned long)prod, (unsigned long)self.numberOfSamples];
272272
}
273273

274274
shape = [shapeArray copy];

framework/Source/CPTXYAxis.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ -(void)setCoordinate:(CPTCoordinate)newCoordinate
759759
break;
760760

761761
default:
762-
[NSException raise:NSInvalidArgumentException format:@"Invalid coordinate: %lu", newCoordinate];
762+
[NSException raise:NSInvalidArgumentException format:@"Invalid coordinate: %lu", (unsigned long)newCoordinate];
763763
break;
764764
}
765765
}

framework/Source/NSCoderExtensions.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ -(void)encodeCGPath:(CGPathRef)path forKey:(NSString *)key
146146
NSDictionary *elementData = [pathData objectAtIndex:i];
147147

148148
CGPathElementType type = [[elementData objectForKey:@"type"] intValue];
149-
newKey = [[NSString alloc] initWithFormat:@"%@[%u].type", key, i];
149+
newKey = [[NSString alloc] initWithFormat:@"%@[%lu].type", key, i];
150150
[self encodeInteger:type forKey:newKey];
151151
[newKey release];
152152

@@ -156,22 +156,22 @@ -(void)encodeCGPath:(CGPathRef)path forKey:(NSString *)key
156156
case kCGPathElementAddCurveToPoint: // 3 points
157157
point.x = [[elementData objectForKey:@"point3.x"] cgFloatValue];
158158
point.y = [[elementData objectForKey:@"point3.y"] cgFloatValue];
159-
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point3", key, i];
159+
newKey = [[NSString alloc] initWithFormat:@"%@[%lu].point3", key, (unsigned long)i];
160160
[self encodeCPTPoint:point forKey:newKey];
161161
[newKey release];
162162

163163
case kCGPathElementAddQuadCurveToPoint: // 2 points
164164
point.x = [[elementData objectForKey:@"point2.x"] cgFloatValue];
165165
point.y = [[elementData objectForKey:@"point2.y"] cgFloatValue];
166-
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point2", key, i];
166+
newKey = [[NSString alloc] initWithFormat:@"%@[%lu].point2", key, (unsigned long)i];
167167
[self encodeCPTPoint:point forKey:newKey];
168168
[newKey release];
169169

170170
case kCGPathElementMoveToPoint: // 1 point
171171
case kCGPathElementAddLineToPoint: // 1 point
172172
point.x = [[elementData objectForKey:@"point1.x"] cgFloatValue];
173173
point.y = [[elementData objectForKey:@"point1.y"] cgFloatValue];
174-
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point1", key, i];
174+
newKey = [[NSString alloc] initWithFormat:@"%@[%lu].point1", key, (unsigned long)i];
175175
[self encodeCPTPoint:point forKey:newKey];
176176
[newKey release];
177177
break;
@@ -237,11 +237,11 @@ -(void)encodeCGImage:(CGImageRef)image forKey:(NSString *)key
237237
[newKey release];
238238

239239
for ( size_t i = 0; i < numberOfComponents; i++ ) {
240-
newKey = [[NSString alloc] initWithFormat:@"%@.decode[%u].lower", key, i];
240+
newKey = [[NSString alloc] initWithFormat:@"%@.decode[%u].lower", key, (unsigned)i];
241241
[self encodeCGFloat:decodeArray[i * 2] forKey:newKey];
242242
[newKey release];
243243

244-
newKey = [[NSString alloc] initWithFormat:@"%@.decode[%u].upper", key, i];
244+
newKey = [[NSString alloc] initWithFormat:@"%@.decode[%u].upper", key, (unsigned)i];
245245
[self encodeCGFloat:decodeArray[i * 2 + 1] forKey:newKey];
246246
[newKey release];
247247
}
@@ -383,26 +383,26 @@ -(CGPathRef)newCGPathDecodeForKey:(NSString *)key
383383

384384
// decode elements
385385
for ( NSUInteger i = 0; i < count; i++ ) {
386-
newKey = [[NSString alloc] initWithFormat:@"%@[%u].type", key, i];
386+
newKey = [[NSString alloc] initWithFormat:@"%@[%u].type", key, (unsigned)i];
387387
CGPathElementType type = [self decodeIntegerForKey:newKey];
388388
[newKey release];
389389

390390
CGPoint point1, point2, point3;
391391

392392
switch ( type ) {
393393
case kCGPathElementAddCurveToPoint: // 3 points
394-
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point3", key, i];
394+
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point3", key, (unsigned)i];
395395
point3 = [self decodeCPTPointForKey:newKey];
396396
[newKey release];
397397

398398
case kCGPathElementAddQuadCurveToPoint: // 2 points
399-
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point2", key, i];
399+
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point2", key, (unsigned)i];
400400
point2 = [self decodeCPTPointForKey:newKey];
401401
[newKey release];
402402

403403
case kCGPathElementMoveToPoint: // 1 point
404404
case kCGPathElementAddLineToPoint: // 1 point
405-
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point1", key, i];
405+
newKey = [[NSString alloc] initWithFormat:@"%@[%u].point1", key, (unsigned)i];
406406
point1 = [self decodeCPTPointForKey:newKey];
407407
[newKey release];
408408
break;
@@ -493,11 +493,11 @@ -(CGImageRef)newCGImageDecodeForKey:(NSString *)key
493493
decodeArray = malloc( numberOfComponents * 2 * sizeof(CGFloat) );
494494

495495
for ( size_t i = 0; i < numberOfComponents; i++ ) {
496-
newKey = [[NSString alloc] initWithFormat:@"%@.decode[%u].lower", key, i];
496+
newKey = [[NSString alloc] initWithFormat:@"%@.decode[%u].lower", key, (unsigned)i];
497497
decodeArray[i * 2] = [self decodeCGFloatForKey:newKey];
498498
[newKey release];
499499

500-
newKey = [[NSString alloc] initWithFormat:@"%@.decode[%u].upper", key, i];
500+
newKey = [[NSString alloc] initWithFormat:@"%@.decode[%u].upper", key, (unsigned)i];
501501
decodeArray[i * 2 + 1] = [self decodeCGFloatForKey:newKey];
502502
[newKey release];
503503
}

0 commit comments

Comments
 (0)