├── .gitignore ├── Divisé.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ ├── matty.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings │ │ └── samgardner.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── cryptic.xcuserdatad │ └── xcschemes │ │ └── xcschememanagement.plist │ ├── matty.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ └── xcschememanagement.plist │ └── samgardner.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── Divisé ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── 4pplecracker.imageset │ │ ├── 4pplecracker.png │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ ├── 100.png │ │ ├── 1024.png │ │ ├── 114.png │ │ ├── 120.png │ │ ├── 144.png │ │ ├── 152.png │ │ ├── 167.png │ │ ├── 180.png │ │ ├── 20.png │ │ ├── 29.png │ │ ├── 40.png │ │ ├── 50.png │ │ ├── 57.png │ │ ├── 58.png │ │ ├── 60.png │ │ ├── 72.png │ │ ├── 76.png │ │ ├── 80.png │ │ ├── 87.png │ │ └── Contents.json │ ├── Contents.json │ ├── Halo-Michael.imageset │ │ ├── Contents.json │ │ └── Halo-Michael.png │ ├── Midnightchip.imageset │ │ ├── Contents.json │ │ └── Midnightchip.png │ ├── PsychoTea.imageset │ │ ├── Contents.json │ │ └── PsychoTea.png │ ├── cryptiiiic.imageset │ │ ├── Contents.json │ │ └── cryptiiiic.png │ ├── hawk.imageset │ │ ├── Contents.json │ │ └── hawk.png │ ├── matty.imageset │ │ ├── Contents.json │ │ └── matty.png │ ├── pwn20wnd.imageset │ │ ├── Contents.json │ │ └── pwn20wnd.png │ ├── samgisaninja.imageset │ │ ├── Contents.json │ │ └── samgisaninja.png │ ├── sbingner.imageset │ │ ├── Contents.json │ │ ├── sbingner-1.jpg │ │ ├── sbingner-2.jpg │ │ └── sbingner.jpg │ ├── swaggo.imageset │ │ ├── Contents.json │ │ └── swaggo.png │ ├── uroboro.imageset │ │ ├── Contents.json │ │ └── uroboro.png │ ├── xTM3x.imageset │ │ ├── Contents.json │ │ └── xTM3x.jpg │ └── xerusdesign.imageset │ │ ├── Contents.json │ │ └── xerusdesign.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── DecryptViewController.h ├── DecryptViewController.m ├── DownloadViewController.h ├── DownloadViewController.m ├── DualbootSettingsViewController.h ├── DualbootSettingsViewController.m ├── HelpViewController.h ├── HelpViewController.m ├── HomePageViewController.h ├── HomePageViewController.m ├── Info.plist ├── NSTask.h ├── Objective-Zip │ ├── LICENSE.md │ ├── MiniZip │ │ ├── crypt.c │ │ ├── crypt.h │ │ ├── ioapi.c │ │ ├── ioapi.h │ │ ├── unzip.c │ │ ├── unzip.h │ │ ├── zip.c │ │ └── zip.h │ ├── Objective-Zip │ │ ├── NSData+CRC32.h │ │ ├── NSData+CRC32.m │ │ ├── NSDate+DOSDate.h │ │ ├── NSDate+DOSDate.m │ │ ├── OZFileInZipInfo+Internals.h │ │ ├── OZFileInZipInfo.h │ │ ├── OZFileInZipInfo.m │ │ ├── OZZipCompressionLevel.h │ │ ├── OZZipException+Internals.h │ │ ├── OZZipException.h │ │ ├── OZZipException.m │ │ ├── OZZipFile+NSError.h │ │ ├── OZZipFile+Standard.h │ │ ├── OZZipFile.h │ │ ├── OZZipFile.m │ │ ├── OZZipFileMode.h │ │ ├── OZZipReadStream+Internals.h │ │ ├── OZZipReadStream+NSError.h │ │ ├── OZZipReadStream+Standard.h │ │ ├── OZZipReadStream.h │ │ ├── OZZipReadStream.m │ │ ├── OZZipWriteStream+Internals.h │ │ ├── OZZipWriteStream+NSError.h │ │ ├── OZZipWriteStream+Standard.h │ │ ├── OZZipWriteStream.h │ │ ├── OZZipWriteStream.m │ │ ├── Objective-Zip+NSError.h │ │ └── Objective-Zip.h │ ├── README.md │ └── ZLib │ │ ├── adler32.c │ │ ├── compress.c │ │ ├── crc32.c │ │ ├── crc32.h │ │ ├── deflate.c │ │ ├── deflate.h │ │ ├── gzclose.c │ │ ├── gzguts.h │ │ ├── gzlib.c │ │ ├── gzread.c │ │ ├── gzwrite.c │ │ ├── infback.c │ │ ├── inffast.c │ │ ├── inffast.h │ │ ├── inffixed.h │ │ ├── inflate.c │ │ ├── inflate.h │ │ ├── inftrees.c │ │ ├── inftrees.h │ │ ├── trees.c │ │ ├── trees.h │ │ ├── uncompr.c │ │ ├── zconf.h │ │ ├── zlib.h │ │ ├── zutil.c │ │ └── zutil.h ├── RestoreViewController.h ├── RestoreViewController.m ├── SettingsViewController.h ├── SettingsViewController.m ├── SpecialThanksTableViewController.h ├── SpecialThanksTableViewController.m ├── SpringBoardServices.framework │ └── SpringBoardServices.tbd ├── apfs_deletefs ├── attach ├── binaryinfo.txt ├── hdik ├── main.m └── mobileactivationd ├── Entitlements.plist ├── LICENSE ├── README.md ├── Template └── DEBIAN │ ├── control │ ├── postinst │ └── prerm ├── beta.plist ├── compile ├── compile64.xcconfig └── succdatroot ├── Makefile ├── ent.plist ├── launch.h └── main.c /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Build 3 | Index 4 | *.log 5 | *.deb 6 | .logs 7 | .vscode 8 | succdatroot/.theos 9 | com.moski.SuccessionRestore/ 10 | com.moski.SuccessionDown/ 11 | com.moski.*/ 12 | compile5s 13 | sep.plist 14 | TODO 15 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Latest 7 | PreviewsEnabled 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/project.xcworkspace/xcuserdata/matty.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé.xcodeproj/project.xcworkspace/xcuserdata/matty.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Divisé.xcodeproj/project.xcworkspace/xcuserdata/matty.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataCustomLocation 10 | Build 11 | DerivedDataLocationStyle 12 | WorkspaceRelativePath 13 | IssueFilterStyle 14 | ShowActiveSchemeOnly 15 | LiveSourceIssuesEnabled 16 | 17 | ShowSharedSchemesAutomaticallyEnabled 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/project.xcworkspace/xcuserdata/samgardner.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé.xcodeproj/project.xcworkspace/xcuserdata/samgardner.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Divisé.xcodeproj/xcuserdata/cryptic.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SuccessionRestore.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/xcuserdata/matty.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/xcuserdata/matty.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Divisé.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | SuccessionDown.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | SuccessionRestore.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 0 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/xcuserdata/samgardner.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /Divisé.xcodeproj/xcuserdata/samgardner.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SuccessionRestore.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | SuccessionRestore.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Divisé/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 9/27/17. 6 | // Copyright © 2017 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Divisé/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 9/27/17. 6 | // Copyright © 2017 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | exit(0); 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/4pplecracker.imageset/4pplecracker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/4pplecracker.imageset/4pplecracker.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/4pplecracker.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4pplecracker.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/100.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/114.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/120.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/144.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/152.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/167.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/180.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/20.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/29.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/40.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/50.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/57.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/58.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/60.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/72.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/76.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/80.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/AppIcon.appiconset/87.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "40.png", 5 | "idiom" : "iphone", 6 | "scale" : "2x", 7 | "size" : "20x20" 8 | }, 9 | { 10 | "filename" : "60.png", 11 | "idiom" : "iphone", 12 | "scale" : "3x", 13 | "size" : "20x20" 14 | }, 15 | { 16 | "filename" : "29.png", 17 | "idiom" : "iphone", 18 | "scale" : "1x", 19 | "size" : "29x29" 20 | }, 21 | { 22 | "filename" : "58.png", 23 | "idiom" : "iphone", 24 | "scale" : "2x", 25 | "size" : "29x29" 26 | }, 27 | { 28 | "filename" : "87.png", 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "29x29" 32 | }, 33 | { 34 | "filename" : "80.png", 35 | "idiom" : "iphone", 36 | "scale" : "2x", 37 | "size" : "40x40" 38 | }, 39 | { 40 | "filename" : "120.png", 41 | "idiom" : "iphone", 42 | "scale" : "3x", 43 | "size" : "40x40" 44 | }, 45 | { 46 | "filename" : "57.png", 47 | "idiom" : "iphone", 48 | "scale" : "1x", 49 | "size" : "57x57" 50 | }, 51 | { 52 | "filename" : "114.png", 53 | "idiom" : "iphone", 54 | "scale" : "2x", 55 | "size" : "57x57" 56 | }, 57 | { 58 | "filename" : "120.png", 59 | "idiom" : "iphone", 60 | "scale" : "2x", 61 | "size" : "60x60" 62 | }, 63 | { 64 | "filename" : "180.png", 65 | "idiom" : "iphone", 66 | "scale" : "3x", 67 | "size" : "60x60" 68 | }, 69 | { 70 | "filename" : "20.png", 71 | "idiom" : "ipad", 72 | "scale" : "1x", 73 | "size" : "20x20" 74 | }, 75 | { 76 | "filename" : "40.png", 77 | "idiom" : "ipad", 78 | "scale" : "2x", 79 | "size" : "20x20" 80 | }, 81 | { 82 | "filename" : "29.png", 83 | "idiom" : "ipad", 84 | "scale" : "1x", 85 | "size" : "29x29" 86 | }, 87 | { 88 | "filename" : "58.png", 89 | "idiom" : "ipad", 90 | "scale" : "2x", 91 | "size" : "29x29" 92 | }, 93 | { 94 | "filename" : "40.png", 95 | "idiom" : "ipad", 96 | "scale" : "1x", 97 | "size" : "40x40" 98 | }, 99 | { 100 | "filename" : "80.png", 101 | "idiom" : "ipad", 102 | "scale" : "2x", 103 | "size" : "40x40" 104 | }, 105 | { 106 | "filename" : "50.png", 107 | "idiom" : "ipad", 108 | "scale" : "1x", 109 | "size" : "50x50" 110 | }, 111 | { 112 | "filename" : "100.png", 113 | "idiom" : "ipad", 114 | "scale" : "2x", 115 | "size" : "50x50" 116 | }, 117 | { 118 | "filename" : "72.png", 119 | "idiom" : "ipad", 120 | "scale" : "1x", 121 | "size" : "72x72" 122 | }, 123 | { 124 | "filename" : "144.png", 125 | "idiom" : "ipad", 126 | "scale" : "2x", 127 | "size" : "72x72" 128 | }, 129 | { 130 | "filename" : "76.png", 131 | "idiom" : "ipad", 132 | "scale" : "1x", 133 | "size" : "76x76" 134 | }, 135 | { 136 | "filename" : "152.png", 137 | "idiom" : "ipad", 138 | "scale" : "2x", 139 | "size" : "76x76" 140 | }, 141 | { 142 | "filename" : "167.png", 143 | "idiom" : "ipad", 144 | "scale" : "2x", 145 | "size" : "83.5x83.5" 146 | }, 147 | { 148 | "filename" : "1024.png", 149 | "idiom" : "ios-marketing", 150 | "scale" : "1x", 151 | "size" : "1024x1024" 152 | } 153 | ], 154 | "info" : { 155 | "author" : "xcode", 156 | "version" : 1 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/Halo-Michael.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Halo-Michael.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/Halo-Michael.imageset/Halo-Michael.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/Halo-Michael.imageset/Halo-Michael.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/Midnightchip.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Midnightchip.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/Midnightchip.imageset/Midnightchip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/Midnightchip.imageset/Midnightchip.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/PsychoTea.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "PsychoTea.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/PsychoTea.imageset/PsychoTea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/PsychoTea.imageset/PsychoTea.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/cryptiiiic.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "cryptiiiic.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/cryptiiiic.imageset/cryptiiiic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/cryptiiiic.imageset/cryptiiiic.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/hawk.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "hawk.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/hawk.imageset/hawk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/hawk.imageset/hawk.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/matty.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "matty.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/matty.imageset/matty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/matty.imageset/matty.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/pwn20wnd.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "pwn20wnd.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/pwn20wnd.imageset/pwn20wnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/pwn20wnd.imageset/pwn20wnd.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/samgisaninja.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "samgisaninja.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/samgisaninja.imageset/samgisaninja.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/samgisaninja.imageset/samgisaninja.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/sbingner.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "sbingner.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "sbingner-1.jpg", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "sbingner-2.jpg", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/sbingner.imageset/sbingner-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/sbingner.imageset/sbingner-1.jpg -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/sbingner.imageset/sbingner-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/sbingner.imageset/sbingner-2.jpg -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/sbingner.imageset/sbingner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/sbingner.imageset/sbingner.jpg -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/swaggo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "swaggo.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/swaggo.imageset/swaggo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/swaggo.imageset/swaggo.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/uroboro.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "uroboro.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/uroboro.imageset/uroboro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/uroboro.imageset/uroboro.png -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/xTM3x.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "xTM3x.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/xTM3x.imageset/xTM3x.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/xTM3x.imageset/xTM3x.jpg -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/xerusdesign.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "xerusdesign.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Divisé/Assets.xcassets/xerusdesign.imageset/xerusdesign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/Assets.xcassets/xerusdesign.imageset/xerusdesign.png -------------------------------------------------------------------------------- /Divisé/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Divisé/DecryptViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DecryptViewController.h 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 8/30/19. 6 | // Copyright © 2019 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DecryptViewController : UIViewController 12 | 13 | @property (strong, nonatomic) NSDictionary *successionPrefs; 14 | @property (strong, nonatomic) NSString *deviceModel; 15 | @property (strong, nonatomic) NSString *deviceBuild; 16 | @property (strong, nonatomic) NSString *deviceVersion; 17 | @property (strong, nonatomic) IBOutlet UILabel *activityLabel; 18 | @end 19 | -------------------------------------------------------------------------------- /Divisé/DownloadViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DownloadViewController.h 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 2/3/18. 6 | // Copyright © 2018 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DownloadViewController : UIViewController 12 | 13 | @property (strong, nonatomic) NSString *deviceModel; 14 | @property (strong, nonatomic) NSString *deviceBuild; 15 | @property (strong, nonatomic) NSString *deviceVersion; 16 | @property (strong, nonatomic) NSURL *downloadLink; 17 | @property (strong, nonatomic) IBOutlet UILabel *activityLabel; 18 | @property (strong, nonatomic) NSString *downloadPath; 19 | @property (strong, nonatomic) IBOutlet UIButton *startDownloadButton; 20 | @property (strong, nonatomic) IBOutlet UIActivityIndicatorView *unzipActivityIndicator; 21 | @property (strong, nonatomic) IBOutlet UIProgressView *downloadProgressBar; 22 | @property (strong, nonatomic) UIFont *monospacedNumberSystemFont; 23 | @property (strong, nonatomic) NSMutableDictionary *divisePrefs; 24 | @property (strong, nonatomic) NSMutableDictionary *dualbootPrefs; 25 | @property (nonatomic) BOOL needsDecryption; 26 | @property (weak, nonatomic) IBOutlet UIButton *unzipButton; 27 | @property (weak, nonatomic) IBOutlet UIPickerView *iosPicker; 28 | @end 29 | -------------------------------------------------------------------------------- /Divisé/DualbootSettingsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DualbootSettingsViewController.h 3 | // Divisé 4 | // 5 | // Created by matty on 10/05/20. 6 | // Copyright © 2020 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DualbootSettingsViewController : UIViewController 12 | @property (strong, nonatomic) NSMutableDictionary *dualbootPrefs; 13 | @property (strong, nonatomic) NSMutableDictionary *divisePrefs; 14 | @property (weak, nonatomic) IBOutlet UIButton *deleteButton; 15 | @property (weak, nonatomic) IBOutlet UIButton *wipeButton; 16 | @property (weak, nonatomic) IBOutlet UIButton *mountButton; 17 | @property (weak, nonatomic) IBOutlet UIButton *unmountButton; 18 | @property (weak, nonatomic) IBOutlet UIButton *deleteRfs; 19 | @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *spinningThing; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /Divisé/HelpViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HelpViewController.h 3 | // Divisé 4 | // 5 | // Created by matty on 30/05/20. 6 | // Copyright © 2020 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HelpViewController : UIViewController 12 | 13 | @property (nonatomic, strong) NSMutableDictionary *divisePrefs; 14 | @property (weak, nonatomic) IBOutlet UILabel *headerText; 15 | @property (weak, nonatomic) IBOutlet UILabel *infoText; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Divisé/HelpViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HelpViewController.m 3 | // Divisé 4 | // 5 | // Created by matty on 30/05/20. 6 | // Copyright © 2020 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import "HelpViewController.h" 10 | #import "NSTask.h" 11 | #include 12 | 13 | @interface HelpViewController () 14 | 15 | @end 16 | 17 | @implementation HelpViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | _divisePrefs = [NSMutableDictionary dictionaryWithDictionary:[NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.moski.Divise.plist"]]; 22 | [[[self navigationController] navigationBar] setHidden:FALSE]; 23 | self.navigationItem.title = @"Settings"; 24 | 25 | size_t size; 26 | sysctlbyname("hw.machine", NULL, &size, NULL, 0); 27 | 28 | //Gets iOS device model (ex iPhone9,1 == iPhone 7 GSM) and changes label. 29 | char *modelChar = malloc(size); 30 | sysctlbyname("hw.machine", modelChar, &size, NULL, 0); 31 | 32 | _headerText.backgroundColor = [[UIColor darkGrayColor] colorWithAlphaComponent:0.75f]; 33 | } 34 | 35 | -(void)viewDidAppear:(BOOL)animated{ 36 | [[[self navigationController] navigationBar] setHidden:FALSE]; 37 | self.navigationItem.title = @"Settings"; 38 | } 39 | 40 | 41 | - (IBAction)startButton:(UIButton *)sender { 42 | 43 | UIAlertController *startHelp = [UIAlertController alertControllerWithTitle:@"How to use Divise" message:@"To start Divse, simply press the\n'Download IPSW'\nbutton on the homepage, then press the\n'Enter iOS Version'\nbutton to pick an iOS version to download! From there a red button will appear on the homescreen which you press to begin the dualboot/tethered downgrade process!" preferredStyle:UIAlertControllerStyleAlert]; 44 | UIAlertAction *useDefualtPathAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; 45 | [startHelp addAction:useDefualtPathAction]; 46 | [self presentViewController:startHelp animated:TRUE completion:nil]; 47 | 48 | } 49 | 50 | 51 | - (IBAction)modeButton:(UIButton *)sender { 52 | 53 | UIAlertController *modeHelp = [UIAlertController alertControllerWithTitle:@"How to change restore modes" message:@"To change between dualbooting and tethered downgrading, simply go into the Settings page using the button on the homescreen, and toggle the\n'Dualboot Device'\noption, with off being Tethered Downgrading and on being Dualbooting.\nDO NOT do this if you have already dualbooted your device! It WILL cause issues!" preferredStyle:UIAlertControllerStyleAlert]; 54 | UIAlertAction *useDefualtPathAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; 55 | [modeHelp addAction:useDefualtPathAction]; 56 | [self presentViewController:modeHelp animated:TRUE completion:nil]; 57 | 58 | } 59 | 60 | - (IBAction)uninstallHelp:(UIButton *)sender { 61 | 62 | UIAlertController *uninstallHelp = [UIAlertController alertControllerWithTitle:@"How to uninstall the second OS" message:@"To uninstall the second OS, simply press the\n'Manage Installed Versions'\non the homepage, then press the red\n'Uninstall Second OS'\nbutton. This will uninstall the second OS, allowing you to re-dualboot the device if you want to! This will delete the newly created partitions as well, so any space taken up by then will be free to use for other things." preferredStyle:UIAlertControllerStyleAlert]; 63 | UIAlertAction *useDefualtPathAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; 64 | [uninstallHelp addAction:useDefualtPathAction]; 65 | [self presentViewController:uninstallHelp animated:TRUE completion:nil]; 66 | 67 | } 68 | 69 | - (IBAction)bootHelp:(UIButton *)sender { 70 | 71 | UIAlertController *bootHelp = [UIAlertController alertControllerWithTitle:@"How to boot the second OS" message:@"To boot the second OS, the simplest way is to use PyBoot (macOS only) with the '-d disk0s1sX' flag. This is what is shown at the end of a successfull dualboot.\n\nIf you only have access to a linux machine (Windows is not supported AT ALL) you can manually tether boot the device. You will need to find a guide online somewhere for this, I will not be offering support or help to Linux users trying to manually tether boot." preferredStyle:UIAlertControllerStyleAlert]; 72 | UIAlertAction *useDefualtPathAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; 73 | [bootHelp addAction:useDefualtPathAction]; 74 | [self presentViewController:bootHelp animated:TRUE completion:nil]; 75 | 76 | } 77 | 78 | - (IBAction)reportHelp:(UIButton *)sender { 79 | 80 | UIAlertController *reportHelp = [UIAlertController alertControllerWithTitle:@"How to report issues/bugs" message:@"Either DM me on twitter (@mosk_i), email me at 'moski@moski.fun' or open an issue on Github.\n\nPLEASE CHECK IF SOMEONE ELSE HAS ALREADY OPENED AN ISSUE BEFORE OPENING A NEW ONE." preferredStyle:UIAlertControllerStyleAlert]; 81 | UIAlertAction *useDefualtPathAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; 82 | [reportHelp addAction:useDefualtPathAction]; 83 | [self presentViewController:reportHelp animated:TRUE completion:nil]; 84 | 85 | } 86 | 87 | 88 | - (IBAction)backButton:(UIButton *)sender { 89 | [self dismissViewControllerAnimated:YES completion:nil]; 90 | } 91 | 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /Divisé/HomePageViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 9/27/17. 6 | // Copyright © 2017 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HomePageViewController : UIViewController 12 | 13 | @property (strong, nonatomic) NSMutableDictionary *divisePrefs; 14 | @property (strong, nonatomic) NSMutableArray *diskDeletion; 15 | @property (weak, nonatomic) IBOutlet UILabel *iOSBuildLabel; 16 | @property (weak, nonatomic) IBOutlet UIButton *downloadDMGButton; 17 | @property (weak, nonatomic) IBOutlet UIButton *prepareToRestoreButton; 18 | @property (weak, nonatomic) IBOutlet UIButton *decryptDMGButton; 19 | @property (strong, nonatomic) NSString *deviceModel; 20 | @property (strong, nonatomic) NSString *deviceBuild; 21 | @property (strong, nonatomic) NSString *deviceVersion; 22 | @property (weak, nonatomic) IBOutlet UILabel *mainInstalledVersion; 23 | @property (weak, nonatomic) IBOutlet UILabel *maininstallLabel; 24 | @property (weak, nonatomic) IBOutlet UILabel *dualbootedVersion; 25 | @property (weak, nonatomic) IBOutlet UILabel *dualbootedDiskID; 26 | @property (weak, nonatomic) IBOutlet UIButton *dualbootSettings; 27 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 28 | @property (weak, nonatomic) IBOutlet UIButton *donateButton; 29 | @property (weak, nonatomic) IBOutlet UIButton *ContactButton; 30 | @property (weak, nonatomic) IBOutlet UIButton *settingsButton; 31 | @property (weak, nonatomic) IBOutlet UILabel *blackBoxX; 32 | @property (weak, nonatomic) IBOutlet UILabel *blackBox; 33 | @property (weak, nonatomic) IBOutlet UILabel *secondOSLabel; 34 | @property (weak, nonatomic) IBOutlet UILabel *secondIosVersionLabel; 35 | @property (weak, nonatomic) IBOutlet UILabel *secondBuildIDLabel; 36 | @property (weak, nonatomic) IBOutlet UILabel *secondDiskIDLabel; 37 | @property (weak, nonatomic) IBOutlet UILabel *secondDiskID; 38 | @property (weak, nonatomic) IBOutlet NSLayoutConstraint *topSpacing; 39 | @end 40 | -------------------------------------------------------------------------------- /Divisé/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | $(PRODUCT_NAME) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIcons 12 | 13 | CFBundleIcons~ipad 14 | 15 | CFBundleIdentifier 16 | $(PRODUCT_BUNDLE_IDENTIFIER) 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundleName 20 | $(PRODUCT_NAME) 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | $(MARKETING_VERSION) 25 | CFBundleVersion 26 | 1 27 | LSRequiresIPhoneOS 28 | 29 | NSAppTransportSecurity 30 | 31 | NSExceptionDomains 32 | 33 | updates-http.cdn-apple.com 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | NSExceptionMinimumTLSVersion 38 | TLSv1.1 39 | NSIncludesSubdomains 40 | 41 | 42 | 43 | 44 | UIFileSharingEnabled 45 | 46 | UILaunchStoryboardName 47 | LaunchScreen 48 | UIMainStoryboardFile 49 | Main 50 | UIRequiredDeviceCapabilities 51 | 52 | armv7 53 | 54 | UIStatusBarHidden 55 | 56 | UISupportedInterfaceOrientations 57 | 58 | UIInterfaceOrientationPortrait 59 | 60 | UISupportedInterfaceOrientations~ipad 61 | 62 | UIInterfaceOrientationPortrait 63 | UIInterfaceOrientationPortraitUpsideDown 64 | UIInterfaceOrientationLandscapeLeft 65 | UIInterfaceOrientationLandscapeRight 66 | 67 | UIViewControllerBasedStatusBarAppearance 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Divisé/NSTask.h: -------------------------------------------------------------------------------- 1 | /* Generated by RuntimeBrowser 2 | Image: /System/Library/Frameworks/Foundation.framework/Foundation 3 | */ 4 | 5 | @interface NSTask : NSObject 6 | 7 | @property (copy) NSArray *arguments; 8 | @property (copy) NSURL *currentDirectoryURL; 9 | @property (copy) NSDictionary *environment; 10 | @property (copy) NSURL *executableURL; 11 | @property (readonly) int processIdentifier; 12 | @property long long qualityOfService; 13 | @property (getter=isRunning, readonly) bool running; 14 | @property (retain) id standardError; 15 | @property (retain) id standardInput; 16 | @property (retain) id standardOutput; 17 | @property (copy) id /* block */ terminationHandler; 18 | @property (readonly) long long terminationReason; 19 | @property (readonly) int terminationStatus; 20 | 21 | // Image: /System/Library/Frameworks/Foundation.framework/Foundation 22 | 23 | + (id)allocWithZone:(struct _NSZone { }*)arg1; 24 | + (id)currentTaskDictionary; 25 | + (id)launchedTaskWithDictionary:(id)arg1; 26 | + (id)launchedTaskWithExecutableURL:(id)arg1 arguments:(id)arg2 error:(out id*)arg3 terminationHandler:(id /* block */)arg4; 27 | + (id)launchedTaskWithLaunchPath:(id)arg1 arguments:(id)arg2; 28 | 29 | - (id)arguments; 30 | - (id)currentDirectoryPath; 31 | - (id)currentDirectoryURL; 32 | - (id)environment; 33 | - (id)executableURL; 34 | - (id)init; 35 | - (void)interrupt; 36 | - (bool)isRunning; 37 | - (void)launch; 38 | - (bool)launchAndReturnError:(id*)arg1; 39 | - (id)launchPath; 40 | - (int)processIdentifier; 41 | - (long long)qualityOfService; 42 | - (bool)resume; 43 | - (void)setArguments:(id)arg1; 44 | - (void)setCurrentDirectoryPath:(id)arg1; 45 | - (void)setCurrentDirectoryURL:(id)arg1; 46 | - (void)setEnvironment:(id)arg1; 47 | - (void)setExecutableURL:(id)arg1; 48 | - (void)setLaunchPath:(id)arg1; 49 | - (void)setQualityOfService:(long long)arg1; 50 | - (void)setStandardError:(id)arg1; 51 | - (void)setStandardInput:(id)arg1; 52 | - (void)setStandardOutput:(id)arg1; 53 | - (void)setTerminationHandler:(id /* block */)arg1; 54 | - (id)standardError; 55 | - (id)standardInput; 56 | - (id)standardOutput; 57 | - (bool)suspend; 58 | - (long long)suspendCount; 59 | - (void)terminate; 60 | - (id /* block */)terminationHandler; 61 | - (long long)terminationReason; 62 | - (int)terminationStatus; 63 | 64 | // Image: /System/Library/PrivateFrameworks/WiFiVelocity.framework/WiFiVelocity 65 | 66 | + (bool)__checkLaunchPath:(id)arg1; 67 | + (void)applebtDumpPacketLogWithFileName:(id)arg1 timeout:(double)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 68 | + (void)arpWithTimeout:(double)arg1 arguments:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 69 | + (void)bluetoothReporterWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 70 | + (void)cctoolWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 71 | + (void)curlWithAddress:(id)arg1 interfaceName:(id)arg2 timeout:(double)arg3 queue:(id)arg4 errorBlock:(id /* block */)arg5 completeBlock:(id /* block */)arg6; 72 | + (void)darwinupListWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 73 | + (void)dittoWithSource:(id)arg1 destination:(id)arg2 timeout:(double)arg3 queue:(id)arg4 errorBlock:(id /* block */)arg5 completeBlock:(id /* block */)arg6; 74 | + (void)fullSystemProfilerWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 75 | + (void)ifconfigWithTimeout:(double)arg1 arguments:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 76 | + (void)ioregWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 updateBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 77 | + (void)ipconfigWithInterfaceName:(id)arg1 timeout:(double)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 78 | + (void)kextstatWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 79 | + (void)killallWithProcessName:(id)arg1 timeout:(double)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 80 | + (void)miniSystemProfilerWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 81 | + (void)mobilewifitoolWithTimeout:(double)arg1 arguments:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 82 | + (void)monitorModeWithInterfaceName:(id)arg1 outputPath:(id)arg2 timeout:(double)arg3 queue:(id)arg4 startBlock:(id /* block */)arg5 endBlock:(id /* block */)arg6; 83 | + (void)ndpWithTimeout:(double)arg1 arguments:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 84 | + (void)netstatWithTimeout:(double)arg1 arguments:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 85 | + (void)nvramBootArgsWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 86 | + (void)pingWithAddress:(id)arg1 count:(long long)arg2 trafficClass:(id)arg3 dataLength:(unsigned long long)arg4 interfaceName:(id)arg5 timeout:(double)arg6 wait:(double)arg7 interval:(double)arg8 queue:(id)arg9 errorBlock:(id /* block */)arg10 completeBlock:(id /* block */)arg11; 87 | + (void)pingWithTimeout:(double)arg1 arguments:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 88 | + (void)pmsetEverythingWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 89 | + (void)runTaskWithLaunchPath:(id)arg1 arguments:(id)arg2 timeout:(double)arg3 queue:(id)arg4 errorBlock:(id /* block */)arg5 updateBlock:(id /* block */)arg6 completeBlock:(id /* block */)arg7; 90 | + (void)runTaskWithLaunchPath:(id)arg1 arguments:(id)arg2 timeout:(double)arg3 queue:(id)arg4 startBlock:(id /* block */)arg5 updateBlock:(id /* block */)arg6 endBlock:(id /* block */)arg7; 91 | + (void)scutilWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 92 | + (void)securityWithTimeout:(double)arg1 arguments:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 93 | + (void)spindumpWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 94 | + (void)swversWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 95 | + (void)sysctlHWModelWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 96 | + (void)sysdiagnoseWithTimeout:(double)arg1 outputPath:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 97 | + (void)syslogWithTimeout:(double)arg1 outputURL:(id)arg2 queue:(id)arg3 errorBlock:(id /* block */)arg4 completeBlock:(id /* block */)arg5; 98 | + (void)tarWithSource:(id)arg1 destination:(id)arg2 timeout:(double)arg3 queue:(id)arg4 errorBlock:(id /* block */)arg5 completeBlock:(id /* block */)arg6; 99 | + (void)tcpdumpWithInterfaceName:(id)arg1 outputPath:(id)arg2 timeout:(double)arg3 queue:(id)arg4 startBlock:(id /* block */)arg5 endBlock:(id /* block */)arg6; 100 | + (void)topWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 101 | + (void)tracerouteWithAddress:(id)arg1 maxTTL:(long long)arg2 waittime:(long long)arg3 queries:(long long)arg4 interfaceName:(id)arg5 timeout:(double)arg6 queue:(id)arg7 errorBlock:(id /* block */)arg8 completeBlock:(id /* block */)arg9; 102 | + (void)untarWithSource:(id)arg1 destination:(id)arg2 timeout:(double)arg3 queue:(id)arg4 errorBlock:(id /* block */)arg5 completeBlock:(id /* block */)arg6; 103 | - (void)waitUntilExit; 104 | + (void)wlCurpowerWithTimeout:(double)arg1 queue:(id)arg2 errorBlock:(id /* block */)arg3 completeBlock:(id /* block */)arg4; 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2009-2012, Flying Dolphin Studio 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | - Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | - Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | - Neither the name of Flying Dolphin Studio nor the names of its contributors 17 | may be used to endorse or promote products derived from this software 18 | without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 23 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 26 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/MiniZip/crypt.c: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for traditional PKWARE encryption 2 | Version 1.01e, February 12th, 2005 3 | 4 | Copyright (C) 1998-2005 Gilles Vollant 5 | Modifications for Info-ZIP crypting 6 | Copyright (C) 2003 Terry Thorsen 7 | 8 | This code is a modified version of crypting code in Info-ZIP distribution 9 | 10 | Copyright (C) 1990-2000 Info-ZIP. All rights reserved. 11 | 12 | This program is distributed under the terms of the same license as zlib. 13 | See the accompanying LICENSE file for the full text of the license. 14 | 15 | This encryption code is a direct transcription of the algorithm from 16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This 17 | file (appnote.txt) is distributed with the PKZIP program (even in the 18 | version without encryption capabilities). 19 | 20 | If you don't need crypting in your application, just define symbols 21 | NOCRYPT and NOUNCRYPT. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef _WIN32 30 | # include 31 | # include 32 | #else 33 | # include 34 | # include 35 | # include 36 | #endif 37 | 38 | #include "zlib.h" 39 | 40 | #include "crypt.h" 41 | 42 | /***************************************************************************/ 43 | 44 | #define CRC32(c, b) ((*(pcrc_32_tab+(((uint32_t)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 45 | 46 | #ifndef ZCR_SEED2 47 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 48 | #endif 49 | 50 | /***************************************************************************/ 51 | 52 | uint8_t decrypt_byte(uint32_t *pkeys) 53 | { 54 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 55 | * unpredictable manner on 16-bit systems; not a problem 56 | * with any known compiler so far, though */ 57 | 58 | temp = ((uint32_t)(*(pkeys+2)) & 0xffff) | 2; 59 | return (uint8_t)(((temp * (temp ^ 1)) >> 8) & 0xff); 60 | } 61 | 62 | uint8_t update_keys(uint32_t *pkeys, const z_crc_t *pcrc_32_tab, int32_t c) 63 | { 64 | (*(pkeys+0)) = (uint32_t)CRC32((*(pkeys+0)), c); 65 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 66 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 67 | { 68 | register int32_t keyshift = (int32_t)((*(pkeys + 1)) >> 24); 69 | (*(pkeys+2)) = (uint32_t)CRC32((*(pkeys+2)), keyshift); 70 | } 71 | return c; 72 | } 73 | 74 | void init_keys(const char *passwd, uint32_t *pkeys, const z_crc_t *pcrc_32_tab) 75 | { 76 | *(pkeys+0) = 305419896L; 77 | *(pkeys+1) = 591751049L; 78 | *(pkeys+2) = 878082192L; 79 | while (*passwd != 0) 80 | { 81 | update_keys(pkeys, pcrc_32_tab, *passwd); 82 | passwd += 1; 83 | } 84 | } 85 | 86 | /***************************************************************************/ 87 | 88 | int cryptrand(unsigned char *buf, unsigned int len) 89 | { 90 | static unsigned calls = 0; 91 | int rlen = 0; 92 | #ifdef _WIN32 93 | HCRYPTPROV provider; 94 | unsigned __int64 pentium_tsc[1]; 95 | int result = 0; 96 | 97 | 98 | if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) 99 | { 100 | result = CryptGenRandom(provider, len, buf); 101 | CryptReleaseContext(provider, 0); 102 | if (result) 103 | return len; 104 | } 105 | 106 | for (rlen = 0; rlen < (int)len; ++rlen) 107 | { 108 | if (rlen % 8 == 0) 109 | QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc); 110 | buf[rlen] = ((unsigned char*)pentium_tsc)[rlen % 8]; 111 | } 112 | #else 113 | int frand = open("/dev/urandom", O_RDONLY); 114 | if (frand != -1) 115 | { 116 | rlen = (int)read(frand, buf, len); 117 | close(frand); 118 | } 119 | #endif 120 | if (rlen < (int)len) 121 | { 122 | /* Ensure different random header each time */ 123 | if (++calls == 1) 124 | srand((unsigned)(time(NULL) ^ ZCR_SEED2)); 125 | 126 | while (rlen < (int)len) 127 | buf[rlen++] = (rand() >> 7) & 0xff; 128 | } 129 | return rlen; 130 | } 131 | 132 | int crypthead(const char *passwd, uint8_t *buf, int buf_size, 133 | uint32_t *pkeys, const z_crc_t *pcrc_32_tab, uint32_t crc_for_crypting) 134 | { 135 | uint8_t n = 0; /* index in random header */ 136 | uint8_t header[RAND_HEAD_LEN-2]; /* random header */ 137 | uint16_t t = 0; /* temporary */ 138 | 139 | if (buf_size < RAND_HEAD_LEN) 140 | return 0; 141 | 142 | init_keys(passwd, pkeys, pcrc_32_tab); 143 | 144 | /* First generate RAND_HEAD_LEN-2 random bytes. */ 145 | cryptrand(header, RAND_HEAD_LEN-2); 146 | 147 | /* Encrypt random header (last two bytes is high word of crc) */ 148 | init_keys(passwd, pkeys, pcrc_32_tab); 149 | 150 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 151 | buf[n] = (uint8_t)zencode(pkeys, pcrc_32_tab, header[n], t); 152 | 153 | buf[n++] = (uint8_t)zencode(pkeys, pcrc_32_tab, (uint8_t)((crc_for_crypting >> 16) & 0xff), t); 154 | buf[n++] = (uint8_t)zencode(pkeys, pcrc_32_tab, (uint8_t)((crc_for_crypting >> 24) & 0xff), t); 155 | return n; 156 | } 157 | 158 | /***************************************************************************/ 159 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/MiniZip/crypt.h: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for traditional PKWARE encryption 2 | Version 1.01e, February 12th, 2005 3 | 4 | Copyright (C) 1998-2005 Gilles Vollant 5 | Modifications for Info-ZIP crypting 6 | Copyright (C) 2003 Terry Thorsen 7 | 8 | This code is a modified version of crypting code in Info-ZIP distribution 9 | 10 | Copyright (C) 1990-2000 Info-ZIP. All rights reserved. 11 | 12 | This program is distributed under the terms of the same license as zlib. 13 | See the accompanying LICENSE file for the full text of the license. 14 | */ 15 | 16 | #ifndef _MINICRYPT_H 17 | #define _MINICRYPT_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #define RAND_HEAD_LEN 12 24 | 25 | /***************************************************************************/ 26 | 27 | #define zdecode(pkeys,pcrc_32_tab,c) \ 28 | (update_keys(pkeys,pcrc_32_tab, c ^= decrypt_byte(pkeys))) 29 | 30 | #define zencode(pkeys,pcrc_32_tab,c,t) \ 31 | (t = decrypt_byte(pkeys), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 32 | 33 | /***************************************************************************/ 34 | 35 | /* Return the next byte in the pseudo-random sequence */ 36 | uint8_t decrypt_byte(uint32_t *pkeys); 37 | 38 | /* Update the encryption keys with the next byte of plain text */ 39 | uint8_t update_keys(uint32_t *pkeys, const z_crc_t *pcrc_32_tab, int32_t c); 40 | 41 | /* Initialize the encryption keys and the random header according to the given password. */ 42 | void init_keys(const char *passwd, uint32_t *pkeys, const z_crc_t *pcrc_32_tab); 43 | 44 | /* Generate cryptographically secure random numbers */ 45 | int cryptrand(unsigned char *buf, unsigned int len); 46 | 47 | /* Create encryption header */ 48 | int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys, 49 | const z_crc_t *pcrc_32_tab, uint32_t crc_for_crypting); 50 | 51 | /***************************************************************************/ 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/MiniZip/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | part of the MiniZip project 3 | 4 | Copyright (C) 1998-2010 Gilles Vollant 5 | http://www.winimage.com/zLibDll/minizip.html 6 | Modifications for Zip64 support 7 | Copyright (C) 2009-2010 Mathias Svensson 8 | http://result42.com 9 | 10 | This program is distributed under the terms of the same license as zlib. 11 | See the accompanying LICENSE file for the full text of the license. 12 | */ 13 | 14 | #ifndef _ZLIBIOAPI64_H 15 | #define _ZLIBIOAPI64_H 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include "zlib.h" 22 | 23 | #if defined(USE_FILE32API) 24 | # define fopen64 fopen 25 | # define ftello64 ftell 26 | # define fseeko64 fseek 27 | #else 28 | # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__APPLE__) 29 | # define fopen64 fopen 30 | # define ftello64 ftello 31 | # define fseeko64 fseeko 32 | # endif 33 | # ifdef _MSC_VER 34 | # define fopen64 fopen 35 | # if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC))) 36 | # define ftello64 _ftelli64 37 | # define fseeko64 _fseeki64 38 | # else /* old MSC */ 39 | # define ftello64 ftell 40 | # define fseeko64 fseek 41 | # endif 42 | # endif 43 | #endif 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 50 | #define ZLIB_FILEFUNC_SEEK_END (2) 51 | #define ZLIB_FILEFUNC_SEEK_SET (0) 52 | 53 | #define ZLIB_FILEFUNC_MODE_READ (1) 54 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 55 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 56 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 57 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 58 | 59 | #ifndef ZCALLBACK 60 | # if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || \ 61 | defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 62 | # define ZCALLBACK CALLBACK 63 | # else 64 | # define ZCALLBACK 65 | # endif 66 | #endif 67 | 68 | typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char *filename, int mode); 69 | typedef voidpf (ZCALLBACK *opendisk_file_func) (voidpf opaque, voidpf stream, uint32_t number_disk, int mode); 70 | typedef uint32_t (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uint32_t size); 71 | typedef uint32_t (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void *buf, uint32_t size); 72 | typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream); 73 | typedef int (ZCALLBACK *error_file_func) (voidpf opaque, voidpf stream); 74 | 75 | typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream); 76 | typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uint32_t offset, int origin); 77 | 78 | /* here is the "old" 32 bits structure structure */ 79 | typedef struct zlib_filefunc_def_s 80 | { 81 | open_file_func zopen_file; 82 | opendisk_file_func zopendisk_file; 83 | read_file_func zread_file; 84 | write_file_func zwrite_file; 85 | tell_file_func ztell_file; 86 | seek_file_func zseek_file; 87 | close_file_func zclose_file; 88 | error_file_func zerror_file; 89 | voidpf opaque; 90 | } zlib_filefunc_def; 91 | 92 | typedef uint64_t (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream); 93 | typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, uint64_t offset, int origin); 94 | typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void *filename, int mode); 95 | typedef voidpf (ZCALLBACK *opendisk64_file_func)(voidpf opaque, voidpf stream, uint32_t number_disk, int mode); 96 | 97 | typedef struct zlib_filefunc64_def_s 98 | { 99 | open64_file_func zopen64_file; 100 | opendisk64_file_func zopendisk64_file; 101 | read_file_func zread_file; 102 | write_file_func zwrite_file; 103 | tell64_file_func ztell64_file; 104 | seek64_file_func zseek64_file; 105 | close_file_func zclose_file; 106 | error_file_func zerror_file; 107 | voidpf opaque; 108 | } zlib_filefunc64_def; 109 | 110 | void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def); 111 | void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def); 112 | 113 | /* now internal definition, only for zip.c and unzip.h */ 114 | typedef struct zlib_filefunc64_32_def_s 115 | { 116 | zlib_filefunc64_def zfile_func64; 117 | open_file_func zopen32_file; 118 | opendisk_file_func zopendisk32_file; 119 | tell_file_func ztell32_file; 120 | seek_file_func zseek32_file; 121 | } zlib_filefunc64_32_def; 122 | 123 | #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) 124 | #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) 125 | /*#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))*/ 126 | /*#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))*/ 127 | #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) 128 | #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) 129 | 130 | voidpf call_zopen64(const zlib_filefunc64_32_def *pfilefunc,const void*filename, int mode); 131 | voidpf call_zopendisk64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream, uint32_t number_disk, int mode); 132 | long call_zseek64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream, uint64_t offset, int origin); 133 | uint64_t call_ztell64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream); 134 | 135 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def *p_filefunc64_32, const zlib_filefunc_def *p_filefunc32); 136 | 137 | #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) 138 | #define ZOPENDISK64(filefunc,filestream,diskn,mode) (call_zopendisk64((&(filefunc)),(filestream),(diskn),(mode))) 139 | #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) 140 | #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode))) 141 | 142 | #ifdef __cplusplus 143 | } 144 | #endif 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/NSData+CRC32.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+CRC32.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 13/05/2017. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | 37 | @interface NSData (CRC32) 38 | 39 | 40 | #pragma mark - 41 | #pragma mark Handy CRC32 computation 42 | 43 | - (uint32_t) crc32; 44 | - (uint32_t) crc32withInitialCrc32:(uint32_t)initialCrc32; 45 | 46 | 47 | @end 48 | 49 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/NSData+CRC32.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+CRC32.m 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 13/05/2017. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | #import "NSData+CRC32.h" 37 | 38 | 39 | // Part of ZLib, see crc32.c 40 | unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len); 41 | 42 | 43 | @implementation NSData (CRC32) 44 | 45 | 46 | #pragma mark - 47 | #pragma mark Handy CRC32 computation 48 | 49 | - (uint32_t) crc32 { 50 | return [self crc32withInitialCrc32:0]; 51 | } 52 | 53 | - (uint32_t) crc32withInitialCrc32:(uint32_t)initialCrc32 { 54 | return (uint32_t) crc32(initialCrc32, [self bytes], (unsigned int) [self length]); 55 | } 56 | 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/NSDate+DOSDate.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+DOSDate.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 13/05/2017. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | 37 | @interface NSDate (DOSDate) 38 | 39 | 40 | #pragma mark - 41 | #pragma mark Conversion to/from 32 bit DOS date format 42 | 43 | - (uint32_t) dosDate; 44 | + (NSDate *) fromDosDate:(uint32_t)dosDate; 45 | 46 | 47 | @end 48 | 49 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/NSDate+DOSDate.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+DOSDate.m 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 13/05/2017. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | #import "NSDate+DOSDate.h" 37 | 38 | 39 | @implementation NSDate (DOSDate) 40 | 41 | 42 | #pragma mark - 43 | #pragma mark Conversion to/from 32 bit DOS date format 44 | 45 | - (uint32_t) dosDate { 46 | NSCalendar *calendar= [NSCalendar currentCalendar]; 47 | NSDateComponents *date= [calendar components:(NSCalendarUnitSecond | NSCalendarUnitMinute | NSCalendarUnitHour | NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear) fromDate:self]; 48 | 49 | return (((uint32_t)[date day] + (32 * (uint32_t)[date month]) + (512 * ((uint32_t)[date year] - 1980))) << 16) | 50 | (((uint32_t)[date second] / 2) + (32 * (uint32_t)[date minute]) + (2048 * (uint32_t)[date hour])); 51 | } 52 | 53 | + (NSDate *) fromDosDate:(uint32_t)dosDate { 54 | uint64_t date= (uint64_t)(dosDate >> 16); 55 | 56 | NSDateComponents *components= [[NSDateComponents alloc] init]; 57 | [components setDay:date & 0x1f]; 58 | [components setMonth:(date & 0x1E0) / 0x20]; 59 | [components setYear:((date & 0x0FE00) / 0x0200) + 1980]; 60 | [components setHour:(dosDate & 0xF800) / 0x800]; 61 | [components setMinute:(dosDate & 0x7E0) / 0x20]; 62 | [components setSecond:2 * (dosDate & 0x1f)]; 63 | 64 | NSCalendar *calendar= [NSCalendar currentCalendar]; 65 | return [calendar dateFromComponents:components]; 66 | } 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZFileInZipInfo+Internals.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZFileInZipInfo+Internals.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/08/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZFileInZipInfo.h" 35 | 36 | 37 | @interface OZFileInZipInfo (Internals) 38 | 39 | 40 | #pragma mark - 41 | #pragma mark Initialization 42 | 43 | - (nonnull instancetype) initWithName:(nonnull NSString *)name length:(unsigned long long)length level:(OZZipCompressionLevel)level crypted:(BOOL)crypted size:(unsigned long long)size date:(nonnull NSDate *)date crc32:(NSUInteger)crc32; 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZFileInZipInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZFileInZipInfo.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | #import "OZZipCompressionLevel.h" 37 | 38 | 39 | /** 40 | @brief OZFileInZipInfo provides properties to inspect a file contained in 41 | the zip file. 42 | */ 43 | @interface OZFileInZipInfo : NSObject 44 | 45 | 46 | #pragma mark - 47 | #pragma mark Properties 48 | 49 | /** 50 | @brief Name of the file in the zip file. 51 |

