Skip to content

Fix some warnings by adding explicit typecasts #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions UIImage+PDF/UIImage+PDF.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ +(UIImage *)imageWithPDFData:(NSData *)data atWidth:(CGFloat)width atPage:(NSUIn

CGRect mediaRect = [ PDFView mediaRectForData:data atPage:page ];
CGFloat aspectRatio = mediaRect.size.width / mediaRect.size.height;
CGSize size = CGSizeMake( width, ceil( width / aspectRatio ));
CGSize size = CGSizeMake( width, (CGFloat) ceil( width / aspectRatio ));

return [ UIImage imageWithPDFData:data atSize:size atPage:page ];
}
Expand All @@ -210,7 +210,7 @@ +(UIImage *)imageWithPDFData:(NSData *)data atHeight:(CGFloat)height atPage:(NSU

CGRect mediaRect = [ PDFView mediaRectForData:data atPage:page ];
CGFloat aspectRatio = mediaRect.size.width / mediaRect.size.height;
CGSize size = CGSizeMake( ceil( height * aspectRatio ), height );
CGSize size = CGSizeMake( (CGFloat) ceil( height * aspectRatio ), height );

return [ UIImage imageWithPDFData:data atSize:size atPage:page ];
}
Expand Down Expand Up @@ -251,7 +251,7 @@ +(UIImage *)imageWithPDFData:(NSData *)data atSize:(CGSize)size atPage:(NSUInteg
else
{
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(NULL, size.width * screenScale, size.height * screenScale, 8, 0, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
CGContextRef ctx = CGBitmapContextCreate(NULL, (size_t)(size.width * screenScale), (size_t)(size.height * screenScale), 8, 0, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
CGContextScaleCTM(ctx, screenScale, screenScale);

[PDFView renderIntoContext:ctx url:nil data:data size:size page:page preserveAspectRatio:preserveAspectRatio];
Expand Down Expand Up @@ -305,7 +305,7 @@ +(UIImage *) imageWithPDFURL:(NSURL *)URL atSize:(CGSize)size atPage:(NSUInteger
else
{
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx = CGBitmapContextCreate(NULL, size.width * screenScale, size.height * screenScale, 8, 0, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
CGContextRef ctx = CGBitmapContextCreate(NULL, (size_t)(size.width * screenScale), (size_t)(size.height * screenScale), 8, 0, colorSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst);
CGContextScaleCTM(ctx, screenScale, screenScale);

[PDFView renderIntoContext:ctx url:URL data:nil size:size page:page preserveAspectRatio:preserveAspectRatio];
Expand Down Expand Up @@ -353,7 +353,7 @@ +(UIImage *) imageWithPDFURL:(NSURL *)URL atWidth:(CGFloat)width atPage:(NSUInte
CGRect mediaRect = [ PDFView mediaRectForURL:URL atPage:page ];
CGFloat aspectRatio = mediaRect.size.width / mediaRect.size.height;

CGSize size = CGSizeMake( width, ceil( width / aspectRatio ));
CGSize size = CGSizeMake( width, (CGFloat) ceil( width / aspectRatio ));

return [ UIImage imageWithPDFURL:URL atSize:size atPage:page ];
}
Expand All @@ -372,7 +372,7 @@ +(UIImage *) imageWithPDFURL:(NSURL *)URL atHeight:(CGFloat)height atPage:(NSUIn
CGRect mediaRect = [ PDFView mediaRectForURL:URL atPage:page ];
CGFloat aspectRatio = mediaRect.size.width / mediaRect.size.height;

CGSize size = CGSizeMake( ceil( height * aspectRatio ), height );
CGSize size = CGSizeMake( (CGFloat) ceil( height * aspectRatio ), height );

return [ UIImage imageWithPDFURL:URL atSize:size atPage:page ];
}
Expand Down