diff options
-rw-r--r-- | osdep/macosx_application.m | 3 | ||||
-rw-r--r-- | video/out/cocoa_common.m | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index ca613e04f4..086d51fef3 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -127,8 +127,9 @@ static const char macosx_icon[] = - (NSImage *)getMPVIcon { + // The C string contains a trailing null, so we strip it away NSData *icon_data = [NSData dataWithBytesNoCopy:(void *)macosx_icon - length:sizeof(macosx_icon) + length:sizeof(macosx_icon) - 1 freeWhenDone:NO]; return [[NSImage alloc] initWithData:icon_data]; } diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index abead0fb53..b4283bbe8d 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -172,8 +172,10 @@ static void set_application_icon(NSApplication *app) NSBundle *bundle = [NSBundle mainBundle]; if ([bundle pathForResource:@"icon" ofType:@"icns"]) return; + + // The C string contains a trailing null, so we strip it away NSData *icon_data = [NSData dataWithBytesNoCopy:(void *)macosx_icon - length:sizeof(macosx_icon) + length:sizeof(macosx_icon) - 1 freeWhenDone:NO]; NSImage *icon = [[NSImage alloc] initWithData:icon_data]; [app setApplicationIconImage:icon]; |