summaryrefslogtreecommitdiff
path: root/platform/ios/Classes
diff options
context:
space:
mode:
authorMatt Holgate <matt@emobix.co.uk>2014-06-26 11:11:52 +0100
committerMatt Holgate <matt@emobix.co.uk>2014-06-26 11:58:35 +0100
commitca43cfebcad7fef14b954e9b300e5bf818bfe4c5 (patch)
treebbcdebe6d1488fda59e6d08d7087c0cf161f8493 /platform/ios/Classes
parente8f0394761e24ad1cdb143aa40e5594e93a97f0b (diff)
downloadmupdf-ca43cfebcad7fef14b954e9b300e5bf818bfe4c5.tar.xz
Fix various Xcode analyzer warnings.
Most were pretty harmless, and were addressed by renaming functions to match the Core Foundation naming conventions, but there was one actual memory leak, and some potential uses of uninitialised data.
Diffstat (limited to 'platform/ios/Classes')
-rw-r--r--platform/ios/Classes/MuDocumentController.m39
-rw-r--r--platform/ios/Classes/MuPageViewNormal.m20
-rw-r--r--platform/ios/Classes/MuPrintPageRenderer.m4
3 files changed, 33 insertions, 30 deletions
diff --git a/platform/ios/Classes/MuDocumentController.m b/platform/ios/Classes/MuDocumentController.m
index 8e49c27f..5dae4a52 100644
--- a/platform/ios/Classes/MuDocumentController.m
+++ b/platform/ios/Classes/MuDocumentController.m
@@ -157,7 +157,7 @@ static void saveDoc(char *current_path, fz_document *doc)
return self;
}
-- (UIBarButtonItem *) resourceBasedButton:(NSString *)resource withAction:(SEL)selector
+- (UIBarButtonItem *) newResourceBasedButton:(NSString *)resource withAction:(SEL)selector
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
@@ -246,26 +246,26 @@ static void saveDoc(char *current_path, fz_document *doc)
// Set up the buttons on the navigation and search bar
if (outline) {
- outlineButton = [self resourceBasedButton:@"ic_list" withAction:@selector(onShowOutline:)];
+ outlineButton = [self newResourceBasedButton:@"ic_list" withAction:@selector(onShowOutline:)];
}
- linkButton = [self resourceBasedButton:@"ic_link" withAction:@selector(onToggleLinks:)];
- cancelButton = [self resourceBasedButton:@"ic_cancel" withAction:@selector(onCancel:)];
- searchButton = [self resourceBasedButton:@"ic_magnifying_glass" withAction:@selector(onShowSearch:)];
- prevButton = [self resourceBasedButton:@"ic_arrow_left" withAction:@selector(onSearchPrev:)];
- nextButton = [self resourceBasedButton:@"ic_arrow_right" withAction:@selector(onSearchNext:)];
- reflowButton = [self resourceBasedButton:@"ic_reflow" withAction:@selector(onToggleReflow:)];
- moreButton = [self resourceBasedButton:@"ic_more" withAction:@selector(onMore:)];
- annotButton = [self resourceBasedButton:@"ic_annotation" withAction:@selector(onAnnot:)];
- shareButton = [self resourceBasedButton:@"ic_share" withAction:@selector(onShare:)];
- printButton = [self resourceBasedButton:@"ic_print" withAction:@selector(onPrint:)];
- highlightButton = [self resourceBasedButton:@"ic_highlight" withAction:@selector(onHighlight:)];
- underlineButton = [self resourceBasedButton:@"ic_underline" withAction:@selector(onUnderline:)];
- strikeoutButton = [self resourceBasedButton:@"ic_strike" withAction:@selector(onStrikeout:)];
- inkButton = [self resourceBasedButton:@"ic_pen" withAction:@selector(onInk:)];
- tickButton = [self resourceBasedButton:@"ic_check" withAction:@selector(onTick:)];
- deleteButton = [self resourceBasedButton:@"ic_trash" withAction:@selector(onDelete:)];
+ linkButton = [self newResourceBasedButton:@"ic_link" withAction:@selector(onToggleLinks:)];
+ cancelButton = [self newResourceBasedButton:@"ic_cancel" withAction:@selector(onCancel:)];
+ searchButton = [self newResourceBasedButton:@"ic_magnifying_glass" withAction:@selector(onShowSearch:)];
+ prevButton = [self newResourceBasedButton:@"ic_arrow_left" withAction:@selector(onSearchPrev:)];
+ nextButton = [self newResourceBasedButton:@"ic_arrow_right" withAction:@selector(onSearchNext:)];
+ reflowButton = [self newResourceBasedButton:@"ic_reflow" withAction:@selector(onToggleReflow:)];
+ moreButton = [self newResourceBasedButton:@"ic_more" withAction:@selector(onMore:)];
+ annotButton = [self newResourceBasedButton:@"ic_annotation" withAction:@selector(onAnnot:)];
+ shareButton = [self newResourceBasedButton:@"ic_share" withAction:@selector(onShare:)];
+ printButton = [self newResourceBasedButton:@"ic_print" withAction:@selector(onPrint:)];
+ highlightButton = [self newResourceBasedButton:@"ic_highlight" withAction:@selector(onHighlight:)];
+ underlineButton = [self newResourceBasedButton:@"ic_underline" withAction:@selector(onUnderline:)];
+ strikeoutButton = [self newResourceBasedButton:@"ic_strike" withAction:@selector(onStrikeout:)];
+ inkButton = [self newResourceBasedButton:@"ic_pen" withAction:@selector(onInk:)];
+ tickButton = [self newResourceBasedButton:@"ic_check" withAction:@selector(onTick:)];
+ deleteButton = [self newResourceBasedButton:@"ic_trash" withAction:@selector(onDelete:)];
searchBar = [[UISearchBar alloc] initWithFrame: CGRectMake(0,0,50,32)];
- backButton = [self resourceBasedButton:@"ic_arrow_left" withAction:@selector(onBack:)];
+ backButton = [self newResourceBasedButton:@"ic_arrow_left" withAction:@selector(onBack:)];
[searchBar setPlaceholder: @"Search"];
[searchBar setDelegate: self];
@@ -530,6 +530,7 @@ static void saveDoc(char *current_path, fz_document *doc)
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:filePath]];
UIActivityViewController *cont = [[UIActivityViewController alloc] initWithActivityItems:[NSArray arrayWithObject:url] applicationActivities:nil];
[self presentViewController:cont animated:YES completion:nil];
+ [cont release];
}
- (void) onShare: (id)sender
diff --git a/platform/ios/Classes/MuPageViewNormal.m b/platform/ios/Classes/MuPageViewNormal.m
index 1cf2023d..a339df45 100644
--- a/platform/ios/Classes/MuPageViewNormal.m
+++ b/platform/ios/Classes/MuPageViewNormal.m
@@ -13,7 +13,7 @@
static UIImage *newImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata)
{
- CGImageRef cgimage = newCGImageWithPixmap(pix, cgdata);
+ CGImageRef cgimage = CreateCGImageWithPixmap(pix, cgdata);
UIImage *image = [[UIImage alloc] initWithCGImage: cgimage scale: screenScale orientation: UIImageOrientationUp];
CGImageRelease(cgimage);
return image;
@@ -45,7 +45,6 @@ static NSArray *enumerateWidgetRects(fz_document *doc, fz_page *page)
static NSArray *enumerateAnnotations(fz_document *doc, fz_page *page)
{
- pdf_document *idoc = pdf_specifics(doc);
fz_annot *annot;
NSMutableArray *arr = [NSMutableArray arrayWithCapacity:10];
@@ -190,6 +189,9 @@ static void addMarkupAnnot(fz_document *doc, fz_page *page, int type, NSArray *r
line_thickness = LINE_THICKNESS;
line_height = STRIKE_HEIGHT;
break;
+
+ default:
+ return;
}
fz_var(quadpts);
@@ -316,7 +318,7 @@ static void deleteAnnotation(fz_document *doc, fz_page *page, int index)
static int setFocussedWidgetText(fz_document *doc, fz_page *page, const char *text)
{
- int accepted;
+ int accepted = 0;
fz_try(ctx)
{
@@ -340,7 +342,7 @@ static int setFocussedWidgetText(fz_document *doc, fz_page *page, const char *te
static int setFocussedWidgetChoice(fz_document *doc, fz_page *page, const char *text)
{
- int accepted;
+ int accepted = 0;
fz_try(ctx)
{
@@ -365,7 +367,7 @@ static int setFocussedWidgetChoice(fz_document *doc, fz_page *page, const char *
static fz_display_list *create_page_list(fz_document *doc, fz_page *page)
{
- fz_display_list *list;
+ fz_display_list *list = NULL;
fz_device *dev = NULL;
fz_var(dev);
@@ -389,7 +391,7 @@ static fz_display_list *create_page_list(fz_document *doc, fz_page *page)
static fz_display_list *create_annot_list(fz_document *doc, fz_page *page)
{
- fz_display_list *list;
+ fz_display_list *list = NULL;
fz_device *dev = NULL;
fz_var(dev);
@@ -891,7 +893,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
CGRect rect = (CGRect){{0.0, 0.0},{pageSize.width * scale.width, pageSize.height * scale.height}};
image_pix = renderPixmap(doc, page_list, annot_list, pageSize, self.bounds.size, rect, 1.0);
CGDataProviderRelease(imageData);
- imageData = wrapPixmap(image_pix);
+ imageData = CreateWrappedPixmap(image_pix);
UIImage *image = newImageWithPixmap(image_pix, imageData);
widgetRects = enumerateWidgetRects(doc, page);
[self loadAnnotations];
@@ -1060,7 +1062,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
printf("render tile\n");
tile_pix = renderPixmap(doc, page_list, annot_list, pageSize, screenSize, viewFrame, scale);
CGDataProviderRelease(tileData);
- tileData = wrapPixmap(tile_pix);
+ tileData = CreateWrappedPixmap(tile_pix);
UIImage *image = newImageWithPixmap(tile_pix, tileData);
dispatch_async(dispatch_get_main_queue(), ^{
@@ -1234,7 +1236,7 @@ static void updatePixmap(fz_document *doc, fz_display_list *page_list, fz_displa
char *text = NULL;
if (!idoc)
- return;
+ return 0;
fz_var(opts);
fz_var(text);
diff --git a/platform/ios/Classes/MuPrintPageRenderer.m b/platform/ios/Classes/MuPrintPageRenderer.m
index ba452d6b..9a396df7 100644
--- a/platform/ios/Classes/MuPrintPageRenderer.m
+++ b/platform/ios/Classes/MuPrintPageRenderer.m
@@ -168,11 +168,11 @@ static void renderPage(fz_document *doc, fz_page *page, fz_pixmap *pix, fz_matri
if (!pix)
goto exit;
- dataref = wrapPixmap(pix);
+ dataref = CreateWrappedPixmap(pix);
if (dataref == NULL)
goto exit;
- img = newCGImageWithPixmap(pix, dataref);
+ img = CreateCGImageWithPixmap(pix, dataref);
if (img == NULL)
goto exit;