[darwin] Fix GCC_WARN_SIGN_COMPARE warnings

This commit is contained in:
Jason Wray
2018-11-19 18:51:28 -05:00
parent 00d0864441
commit 83ecb76562
11 changed files with 22 additions and 22 deletions

View File

@@ -105,7 +105,7 @@ NS_ASSUME_NONNULL_BEGIN
{
mbgl::MultiPoint<double> multiPoint;
multiPoint.reserve(self.pointCount);
for (NSInteger i = 0; i< self.pointCount; i++)
for (NSUInteger i = 0; i < self.pointCount; i++)
{
multiPoint.push_back(mbgl::Point<double>(self.coordinates[i].longitude, self.coordinates[i].latitude));
}

View File

@@ -117,7 +117,7 @@
for (MGLPolygon *interiorPolygon in self.interiorPolygons) {
NSMutableArray *interiorRing = [NSMutableArray array];
for (int index = 0; index < interiorPolygon.pointCount; index++) {
for (NSUInteger index = 0; index < interiorPolygon.pointCount; index++) {
CLLocationCoordinate2D coordinate = interiorPolygon.coordinates[index];
[interiorRing addObject:@[@(coordinate.longitude), @(coordinate.latitude)]];
}

View File

@@ -39,7 +39,7 @@
features.push_back(mbgl::Feature { polygon });
NSArray<MGLShape <MGLFeature> *> *shapes = MGLFeaturesFromMBGLFeatures(features);
XCTAssertEqual(shapes.count, 3, @"All features should be converted into shapes");
XCTAssertEqual(shapes.count, 3UL, @"All features should be converted into shapes");
MGLPointFeature *pointShape = (MGLPointFeature *)shapes[0];
XCTAssertTrue([pointShape isKindOfClass:[MGLPointFeature class]]);
@@ -48,7 +48,7 @@
MGLPolylineFeature *polylineShape = (MGLPolylineFeature *)shapes[1];
XCTAssertTrue([polylineShape isKindOfClass:[MGLPolylineFeature class]]);
XCTAssertEqual(polylineShape.pointCount, 2);
XCTAssertEqual(polylineShape.pointCount, 2UL);
CLLocationCoordinate2D polylineCoordinates[2];
[polylineShape getCoordinates:polylineCoordinates range:NSMakeRange(0, polylineShape.pointCount)];
XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:polylineCoordinates[0]],
@@ -58,7 +58,7 @@
MGLPolygonFeature *polygonShape = (MGLPolygonFeature *)shapes[2];
XCTAssertTrue([polygonShape isKindOfClass:[MGLPolygonFeature class]]);
XCTAssertEqual(polygonShape.pointCount, 4);
XCTAssertEqual(polygonShape.pointCount, 4UL);
CLLocationCoordinate2D *polygonCoordinates = polygonShape.coordinates;
XCTAssertNotEqual(polygonCoordinates, nil);
XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:polygonCoordinates[0]],
@@ -70,9 +70,9 @@
XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:polygonCoordinates[3]],
[NSValue valueWithMGLCoordinate:CLLocationCoordinate2DMake(4, 1)]);
NSArray<MGLPolygon *> *interiorPolygons = polygonShape.interiorPolygons;
XCTAssertEqual(interiorPolygons.count, 1);
XCTAssertEqual(interiorPolygons.count, 1UL);
MGLPolygon *interiorPolygon = interiorPolygons.firstObject;
XCTAssertEqual(interiorPolygon.pointCount, 4);
XCTAssertEqual(interiorPolygon.pointCount, 4UL);
CLLocationCoordinate2D interiorPolygonCoordinates[4];
[interiorPolygon getCoordinates:interiorPolygonCoordinates range:NSMakeRange(0, interiorPolygon.pointCount)];
XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:interiorPolygonCoordinates[0]],
@@ -104,7 +104,7 @@
features.push_back(pointFeature);
NSArray<MGLShape <MGLFeature> *> *shapes = MGLFeaturesFromMBGLFeatures(features);
XCTAssertEqual(shapes.count, 1, @"All features should be converted into shapes");
XCTAssertEqual(shapes.count, 1UL, @"All features should be converted into shapes");
MGLShape <MGLFeature> *shape = shapes.firstObject;
XCTAssertTrue([shape conformsToProtocol:@protocol(MGLFeature)]);

View File

@@ -106,7 +106,7 @@
XCTAssertNil(error, @"Valid GeoJSON data should produce no error on deserialization.");
XCTAssertNotNil(feature, @"Valid GeoJSON data should produce an object on deserialization.");
XCTAssertTrue([feature isKindOfClass:[MGLPointFeature class]], @"Valid GeoJSON point feature data should produce an MGLPointFeature.");
XCTAssertEqual(feature.attributes.count, 0);
XCTAssertEqual(feature.attributes.count, 0UL);
XCTAssertEqual(feature.coordinate.latitude, 0);
XCTAssertEqual(feature.coordinate.longitude, 0);

View File