Note: in case the zip file has a directory structure, directory and 52 | subdirectory names are prepended to the file name, e.g. 53 | "docs/html/index.html".

54 | */ 55 | @property (nonatomic, readonly, nonnull) NSString *name; 56 | 57 | /** 58 | @brief Length in bytes of the uncompressed file. 59 | */ 60 | @property (nonatomic, readonly) unsigned long long length; 61 | 62 | /** 63 | @brief Compression level of the file. Can be:
    64 |
  • OZZipCompressionLevelNone: not compressed (stored as is). 65 |
  • OZZipCompressionLevelFastest: minimum compression. 66 |
  • OZZipCompressionLevelBest: maximum compression 67 |
  • OZZipCompressionLevelDefault: intermediate compression. 68 |
69 | */ 70 | @property (nonatomic, readonly) OZZipCompressionLevel level; 71 | 72 | /** 73 | @brief YES if the file has been encrypted during 74 | writing, NO if the file is not encrypted. 75 | */ 76 | @property (nonatomic, readonly) BOOL crypted; 77 | 78 | /** 79 | @brief Length in bytes of the (compressed) file in the zip file. 80 | */ 81 | @property (nonatomic, readonly) unsigned long long size; 82 | 83 | /** 84 | @brief Date/time the of file. 85 | */ 86 | @property (nonatomic, readonly, nonnull) NSDate *date; 87 | 88 | /** 89 | @brief CRC32 of the file. 90 | */ 91 | @property (nonatomic, readonly) NSUInteger crc32; 92 | 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZFileInZipInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // OZFileInZipInfo.m 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZFileInZipInfo.h" 35 | 36 | 37 | #pragma mark - 38 | #pragma mark OZFileInZipInfo extension 39 | 40 | @interface OZFileInZipInfo () { 41 | 42 | @private 43 | unsigned long long _length; 44 | OZZipCompressionLevel _level; 45 | BOOL _crypted; 46 | unsigned long long _size; 47 | NSDate *_date; 48 | NSUInteger _crc32; 49 | NSString *_name; 50 | } 51 | 52 | 53 | @end 54 | 55 | 56 | #pragma mark - 57 | #pragma mark OZFileInZipInfo implementation 58 | 59 | @implementation OZFileInZipInfo 60 | 61 | 62 | #pragma mark - 63 | #pragma mark Initialization 64 | 65 | - (instancetype) initWithName:(NSString *)name length:(unsigned long long)length level:(OZZipCompressionLevel)level crypted:(BOOL)crypted size:(unsigned long long)size date:(NSDate *)date crc32:(NSUInteger)crc32 { 66 | if (self= [super init]) { 67 | _name= name; 68 | _length= length; 69 | _level= level; 70 | _crypted= crypted; 71 | _size= size; 72 | _date= date; 73 | _crc32= crc32; 74 | } 75 | 76 | return self; 77 | } 78 | 79 | 80 | #pragma mark - 81 | #pragma mark Properties 82 | 83 | @synthesize name= _name; 84 | @synthesize length= _length; 85 | @synthesize level= _level; 86 | @synthesize crypted= _crypted; 87 | @synthesize size= _size; 88 | @synthesize date= _date; 89 | @synthesize crc32= _crc32; 90 | 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipCompressionLevel.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipCompressionLevel.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/08/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #ifndef Objective_Zip_OZZipCompressionLevel_h 35 | #define Objective_Zip_OZZipCompressionLevel_h 36 | 37 | 38 | /** 39 | @brief Compression level to be used to compress new files added to the zip 40 | file. 41 | */ 42 | typedef NS_ENUM(NSInteger, OZZipCompressionLevel) { 43 | 44 | /** 45 | @brief Compression level that compresses the new file somewhere inbetween 46 | OZZipCompressionLevelBest and OZZipCompressionLevelFastest. 47 | */ 48 | OZZipCompressionLevelDefault= -1, 49 | 50 | /** 51 | @brief Compression level that does not compress the new file, it is 52 | stored as is. 53 | */ 54 | OZZipCompressionLevelNone= 0, 55 | 56 | /** 57 | @brief Compression level that compresses the new file as fast as 58 | possible, corresponding to the least compression. 59 | */ 60 | OZZipCompressionLevelFastest= 1, 61 | 62 | /** 63 | @brief Compression level that compresses the new file as much as 64 | possible, corresponding to the slowest compression. 65 | */ 66 | OZZipCompressionLevelBest= 9 67 | }; 68 | 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipException+Internals.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipException+Internals.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/08/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipException.h" 35 | 36 | #define ERROR_WRAP_BEGIN \ 37 | @try { 38 | 39 | #define ERROR_WRAP_END_AND_RETURN(err, ret) \ 40 | } @catch (OZZipException *ze) { \ 41 | if (ze.error) { \ 42 | if (err) { \ 43 | *err= [NSError errorWithDomain:@"ObjectiveZipErrorDomain" \ 44 | code:ze.error \ 45 | userInfo:@{NSLocalizedDescriptionKey: ze.name, \ 46 | NSLocalizedFailureReasonErrorKey: ze.reason}]; \ 47 | } \ 48 | return ret; \ 49 | } else \ 50 | @throw ze; \ 51 | } @catch (NSException *exc) { \ 52 | @throw exc; \ 53 | } 54 | 55 | 56 | @interface OZZipException (Internals) 57 | 58 | 59 | #pragma mark - 60 | #pragma mark Initialization 61 | 62 | + (nonnull OZZipException *) zipExceptionWithReason:(nonnull NSString *)format, ...; 63 | + (nonnull OZZipException *) zipExceptionWithError:(NSInteger)error reason:(nonnull NSString *)format, ...; 64 | 65 | - (nonnull instancetype) initWithReason:(nonnull NSString *)reason; 66 | - (nonnull instancetype) initWithError:(NSInteger)error reason:(nonnull NSString *)reason; 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipException.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipException.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 25/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | extern const NSInteger OZ_ERROR_NO_SUCH_FILE; 37 | 38 | 39 | /** 40 | @brief OZZipException is a custom exception type to quickly discern between 41 | error originated during the zip/unzip process or elsewhere. 42 |

