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

Commit

Permalink
[osx] Fixed type mismatch and selector warnings
Browse files Browse the repository at this point in the history
Fixed some issues that were obscured by the old gyp-generated build settings.
  • Loading branch information
1ec5 committed Apr 17, 2016
1 parent 1576953 commit 6da746a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions platform/osx/app/MapDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 <MGLAnnotation> 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 <MGLAnnotation> annotationUnderCursor = [self.mapView annotationAtPoint:_mouseLocationForMapViewContextMenu];
menuItem.hidden = annotationUnderCursor == nil;
return YES;
}
if (menuItem.action == @selector(toggleTileBoundaries:)) {
Expand Down Expand Up @@ -647,7 +647,7 @@ - (MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MG
[NSCursor dragCopyCursor],
[NSCursor contextualMenuCursor],
];
annotationImage.cursor = cursors[arc4random_uniform(cursors.count)];
annotationImage.cursor = cursors[arc4random_uniform((uint32_t)cursors.count) % cursors.count];
} else {
annotationImage.cursor = nil;
}
Expand Down
11 changes: 6 additions & 5 deletions platform/osx/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ - (void)setDelegate:(id<MGLMapViewDelegate>)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.",
Expand All @@ -496,6 +498,7 @@ - (void)setDelegate:(id<MGLMapViewDelegate>)delegate {
@"Please implement -[%@ mapView:cameraDidChangeAnimated:] instead.",
NSStringFromClass([delegate class]), NSStringFromClass([delegate class]));
}
#pragma clang diagnostic pop
}

#pragma mark Style
Expand Down Expand Up @@ -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 <MGLAnnotation> annotation = [self annotationWithTag:annotationTag];
return annotation.toolTip;
}
Expand Down Expand Up @@ -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<uint8_t[]>(stride);
uint8_t *rgba = image.data.get();
for (int i = 0, j = h - 1; i < j; i++, j--) {
Expand Down

0 comments on commit 6da746a

Please sign in to comment.