Skip to content
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 XADPDFParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#import "CSMultiHandle.h"
#import "XADLZMAHandle.h"

static int SortPages(id first,id second,void *context);
static NSComparisonResult SortPages(id first,id second,void *context);

static NSDictionary *TIFFShortEntry(int tag,int value);
static NSDictionary *TIFFLongEntry(int tag,int value);
Expand Down Expand Up @@ -121,7 +121,7 @@ -(void)parse
}

// Sort images in page order.
[images sortUsingFunction:(void *)SortPages context:order];
[images sortUsingFunction:SortPages context:order];

// Output images.
enumerator=[images objectEnumerator];
Expand Down Expand Up @@ -457,14 +457,14 @@ -(NSString *)formatName { return @"PDF"; }



static int SortPages(id first,id second,void *context)
static NSComparisonResult SortPages(id first,id second,void *context)
{
NSDictionary *order=(NSDictionary *)context;
NSNumber *firstpage=[order objectForKey:[first reference]];
NSNumber *secondpage=[order objectForKey:[second reference]];
if(!firstpage&&!secondpage) return 0;
else if(!firstpage) return 1;
else if(!secondpage) return -1;
if(!firstpage&&!secondpage) return NSOrderedSame;
else if(!firstpage) return NSOrderedDescending;
else if(!secondpage) return NSOrderedAscending;
else return [firstpage compare:secondpage];
}

Expand Down