All exceptions thrown by Objective-Zip are of OZZipException type.

43 | */ 44 | @interface OZZipException : NSException 45 | 46 | 47 | #pragma mark - 48 | #pragma mark Properties 49 | 50 | /** 51 | @brief Underlying error code provided by MiniZip/ZLib libraries. May be 52 | 0 if the exception originated in the Objective-Zip layer. 53 |

Common error codes are:

    54 |
  • -1: System error. 55 |
  • -103: Bad zip file. 56 |
  • -104: Internal error. 57 |
  • -105: CRC error. 58 |

59 | */ 60 | @property (nonatomic, readonly) NSInteger error; 61 | 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipException.m: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipException.m 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 25/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipException.h" 35 | 36 | 37 | #pragma mark - 38 | #pragma mark OZZipException extension 39 | 40 | @interface OZZipException () { 41 | 42 | @private 43 | NSInteger _error; 44 | } 45 | 46 | 47 | @end 48 | 49 | 50 | #pragma mark - 51 | #pragma mark OZZipException constants 52 | 53 | const NSInteger OZ_ERROR_NO_SUCH_FILE= -9001; 54 | 55 | 56 | #pragma mark - 57 | #pragma mark OZZipException implementation 58 | 59 | @implementation OZZipException 60 | 61 | 62 | #pragma mark - 63 | #pragma mark Initialization 64 | 65 | + (OZZipException *) zipExceptionWithReason:(NSString *)format, ... { 66 | 67 | // Variable arguments formatting 68 | va_list arguments; 69 | va_start(arguments, format); 70 | NSString *reason= [[NSString alloc] initWithFormat:format arguments:arguments]; 71 | va_end(arguments); 72 | 73 | return [[OZZipException alloc] initWithReason:reason]; 74 | } 75 | 76 | + (OZZipException *) zipExceptionWithError:(NSInteger)error reason:(NSString *)format, ... { 77 | 78 | // Variable arguments formatting 79 | va_list arguments; 80 | va_start(arguments, format); 81 | NSString *reason= [[NSString alloc] initWithFormat:format arguments:arguments]; 82 | va_end(arguments); 83 | 84 | return [[OZZipException alloc] initWithError:error reason:reason]; 85 | } 86 | 87 | - (instancetype) initWithReason:(NSString *)reason { 88 | if (self= [super initWithName:@"OZZipException" reason:reason userInfo:nil]) { 89 | _error= 0; 90 | } 91 | 92 | return self; 93 | } 94 | 95 | - (instancetype) initWithError:(NSInteger)error reason:(NSString *)reason { 96 | if (self= [super initWithName:@"OZZipException" reason:reason userInfo:nil]) { 97 | _error= error; 98 | } 99 | 100 | return self; 101 | } 102 | 103 | 104 | #pragma mark - 105 | #pragma mark Properties 106 | 107 | @synthesize error= _error; 108 | 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipFile.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipFile.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 25/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | #import "OZZipFileMode.h" 37 | #import "OZZipCompressionLevel.h" 38 | 39 | 40 | @class OZZipReadStream; 41 | @class OZZipWriteStream; 42 | @class OZFileInZipInfo; 43 | 44 | /** 45 | @brief OZZipFile provides read or write access to a single zip file. 46 |

