Permalink
Browse files

Make if block more sensible

  • Loading branch information...
1 parent 4198d44 commit ca362996f2df3ee0b624096c76a93aaf5aa2d3b4 @dmcdougall committed Sep 11, 2012
Showing with 18 additions and 20 deletions.
  1. +18 −20 src/_macosx.m
View
@@ -3559,28 +3559,26 @@ static void _data_provider_release(void* info, const void* data, size_t size)
[rep setSize:newSize];
- if (! [extension isEqualToString: @"tiff"] &&
- ! [extension isEqualToString: @"tif"])
- {
- NSBitmapImageFileType filetype;
- if ([extension isEqualToString: @"bmp"])
- filetype = NSBMPFileType;
- else if ([extension isEqualToString: @"gif"])
- filetype = NSGIFFileType;
- else if ([extension isEqualToString: @"jpg"] ||
- [extension isEqualToString: @"jpeg"])
- filetype = NSJPEGFileType;
- else if ([extension isEqualToString: @"png"])
- filetype = NSPNGFileType;
- else
- { PyErr_SetString(PyExc_ValueError, "Unknown file type");
- return NULL;
- }
-
- data = [rep representationUsingType:filetype properties:nil];
+ NSBitmapImageFileType filetype;
+ if ([extension isEqualToString: @"bmp"])
+ filetype = NSBMPFileType;
+ else if ([extension isEqualToString: @"gif"])
+ filetype = NSGIFFileType;
+ else if ([extension isEqualToString: @"jpg"] ||
+ [extension isEqualToString: @"jpeg"])
+ filetype = NSJPEGFileType;
+ else if ([extension isEqualToString: @"png"])
+ filetype = NSPNGFileType;
+ else if ([extension isEqualToString: @"tiff"] ||
+ [extension isEqualToString: @"tif"])
+ filetype = NSTIFFFileType;
+ else
+ { PyErr_SetString(PyExc_ValueError, "Unknown file type");
+ return NULL;
}
- data = [rep representationUsingType:NSTIFFFileType properties:nil];
+ data = [rep representationUsingType:filetype properties:nil];
+
[data writeToFile: filename atomically: YES];
[pool release];

0 comments on commit ca36299

Please sign in to comment.