Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Fixes for static analyzer warnings #1425

Merged
merged 6 commits into from
May 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions platform/darwin/http_request_nsurl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@

@autoreleasepool {

NSMutableString *url = [[NSMutableString alloc] initWithString:@(resource.url.c_str())];
NSMutableString *url = [NSMutableString stringWithString:@(resource.url.c_str())];
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"mapbox_metrics_disabled"] == nil) {
if ([url rangeOfString:@"?"].location == NSNotFound) {
[url appendString:@"?"];
Expand All @@ -163,8 +163,7 @@
[url appendString:@"events=true"];
}

NSMutableURLRequest *req = [[NSMutableURLRequest alloc]
initWithURL:[NSURL URLWithString:url]];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
if (existingResponse) {
if (!existingResponse->etag.empty()) {
[req addValue:@(existingResponse->etag.c_str()) forHTTPHeaderField:@"If-None-Match"];
Expand All @@ -179,7 +178,6 @@
task = [context->session dataTaskWithRequest:req
completionHandler:^(NSData *data, NSURLResponse *res,
NSError *error) { handleResult(data, res, error); }];
[req release];
[task retain];
[task resume];
}
Expand Down
9 changes: 3 additions & 6 deletions platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1079,22 +1079,19 @@ - (void)handleDoubleTapGesture:(UITapGestureRecognizer *)doubleTap
{
CGPoint doubleTapPoint = [doubleTap locationInView:doubleTap.view];

CGPoint zoomInPoint;

CGPoint zoomInPoint = doubleTapPoint;
CGPoint userPoint = [self convertCoordinate:self.userLocation.coordinate toPointToView:self];
if (self.userTrackingMode != MGLUserTrackingModeNone)
{
CGPoint userPoint = [self convertCoordinate:self.userLocation.coordinate toPointToView:self];
CGRect userLocationRect = CGRectMake(userPoint.x - 40, userPoint.y - 40, 80, 80);
if (CGRectContainsPoint(userLocationRect, doubleTapPoint))
{
zoomInPoint = userPoint;
}
}
else
if ( ! CGPointEqualToPoint(zoomInPoint, userPoint))
{
self.userTrackingMode = MGLUserTrackingModeNone;

zoomInPoint = doubleTapPoint;
}

_mbglMap->scaleBy(2, zoomInPoint.x, zoomInPoint.y, secondsAsDuration(MGLAnimationDuration));
Expand Down
4 changes: 2 additions & 2 deletions platform/ios/MGLMapboxEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,11 @@ - (NSString *) getWifiNetworkName {
NSString *ssid = nil;
CFArrayRef interfaces = CNCopySupportedInterfaces();
if (interfaces) {
NSDictionary *info = (__bridge NSDictionary *)CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(interfaces, 0));
NSDictionary *info = CFBridgingRelease(CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(interfaces, 0)));
if (info) {
ssid = info[@"SSID"];
}
CFRelease(interfaces);
}

return ssid;
Expand Down Expand Up @@ -699,7 +700,6 @@ - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticat
if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {

SecTrustRef serverTrust = [[challenge protectionSpace] serverTrust];
NSString *domain = [[challenge protectionSpace] host];
SecTrustResultType trustResult;

// Validate the certificate chain with the device's trust store anyway
Expand Down
17 changes: 0 additions & 17 deletions platform/ios/MGLMetricsLocationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,34 +89,17 @@ - (void)locationManager:(CLLocationManager *)manager didVisit:(CLVisit *)visit {
}

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
NSString *newStatus = nil;
switch (status) {
case kCLAuthorizationStatusNotDetermined:
newStatus = @"User Hasn't Determined Yet";
break;
case kCLAuthorizationStatusRestricted:
newStatus = @"Restricted and Can't Be Changed By User";
break;
case kCLAuthorizationStatusDenied:
newStatus = @"User Explcitly Denied";
[self stopUpdatingLocation];
[self stopMonitoringVisits];
break;
case kCLAuthorizationStatusAuthorized:
newStatus = @"User Has Authorized / Authorized Always";
[self startUpdatingLocation];
[self startMonitoringVisits];
break;
// case kCLAuthorizationStatusAuthorizedAlways:
// newStatus = @"Not Determined";
// break;
case kCLAuthorizationStatusAuthorizedWhenInUse:
newStatus = @"User Has Authorized When In Use Only";
[self startUpdatingLocation];
[self startMonitoringVisits];
break;
default:
newStatus = @"Unknown";
break;
}
}
Expand Down