During initialization you must specify the access mode, i.e. if the zip 47 | file is being created, appended, or unzipped. You can also specify if the zip 48 | file must be opened in legacy 32-bit mode, to be compatible with older 49 | operating systems (such as some versions of Android).

50 |

If the zip file has been opened in unzip mode, you can list its content, 51 | move within its content from file to file, and finally open a reading stream 52 | of the selected file.

53 |

If the zip file has been opened in creation or append mode, you can open a 54 | writing stream to add new files to its content.

55 | */ 56 | @interface OZZipFile : NSObject 57 | 58 | 59 | #pragma mark - 60 | #pragma mark Properties 61 | 62 | /** 63 | @brief File name of the zip file. 64 | */ 65 | @property (nonatomic, readonly, nonnull) NSString *fileName; 66 | 67 | /** 68 | @brief Access mode specified during opening. Can be:
    69 |
  • OZZipFileModeUnzip: the zip file has been opened for reading. 70 |
  • OZZipFileModeCreate: the zip file has been opened for creation. 71 |
  • OZZipFileModeAppend: the zip file has been opened for writing. 72 |
73 | */ 74 | @property (nonatomic, readonly) OZZipFileMode mode; 75 | 76 | /** 77 | @brief YES if the zip file has been opened in 32-bit 78 | compatibility mode, NO if it has been opened in standard 79 | (default) 64-bit mode. 80 | */ 81 | @property (nonatomic, readonly) BOOL legacy32BitMode; 82 | 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipFileMode.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipFileMode.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/08/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #ifndef Objective_Zip_OZZipFileMode_h 35 | #define Objective_Zip_OZZipFileMode_h 36 | 37 | /** 38 | @brief Access mode for opening a zip file. 39 | */ 40 | typedef NS_ENUM(NSInteger, OZZipFileMode) { 41 | 42 | /** 43 | @brief Acces mode for opening the zip file for reading. 44 | */ 45 | OZZipFileModeUnzip, 46 | 47 | /** 48 | @brief Acces mode for opening the zip file for creation. 49 |
Note: if the file already exists the behavior is unspecified. 50 | */ 51 | OZZipFileModeCreate, 52 | 53 | /** 54 | @brief Acces mode for opening the zip file for writing. 55 | */ 56 | OZZipFileModeAppend 57 | }; 58 | 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipReadStream+Internals.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipReadStream+Internals.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/08/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipReadStream.h" 35 | 36 | #include "unzip.h" 37 | 38 | 39 | @interface OZZipReadStream (Internals) 40 | 41 | 42 | #pragma mark - 43 | #pragma mark Initialization 44 | 45 | - (nonnull instancetype) initWithUnzFileStruct:(nonnull unzFile)unzFile fileNameInZip:(nonnull NSString *)fileNameInZip; 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipReadStream+NSError.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipReadStream+NSError.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 09/09/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipReadStream.h" 35 | 36 | 37 | /** 38 | @brief Indicates the end of the file has been reached. 39 | */ 40 | static const NSInteger OZReadStreamResultEndOfFile= -1; 41 | 42 | 43 | @interface OZZipReadStream (NSError) 44 | 45 | 46 | #pragma mark - 47 | #pragma mark Reading data (NSError variants) 48 | 49 | /** 50 | @brief Reads and uncompresses data from the file in the zip file and stores 51 | them in the specified buffer. 52 | @param buffer The buffer where read and uncompressed data must be stored. 53 | @param error If passed, may be filled with an NSError is case data could 54 | not be read. 55 | @return The number of uncompressed bytes read, OZReadStreamResultEndOfFile 56 | if the end of the file has been reached, or 0 57 | if data could not be read due to an error. 58 |
NOTE: return value convention is different in the standard (non-NSError 59 | compliant) interface. 60 | */ 61 | - (NSInteger) __attribute__((swift_error(nonnull_error))) readDataWithBuffer:(nonnull NSMutableData *)buffer error:(NSError * __autoreleasing __nullable * __nullable)error; 62 | 63 | /** 64 | @brief Closes the read steam. 65 |

Once you have finished read data to the file, it is important to close 66 | the stream so system resources may be freed.

67 |

Note: after the stream has been closed any subsequent read will result in 68 | an error.

69 | @param error If passed, may be filled with an NSError is case the stream could 70 | not be closed. 71 | @return YES if the stream has been closed, NO if 72 | the stream could not be closed due to an error. 73 | */ 74 | - (BOOL) finishedReadingWithError:(NSError * __autoreleasing __nullable * __nullable)error; 75 | 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipReadStream+Standard.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipReadStream+Standard.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 09/09/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipReadStream.h" 35 | 36 | 37 | @interface OZZipReadStream (Standard) 38 | 39 | 40 | #pragma mark - 41 | #pragma mark Reading data 42 | 43 | /** 44 | @brief Reads and uncompresses data from the file in the zip file and stores 45 | them in the specified buffer. 46 | @param buffer The buffer where read and uncompressed data must be stored. 47 | @return The number of uncompressed bytes read, 0 if the end of 48 | the file has been reached. 49 |
NOTE: return value convention is different in NSError compliant 50 | interface. 51 | @throws OZZipException If the data could not be read due to an error. 52 | */ 53 | - (NSUInteger) readDataWithBuffer:(nonnull NSMutableData *)buffer; 54 | 55 | /** 56 | @brief Closes the read steam. 57 |

Once you have finished read data to the file, it is important to close 58 | the stream so system resources may be freed.

59 |

Note: after the stream has been closed any subsequent read will result in 60 | an error.

61 | @throws OZZipException If the stream could not be closed due to an error. 62 | */ 63 | - (void) finishedReading; 64 | 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipReadStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipReadStream.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 28/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | 37 | /** 38 | @brief OZZipReadStream implements a read stream and provides services to 39 | read content from a file in the zip file. 40 | */ 41 | @interface OZZipReadStream : NSObject 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipReadStream.m: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipReadStream.m 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 28/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipReadStream.h" 35 | #import "OZZipReadStream+Standard.h" 36 | #import "OZZipReadStream+NSError.h" 37 | #import "OZZipReadStream+Internals.h" 38 | #import "OZZipException.h" 39 | #import "OZZipException+Internals.h" 40 | 41 | 42 | #pragma mark - 43 | #pragma mark OZZipReadStream extension 44 | 45 | @interface OZZipReadStream () { 46 | NSString *_fileNameInZip; 47 | 48 | @private 49 | unzFile _unzFile; 50 | } 51 | 52 | 53 | @end 54 | 55 | 56 | #pragma mark - 57 | #pragma mark OZZipReadStream implementation 58 | 59 | @implementation OZZipReadStream 60 | 61 | 62 | #pragma mark - 63 | #pragma mark Initialization 64 | 65 | - (instancetype) initWithUnzFileStruct:(unzFile)unzFile fileNameInZip:(NSString *)fileNameInZip { 66 | if (self= [super init]) { 67 | _unzFile= unzFile; 68 | _fileNameInZip= fileNameInZip; 69 | } 70 | 71 | return self; 72 | } 73 | 74 | 75 | #pragma mark - 76 | #pragma mark Reading data 77 | 78 | - (NSUInteger) readDataWithBuffer:(NSMutableData *)buffer { 79 | int err= unzReadCurrentFile(_unzFile, [buffer mutableBytes], (uInt) [buffer length]); 80 | if (err < 0) 81 | @throw [OZZipException zipExceptionWithError:err reason:@"Error reading '%@' in the zipfile", _fileNameInZip]; 82 | 83 | return err; 84 | } 85 | 86 | - (void) finishedReading { 87 | int err= unzCloseCurrentFile(_unzFile); 88 | if (err != UNZ_OK) 89 | @throw [OZZipException zipExceptionWithError:err reason:@"Error closing '%@' in the zipfile", _fileNameInZip]; 90 | } 91 | 92 | 93 | #pragma mark - 94 | #pragma mark Reading data (NSError variants) 95 | 96 | - (NSInteger) readDataWithBuffer:(NSMutableData *)buffer error:(NSError * __autoreleasing *)error { 97 | ERROR_WRAP_BEGIN { 98 | 99 | NSUInteger bytesRead= [self readDataWithBuffer:buffer]; 100 | return (bytesRead == 0) ? OZReadStreamResultEndOfFile : bytesRead; 101 | 102 | } ERROR_WRAP_END_AND_RETURN(error, 0); 103 | } 104 | 105 | - (BOOL) finishedReadingWithError:(NSError * __autoreleasing *)error { 106 | ERROR_WRAP_BEGIN { 107 | 108 | [self finishedReading]; 109 | 110 | return YES; 111 | 112 | } ERROR_WRAP_END_AND_RETURN(error, NO); 113 | } 114 | 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipWriteStream+Internals.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipWriteStream+Internals.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/08/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipWriteStream.h" 35 | 36 | #include "zip.h" 37 | 38 | 39 | @interface OZZipWriteStream (Internals) 40 | 41 | 42 | #pragma mark - 43 | #pragma mark Initialization 44 | 45 | - (nonnull instancetype) initWithZipFileStruct:(nonnull zipFile)zipFile fileNameInZip:(nonnull NSString *)fileNameInZip; 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipWriteStream+NSError.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipWriteStream+NSError.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 09/09/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipWriteStream.h" 35 | 36 | 37 | @interface OZZipWriteStream (NSError) 38 | 39 | 40 | #pragma mark - 41 | #pragma mark Writing data (NSError variants) 42 | 43 | /** 44 | @brief Compresses and writes data to the new file in the zip file. 45 |

