diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m index 16d15c4ffde..2c5930f004c 100644 --- a/platform/osx/app/MapDocument.m +++ b/platform/osx/app/MapDocument.m @@ -480,13 +480,13 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { return YES; } if (menuItem.action == @selector(dropPin:)) { - BOOL isOverAnnotation = [self.mapView annotationAtPoint:_mouseLocationForMapViewContextMenu]; - menuItem.hidden = isOverAnnotation; + id annotationUnderCursor = [self.mapView annotationAtPoint:_mouseLocationForMapViewContextMenu]; + menuItem.hidden = annotationUnderCursor != nil; return YES; } if (menuItem.action == @selector(removePin:)) { - BOOL isOverAnnotation = [self.mapView annotationAtPoint:_mouseLocationForMapViewContextMenu]; - menuItem.hidden = !isOverAnnotation; + id annotationUnderCursor = [self.mapView annotationAtPoint:_mouseLocationForMapViewContextMenu]; + menuItem.hidden = annotationUnderCursor == nil; return YES; } if (menuItem.action == @selector(toggleTileBoundaries:)) { @@ -647,7 +647,7 @@ - (MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id )delegate { _delegateHasFillColorsForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:fillColorForPolygonAnnotation:)]; _delegateHasLineWidthsForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:lineWidthForPolylineAnnotation:)]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" if ([self.delegate respondsToSelector:@selector(mapView:regionWillChangeAnimated:)]) { NSLog(@"-mapView:regionWillChangeAnimated: is not supported by the OS X SDK, but %@ implements it anyways. " @"Please implement -[%@ mapView:cameraWillChangeAnimated:] instead.", @@ -496,6 +498,7 @@ - (void)setDelegate:(id)delegate { @"Please implement -[%@ mapView:cameraDidChangeAnimated:] instead.", NSStringFromClass([delegate class]), NSStringFromClass([delegate class])); } +#pragma clang diagnostic pop } #pragma mark Style @@ -2109,10 +2112,8 @@ - (void)updateAnnotationTrackingAreas { } - (NSString *)view:(__unused NSView *)view stringForToolTip:(__unused NSToolTipTag)tag point:(__unused NSPoint)point userData:(void *)data { - if ((NSUInteger)data >= MGLAnnotationTagNotFound) { - return nil; - } - MGLAnnotationTag annotationTag = (NSUInteger)data; + NSAssert((NSUInteger)data < MGLAnnotationTagNotFound, @"Invalid annotation tag in tooltip rect user data."); + MGLAnnotationTag annotationTag = (MGLAnnotationTag)MIN((NSUInteger)data, MGLAnnotationTagNotFound); id annotation = [self annotationWithTag:annotationTag]; return annotation.toolTip; } @@ -2332,7 +2333,7 @@ void deactivate() override { mbgl::PremultipliedImage image { w, h }; MBGL_CHECK_ERROR(glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, image.data.get())); - const int stride = image.stride(); + const size_t stride = image.stride(); auto tmp = std::make_unique(stride); uint8_t *rgba = image.data.get(); for (int i = 0, j = h - 1; i < j; i++, j--) {