Corrected image rep casting, fixing several warnings adium-1.5.10.5
authorEvan Schoenberg
Thu, 14 Nov 2019 16:23:07 -0500
branchadium-1.5.10.5
changeset 5998 c1c33c0ba53a
parent 5997 d88e6711d0e0
child 5999 91f7da2a2338
Corrected image rep casting, fixing several warnings
Frameworks/AIUtilities Framework/Source/AIImageAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIImageAdditions.m	Thu Nov 14 16:22:42 2019 -0500
+++ b/Frameworks/AIUtilities Framework/Source/AIImageAdditions.m	Thu Nov 14 16:23:07 2019 -0500
@@ -232,7 +232,7 @@
 	/* PNG is easy; it supports everything TIFF does, and NSImage's PNG support is great. */
 	NSBitmapImageRep *bitmapRep =  [self largestBitmapImageRep];
 
-	return ([bitmapRep representationUsingType:NSPNGFileType properties:nil]);
+    return ([bitmapRep representationUsingType:NSPNGFileType properties:[NSDictionary dictionary]]);
 }
 
 - (NSData *)GIFRepresentation
@@ -240,9 +240,11 @@
 	// GIF requires special treatment, as Apple doesn't allow you to save animations.
 	
 	NSMutableData *GIFRepresentation = nil;
-	NSBitmapImageRep *bitmap = [[self representations] objectAtIndex:0];
-	
-	if (bitmap && [bitmap isKindOfClass:[NSBitmapImageRep class]]) {
+	NSImageRep *imageRep = [[self representations] objectAtIndex:0];
+    NSBitmapImageRep *bitmap = nil;
+    
+	if (imageRep && [imageRep isKindOfClass:[NSBitmapImageRep class]]) {
+        bitmap = (NSBitmapImageRep *)bitmap;
 		unsigned frameCount = [[bitmap valueForProperty:NSImageFrameCount] intValue];
 		
 		if (!frameCount) {
@@ -258,7 +260,8 @@
 				// Set current frame
 				[bitmap setProperty:NSImageCurrentFrame withValue:[NSNumber numberWithUnsignedInt:i]];
 				// Add frame representation
-				[images addObject:[NSBitmapImageRep imageRepWithData:[bitmap representationUsingType:NSGIFFileType properties:nil]]];
+                [images addObject:[NSBitmapImageRep imageRepWithData:[bitmap representationUsingType:NSGIFFileType
+                                                                                          properties:[NSDictionary dictionary]]]];
 			}
 			
 			GIFRepresentation = [NSMutableData dataWithData:[NSBitmapImageRep representationOfImageRepsInArray:images
@@ -279,7 +282,7 @@
 	 * before creating our representation or transparent parts will become black. White is preferable.
 	 */
 
-	return ([[self opaqueBitmapImageRep] representationUsingType:NSBMPFileType properties:nil]);
+    return ([[self opaqueBitmapImageRep] representationUsingType:NSBMPFileType properties:@{}]);
 }
 
 /*!
@@ -288,11 +291,11 @@
 - (NSData *)bestRepresentationByType
 {
 	NSData *data = nil;
-	NSBitmapImageRep *bitmap = nil;
+	NSImageRep *bitmap = nil;
 	
 	if ((bitmap = [[self representations] objectAtIndex:0]) &&
 		[bitmap isKindOfClass:[NSBitmapImageRep class]] &&
-		([[bitmap valueForProperty:NSImageFrameCount] intValue] > 1)) {
+		([[(NSBitmapImageRep *)bitmap valueForProperty:NSImageFrameCount] intValue] > 1)) {
 		data = [self GIFRepresentation];
 	} else {
 		data = [self PNGRepresentation];
@@ -332,7 +335,7 @@
 	if (!imageRep)
 		return nil;
 	
-	NSData *data = [imageRep representationUsingType:fileType properties:nil];
+	NSData *data = [imageRep representationUsingType:fileType properties:@{}];
 	
 	// If no maximum size, return the base representation.
 	if (!maximumSize)
@@ -369,7 +372,7 @@
 		imageRep = newImageRep;
 		
 		// Grab a new representation
-		data = [imageRep representationUsingType:fileType properties:nil];
+		data = [imageRep representationUsingType:fileType properties:@{}];
 	}
 	
 	return data;