@@ -248,7 +248,7 @@
}
- (void)testCountOfBytesCompleted {
XCTAssertGreaterThan([MGLOfflineStorage sharedOfflineStorage].countOfBytesCompleted, 0);
XCTAssertGreaterThan([MGLOfflineStorage sharedOfflineStorage].countOfBytesCompleted, 0UL);
}
- (NSURL *)offlineStorage:(MGLOfflineStorage *)storage

View File

@@ -65,7 +65,7 @@
MGLShapeCollection *collection = (MGLShapeCollection *)source.shape;
XCTAssertNotNil(collection);
XCTAssertEqual(collection.shapes.count, 1);
XCTAssertEqual(collection.shapes.count, 1UL);
XCTAssertTrue([collection.shapes.firstObject isMemberOfClass:[MGLPolylineFeature class]]);
}
@@ -294,7 +294,7 @@
MGLShapeCollectionFeature *shape = (MGLShapeCollectionFeature *)source.shape;
XCTAssertTrue([shape isKindOfClass:[MGLShapeCollectionFeature class]]);
XCTAssertEqual(shape.shapes.count, 1, @"Shape collection should contain 1 shape");
XCTAssertEqual(shape.shapes.count, 1UL, @"Shape collection should contain 1 shape");
// when a shape is included in the features array
MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:coordinates count:sizeof(coordinates)/sizeof(coordinates[0]) interiorPolygons:nil];
@@ -319,7 +319,7 @@
MGLShapeCollectionFeature *shape = (MGLShapeCollectionFeature *)source.shape;
XCTAssertTrue([shape isKindOfClass:[MGLShapeCollection class]]);
XCTAssertEqual(shape.shapes.count, 1, @"Shape collection should contain 1 shape");
XCTAssertEqual(shape.shapes.count, 1UL, @"Shape collection should contain 1 shape");
}
@end

View File

@@ -141,9 +141,9 @@
- (void)testSources {
NSSet<MGLSource *> *initialSources = self.style.sources;
if ([initialSources.anyObject.identifier isEqualToString:@"com.mapbox.annotations"]) {
XCTAssertEqual(self.style.sources.count, 1);
XCTAssertEqual(self.style.sources.count, 1UL);
} else {
XCTAssertEqual(self.style.sources.count, 0);
XCTAssertEqual(self.style.sources.count, 0UL);
}
MGLShapeSource *shapeSource = [[MGLShapeSource alloc] initWithIdentifier:@"shapeSource" shape:nil options:nil];
[self.style addSource:shapeSource];
@@ -251,9 +251,9 @@
- (void)testLayers {
NSArray<MGLStyleLayer *> *initialLayers = self.style.layers;
if ([initialLayers.firstObject.identifier isEqualToString:@"com.mapbox.annotations.points"]) {
XCTAssertEqual(self.style.layers.count, 1);
XCTAssertEqual(self.style.layers.count, 1UL);
} else {
XCTAssertEqual(self.style.layers.count, 0);
XCTAssertEqual(self.style.layers.count, 0UL);
}
MGLShapeSource *shapeSource = [[MGLShapeSource alloc] initWithIdentifier:@"shapeSource" shape:nil options:nil];
[self.style addSource:shapeSource];

View File

@@ -18,7 +18,7 @@
mbgl::Tileset tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, nil);
// has the correct URL templates
XCTAssertEqual(tileSet.tiles.size(), 3);
XCTAssertEqual(tileSet.tiles.size(), 3UL);
XCTAssertEqual(tileSet.tiles[0], "tile.1");
XCTAssertEqual(tileSet.tiles[1], "tile.2");
XCTAssertEqual(tileSet.tiles[2], "tile.3");

View File

@@ -2590,7 +2590,7 @@ public:
}
// Compass
NSUInteger compassIndex = 0;
NSInteger compassIndex = 0;
if (index == compassIndex)
{
return self.compassView;
@@ -2666,7 +2666,7 @@ public:
}
// Attribution button
NSUInteger attributionButtonIndex = NSMaxRange(visibleRoadFeatureRange);
NSInteger attributionButtonIndex = NSMaxRange(visibleRoadFeatureRange);
if (index == attributionButtonIndex)
{
return self.attributionButton;

View File

@@ -358,7 +358,7 @@ static const CGFloat MGLFeetPerMeter = 3.28084;
- (void)updateLabels {
NSEnumerator<UIView*> *viewEnumerator = [self.labelViews objectEnumerator];
NSInteger i = 0;
NSUInteger i = 0;
CLLocationDistance multiplier = (self.row.distance / self.row.numberOfBars);
if (![self usesMetricSystem]) {

View File

@@ -1324,7 +1324,7 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
}
if (action == @selector(showStyle:)) {
NSPopUpButton *popUpButton = (NSPopUpButton *)toolbarItem.view;
NSUInteger index = self.indexOfStyleInToolbarItem;
NSInteger index = self.indexOfStyleInToolbarItem;
if (index == NSNotFound) {
index = -1;
}