Data are compressed depending on the choice of compression level specified 46 | during creation of the write stream.

47 | @param data The data to be compressed and written. 48 | @param error If passed, may be filled with an NSError is case data could 49 | not be written. 50 | @return YES if data has been written, NO if 51 | data could not be written due to an error. 52 | */ 53 | - (BOOL) writeData:(nonnull NSData *)data error:(NSError * __autoreleasing __nullable * __nullable)error; 54 | 55 | /** 56 | @brief Closes the write stream. 57 |

Once you have finished writing data to the new file, it is important to 58 | close the stream so system resources may be freed.

59 |

Note: after the stream has been closed any subsequent write will result in 60 | an error.

61 | @param error If passed, may be filled with an NSError is case the stream could 62 | not be closed. 63 | @return YES if the stream has been closed, NO if 64 | the stream could not be closed due to an error. 65 | */ 66 | - (BOOL) finishedWritingWithError:(NSError * __autoreleasing __nullable * __nullable)error; 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipWriteStream+Standard.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipWriteStream+Standard.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 09/09/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipWriteStream.h" 35 | 36 | 37 | @interface OZZipWriteStream (Standard) 38 | 39 | 40 | #pragma mark - 41 | #pragma mark Writing data 42 | 43 | /** 44 | @brief Compresses and writes data to the new file in the zip file. 45 |

Data are compressed depending on the choice of compression level specified 46 | during creation of the write stream.

