From 4096544188501c8e6e9220847fff910eb153d42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 28 Nov 2016 21:51:37 -0800 Subject: [ios, macos] Marked C array parameters as const Fixes #7214. --- platform/darwin/src/MGLMultiPoint.h | 4 ++-- platform/darwin/src/MGLMultiPoint.mm | 6 +++--- platform/darwin/src/MGLMultiPoint_Private.h | 2 +- platform/darwin/src/MGLPointCollection.h | 2 +- platform/darwin/src/MGLPointCollection.mm | 4 ++-- platform/darwin/src/MGLPointCollection_Private.h | 2 +- platform/darwin/src/MGLPolygon.h | 4 ++-- platform/darwin/src/MGLPolygon.mm | 6 +++--- platform/darwin/src/MGLPolyline.h | 2 +- platform/darwin/src/MGLPolyline.mm | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) (limited to 'platform/darwin') diff --git a/platform/darwin/src/MGLMultiPoint.h b/platform/darwin/src/MGLMultiPoint.h index 5a37e25cc3..3431fc2483 100644 --- a/platform/darwin/src/MGLMultiPoint.h +++ b/platform/darwin/src/MGLMultiPoint.h @@ -56,7 +56,7 @@ NS_ASSUME_NONNULL_BEGIN @param coords The array of coordinates defining the shape. The data in this array is copied to the object. */ -- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(CLLocationCoordinate2D *)coords; +- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(const CLLocationCoordinate2D *)coords; /** Appends one or more coordinates for the shape, which will instantaneously @@ -66,7 +66,7 @@ NS_ASSUME_NONNULL_BEGIN array is copied to the new object. @param count The number of items in the `coords` array. */ -- (void)appendCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count; +- (void)appendCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count; @end diff --git a/platform/darwin/src/MGLMultiPoint.mm b/platform/darwin/src/MGLMultiPoint.mm index 0133e03b32..57b57889f3 100644 --- a/platform/darwin/src/MGLMultiPoint.mm +++ b/platform/darwin/src/MGLMultiPoint.mm @@ -18,7 +18,7 @@ mbgl::Color MGLColorObjectFromCGColorRef(CGColorRef cgColor) std::vector _coordinates; } -- (instancetype)initWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count +- (instancetype)initWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count { self = [super init]; @@ -65,7 +65,7 @@ mbgl::Color MGLColorObjectFromCGColorRef(CGColorRef cgColor) std::copy(_coordinates.begin() + range.location, _coordinates.begin() + NSMaxRange(range), coords); } -- (void)appendCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count +- (void)appendCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count { [self willChangeValueForKey:@"coordinates"]; _coordinates.insert(_coordinates.end(), count, *coords); @@ -73,7 +73,7 @@ mbgl::Color MGLColorObjectFromCGColorRef(CGColorRef cgColor) [self didChangeValueForKey:@"coordinates"]; } -- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(CLLocationCoordinate2D *)coords +- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(const CLLocationCoordinate2D *)coords { if (range.length == 0) { diff --git a/platform/darwin/src/MGLMultiPoint_Private.h b/platform/darwin/src/MGLMultiPoint_Private.h index 7bc3cae58a..a9b4b72ca5 100644 --- a/platform/darwin/src/MGLMultiPoint_Private.h +++ b/platform/darwin/src/MGLMultiPoint_Private.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MGLMultiPoint (Private) -- (instancetype)initWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count; +- (instancetype)initWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count; - (BOOL)intersectsOverlayBounds:(MGLCoordinateBounds)overlayBounds; /** Constructs a shape annotation object, asking the delegate for style values. */ diff --git a/platform/darwin/src/MGLPointCollection.h b/platform/darwin/src/MGLPointCollection.h index db497d0a52..ce3e95a16d 100644 --- a/platform/darwin/src/MGLPointCollection.h +++ b/platform/darwin/src/MGLPointCollection.h @@ -26,7 +26,7 @@ @param count The number of items in the `coords` array. @return A new point collection object. */ -+ (instancetype)pointCollectionWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count; ++ (instancetype)pointCollectionWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count; /** The array of coordinates associated with the shape. */ @property (nonatomic, readonly) CLLocationCoordinate2D *coordinates NS_RETURNS_INNER_POINTER; diff --git a/platform/darwin/src/MGLPointCollection.mm b/platform/darwin/src/MGLPointCollection.mm index 8c9d11f42b..ab4a9c978e 100644 --- a/platform/darwin/src/MGLPointCollection.mm +++ b/platform/darwin/src/MGLPointCollection.mm @@ -12,12 +12,12 @@ NS_ASSUME_NONNULL_BEGIN std::vector _coordinates; } -+ (instancetype)pointCollectionWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count ++ (instancetype)pointCollectionWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count { return [[self alloc] initWithCoordinates:coords count:count]; } -- (instancetype)initWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count +- (instancetype)initWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count { self = [super init]; if (self) diff --git a/platform/darwin/src/MGLPointCollection_Private.h b/platform/darwin/src/MGLPointCollection_Private.h index 039c1f18be..fc1c33fe4c 100644 --- a/platform/darwin/src/MGLPointCollection_Private.h +++ b/platform/darwin/src/MGLPointCollection_Private.h @@ -4,7 +4,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MGLPointCollection (Private) -- (instancetype)initWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count; +- (instancetype)initWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count; @end diff --git a/platform/darwin/src/MGLPolygon.h b/platform/darwin/src/MGLPolygon.h index 3d5b36abb6..b9ec6b8399 100644 --- a/platform/darwin/src/MGLPolygon.h +++ b/platform/darwin/src/MGLPolygon.h @@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN @param count The number of items in the `coords` array. @return A new polygon object. */ -+ (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count; ++ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count; /** Creates and returns an `MGLPolygon` object from the specified set of @@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN is considered to have no interior polygons. @return A new polygon object. */ -+ (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(nullable NS_ARRAY_OF(MGLPolygon *) *)interiorPolygons; ++ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(nullable NS_ARRAY_OF(MGLPolygon *) *)interiorPolygons; @end diff --git a/platform/darwin/src/MGLPolygon.mm b/platform/darwin/src/MGLPolygon.mm index eae2cfe75a..7562db6e61 100644 --- a/platform/darwin/src/MGLPolygon.mm +++ b/platform/darwin/src/MGLPolygon.mm @@ -9,15 +9,15 @@ @dynamic overlayBounds; -+ (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count { ++ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count { return [self polygonWithCoordinates:coords count:count interiorPolygons:nil]; } -+ (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(NSArray *)interiorPolygons { ++ (instancetype)polygonWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(NSArray *)interiorPolygons { return [[self alloc] initWithCoordinates:coords count:count interiorPolygons:interiorPolygons]; } -- (instancetype)initWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(NSArray *)interiorPolygons { +- (instancetype)initWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(NSArray *)interiorPolygons { if (self = [super initWithCoordinates:coords count:count]) { if (interiorPolygons.count) { _interiorPolygons = interiorPolygons; diff --git a/platform/darwin/src/MGLPolyline.h b/platform/darwin/src/MGLPolyline.h index d0274b44e3..cb98df9a1b 100644 --- a/platform/darwin/src/MGLPolyline.h +++ b/platform/darwin/src/MGLPolyline.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @param count The number of items in the `coords` array. @return A new polyline object. */ -+ (instancetype)polylineWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count; ++ (instancetype)polylineWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count; @end diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm index dd2fccf53d..1801dfd44e 100644 --- a/platform/darwin/src/MGLPolyline.mm +++ b/platform/darwin/src/MGLPolyline.mm @@ -9,7 +9,7 @@ @dynamic overlayBounds; -+ (instancetype)polylineWithCoordinates:(CLLocationCoordinate2D *)coords ++ (instancetype)polylineWithCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count { return [[self alloc] initWithCoordinates:coords count:count]; -- cgit v1.2.1