[darwin] Rename variables to avoid shadow declarations
Per GCC_WARN_SHADOW.
This commit is contained in:
@@ -387,8 +387,8 @@ private:
|
||||
innerPolygons = [NSMutableArray arrayWithCapacity:geometry.size() - 1];
|
||||
for (auto iter = geometry.begin() + 1; iter != geometry.end(); iter++) {
|
||||
auto &innerRing = *iter;
|
||||
std::vector<CLLocationCoordinate2D> coordinates = toLocationCoordinates2D(innerRing);
|
||||
MGLPolygon *innerPolygon = [MGLPolygon polygonWithCoordinates:&coordinates[0] count:coordinates.size()];
|
||||
std::vector<CLLocationCoordinate2D> innerCoordinates = toLocationCoordinates2D(innerRing);
|
||||
MGLPolygon *innerPolygon = [MGLPolygon polygonWithCoordinates:&innerCoordinates[0] count:innerCoordinates.size()];
|
||||
[innerPolygons addObject:innerPolygon];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,8 +449,8 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
|
||||
auto layers = self.rawStyle->getLayers();
|
||||
std::string siblingIdentifier = sibling.identifier.UTF8String;
|
||||
NSUInteger index = 0;
|
||||
for (auto layer : layers) {
|
||||
if (layer->getID() == siblingIdentifier) {
|
||||
for (auto siblingLayer : layers) {
|
||||
if (siblingLayer->getID() == siblingIdentifier) {
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
@@ -470,9 +470,9 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
|
||||
[NSException raise:MGLRedundantLayerIdentifierException format:@"%s", err.what()];
|
||||
}
|
||||
} else {
|
||||
MGLStyleLayer *sibling = [self layerFromMBGLLayer:layers.at(index + 1)];
|
||||
MGLStyleLayer *nextSibling = [self layerFromMBGLLayer:layers.at(index + 1)];
|
||||
try {
|
||||
[layer addToStyle:self belowLayer:sibling];
|
||||
[layer addToStyle:self belowLayer:nextSibling];
|
||||
} catch (std::runtime_error & err) {
|
||||
[NSException raise:MGLRedundantLayerIdentifierException format:@"%s", err.what()];
|
||||
}
|
||||
|
||||
@@ -1117,14 +1117,14 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) {
|
||||
format:@"Casting expression to %@ not yet implemented.", type];
|
||||
} else if ([function isEqualToString:@"MGL_FUNCTION"] ||
|
||||
[function isEqualToString:@"MGL_FUNCTION:"]) {
|
||||
NSExpression *op = self.arguments.firstObject;
|
||||
if (op.expressionType == NSConstantValueExpressionType
|
||||
&& [op.constantValue isEqualToString:@"collator"]) {
|
||||
NSExpression *firstOp = self.arguments.firstObject;
|
||||
if (firstOp.expressionType == NSConstantValueExpressionType
|
||||
&& [firstOp.constantValue isEqualToString:@"collator"]) {
|
||||
// Avoid wrapping collator options object in literal expression.
|
||||
return @[@"collator", self.arguments[1].constantValue];
|
||||
}
|
||||
if (op.expressionType == NSConstantValueExpressionType
|
||||
&& [op.constantValue isEqualToString:@"format"]) {
|
||||
if (firstOp.expressionType == NSConstantValueExpressionType
|
||||
&& [firstOp.constantValue isEqualToString:@"format"]) {
|
||||
// Avoid wrapping format options object in literal expression.
|
||||
return @[@"format", self.arguments[1].mgl_jsonExpressionObject, self.arguments[2].constantValue];
|
||||
}
|
||||
|
||||
@@ -375,8 +375,8 @@ using namespace std::string_literals;
|
||||
XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression);
|
||||
}
|
||||
{
|
||||
NSArray *arguments = @[MGLConstantExpression(@1), MGLConstantExpression(@1), MGLConstantExpression(@1)];
|
||||
NSExpression *expression = [NSExpression expressionForFunction:@"add:to:" arguments:arguments];
|
||||
NSArray *threeArguments = @[MGLConstantExpression(@1), MGLConstantExpression(@1), MGLConstantExpression(@1)];
|
||||
NSExpression *expression = [NSExpression expressionForFunction:@"add:to:" arguments:threeArguments];
|
||||
NSArray *jsonExpression = @[@"+", @1, @1, @1];
|
||||
XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression);
|
||||
jsonExpression = @[@"+", @[@"+", @1, @1], @1];
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include <mbgl/util/run_loop.hpp>
|
||||
|
||||
#pragma clang diagnostic ignored "-Wshadow"
|
||||
|
||||
@interface MGLOfflineStorageTests : XCTestCase <MGLOfflineStorageDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@@ -110,9 +110,9 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac
|
||||
[[MGLOfflineStorage sharedOfflineStorage] addPackForRegion:region withContext:context completionHandler:^(MGLOfflinePack *pack, NSError *error) {
|
||||
if (error) {
|
||||
NSString *message = [NSString stringWithFormat:@"Mapbox GL was unable to add the offline pack “%@”.", name];
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Can’t Add Offline Pack" message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
UIAlertController *errorAlertController = [UIAlertController alertControllerWithTitle:@"Can’t Add Offline Pack" message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
[errorAlertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
|
||||
[self presentViewController:errorAlertController animated:YES completion:nil];
|
||||
} else {
|
||||
[pack resume];
|
||||
}
|
||||
|
||||
@@ -1159,10 +1159,10 @@ CLLocationCoordinate2D randomWorldCoordinate() {
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:querySourceID features:visibleFeatures options:nil];
|
||||
[self.mapView.style addSource:source];
|
||||
MGLShapeSource *shapeSource = [[MGLShapeSource alloc] initWithIdentifier:querySourceID features:visibleFeatures options:nil];
|
||||
[self.mapView.style addSource:shapeSource];
|
||||
|
||||
MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:queryLayerID source:source];
|
||||
MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:queryLayerID source:shapeSource];
|
||||
fillLayer.fillColor = [NSExpression expressionForConstantValue:[UIColor blueColor]];
|
||||
fillLayer.fillOpacity = [NSExpression expressionForConstantValue:@0.5];
|
||||
[self.mapView.style addLayer:fillLayer];
|
||||
@@ -1264,10 +1264,10 @@ CLLocationCoordinate2D randomWorldCoordinate() {
|
||||
[self.mapView.style addLayer:layer];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSString *geoJSON = @"{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[-107.75390625,40.329795743702064],[-109.34814453125,37.64903402157866]]}}]}";
|
||||
NSData *data = [geoJSON dataUsingEncoding:NSUTF8StringEncoding];
|
||||
MGLShape *shape = [MGLShape shapeWithData:data encoding:NSUTF8StringEncoding error:NULL];
|
||||
source.shape = shape;
|
||||
NSString *updatedGeoJSON = @"{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[-107.75390625,40.329795743702064],[-109.34814453125,37.64903402157866]]}}]}";
|
||||
NSData *updatedData = [updatedGeoJSON dataUsingEncoding:NSUTF8StringEncoding];
|
||||
MGLShape *updatedShape = [MGLShape shapeWithData:updatedData encoding:NSUTF8StringEncoding error:NULL];
|
||||
source.shape = updatedShape;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1286,10 +1286,10 @@ CLLocationCoordinate2D randomWorldCoordinate() {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(41.563986787078704, -75.04843935793578) zoomLevel:8 animated:NO];
|
||||
|
||||
NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"threestates" ofType:@"geojson"];
|
||||
NSURL *geoJSONURL = [NSURL fileURLWithPath:filePath];
|
||||
NSString *threeStatesFilePath = [[NSBundle bundleForClass:self.class] pathForResource:@"threestates" ofType:@"geojson"];
|
||||
NSURL *updatedGeoJSONURL = [NSURL fileURLWithPath:threeStatesFilePath];
|
||||
|
||||
source.URL = geoJSONURL;
|
||||
source.URL = updatedGeoJSONURL;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -2148,24 +2148,23 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
NSString *title = NSLocalizedStringWithDefaultValue(@"SDK_NAME", nil, nil, @"Mapbox Maps SDK for iOS", @"Action sheet title");
|
||||
UIAlertController *attributionController = [UIAlertController alertControllerWithTitle:title
|
||||
NSString *actionSheetTitle = NSLocalizedStringWithDefaultValue(@"SDK_NAME", nil, nil, @"Mapbox Maps SDK for iOS", @"Action sheet title");
|
||||
UIAlertController *attributionController = [UIAlertController alertControllerWithTitle:actionSheetTitle
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
if (shouldShowVersion)
|
||||
{
|
||||
attributionController.title = [title stringByAppendingFormat:@" %@", [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"]];
|
||||
attributionController.title = [actionSheetTitle stringByAppendingFormat:@" %@", [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"]];
|
||||
}
|
||||
|
||||
NSArray *attributionInfos = [self.style attributionInfosWithFontSize:[UIFont buttonFontSize]
|
||||
linkColor:nil];
|
||||
for (MGLAttributionInfo *info in attributionInfos)
|
||||
{
|
||||
NSString *title = [info.title.string mgl_titleCasedStringWithLocale:[NSLocale currentLocale]];
|
||||
UIAlertAction *action = [UIAlertAction actionWithTitle:title
|
||||
UIAlertAction *action = [UIAlertAction actionWithTitle:[info.title.string mgl_titleCasedStringWithLocale:[NSLocale currentLocale]]
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
handler:^(UIAlertAction * _Nonnull actionBlock) {
|
||||
NSURL *url = info.URL;
|
||||
if (url)
|
||||
{
|
||||
@@ -2202,9 +2201,7 @@ public:
|
||||
attributionController.popoverPresentationController.sourceRect = self.attributionButton.frame;
|
||||
|
||||
UIViewController *viewController = [self.window.rootViewController mgl_topMostViewController];
|
||||
[viewController presentViewController:attributionController
|
||||
animated:YES
|
||||
completion:NULL];
|
||||
[viewController presentViewController:attributionController animated:YES completion:NULL];
|
||||
}
|
||||
|
||||
- (void)presentTelemetryAlertController
|
||||
@@ -2234,8 +2231,7 @@ public:
|
||||
UIAlertAction *moreAction = [UIAlertAction actionWithTitle:moreTitle
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIApplication sharedApplication] openURL:
|
||||
[NSURL URLWithString:@"https://www.mapbox.com/telemetry/"]];
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.mapbox.com/telemetry/"]];
|
||||
}];
|
||||
[alertController addAction:moreAction];
|
||||
|
||||
@@ -2254,9 +2250,7 @@ public:
|
||||
[alertController addAction:participateAction];
|
||||
|
||||
UIViewController *viewController = [self.window.rootViewController mgl_topMostViewController];
|
||||
[viewController presentViewController:alertController
|
||||
animated:YES
|
||||
completion:NULL];
|
||||
[viewController presentViewController:alertController animated:YES completion:NULL];
|
||||
}
|
||||
|
||||
#pragma mark - Properties -
|
||||
@@ -2740,8 +2734,8 @@ public:
|
||||
_featureAccessibilityElements = [NSMutableSet set];
|
||||
}
|
||||
|
||||
MGLFeatureAccessibilityElement *element = [_featureAccessibilityElements objectsPassingTest:^BOOL(MGLFeatureAccessibilityElement * _Nonnull element, BOOL * _Nonnull stop) {
|
||||
return element.feature.identifier && ![element.feature.identifier isEqual:@0] && [element.feature.identifier isEqual:feature.identifier];
|
||||
MGLFeatureAccessibilityElement *element = [_featureAccessibilityElements objectsPassingTest:^BOOL(MGLFeatureAccessibilityElement * _Nonnull testElement, BOOL * _Nonnull stop) {
|
||||
return testElement.feature.identifier && ![testElement.feature.identifier isEqual:@0] && [testElement.feature.identifier isEqual:feature.identifier];
|
||||
}].anyObject;
|
||||
if (!element)
|
||||
{
|
||||
@@ -2769,8 +2763,8 @@ public:
|
||||
_featureAccessibilityElements = [NSMutableSet set];
|
||||
}
|
||||
|
||||
MGLFeatureAccessibilityElement *element = [_featureAccessibilityElements objectsPassingTest:^BOOL(MGLFeatureAccessibilityElement * _Nonnull element, BOOL * _Nonnull stop) {
|
||||
return element.feature.identifier && ![element.feature.identifier isEqual:@0] && [element.feature.identifier isEqual:feature.identifier];
|
||||
MGLFeatureAccessibilityElement *element = [_featureAccessibilityElements objectsPassingTest:^BOOL(MGLFeatureAccessibilityElement * _Nonnull testElement, BOOL * _Nonnull stop) {
|
||||
return testElement.feature.identifier && ![testElement.feature.identifier isEqual:@0] && [testElement.feature.identifier isEqual:feature.identifier];
|
||||
}].anyObject;
|
||||
if (!element)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user