47 | @param data The data to be compressed and written. 48 | @throws OZZipException If the data could not be written due to an error. 49 | */ 50 | - (void) writeData:(nonnull NSData *)data; 51 | 52 | /** 53 | @brief Closes the write stream. 54 |

Once you have finished writing data to the new file, it is important to 55 | close the stream so system resources may be freed.

56 |

Note: after the stream has been closed any subsequent write will result in 57 | an error.

58 | @throws OZZipException If the stream could not be closed due to an error. 59 | */ 60 | - (void) finishedWriting; 61 | 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipWriteStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipWriteStream.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 25/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import 35 | 36 | 37 | /** 38 | @brief OZZipWriteStream implements a write stream and provides services to 39 | write content to a new file in the zip file. 40 | */ 41 | @interface OZZipWriteStream : NSObject 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/OZZipWriteStream.m: -------------------------------------------------------------------------------- 1 | // 2 | // OZZipWriteStream.m 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 25/12/09. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipWriteStream.h" 35 | #import "OZZipWriteStream+Standard.h" 36 | #import "OZZipWriteStream+NSError.h" 37 | #import "OZZipWriteStream+Internals.h" 38 | #import "OZZipException.h" 39 | #import "OZZipException+Internals.h" 40 | 41 | 42 | #pragma mark - 43 | #pragma mark OZZipWriteStream extension 44 | 45 | @interface OZZipWriteStream () { 46 | NSString *_fileNameInZip; 47 | 48 | @private 49 | zipFile _zipFile; 50 | } 51 | 52 | 53 | @end 54 | 55 | 56 | #pragma mark - 57 | #pragma mark OZZipWriteStream implementation 58 | 59 | @implementation OZZipWriteStream 60 | 61 | 62 | #pragma mark - 63 | #pragma mark Initialization 64 | 65 | - (instancetype) initWithZipFileStruct:(zipFile)zipFile fileNameInZip:(NSString *)fileNameInZip { 66 | if (self= [super init]) { 67 | _zipFile= zipFile; 68 | _fileNameInZip= fileNameInZip; 69 | } 70 | 71 | return self; 72 | } 73 | 74 | 75 | #pragma mark - 76 | #pragma mark Writing data 77 | 78 | - (void) writeData:(NSData *)data { 79 | int err= zipWriteInFileInZip(_zipFile, [data bytes], (uInt) [data length]); 80 | if (err < 0) 81 | @throw [OZZipException zipExceptionWithError:err reason:@"Error writing '%@' in the zipfile", _fileNameInZip]; 82 | } 83 | 84 | - (void) finishedWriting { 85 | int err= zipCloseFileInZip(_zipFile); 86 | if (err != ZIP_OK) 87 | @throw [OZZipException zipExceptionWithError:err reason:@"Error closing '%@' in the zipfile", _fileNameInZip]; 88 | } 89 | 90 | 91 | #pragma mark - 92 | #pragma mark Writing data (NSError variants) 93 | 94 | - (BOOL) writeData:(NSData *)data error:(NSError * __autoreleasing *)error { 95 | ERROR_WRAP_BEGIN { 96 | 97 | [self writeData:data]; 98 | 99 | return YES; 100 | 101 | } ERROR_WRAP_END_AND_RETURN(error, NO); 102 | } 103 | 104 | - (BOOL) finishedWritingWithError:(NSError * __autoreleasing *)error { 105 | ERROR_WRAP_BEGIN { 106 | 107 | [self finishedWriting]; 108 | 109 | return YES; 110 | 111 | } ERROR_WRAP_END_AND_RETURN(error, NO); 112 | } 113 | 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/Objective-Zip+NSError.h: -------------------------------------------------------------------------------- 1 | // 2 | // Objective-Zip+NSError.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 09/09/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipFile.h" 35 | #import "OZZipFile+NSError.h" 36 | #import "OZZipFileMode.h" 37 | #import "OZZipCompressionLevel.h" 38 | #import "OZZipException.h" 39 | #import "OZZipWriteStream.h" 40 | #import "OZZipWriteStream+NSError.h" 41 | #import "OZZipReadStream.h" 42 | #import "OZZipReadStream+NSError.h" 43 | #import "OZFileInZipInfo.h" 44 | #import "NSDate+DOSDate.h" 45 | #import "NSData+CRC32.h" 46 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/Objective-Zip/Objective-Zip.h: -------------------------------------------------------------------------------- 1 | // 2 | // Objective-Zip.h 3 | // Objective-Zip v. 1.0.5 4 | // 5 | // Created by Gianluca Bertani on 27/08/15. 6 | // Copyright 2009-2017 Gianluca Bertani. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 12 | // * Redistributions of source code must retain the above copyright notice, 13 | // this list of conditions and the following disclaimer. 14 | // * Redistributions in binary form must reproduce the above copyright notice, 15 | // this list of conditions and the following disclaimer in the documentation 16 | // and/or other materials provided with the distribution. 17 | // * Neither the name of Gianluca Bertani nor the names of its contributors 18 | // may be used to endorse or promote products derived from this software 19 | // without specific prior written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | // POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | 34 | #import "OZZipFile.h" 35 | #import "OZZipFile+Standard.h" 36 | #import "OZZipFileMode.h" 37 | #import "OZZipCompressionLevel.h" 38 | #import "OZZipException.h" 39 | #import "OZZipWriteStream.h" 40 | #import "OZZipWriteStream+Standard.h" 41 | #import "OZZipReadStream.h" 42 | #import "OZZipReadStream+Standard.h" 43 | #import "OZFileInZipInfo.h" 44 | #import "NSDate+DOSDate.h" 45 | #import "NSData+CRC32.h" 46 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/adler32.c: -------------------------------------------------------------------------------- 1 | /* adler32.c -- compute the Adler-32 checksum of a data stream 2 | * Copyright (C) 1995-2011 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #include "zutil.h" 9 | 10 | #define local static 11 | 12 | local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); 13 | 14 | #define BASE 65521 /* largest prime smaller than 65536 */ 15 | #define NMAX 5552 16 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ 17 | 18 | #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} 19 | #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); 20 | #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); 21 | #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); 22 | #define DO16(buf) DO8(buf,0); DO8(buf,8); 23 | 24 | /* use NO_DIVIDE if your processor does not do division in hardware -- 25 | try it both ways to see which is faster */ 26 | #ifdef NO_DIVIDE 27 | /* note that this assumes BASE is 65521, where 65536 % 65521 == 15 28 | (thank you to John Reiser for pointing this out) */ 29 | # define CHOP(a) \ 30 | do { \ 31 | unsigned long tmp = a >> 16; \ 32 | a &= 0xffffUL; \ 33 | a += (tmp << 4) - tmp; \ 34 | } while (0) 35 | # define MOD28(a) \ 36 | do { \ 37 | CHOP(a); \ 38 | if (a >= BASE) a -= BASE; \ 39 | } while (0) 40 | # define MOD(a) \ 41 | do { \ 42 | CHOP(a); \ 43 | MOD28(a); \ 44 | } while (0) 45 | # define MOD63(a) \ 46 | do { /* this assumes a is not negative */ \ 47 | z_off64_t tmp = a >> 32; \ 48 | a &= 0xffffffffL; \ 49 | a += (tmp << 8) - (tmp << 5) + tmp; \ 50 | tmp = a >> 16; \ 51 | a &= 0xffffL; \ 52 | a += (tmp << 4) - tmp; \ 53 | tmp = a >> 16; \ 54 | a &= 0xffffL; \ 55 | a += (tmp << 4) - tmp; \ 56 | if (a >= BASE) a -= BASE; \ 57 | } while (0) 58 | #else 59 | # define MOD(a) a %= BASE 60 | # define MOD28(a) a %= BASE 61 | # define MOD63(a) a %= BASE 62 | #endif 63 | 64 | /* ========================================================================= */ 65 | uLong ZEXPORT adler32(adler, buf, len) 66 | uLong adler; 67 | const Bytef *buf; 68 | uInt len; 69 | { 70 | unsigned long sum2; 71 | unsigned n; 72 | 73 | /* split Adler-32 into component sums */ 74 | sum2 = (adler >> 16) & 0xffff; 75 | adler &= 0xffff; 76 | 77 | /* in case user likes doing a byte at a time, keep it fast */ 78 | if (len == 1) { 79 | adler += buf[0]; 80 | if (adler >= BASE) 81 | adler -= BASE; 82 | sum2 += adler; 83 | if (sum2 >= BASE) 84 | sum2 -= BASE; 85 | return adler | (sum2 << 16); 86 | } 87 | 88 | /* initial Adler-32 value (deferred check for len == 1 speed) */ 89 | if (buf == Z_NULL) 90 | return 1L; 91 | 92 | /* in case short lengths are provided, keep it somewhat fast */ 93 | if (len < 16) { 94 | while (len--) { 95 | adler += *buf++; 96 | sum2 += adler; 97 | } 98 | if (adler >= BASE) 99 | adler -= BASE; 100 | MOD28(sum2); /* only added so many BASE's */ 101 | return adler | (sum2 << 16); 102 | } 103 | 104 | /* do length NMAX blocks -- requires just one modulo operation */ 105 | while (len >= NMAX) { 106 | len -= NMAX; 107 | n = NMAX / 16; /* NMAX is divisible by 16 */ 108 | do { 109 | DO16(buf); /* 16 sums unrolled */ 110 | buf += 16; 111 | } while (--n); 112 | MOD(adler); 113 | MOD(sum2); 114 | } 115 | 116 | /* do remaining bytes (less than NMAX, still just one modulo) */ 117 | if (len) { /* avoid modulos if none remaining */ 118 | while (len >= 16) { 119 | len -= 16; 120 | DO16(buf); 121 | buf += 16; 122 | } 123 | while (len--) { 124 | adler += *buf++; 125 | sum2 += adler; 126 | } 127 | MOD(adler); 128 | MOD(sum2); 129 | } 130 | 131 | /* return recombined sums */ 132 | return adler | (sum2 << 16); 133 | } 134 | 135 | /* ========================================================================= */ 136 | local uLong adler32_combine_(adler1, adler2, len2) 137 | uLong adler1; 138 | uLong adler2; 139 | z_off64_t len2; 140 | { 141 | unsigned long sum1; 142 | unsigned long sum2; 143 | unsigned rem; 144 | 145 | /* for negative len, return invalid adler32 as a clue for debugging */ 146 | if (len2 < 0) 147 | return 0xffffffffUL; 148 | 149 | /* the derivation of this formula is left as an exercise for the reader */ 150 | MOD63(len2); /* assumes len2 >= 0 */ 151 | rem = (unsigned)len2; 152 | sum1 = adler1 & 0xffff; 153 | sum2 = rem * sum1; 154 | MOD(sum2); 155 | sum1 += (adler2 & 0xffff) + BASE - 1; 156 | sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; 157 | if (sum1 >= BASE) sum1 -= BASE; 158 | if (sum1 >= BASE) sum1 -= BASE; 159 | if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); 160 | if (sum2 >= BASE) sum2 -= BASE; 161 | return sum1 | (sum2 << 16); 162 | } 163 | 164 | /* ========================================================================= */ 165 | uLong ZEXPORT adler32_combine(adler1, adler2, len2) 166 | uLong adler1; 167 | uLong adler2; 168 | z_off_t len2; 169 | { 170 | return adler32_combine_(adler1, adler2, len2); 171 | } 172 | 173 | uLong ZEXPORT adler32_combine64(adler1, adler2, len2) 174 | uLong adler1; 175 | uLong adler2; 176 | z_off64_t len2; 177 | { 178 | return adler32_combine_(adler1, adler2, len2); 179 | } 180 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/compress.c: -------------------------------------------------------------------------------- 1 | /* compress.c -- compress a memory buffer 2 | * Copyright (C) 1995-2005 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Compresses the source buffer into the destination buffer. The level 13 | parameter has the same meaning as in deflateInit. sourceLen is the byte 14 | length of the source buffer. Upon entry, destLen is the total size of the 15 | destination buffer, which must be at least 0.1% larger than sourceLen plus 16 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 17 | 18 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 19 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 20 | Z_STREAM_ERROR if the level parameter is invalid. 21 | */ 22 | int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) 23 | Bytef *dest; 24 | uLongf *destLen; 25 | const Bytef *source; 26 | uLong sourceLen; 27 | int level; 28 | { 29 | z_stream stream; 30 | int err; 31 | 32 | stream.next_in = (z_const Bytef *)source; 33 | stream.avail_in = (uInt)sourceLen; 34 | #ifdef MAXSEG_64K 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | #endif 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | stream.opaque = (voidpf)0; 45 | 46 | err = deflateInit(&stream, level); 47 | if (err != Z_OK) return err; 48 | 49 | err = deflate(&stream, Z_FINISH); 50 | if (err != Z_STREAM_END) { 51 | deflateEnd(&stream); 52 | return err == Z_OK ? Z_BUF_ERROR : err; 53 | } 54 | *destLen = stream.total_out; 55 | 56 | err = deflateEnd(&stream); 57 | return err; 58 | } 59 | 60 | /* =========================================================================== 61 | */ 62 | int ZEXPORT compress (dest, destLen, source, sourceLen) 63 | Bytef *dest; 64 | uLongf *destLen; 65 | const Bytef *source; 66 | uLong sourceLen; 67 | { 68 | return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); 69 | } 70 | 71 | /* =========================================================================== 72 | If the default memLevel or windowBits for deflateInit() is changed, then 73 | this function needs to be updated. 74 | */ 75 | uLong ZEXPORT compressBound (sourceLen) 76 | uLong sourceLen; 77 | { 78 | return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 79 | (sourceLen >> 25) + 13; 80 | } 81 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/gzguts.h: -------------------------------------------------------------------------------- 1 | /* gzguts.h -- zlib internal header definitions for gz* operations 2 | * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #ifdef _LARGEFILE64_SOURCE 7 | # ifndef _LARGEFILE_SOURCE 8 | # define _LARGEFILE_SOURCE 1 9 | # endif 10 | # ifdef _FILE_OFFSET_BITS 11 | # undef _FILE_OFFSET_BITS 12 | # endif 13 | #endif 14 | 15 | #ifdef HAVE_HIDDEN 16 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) 17 | #else 18 | # define ZLIB_INTERNAL 19 | #endif 20 | 21 | #include 22 | #include "zlib.h" 23 | #ifdef STDC 24 | # include 25 | # include 26 | # include 27 | #endif 28 | #include 29 | 30 | #ifdef __APPLE__ 31 | # include 32 | # include 33 | # include 34 | #endif 35 | 36 | #ifdef _WIN32 37 | # include 38 | #endif 39 | 40 | #if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) 41 | # include 42 | #endif 43 | 44 | #ifdef WINAPI_FAMILY 45 | # define open _open 46 | # define read _read 47 | # define write _write 48 | # define close _close 49 | #endif 50 | 51 | #ifdef NO_DEFLATE /* for compatibility with old definition */ 52 | # define NO_GZCOMPRESS 53 | #endif 54 | 55 | #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) 56 | # ifndef HAVE_VSNPRINTF 57 | # define HAVE_VSNPRINTF 58 | # endif 59 | #endif 60 | 61 | #if defined(__CYGWIN__) 62 | # ifndef HAVE_VSNPRINTF 63 | # define HAVE_VSNPRINTF 64 | # endif 65 | #endif 66 | 67 | #if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) 68 | # ifndef HAVE_VSNPRINTF 69 | # define HAVE_VSNPRINTF 70 | # endif 71 | #endif 72 | 73 | #ifndef HAVE_VSNPRINTF 74 | # ifdef MSDOS 75 | /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), 76 | but for now we just assume it doesn't. */ 77 | # define NO_vsnprintf 78 | # endif 79 | # ifdef __TURBOC__ 80 | # define NO_vsnprintf 81 | # endif 82 | # ifdef WIN32 83 | /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ 84 | # if !defined(vsnprintf) && !defined(NO_vsnprintf) 85 | # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) 86 | # define vsnprintf _vsnprintf 87 | # endif 88 | # endif 89 | # endif 90 | # ifdef __SASC 91 | # define NO_vsnprintf 92 | # endif 93 | # ifdef VMS 94 | # define NO_vsnprintf 95 | # endif 96 | # ifdef __OS400__ 97 | # define NO_vsnprintf 98 | # endif 99 | # ifdef __MVS__ 100 | # define NO_vsnprintf 101 | # endif 102 | #endif 103 | 104 | /* unlike snprintf (which is required in C99, yet still not supported by 105 | Microsoft more than a decade later!), _snprintf does not guarantee null 106 | termination of the result -- however this is only used in gzlib.c where 107 | the result is assured to fit in the space provided */ 108 | #ifdef _MSC_VER 109 | # define snprintf _snprintf 110 | #endif 111 | 112 | #ifndef local 113 | # define local static 114 | #endif 115 | /* compile with -Dlocal if your debugger can't find static symbols */ 116 | 117 | /* gz* functions always use library allocation functions */ 118 | #ifndef STDC 119 | extern voidp malloc OF((uInt size)); 120 | extern void free OF((voidpf ptr)); 121 | #endif 122 | 123 | /* get errno and strerror definition */ 124 | #if defined UNDER_CE 125 | # include 126 | # define zstrerror() gz_strwinerror((DWORD)GetLastError()) 127 | #else 128 | # ifndef NO_STRERROR 129 | # include 130 | # define zstrerror() strerror(errno) 131 | # else 132 | # define zstrerror() "stdio error (consult errno)" 133 | # endif 134 | #endif 135 | 136 | /* provide prototypes for these when building zlib without LFS */ 137 | #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 138 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); 139 | ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); 140 | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); 141 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); 142 | #endif 143 | 144 | /* default memLevel */ 145 | #if MAX_MEM_LEVEL >= 8 146 | # define DEF_MEM_LEVEL 8 147 | #else 148 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL 149 | #endif 150 | 151 | /* default i/o buffer size -- double this for output when reading (this and 152 | twice this must be able to fit in an unsigned type) */ 153 | #define GZBUFSIZE 8192 154 | 155 | /* gzip modes, also provide a little integrity check on the passed structure */ 156 | #define GZ_NONE 0 157 | #define GZ_READ 7247 158 | #define GZ_WRITE 31153 159 | #define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ 160 | 161 | /* values for gz_state how */ 162 | #define LOOK 0 /* look for a gzip header */ 163 | #define COPY 1 /* copy input directly */ 164 | #define GZIP 2 /* decompress a gzip stream */ 165 | 166 | /* internal gzip file state data structure */ 167 | typedef struct { 168 | /* exposed contents for gzgetc() macro */ 169 | struct gzFile_s x; /* "x" for exposed */ 170 | /* x.have: number of bytes available at x.next */ 171 | /* x.next: next output data to deliver or write */ 172 | /* x.pos: current position in uncompressed data */ 173 | /* used for both reading and writing */ 174 | int mode; /* see gzip modes above */ 175 | int fd; /* file descriptor */ 176 | char *path; /* path or fd for error messages */ 177 | unsigned size; /* buffer size, zero if not allocated yet */ 178 | unsigned want; /* requested buffer size, default is GZBUFSIZE */ 179 | unsigned char *in; /* input buffer */ 180 | unsigned char *out; /* output buffer (double-sized when reading) */ 181 | int direct; /* 0 if processing gzip, 1 if transparent */ 182 | /* just for reading */ 183 | int how; /* 0: get header, 1: copy, 2: decompress */ 184 | z_off64_t start; /* where the gzip data started, for rewinding */ 185 | int eof; /* true if end of input file reached */ 186 | int past; /* true if read requested past end */ 187 | /* just for writing */ 188 | int level; /* compression level */ 189 | int strategy; /* compression strategy */ 190 | /* seek request */ 191 | z_off64_t skip; /* amount to skip (already rewound if backwards) */ 192 | int seek; /* true if seek request pending */ 193 | /* error information */ 194 | int err; /* error code */ 195 | char *msg; /* error message */ 196 | /* zlib inflate or deflate stream */ 197 | z_stream strm; /* stream structure in-place (not a pointer) */ 198 | } gz_state; 199 | typedef gz_state FAR *gz_statep; 200 | 201 | /* shared functions */ 202 | void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); 203 | #if defined UNDER_CE 204 | char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); 205 | #endif 206 | 207 | /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t 208 | value -- needed when comparing unsigned to z_off64_t, which is signed 209 | (possible z_off64_t types off_t, off64_t, and long are all signed) */ 210 | #ifdef INT_MAX 211 | # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) 212 | #else 213 | unsigned ZLIB_INTERNAL gz_intmax OF((void)); 214 | # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) 215 | #endif 216 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/inffixed.h: -------------------------------------------------------------------------------- 1 | /* inffixed.h -- table for decoding fixed codes 2 | * Generated automatically by makefixed(). 3 | */ 4 | 5 | /* WARNING: this file should *not* be used by applications. 6 | It is part of the implementation of this library and is 7 | subject to change. Applications should only use zlib.h. 8 | */ 9 | 10 | static const code lenfix[512] = { 11 | {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, 12 | {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, 13 | {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, 14 | {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, 15 | {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, 16 | {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, 17 | {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, 18 | {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, 19 | {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, 20 | {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, 21 | {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, 22 | {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, 23 | {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, 24 | {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, 25 | {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, 26 | {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, 27 | {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, 28 | {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, 29 | {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, 30 | {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, 31 | {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, 32 | {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, 33 | {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, 34 | {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, 35 | {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, 36 | {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, 37 | {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, 38 | {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, 39 | {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, 40 | {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, 41 | {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, 42 | {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, 43 | {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, 44 | {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, 45 | {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, 46 | {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, 47 | {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, 48 | {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, 49 | {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, 50 | {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, 51 | {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, 52 | {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, 53 | {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, 54 | {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, 55 | {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, 56 | {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, 57 | {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, 58 | {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, 59 | {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, 60 | {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, 61 | {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, 62 | {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, 63 | {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, 64 | {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, 65 | {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, 66 | {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, 67 | {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, 68 | {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, 69 | {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, 70 | {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, 71 | {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, 72 | {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, 73 | {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, 74 | {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, 75 | {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, 76 | {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, 77 | {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, 78 | {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, 79 | {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, 80 | {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, 81 | {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, 82 | {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, 83 | {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, 84 | {0,9,255} 85 | }; 86 | 87 | static const code distfix[32] = { 88 | {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, 89 | {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, 90 | {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, 91 | {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, 92 | {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, 93 | {22,5,193},{64,5,0} 94 | }; 95 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/inflate.h: -------------------------------------------------------------------------------- 1 | /* inflate.h -- internal inflate state definition 2 | * Copyright (C) 1995-2009 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* define NO_GZIP when compiling if you want to disable gzip header and 12 | trailer decoding by inflate(). NO_GZIP would be used to avoid linking in 13 | the crc code when it is not needed. For shared libraries, gzip decoding 14 | should be left enabled. */ 15 | #ifndef NO_GZIP 16 | # define GUNZIP 17 | #endif 18 | 19 | /* Possible inflate modes between inflate() calls */ 20 | typedef enum { 21 | HEAD, /* i: waiting for magic header */ 22 | FLAGS, /* i: waiting for method and flags (gzip) */ 23 | TIME, /* i: waiting for modification time (gzip) */ 24 | OS, /* i: waiting for extra flags and operating system (gzip) */ 25 | EXLEN, /* i: waiting for extra length (gzip) */ 26 | EXTRA, /* i: waiting for extra bytes (gzip) */ 27 | NAME, /* i: waiting for end of file name (gzip) */ 28 | COMMENT, /* i: waiting for end of comment (gzip) */ 29 | HCRC, /* i: waiting for header crc (gzip) */ 30 | DICTID, /* i: waiting for dictionary check value */ 31 | DICT, /* waiting for inflateSetDictionary() call */ 32 | TYPE, /* i: waiting for type bits, including last-flag bit */ 33 | TYPEDO, /* i: same, but skip check to exit inflate on new block */ 34 | STORED, /* i: waiting for stored size (length and complement) */ 35 | COPY_, /* i/o: same as COPY below, but only first time in */ 36 | COPY, /* i/o: waiting for input or output to copy stored block */ 37 | TABLE, /* i: waiting for dynamic block table lengths */ 38 | LENLENS, /* i: waiting for code length code lengths */ 39 | CODELENS, /* i: waiting for length/lit and distance code lengths */ 40 | LEN_, /* i: same as LEN below, but only first time in */ 41 | LEN, /* i: waiting for length/lit/eob code */ 42 | LENEXT, /* i: waiting for length extra bits */ 43 | DIST, /* i: waiting for distance code */ 44 | DISTEXT, /* i: waiting for distance extra bits */ 45 | MATCH, /* o: waiting for output space to copy string */ 46 | LIT, /* o: waiting for output space to write literal */ 47 | CHECK, /* i: waiting for 32-bit check value */ 48 | LENGTH, /* i: waiting for 32-bit length (gzip) */ 49 | DONE, /* finished check, done -- remain here until reset */ 50 | BAD, /* got a data error -- remain here until reset */ 51 | MEM, /* got an inflate() memory error -- remain here until reset */ 52 | SYNC /* looking for synchronization bytes to restart inflate() */ 53 | } inflate_mode; 54 | 55 | /* 56 | State transitions between above modes - 57 | 58 | (most modes can go to BAD or MEM on error -- not shown for clarity) 59 | 60 | Process header: 61 | HEAD -> (gzip) or (zlib) or (raw) 62 | (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> 63 | HCRC -> TYPE 64 | (zlib) -> DICTID or TYPE 65 | DICTID -> DICT -> TYPE 66 | (raw) -> TYPEDO 67 | Read deflate blocks: 68 | TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK 69 | STORED -> COPY_ -> COPY -> TYPE 70 | TABLE -> LENLENS -> CODELENS -> LEN_ 71 | LEN_ -> LEN 72 | Read deflate codes in fixed or dynamic block: 73 | LEN -> LENEXT or LIT or TYPE 74 | LENEXT -> DIST -> DISTEXT -> MATCH -> LEN 75 | LIT -> LEN 76 | Process trailer: 77 | CHECK -> LENGTH -> DONE 78 | */ 79 | 80 | /* state maintained between inflate() calls. Approximately 10K bytes. */ 81 | struct inflate_state { 82 | inflate_mode mode; /* current inflate mode */ 83 | int last; /* true if processing last block */ 84 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ 85 | int havedict; /* true if dictionary provided */ 86 | int flags; /* gzip header method and flags (0 if zlib) */ 87 | unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ 88 | unsigned long check; /* protected copy of check value */ 89 | unsigned long total; /* protected copy of output count */ 90 | gz_headerp head; /* where to save gzip header information */ 91 | /* sliding window */ 92 | unsigned wbits; /* log base 2 of requested window size */ 93 | unsigned wsize; /* window size or zero if not using window */ 94 | unsigned whave; /* valid bytes in the window */ 95 | unsigned wnext; /* window write index */ 96 | unsigned char FAR *window; /* allocated sliding window, if needed */ 97 | /* bit accumulator */ 98 | unsigned long hold; /* input bit accumulator */ 99 | unsigned bits; /* number of bits in "in" */ 100 | /* for string and stored block copying */ 101 | unsigned length; /* literal or length of data to copy */ 102 | unsigned offset; /* distance back to copy string from */ 103 | /* for table and code decoding */ 104 | unsigned extra; /* extra bits needed */ 105 | /* fixed and dynamic code tables */ 106 | code const FAR *lencode; /* starting table for length/literal codes */ 107 | code const FAR *distcode; /* starting table for distance codes */ 108 | unsigned lenbits; /* index bits for lencode */ 109 | unsigned distbits; /* index bits for distcode */ 110 | /* dynamic table building */ 111 | unsigned ncode; /* number of code length code lengths */ 112 | unsigned nlen; /* number of length code lengths */ 113 | unsigned ndist; /* number of distance code lengths */ 114 | unsigned have; /* number of code lengths in lens[] */ 115 | code FAR *next; /* next available space in codes[] */ 116 | unsigned short lens[320]; /* temporary storage for code lengths */ 117 | unsigned short work[288]; /* work area for code table building */ 118 | code codes[ENOUGH]; /* space for code tables */ 119 | int sane; /* if false, allow invalid distance too far */ 120 | int back; /* bits back of last unprocessed length/lit */ 121 | unsigned was; /* initial length of match */ 122 | }; 123 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of the dynamic table. The maximum number of code structures is 39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance 40 | codes. These values were found by exhaustive searches using the program 41 | examples/enough.c found in the zlib distribtution. The arguments to that 42 | program are the number of symbols, the initial root table size, and the 43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes 44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592. 45 | The initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in inflate.c and infback.c. If the root table size is 47 | changed, then these maximum sizes would be need to be recalculated and 48 | updated. */ 49 | #define ENOUGH_LENS 852 50 | #define ENOUGH_DISTS 592 51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 52 | 53 | /* Type of code to build for inflate_table() */ 54 | typedef enum { 55 | CODES, 56 | LENS, 57 | DISTS 58 | } codetype; 59 | 60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, 61 | unsigned codes, code FAR * FAR *table, 62 | unsigned FAR *bits, unsigned short FAR *work)); 63 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/trees.h: -------------------------------------------------------------------------------- 1 | /* header created automatically with -DGEN_TREES_H */ 2 | 3 | local const ct_data static_ltree[L_CODES+2] = { 4 | {{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, 5 | {{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, 6 | {{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, 7 | {{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, 8 | {{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, 9 | {{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, 10 | {{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, 11 | {{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, 12 | {{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, 13 | {{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, 14 | {{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, 15 | {{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, 16 | {{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, 17 | {{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, 18 | {{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, 19 | {{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, 20 | {{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, 21 | {{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, 22 | {{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, 23 | {{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, 24 | {{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, 25 | {{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, 26 | {{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, 27 | {{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, 28 | {{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, 29 | {{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, 30 | {{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, 31 | {{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, 32 | {{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, 33 | {{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, 34 | {{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, 35 | {{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, 36 | {{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, 37 | {{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, 38 | {{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, 39 | {{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, 40 | {{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, 41 | {{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, 42 | {{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, 43 | {{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, 44 | {{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, 45 | {{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, 46 | {{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, 47 | {{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, 48 | {{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, 49 | {{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, 50 | {{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, 51 | {{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, 52 | {{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, 53 | {{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, 54 | {{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, 55 | {{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, 56 | {{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, 57 | {{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, 58 | {{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, 59 | {{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, 60 | {{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, 61 | {{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} 62 | }; 63 | 64 | local const ct_data static_dtree[D_CODES] = { 65 | {{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, 66 | {{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, 67 | {{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, 68 | {{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, 69 | {{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, 70 | {{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} 71 | }; 72 | 73 | const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { 74 | 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 75 | 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 76 | 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 77 | 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 78 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 79 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 80 | 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 81 | 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 82 | 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 83 | 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 84 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 85 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 86 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 87 | 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 88 | 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 89 | 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 90 | 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 91 | 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 92 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 93 | 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 94 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 95 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 96 | 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 97 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 98 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 99 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 100 | }; 101 | 102 | const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { 103 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 104 | 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 105 | 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 106 | 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 107 | 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 108 | 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 109 | 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 110 | 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 111 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 112 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 113 | 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 114 | 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 115 | 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 116 | }; 117 | 118 | local const int base_length[LENGTH_CODES] = { 119 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 120 | 64, 80, 96, 112, 128, 160, 192, 224, 0 121 | }; 122 | 123 | local const int base_dist[D_CODES] = { 124 | 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 125 | 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 126 | 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 127 | }; 128 | 129 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. sourceLen is 13 | the byte length of the source buffer. Upon entry, destLen is the total 14 | size of the destination buffer, which must be large enough to hold the 15 | entire uncompressed data. (The size of the uncompressed data must have 16 | been saved previously by the compressor and transmitted to the decompressor 17 | by some mechanism outside the scope of this compression library.) 18 | Upon exit, destLen is the actual size of the compressed buffer. 19 | 20 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 21 | enough memory, Z_BUF_ERROR if there was not enough room in the output 22 | buffer, or Z_DATA_ERROR if the input data was corrupted. 23 | */ 24 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 25 | Bytef *dest; 26 | uLongf *destLen; 27 | const Bytef *source; 28 | uLong sourceLen; 29 | { 30 | z_stream stream; 31 | int err; 32 | 33 | stream.next_in = (z_const Bytef *)source; 34 | stream.avail_in = (uInt)sourceLen; 35 | /* Check for source > 64K on 16-bit machine: */ 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 37 | 38 | stream.next_out = dest; 39 | stream.avail_out = (uInt)*destLen; 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 41 | 42 | stream.zalloc = (alloc_func)0; 43 | stream.zfree = (free_func)0; 44 | 45 | err = inflateInit(&stream); 46 | if (err != Z_OK) return err; 47 | 48 | err = inflate(&stream, Z_FINISH); 49 | if (err != Z_STREAM_END) { 50 | inflateEnd(&stream); 51 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 52 | return Z_DATA_ERROR; 53 | return err; 54 | } 55 | *destLen = stream.total_out; 56 | 57 | err = inflateEnd(&stream); 58 | return err; 59 | } 60 | -------------------------------------------------------------------------------- /Divisé/Objective-Zip/ZLib/zutil.h: -------------------------------------------------------------------------------- 1 | /* zutil.h -- internal interface and configuration of the compression library 2 | * Copyright (C) 1995-2013 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* @(#) $Id$ */ 12 | 13 | #ifndef ZUTIL_H 14 | #define ZUTIL_H 15 | 16 | #ifdef HAVE_HIDDEN 17 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) 18 | #else 19 | # define ZLIB_INTERNAL 20 | #endif 21 | 22 | #include "zlib.h" 23 | 24 | #if defined(STDC) && !defined(Z_SOLO) 25 | # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) 26 | # include 27 | # endif 28 | # include 29 | # include 30 | #endif 31 | 32 | #ifdef Z_SOLO 33 | typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ 34 | #endif 35 | 36 | #ifndef local 37 | # define local static 38 | #endif 39 | /* compile with -Dlocal if your debugger can't find static symbols */ 40 | 41 | typedef unsigned char uch; 42 | typedef uch FAR uchf; 43 | typedef unsigned short ush; 44 | typedef ush FAR ushf; 45 | typedef unsigned long ulg; 46 | 47 | extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ 48 | /* (size given to avoid silly warnings with Visual C++) */ 49 | 50 | #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] 51 | 52 | #define ERR_RETURN(strm,err) \ 53 | return (strm->msg = ERR_MSG(err), (err)) 54 | /* To be used only when the state is known to be valid */ 55 | 56 | /* common constants */ 57 | 58 | #ifndef DEF_WBITS 59 | # define DEF_WBITS MAX_WBITS 60 | #endif 61 | /* default windowBits for decompression. MAX_WBITS is for compression only */ 62 | 63 | #if MAX_MEM_LEVEL >= 8 64 | # define DEF_MEM_LEVEL 8 65 | #else 66 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL 67 | #endif 68 | /* default memLevel */ 69 | 70 | #define STORED_BLOCK 0 71 | #define STATIC_TREES 1 72 | #define DYN_TREES 2 73 | /* The three kinds of block type */ 74 | 75 | #define MIN_MATCH 3 76 | #define MAX_MATCH 258 77 | /* The minimum and maximum match lengths */ 78 | 79 | #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ 80 | 81 | /* target dependencies */ 82 | 83 | #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) 84 | # define OS_CODE 0x00 85 | # ifndef Z_SOLO 86 | # if defined(__TURBOC__) || defined(__BORLANDC__) 87 | # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) 88 | /* Allow compilation with ANSI keywords only enabled */ 89 | void _Cdecl farfree( void *block ); 90 | void *_Cdecl farmalloc( unsigned long nbytes ); 91 | # else 92 | # include 93 | # endif 94 | # else /* MSC or DJGPP */ 95 | # include 96 | # endif 97 | # endif 98 | #endif 99 | 100 | #ifdef AMIGA 101 | # define OS_CODE 0x01 102 | #endif 103 | 104 | #if defined(VAXC) || defined(VMS) 105 | # define OS_CODE 0x02 106 | # define F_OPEN(name, mode) \ 107 | fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") 108 | #endif 109 | 110 | #if defined(ATARI) || defined(atarist) 111 | # define OS_CODE 0x05 112 | #endif 113 | 114 | #ifdef OS2 115 | # define OS_CODE 0x06 116 | # if defined(M_I86) && !defined(Z_SOLO) 117 | # include 118 | # endif 119 | #endif 120 | 121 | #if defined(MACOS) || defined(TARGET_OS_MAC) 122 | # define OS_CODE 0x07 123 | # ifndef Z_SOLO 124 | # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os 125 | # include /* for fdopen */ 126 | # else 127 | # ifndef fdopen 128 | # define fdopen(fd,mode) NULL /* No fdopen() */ 129 | # endif 130 | # endif 131 | # endif 132 | #endif 133 | 134 | #ifdef TOPS20 135 | # define OS_CODE 0x0a 136 | #endif 137 | 138 | #ifdef WIN32 139 | # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ 140 | # define OS_CODE 0x0b 141 | # endif 142 | #endif 143 | 144 | #ifdef __50SERIES /* Prime/PRIMOS */ 145 | # define OS_CODE 0x0f 146 | #endif 147 | 148 | #if defined(_BEOS_) || defined(RISCOS) 149 | # define fdopen(fd,mode) NULL /* No fdopen() */ 150 | #endif 151 | 152 | #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX 153 | # if defined(_WIN32_WCE) 154 | # define fdopen(fd,mode) NULL /* No fdopen() */ 155 | # ifndef _PTRDIFF_T_DEFINED 156 | typedef int ptrdiff_t; 157 | # define _PTRDIFF_T_DEFINED 158 | # endif 159 | # else 160 | # define fdopen(fd,type) _fdopen(fd,type) 161 | # endif 162 | #endif 163 | 164 | #if defined(__BORLANDC__) && !defined(MSDOS) 165 | #pragma warn -8004 166 | #pragma warn -8008 167 | #pragma warn -8066 168 | #endif 169 | 170 | /* provide prototypes for these when building zlib without LFS */ 171 | #if !defined(_WIN32) && \ 172 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) 173 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); 174 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); 175 | #endif 176 | 177 | /* common defaults */ 178 | 179 | #ifndef OS_CODE 180 | # define OS_CODE 0x03 /* assume Unix */ 181 | #endif 182 | 183 | #ifndef F_OPEN 184 | # define F_OPEN(name, mode) fopen((name), (mode)) 185 | #endif 186 | 187 | /* functions */ 188 | 189 | #if defined(pyr) || defined(Z_SOLO) 190 | # define NO_MEMCPY 191 | #endif 192 | #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) 193 | /* Use our own functions for small and medium model with MSC <= 5.0. 194 | * You may have to use the same strategy for Borland C (untested). 195 | * The __SC__ check is for Symantec. 196 | */ 197 | # define NO_MEMCPY 198 | #endif 199 | #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) 200 | # define HAVE_MEMCPY 201 | #endif 202 | #ifdef HAVE_MEMCPY 203 | # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ 204 | # define zmemcpy _fmemcpy 205 | # define zmemcmp _fmemcmp 206 | # define zmemzero(dest, len) _fmemset(dest, 0, len) 207 | # else 208 | # define zmemcpy memcpy 209 | # define zmemcmp memcmp 210 | # define zmemzero(dest, len) memset(dest, 0, len) 211 | # endif 212 | #else 213 | void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); 214 | int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); 215 | void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); 216 | #endif 217 | 218 | /* Diagnostic functions */ 219 | #ifdef DEBUG 220 | # include 221 | extern int ZLIB_INTERNAL z_verbose; 222 | extern void ZLIB_INTERNAL z_error OF((char *m)); 223 | # define Assert(cond,msg) {if(!(cond)) z_error(msg);} 224 | # define Trace(x) {if (z_verbose>=0) fprintf x ;} 225 | # define Tracev(x) {if (z_verbose>0) fprintf x ;} 226 | # define Tracevv(x) {if (z_verbose>1) fprintf x ;} 227 | # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} 228 | # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} 229 | #else 230 | # define Assert(cond,msg) 231 | # define Trace(x) 232 | # define Tracev(x) 233 | # define Tracevv(x) 234 | # define Tracec(c,x) 235 | # define Tracecv(c,x) 236 | #endif 237 | 238 | #ifndef Z_SOLO 239 | voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, 240 | unsigned size)); 241 | void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); 242 | #endif 243 | 244 | #define ZALLOC(strm, items, size) \ 245 | (*((strm)->zalloc))((strm)->opaque, (items), (size)) 246 | #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) 247 | #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} 248 | 249 | /* Reverse the bytes in a 32-bit value */ 250 | #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ 251 | (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) 252 | 253 | #endif /* ZUTIL_H */ 254 | -------------------------------------------------------------------------------- /Divisé/RestoreViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RestoreViewController.h 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 11/28/19. 6 | // Copyright © 2019 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface RestoreViewController : UIViewController 13 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 14 | @property (weak, nonatomic) IBOutlet UILabel *subtitleLabel; 15 | @property (weak, nonatomic) IBOutlet UIProgressView *restoreProgressBar; 16 | @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *progressIndicator; 17 | @property (weak, nonatomic) IBOutlet UILabel *outputLabel; 18 | @property (weak, nonatomic) IBOutlet UIButton *eraseButton; 19 | @property (strong, nonatomic) NSMutableDictionary *divisePrefs; 20 | @property (strong, nonatomic) NSMutableDictionary *secondOS; 21 | @property (strong, nonatomic) NSMutableDictionary *dualbootPrefs; 22 | @property (strong, nonatomic) NSMutableDictionary *activationPlist; 23 | @property (strong, nonatomic) NSString *deviceModel; 24 | @property (strong, nonatomic) NSString *deviceType; 25 | @property (strong, nonatomic) UIAlertController *areYouSureAlert; 26 | @property (strong, nonatomic) NSString *filesystemType; 27 | @property (strong, nonatomic) NSString *installedVersion; 28 | @property (weak, nonatomic) IBOutlet UILabel *done1; 29 | @property (weak, nonatomic) IBOutlet UILabel *done2; 30 | @property (weak, nonatomic) IBOutlet UILabel *done3; 31 | @property (weak, nonatomic) IBOutlet UILabel *during1; 32 | @property (weak, nonatomic) IBOutlet UILabel *during2; 33 | @property (weak, nonatomic) IBOutlet UILabel *during3; 34 | @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *spinningThing; 35 | @property (weak, nonatomic) IBOutlet UIButton *backButtonH; 36 | @end 37 | 38 | -------------------------------------------------------------------------------- /Divisé/SettingsViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SettingsViewController.h 3 | // Divisé 4 | // 5 | // Created by matty on 27/05/20. 6 | // Copyright © 2020 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SettingsViewController : UIViewController 12 | 13 | @property (nonatomic, strong) NSMutableDictionary *divisePrefs; 14 | @property (nonatomic, strong) UISwitch *createAPFSsuccessionprerestoreSwitch; 15 | @property (nonatomic, strong) UISwitch *createAPFSorigfsSwitch; 16 | @property (weak, nonatomic) IBOutlet UISwitch *deleteDuringSwitch; 17 | @property (weak, nonatomic) IBOutlet UISwitch *logOutputSwitch; 18 | @property (weak, nonatomic) IBOutlet UIButton *deleterfs; 19 | @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *spinningThing; 20 | @property (weak, nonatomic) IBOutlet UILabel *versionLabel; 21 | @property (weak, nonatomic) IBOutlet UILabel *forceapfsLabel; 22 | @property (weak, nonatomic) IBOutlet UILabel *hacktivateLabel; 23 | @property (weak, nonatomic) IBOutlet UISwitch *forceapfsSwitch; 24 | @property (weak, nonatomic) IBOutlet UISwitch *hacktivateSwitch; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Divisé/SpecialThanksTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SpecialThanksTableViewController.h 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 4/14/19. 6 | // Copyright © 2019 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface SpecialThanksTableViewController : UITableViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Divisé/apfs_deletefs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/apfs_deletefs -------------------------------------------------------------------------------- /Divisé/attach: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/attach -------------------------------------------------------------------------------- /Divisé/binaryinfo.txt: -------------------------------------------------------------------------------- 1 | I'm guessing you saw the "ERROR! Unable to determine system information. Please follow the directions in /Applications/SuccessionRestore.app/binaryinfo.txt". You're welcome. 2 | 3 | FIRST OF ALL: reboot and retry the installation. 4 | 5 | 6 | IF THAT DOESN'T WORK: 7 | 8 | If you're running iOS 10.0 or higher, delete /Applications/SuccessionRestore.app/SuccessionHelper 9 | 10 | If you are on an iPhone XS, XS Max, or an iPad Pro that doesnt have a home button, or newer, delete SuccessionRestore32, hdik-armv7, and hdik-arm64, then rename hdik-arm64e to just 'hdik' (without quotes) 11 | 12 | If you are on any other 64-bit device (the iPhone 5s and newer), delete SuccessionRestore32 hdik-armv7, and hdik-arm64e, then rename hdik-arm64 to just 'hdik' (without quotes) 13 | 14 | If you are on a 32-bit device (the iPhone 5c and older), delete SuccessionRestore, rename SuccessionRestore32 to 'SuccessionRestore' (without quotes), delete hdik-arm64 and hdik-arm64e, then rename hdik-armv7 to just 'hdik' (without quotes) 15 | 16 | If you're running iOS 9.3.6 or lower, you also need to rename SuccessionRestore to 'SuccessionRestore_' and rename SuccessionHelper to 'SuccessionRestore' 17 | -------------------------------------------------------------------------------- /Divisé/hdik: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/hdik -------------------------------------------------------------------------------- /Divisé/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 9/27/17. 6 | // Copyright © 2017 Sam Gardner. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | 15 | NSString *version = [[UIDevice currentDevice] systemVersion]; 16 | 17 | if ([version containsString:@"10."]) { 18 | 19 | // We only need to run as root on 10.x as succdatroot is broken on 10.x 20 | 21 | if (!(setuid(0) == 0 && setgid(0) == 0)) { 22 | 23 | NSLog(@"Failed to gain root privileges, aborting..."); 24 | exit(EXIT_FAILURE); 25 | 26 | } 27 | } else { 28 | if ((getuid() == 0 && getgid() == 0)) { 29 | 30 | NSLog(@"We are running as root when we shouldn't be, aborting..."); 31 | exit(EXIT_FAILURE); 32 | 33 | } 34 | } 35 | 36 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Divisé/mobileactivationd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MatthewPierson/Divise/6a9701ba577faedbf3dbbf9affa3037e7361a795/Divisé/mobileactivationd -------------------------------------------------------------------------------- /Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.private.security.container-required 6 | 7 | com.apple.private.security.no-container 8 | 9 | com.apple.private.security.no-sandbox 10 | 11 | com.apple.private.security.system-application 12 | 13 | com.apple.private.diskimages.kext.user-client-access 14 | 15 | com.apple.private.security.disk-device-access 16 | 17 | com.apple.springboard.wipedevice 18 | 19 | platform-application 20 | 21 | com.apple.private.apfs.xart 22 | 23 | com.apple.security.iokit-user-client-class 24 | 25 | AppleAPFSUserClient 26 | IOHDIXControllerUserClient 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Divisé 2 | 3 | --------- 4 | 5 | ## arm64 Dualbooting 6 | 7 | Divisé is able to install a second iOS/iPadOS version alongside your device's existing iOS/iPadOS install. It does this by creating two new APFS volumes, SystemB and DataB, then uses rsync to restore a downloaded root filesystem image to the new volumes and finally Divisé IDK WRITE SOMETHING HERE. 8 | 9 | The actual process is more complicated then this but this README will not go into that much detail. If you would like to learn more about dualbooting arm64 devices, you can read this applications source code, you can read [this mini-writeup](https://moski.fun/dualboot/) written by me about ramdiskless arm64 dualboots or you can read [the original arm64 dualbooting guide](https://dualbootfun.github.io/dualboot/) written by [@mcg29_ ](https://twitter.com/mcg29_) and [@Ralph0045](https://twitter.com/Ralph0045). 10 | 11 | ## arm64 Tethered Downgrades 12 | 13 | Divisé performs a tethered downgrade on arm64 devices by overwriting the currently installed iOS/iPadOS install with a downloaded root filesystem image. This differs from a dualboot as the main iOS/iPadOS install is not modified in any way during a dualboot, allowing the device to continue to boot the main OS untethered, whereas in a tethered downgrade the main OS is completly gone preventing any untethered boot until a signed iOS/iPadOS version is restored. 14 | 15 | ## Booting after dualbooting/tethered downgrading 16 | 17 | arm64 dualboots/tethered downgrades are tethered, as the only current way to boot into the second OS is via the checkm8 bootrom exploit which supports A7-A11 devices. There is no way to boot other then via a computer (or iOS/iPadOS device via an OTG cable) and there are currently 3 options for tether booting from said computer. The first way is via manually patching and preparing the required files (Advanced users only), PyBoot which is a python CLI script made by me which automates the entire process (Moderate difficultly) and there is Ramiel which is a GUI based applicaiton for checkm8 related tasks/actions (Easiest/Best choice). 18 | 19 | ## Compiling 20 | 21 | *I really dont anticipate that anyone will ever attempt to compile this project... but... here goes* ¯\\\_(ツ)_/¯ 22 | 23 | Requires macOS, and probably a fairly recent version of it. 24 | 25 | Requires `fakeroot`, `ldid`, and `dpkg`. If you dont have them already, they can be easily installed using [homebrew](https://brew.sh): 26 | 27 | `brew install fakeroot` 28 | 29 | `brew install ldid` 30 | 31 | `brew install dpkg` 32 | 33 | You may need to edit "succdatroot/Makefile" and change the theos directory from "~/.theos" to "$THEOS" or where ever you have Theos setup. Also edit "compile" and change the IP address to your device's. 34 | 35 | You will need a fairly recent version of theos set up, you can follow their install tutorial [here](https://github.com/theos/theos/wiki/Installation-macOS) 36 | 37 | Compiling is fairly simple afterwards, thanks to the `compile` script provided in the root directory of the project. You can use it to compile and install Succession directly onto your device. 38 | 39 | To compile and install Divisé to your device, simply run `./compile 192.168.1.100`, swapping in your devices IP address. Then enter your computers password, then the devices root password when prompted and, after a respring, Divisé will be installed! 40 | 41 | ***Note**: The install part of the `compile` script will only work if you have OpenSSH installed on your iOS device.* 42 | 43 | ## License 44 | This project is licensed under the GNU General Public License v3.0, with accordance to [rsync](https://rsync.samba.org/) and [Zebra](https://github.com/wstyres/Zebra). If you'd like to support the project or my development, you can donate [here](https://paypal.me/SamGardner4). **Donations are not a requirement, but highly appreciated!** 45 | 46 | Special thanks to [PsychoTea](https://twitter.com/iBSparkes), [Pwn20wnd](https://twitter.com/Pwn20wnd), [Cryptiiic](https://github.com/Cryptiiiic), and [Nobbele](https://github.com/nobbele) for their respective contributions to this project. 47 | -------------------------------------------------------------------------------- /Template/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: com.moski.Divise 2 | Name: Divisé 3 | Version: 1.1.2 4 | Architecture: iphoneos-arm 5 | Description: arm64 Dualboots/Tethered Downgrades on device! 6 | Maintainer: moski, Samg_is_a_Ninja 7 | Author: moski, Samg_is_a_Ninja 8 | Section: Utilities 9 | Depends: firmware (>= 10.3.0), firmware-sbin, rsync, cy+cpu.arm64 10 | Icon:file:///Applications/Divisé.app/AppIcon60x60@3x.png 11 | -------------------------------------------------------------------------------- /Template/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir /var/mobile/Media/Divise/ 3 | chmod 0777 /var/mobile/Media/Divise/ 4 | killall Divisé 5 | KERNELVERSION=$(uname -r) 6 | searchstring="." 7 | MINORVERSION=${KERNELVERSION%$searchstring*} 8 | MAJORVERSION=${MINORVERSION%$searchstring*} 9 | declare -a arm64eDevices=("iPhone11,2" "iPhone11,4" "iPhone11,6" "iPhone11,8" "iPhone12,1" "iPhone12,3" "iPhone12,5" "iPad8,1" "iPad8,2" "iPad8,3" "iPad8,4" "iPad8,5" "iPad8,6" "iPad8,7" "iPad8,8" "iPad11,1" "iPad11,2" "iPad11,3" "iPad11,4") 10 | declare -a arm64Devices=("iPhone6,1" "iPhone6,2" "iPhone7,1" "iPhone7,2" "iPhone8,1" "iPhone8,2" "iPhone8,4" "iPhone9,1" "iPhone9,2" "iPhone9,3" "iPhone9,4" "iPhone10,1" "iPhone10,2" "iPhone10,3" "iPhone10,4" "iPhone10,5" "iPhone10,6" "iPad4,1" "iPad4,2" "iPad4,3" "iPad5,3" "iPad5,4" "iPad6,11" "iPad6,12" "iPad7,5" "iPad7,6" "iPad7,11" "iPad7,12" "iPad6,7" "iPad6,8" "iPad6,3" "iPad6,4" "iPad7,1" "iPad7,2" "iPad7,3" "iPad7,4" "iPad4,4" "iPad4,5" "iPad4,6" "iPad4,7" "iPad4,8" "iPad4,9" "iPad5,1" "iPad5,2" "iPod7,1" "iPod9,1") 11 | declare -a armv7Devices=("iPhone1,1" "iPhone1,2" "iPhone2,1" "iPhone3,1" "iPhone3,2" "iPhone3,3" "iPhone4,1" "iPhone5,1" "iPhone5,2" "iPhone5,3" "iPhone5,4" "iPad1,1" "iPad2,1" "iPad2,2" "iPad2,3" "iPad2,4" "iPad3,1" "iPad3,2" "iPad3,3" "iPad3,4" "iPad3,5" "iPad3,6" "iPad2,5" "iPad2,6" "iPad2,7" "iPod1,1" "iPod2,1" "iPod3,1" "iPod4,1" "iPod5,1") 12 | MYMACHINEID=$(uname -m) 13 | for deviceModel in ${arm64eDevices[@]}; 14 | do 15 | if [ "$MYMACHINEID" == "$deviceModel" ] 16 | then 17 | echo "Divisé has detected arm64e!" 18 | echo "arm64e is unsupported, deleting Divisé and exiting! (You shouldn't have made it this far!)" 19 | rm -rf /Applications/Divisé.app 20 | uicache 21 | exit 22 | fi 23 | done 24 | for deviceModel in ${arm64Devices[@]}; 25 | do 26 | if [ "$MYMACHINEID" == "$deviceModel" ] 27 | then 28 | echo "Divisé has detected 64-bit!" 29 | if [ "$MAJORVERSION" -gt 15 ] 30 | then 31 | echo "Divisé has detected iOS 10.0 or higher!" 32 | if [ "$MAJORVERSION" == 16 ] 33 | then 34 | echo "Divisé has detected iOS 10.x, performing iOS 10 exclusive tasks" 35 | chmod 6755 /Applications/Divisé.app/Divisé # Only needs to be done on 10.x as doing it on other versions will break VoiceOver support 36 | chown root:wheel /Applications/Divisé.app/Divisé 37 | fi 38 | rm /Applications/Divisé.app/binaryinfo.txt 39 | elif [ "$MAJORVERSION" -lt 16 ] 40 | then 41 | echo "Divisé has detected iOS 9.3.5 or lower!" 42 | rm /Applications/Divisé.app/binaryinfo.txt 43 | fi 44 | fi 45 | done 46 | for deviceModel in ${armv7Devices[@]}; 47 | do 48 | if [ "$MYMACHINEID" == "$deviceModel" ] 49 | then 50 | echo "Divisé has detected 32-bit!" 51 | echo "armv7 is unsupported, deleting Divisé and exiting! (You shouldn't have made it this far!)" 52 | rm -rf /Applications/Divisé.app 53 | uicache 54 | fi 55 | done 56 | if [ ! -f /Applications/Setup.app/Setup ]; then 57 | if [ -f /Applications/Setup.app/Setup.bak ]; then 58 | mv /Applications/Setup.app/Setup.bak /Applications/Setup.app/Setup 59 | else 60 | touch /Applications/Setup.app/Setup 61 | fi 62 | fi 63 | mkdir -p /private/var/mnt/divise/ 64 | 65 | uicache --path /Applications/Divisé.app/ 66 | 67 | chown root:wheel /Applications/Divisé.app/Divisé 68 | chown root:wheel /Applications/Divisé.app/succdatroot 69 | chown root:wheel /Applications/Divisé.app/hdik 70 | chmod 6755 /Applications/Divisé.app/hdik 71 | chmod 6755 /Applications/Divisé.app/succdatroot 72 | chmod 6755 /Applications/Divisé.app/Divisé 73 | 74 | echo "Succession by Sam Gardner // Samg_is_a_Ninja" 75 | echo "Divisé by Matthew Pierson // Moski" 76 | echo "Special Thanks to AppleTech, MidnightChips, pwn20wnd, Cryptiiic, PsychoTea, wstyres, uroboro, comex, and 4ppleCracker" 77 | 78 | exit 0 79 | -------------------------------------------------------------------------------- /Template/DEBIAN/prerm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" != "upgrade" ]; then 4 | rm -rf /private/var/mobile/Media/Divise/ 5 | rm -rf /Applications/Divisé.app/hdik 6 | rm -rf /Applications/Divisé.app/attach 7 | umount -f /private/var/mnt/divise/ 8 | rm -rf /private/var/mnt/divise/ 9 | fi 10 | -------------------------------------------------------------------------------- /compile: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | IP=$1 3 | VERSION="1.1.2" 4 | echo "COMPILING..." 5 | rm -rf ./Divisé.app 6 | rm -rf ./Build/Release-iphoneos/Divisé.app 7 | rm -rf ./com.moski.Divise 8 | xcodebuild -target Divisé -xcconfig compile64.xcconfig -configuration Release >> /dev/null 9 | mv ./Build/Release-iphoneos/Divisé.app ./Divisé.app 10 | echo "COMPILING SUCCDATROOT..." 11 | cd ./succdatroot/ && make 12 | cd .. 13 | cp ./succdatroot/.theos/obj/debug/succdatroot ./Divisé.app/succdatroot 14 | mv ./Divisé.app/succdatroot ./Divisé.app/succdatroot2 15 | mv ./Divisé.app/succdatroot2/succdatroot ./Divisé.app/succdatroot 16 | rm -rf ./Divisé.app/succdatroot2 ## This is annoying and badly done but it works 17 | ldid -SEntitlements.plist ./Divisé.app/Divisé 18 | rm -rf ./Divisé.app/attach 19 | ldid -SEntitlements.plist ./Divisé.app/succdatroot 20 | ldid -SEntitlements.plist ./Divisé.app/apfs_deletefs 21 | ldid -SEntitlements.plist ./Divisé.app/hdik 22 | rm -f ./Divisé.app/embedded.mobileprovision 23 | mkdir ./com.moski.Divise 24 | cp -r ./Template/* ./com.moski.Divise/ 25 | mkdir com.moski.Divise/Applications/ 26 | mv Divisé.app com.moski.Divise/Applications/ 27 | sudo fakeroot chmod 6755 com.moski.Divise/Applications/Divisé.app/Divisé 28 | sudo fakeroot chmod 6755 com.moski.Divise/Applications/Divisé.app/succdatroot 29 | sudo fakeroot chmod 0755 com.moski.Divise/Applications/Divisé.app/hdik 30 | sudo fakeroot chmod 0755 com.moski.Divise/Applications/Divisé.app/apfs_deletefs 31 | 32 | rm -rf ./Index 33 | find . -type f -name .DS_Store -delete && xattr -cr * 34 | sudo fakeroot dpkg-deb -Zgzip -b com.moski.Divise com.moski.Divise.$VERSION.deb 35 | 36 | if [ -z "$IP" ] 37 | then 38 | echo "Getting ready for release!" 39 | echo "Size:" 40 | ls -la com.moski.Divise.$VERSION.deb 41 | echo "md5:" 42 | md5 com.moski.Divise.$VERSION.deb 43 | echo "sha1:" 44 | shasum -a 1 com.moski.Divise.$VERSION.deb 45 | echo "sha256:" 46 | shasum -a 256 com.moski.Divise.$VERSION.deb 47 | echo "Done!" 48 | exit 49 | fi 50 | echo "INSTALLING TO DEVICE" 51 | 52 | echo "Trying to move deb to device" 53 | scp com.moski.Divise.$VERSION.deb root@$IP:/tmp 54 | echo "Trying to install deb" 55 | ssh root@$IP "dpkg -i /tmp/com.moski.Divise.$VERSION.deb && uicache --path /Applications/Divisé.app/" 56 | echo "Success!" 57 | 58 | ## Changes made by nobbele/4ppleCracker/moski 59 | -------------------------------------------------------------------------------- /compile64.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // compile64.xcconfig 3 | // SuccessionRestore 4 | // 5 | // Created by Sam Gardner on 2/27/18. 6 | // Copyright © 2018 Sam Gardner. All rights reserved. 7 | // 8 | //:configuration = Debug 9 | IPHONEOS_DEPLOYMENT_TARGET = 11 10 | 11 | //:configuration = Release 12 | IPHONEOS_DEPLOYMENT_TARGET = 11 13 | -------------------------------------------------------------------------------- /succdatroot/Makefile: -------------------------------------------------------------------------------- 1 | ARCHS = arm64 2 | TARGET = iphone::10.3:8.0 3 | include $(THEOS)/makefiles/common.mk 4 | 5 | TOOL_NAME = succdatroot 6 | succdatroot_FILES = main.c 7 | succdatroot_CODESIGN_FLAGS = -Sent.plist 8 | 9 | include $(THEOS_MAKE_PATH)/tool.mk 10 | -------------------------------------------------------------------------------- /succdatroot/ent.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | platform-application 6 | 7 | com.apple.private.skip-library-validation 8 | 9 | com.apple.private.security.no-container 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /succdatroot/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int proc_pidpath(int pid, void *buffer, uint32_t buffersize); 11 | 12 | /* Set platform binary flag */ 13 | #define FLAG_PLATFORMIZE (1 << 1) 14 | 15 | void patch_setuidandplatformize() { 16 | void *handle = dlopen("/usr/lib/libjailbreak.dylib", RTLD_LAZY); 17 | if (!handle) return; 18 | 19 | // Reset errors 20 | dlerror(); 21 | 22 | typedef void (*fix_setuid_prt_t)(pid_t pid); 23 | fix_setuid_prt_t setuidptr = (fix_setuid_prt_t)dlsym(handle, "jb_oneshot_fix_setuid_now"); 24 | 25 | typedef void (*fix_entitle_prt_t)(pid_t pid, uint32_t what); 26 | fix_entitle_prt_t entitleptr = (fix_entitle_prt_t)dlsym(handle, "jb_oneshot_entitle_now"); 27 | 28 | setuidptr(getpid()); 29 | 30 | setuid(0); 31 | 32 | const char *dlsym_error = dlerror(); 33 | if (dlsym_error) { 34 | return; 35 | } 36 | 37 | entitleptr(getpid(), FLAG_PLATFORMIZE); 38 | } 39 | 40 | int main(int argc, char ** argv) { 41 | patch_setuidandplatformize(); 42 | 43 | struct stat template; 44 | if (lstat("/Applications/Divisé.app/Divisé", &template) == -1) { 45 | printf("THE TRUE AND NEO CHAOS!\n"); 46 | fflush(stdout); 47 | return EX_NOPERM; 48 | } 49 | else { 50 | pid_t pid = getppid(); 51 | 52 | char buffer[PATH_MAX]; 53 | int ret = proc_pidpath(pid, buffer, sizeof(buffer)); 54 | 55 | struct stat response; 56 | stat(buffer, &response); 57 | 58 | if (ret < 1 || (template.st_dev != response.st_dev || template.st_ino != response.st_ino)) { 59 | printf("CHAOS, CHAOS!\n"); 60 | fflush(stdout); 61 | return EX_NOPERM; 62 | } 63 | else { 64 | setuid(0); 65 | setgid(0); 66 | 67 | if (getuid() != 0 || getgid() != 0) { 68 | printf("WHO KEEPS SPINNING THE WORLD AROUND?\n"); 69 | fflush(stdout); 70 | return EX_NOPERM; 71 | } 72 | 73 | int result = execvp(argv[1], &argv[1]); 74 | 75 | return result; 76 | } 77 | } 78 | } 79 | --------------------------------------------------------------------------------