summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/Classes/MuDocumentController.m39
-rw-r--r--platform/ios/Classes/MuPageViewNormal.m20
-rw-r--r--platform/ios/Classes/MuPrintPageRenderer.m4
-rw-r--r--platform/ios/common.h4
-rw-r--r--platform/ios/common.m4
5 files changed, 37 insertions, 34 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;
diff --git a/platform/ios/common.h b/platform/ios/common.h
index 672ea119..dcef5b22 100644
--- a/platform/ios/common.h
+++ b/platform/ios/common.h
@@ -20,8 +20,8 @@ int search_page(fz_document *doc, int number, char *needle, fz_cookie *cookie);
fz_rect search_result_bbox(fz_document *doc, int i);
-CGDataProviderRef wrapPixmap(fz_pixmap *pix);
+CGDataProviderRef CreateWrappedPixmap(fz_pixmap *pix);
-CGImageRef newCGImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata);
+CGImageRef CreateCGImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata);
#endif
diff --git a/platform/ios/common.m b/platform/ios/common.m
index 1ef17c03..f4a1676d 100644
--- a/platform/ios/common.m
+++ b/platform/ios/common.m
@@ -53,7 +53,7 @@ static void releasePixmap(void *info, const void *data, size_t size)
}
}
-CGDataProviderRef wrapPixmap(fz_pixmap *pix)
+CGDataProviderRef CreateWrappedPixmap(fz_pixmap *pix)
{
unsigned char *samples = fz_pixmap_samples(ctx, pix);
int w = fz_pixmap_width(ctx, pix);
@@ -61,7 +61,7 @@ CGDataProviderRef wrapPixmap(fz_pixmap *pix)
return CGDataProviderCreateWithData(pix, samples, w * 4 * h, releasePixmap);
}
-CGImageRef newCGImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata)
+CGImageRef CreateCGImageWithPixmap(fz_pixmap *pix, CGDataProviderRef cgdata)
{
int w = fz_pixmap_width(ctx, pix);
int h = fz_pixmap_height(ctx, pix);