63 Commits

Author SHA1 Message Date
Antoine Cœur
c15c6db4f5 converting isFilePasswordProtectedAtPath 2017-10-07 21:17:44 +08:00
Antoine Cœur
913c3127e0 new minizip files 2017-10-07 00:50:57 +08:00
Antoine Cœur
5a7f52bf50 updated minizip 2017-10-06 01:37:58 +08:00
Antoine Cœur
f59a2d6670 moving test delegates to their own files 2017-10-04 23:46:51 +08:00
Antoine Cœur
0634a08c75 moving filenameStringWithCString to its own method 2017-10-04 22:53:37 +08:00
Antoine Cœur
1011c5ec05 moving fileIsSymbolicLink to its own function 2017-10-04 22:10:52 +08:00
Antoine Cœur
1b253ad445 removing dependency on storyboard for tests on Xcode 7 2017-10-04 22:10:13 +08:00
Antoine Cœur
b7097ae6bb report error for negative readBytes (invalid password) 2017-10-04 20:21:07 +08:00
Antoine Cœur
6bf9406cff fix Xcode 9.1 constraints warnings 2017-10-04 15:46:29 +08:00
Antoine Cœur
2e8fd082ca changing com.samsoffes to com.ziparchive 2017-10-04 15:05:05 +08:00
Antoine Cœur
917cdd6d73 travis tests for macOS 2017-10-04 14:36:52 +08:00
Antoine Cœur
b660cccd24 removing zipArchiveDidUnzipArchiveFile:entryPath:destPath: from SSZipArchiveDelegate as never implemented 2017-10-03 23:42:15 +08:00
Antoine Cœur
2821ab5d3e handling potential errors in zipOpenNewFileInZip 2017-10-02 02:59:21 +08:00
Antoine Cœur
f6fd858c20 Xcode 7 compatibility 2017-09-30 13:43:23 +08:00
Antoine Cœur
6ec780b26a macOS 10.8+ is needed 2017-09-30 13:22:44 +08:00
Antoine Cœur
f827cff917 2.0.8 2017-09-30 10:32:35 +08:00
Antoine Cœur
67f1711fe0 Merge pull request #385 from ZipArchive/encoding_autodetection
supporting encoding detection
2017-09-29 12:43:52 -05:00
Antoine Cœur
6f0bb4e9b4 fix #315 by removing the size_filename test.
latest minizip.
2017-09-30 01:42:17 +08:00
Antoine Cœur
5c10b9bed2 hexa is more readable than base64 for debugging unknown encodings 2017-09-29 19:06:16 +08:00
Antoine Cœur
eed7d2368d removing iOS 7 compatibility 2017-09-29 02:43:27 +08:00
Antoine Cœur
b75031acd0 supporting encoding detection 2017-09-29 02:29:04 +08:00
Antoine Cœur
d6eea31fea Xcode 9 friendly solution for logs 2017-09-28 03:32:49 +08:00
Antoine Cœur
b65da3ff20 hiding system messages on simulator 2017-09-28 01:32:31 +08:00
Antoine Cœur
76c8d2aeee parameters on separate lines 2017-09-21 15:59:34 +08:00
Antoine Cœur
a29b765b4b new devices 2017-09-21 15:57:56 +08:00
Antoine Cœur
5db5451166 fix regression from previous commit 2017-09-19 11:40:25 +08:00
Antoine Cœur
b9ce3814d4 latest minizip 2017-09-18 20:33:11 +08:00
Antoine Cœur
30eff54054 2.0.7 2017-09-18 11:32:01 +08:00
Antoine Cœur
d94e717193 updated copyright 2017-09-18 11:08:13 +08:00
Antoine Cœur
5666c74d61 Merge pull request #379 from ZipArchive/gregorian
fix zipInfo:setDate: when currentCalendar was not gregorian
2017-09-18 10:44:24 +08:00
Antoine Cœur
25fb5cdf58 fix zipInfo:setDate: when currentCalendar was not gregorian 2017-09-17 19:51:47 +08:00
Antoine Cœur
961d471d39 readability and simplifications 2017-09-17 00:55:52 +08:00
Antoine Cœur
ec2cc3f474 Merge pull request #377 from ZipArchive/unicode_passwords
unicode passwords support
2017-09-16 23:47:21 +08:00
Antoine Cœur
8f7d1bb6db add testZippingAndUnzippingWithUnicodePassword
fix testZipping and testZippingAndUnzippingForDate
2017-09-16 22:13:31 +08:00
Antoine Cœur
c8a93311b5 unicode passwords 2017-09-16 18:01:56 +08:00
Antoine Cœur
f9df6800d6 modernizing objectiveC 2017-09-14 00:31:27 +08:00
Antoine Cœur
bad8ca91e2 human readable xcodebuild destination 2017-09-13 20:12:05 +08:00
Antoine Cœur
dd86a28b22 SSZipArchive works on Xcode 7-9 and above, iOS 8-11 and above. 2017-09-13 15:54:43 +08:00
Antoine Cœur
465f6210c4 fix compilation on Xcode 7.x 2017-09-13 00:47:45 +08:00
Antoine Cœur
a004f928cd also printing error for Swift example project 2017-09-12 21:44:47 +08:00
Antoine Cœur
e7116f283f alphabetic order 2017-09-12 21:36:56 +08:00
Antoine Cœur
fa3fe1dfd8 correctly reporting errors for createZipFileAtPath 2017-09-12 21:15:13 +08:00
Antoine Cœur
1c5bf00ec3 travis script on multiple lines for readability 2017-09-10 10:23:56 +08:00
Antoine Cœur
f3030e34ab returning write errors and preventing multiple calls to close by setting _zip to nil 2017-09-10 03:07:15 +08:00
Antoine Cœur
44329ab1a1 avoiding calling the completionHandler twice 2017-09-10 02:49:18 +08:00
Antoine Cœur
bdbe304da3 applying some suggestions from AppCode 2017-09-09 23:05:11 +08:00
Antoine Cœur
5bb31f8d67 .gitignore simplified as we don't need to support Xcode3 (https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore) 2017-09-09 20:22:22 +08:00
Antoine Cœur
7a2b2fe9d4 2.0.5 2017-09-09 17:04:42 +08:00
Antoine Cœur
94da75db53 adding a watchos 2.0 target for Carthage 2017-09-09 15:08:42 +08:00
Antoine Cœur
75dad5ea8d adding a tvos 9.0 target for Carthage 2017-09-09 14:01:27 +08:00
Antoine Cœur
a48f5d140a fix unpacking empty files and folders 2017-09-09 13:27:10 +08:00
Antoine Cœur
dc8bf3558c latest minishared 2017-08-29 13:24:50 +08:00
Joshua Hudson
77054d5ca5 update test pods 2017-08-28 15:20:02 -07:00
Antoine Cœur
123e801b82 podspec bump 2017-08-25 13:58:28 +08:00
Antoine Cœur
77892c97d8 Merge pull request #368 from RobertCain/analyze-success
Fixes Analyze issue for success variable
2017-08-25 13:57:53 +08:00
Robert Cain
790b2c1454 Fixes Analyze: Local variable conflicts
with outer success variable
2017-08-24 17:45:08 +01:00
Joshua Hudson
528ca5694b Update README.md 2017-08-10 09:25:22 -07:00
Joshua Hudson
b4d11dffc9 Merge pull request #363 from ibsh/master
Handle zero-length arguments
2017-08-01 20:10:45 -07:00
Ibrahim Sha'ath
6781d97343 Guard against the receipt of empty paths 2017-08-01 16:08:00 -07:00
Ibrahim Sha'ath
2a248f6b55 Add missing nullability specifier 2017-08-01 16:07:22 -07:00
Joshua Hudson
55b067b11c Podlock updates 2017-08-01 12:27:12 -07:00
Joshua Hudson
889e4293d1 podspec bump 2017-08-01 12:15:50 -07:00
Joshua Hudson
e0a74bddd4 fix crash if device is out of space instead of returning error. Thanks @markonikolvski #361 2017-08-01 10:17:37 -07:00
76 changed files with 7749 additions and 6704 deletions

20
.gitignore vendored
View File

@@ -1,21 +1,13 @@
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
xcuserdata/
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
# AppCode
.idea
# macOS
.DS_Store
# CocoaPods

View File

@@ -1,7 +1,66 @@
language: objective-c
osx_image: xcode8.3
podfile: ObjectiveCExample/Podfile
xcode_workspace: ObjectiveCExample/ObjectiveCExample.xcworkspace
xcode_scheme: ObjectiveCExample
script: xcodebuild -workspace ObjectiveCExample/ObjectiveCExample.xcworkspace -scheme ObjectiveCExample -sdk iphonesimulator -destination "id=F60B87EC-8969-41A7-90ED-D0826ECC32DB" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test
matrix:
include:
- osx_image: xcode9 # OS X 10.12
env: SDK="macosx"
DEVICE="OS X 10.12"
- osx_image: xcode8.3 # OS X 10.12
env: SDK="macosx"
DEVICE="OS X 10.12"
- osx_image: xcode7.3 # OS X 10.11
env: SDK="macosx"
DEVICE="OS X 10.11"
- osx_image: xcode9
env: SDK="iphonesimulator"
DEVICE="iPhone X (11.0)" # oldest/newest for iOS 11.x
- osx_image: xcode9
env: SDK="iphonesimulator"
DEVICE="iPhone 7 Plus (10.3.1)" # latest for iOS 10.x
- osx_image: xcode8.3
env: SDK="iphonesimulator"
DEVICE="iPhone 5 (10.0)" # oldest for iOS 10.x
- osx_image: xcode8.3
env: SDK="iphonesimulator"
DEVICE="iPhone 6s Plus (9.3)" # latest for iOS 9.x
- osx_image: xcode7.3
env: SDK="iphonesimulator"
DEVICE="iPhone 4s (9.0)" # oldest for iOS 9.x
- osx_image: xcode7.3
env: SDK="iphonesimulator"
DEVICE="iPhone 6 Plus (8.4)" # latest for iOS 8.x
- osx_image: xcode7.3
env: SDK="iphonesimulator"
DEVICE="iPhone 4s (8.1)" # oldest for iOS 8.x
before_install:
- if [ ${SDK} = "macosx" ]; then
SCHEME="ObjectiveCExample_macOS";
DESTINATION="platform=macosx";
else
SCHEME="ObjectiveCExample_iOS";
DESTINATION_UDID=$(instruments -s devices | grep "$DEVICE \[" | sed -E 's/.*\[([0-9A-F-]+)\].*/\1/g');
`Prelaunching simulator to avoid timeout https://github.com/travis-ci/travis-ci/issues/6422`
open -a Simulator --args -CurrentDeviceUDID $DESTINATION_UDID;
DESTINATION="id=$DESTINATION_UDID";
fi
script:
# Testing
- xcodebuild
`` -workspace ObjectiveCExample/ObjectiveCExample.xcworkspace
`` -scheme $SCHEME
`` -sdk $SDK
`` -destination "$DESTINATION"
`` -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES
`` test

View File

@@ -3,12 +3,53 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 47;
objects = {
/* Begin PBXBuildFile section */
09C572016004B12D6A6F9BFD /* Pods_ObjectiveCExampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BC9C4E518D9F4FF7C026523 /* Pods_ObjectiveCExampleTests.framework */; };
60F2CD131F797840FEEF41BF /* Pods_ObjectiveCExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E647562E4F5D61128404422A /* Pods_ObjectiveCExample.framework */; };
3773ADB61F7F453E009A4B2D /* CollectingDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */; };
3773ADB71F7F4541009A4B2D /* SSZipArchiveTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */; };
3773ADB81F7F4D13009A4B2D /* hello.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A161BDAA10100709011 /* hello.zip */; };
3773ADB91F7F4D13009A4B2D /* IncorrectHeaders.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */; };
3773ADBA1F7F4D13009A4B2D /* RelativeSymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A191BDAA10100709011 /* RelativeSymbolicLink.zip */; };
3773ADBB1F7F4D13009A4B2D /* SymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1A1BDAA10100709011 /* SymbolicLink.zip */; };
3773ADBC1F7F4D13009A4B2D /* TestArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1B1BDAA10100709011 /* TestArchive.zip */; };
3773ADBD1F7F4D13009A4B2D /* TestPasswordArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */; };
3773ADBE1F7F4D13009A4B2D /* Unicode.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1D1BDAA10100709011 /* Unicode.zip */; };
3773ADBF1F7F4D16009A4B2D /* PermissionsTestApp.app in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */; };
3773ADC01F7F4D1C009A4B2D /* 0.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1F1BDAA10100709011 /* 0.m4a */; };
3773ADC11F7F4D1C009A4B2D /* 1.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A201BDAA10100709011 /* 1.m4a */; };
3773ADC21F7F4D1C009A4B2D /* 2.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A211BDAA10100709011 /* 2.m4a */; };
3773ADC31F7F4D1C009A4B2D /* 3.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A221BDAA10100709011 /* 3.m4a */; };
3773ADC41F7F4D1C009A4B2D /* 4.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A231BDAA10100709011 /* 4.m4a */; };
3773ADC51F7F4D1C009A4B2D /* 5.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A241BDAA10100709011 /* 5.m4a */; };
3773ADC61F7F4D1C009A4B2D /* 6.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A251BDAA10100709011 /* 6.m4a */; };
3773ADC71F7F4D1C009A4B2D /* 7.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A261BDAA10100709011 /* 7.m4a */; };
3793E6DF1F7F6048000B1A19 /* CollectingDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */; };
3793E6E01F7F604B000B1A19 /* SSZipArchiveTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */; };
3793E6E11F7F6052000B1A19 /* 0.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1F1BDAA10100709011 /* 0.m4a */; };
3793E6E21F7F6052000B1A19 /* 1.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A201BDAA10100709011 /* 1.m4a */; };
3793E6E31F7F6052000B1A19 /* 2.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A211BDAA10100709011 /* 2.m4a */; };
3793E6E41F7F6052000B1A19 /* 3.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A221BDAA10100709011 /* 3.m4a */; };
3793E6E51F7F6052000B1A19 /* 4.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A231BDAA10100709011 /* 4.m4a */; };
3793E6E61F7F6052000B1A19 /* 5.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A241BDAA10100709011 /* 5.m4a */; };
3793E6E71F7F6052000B1A19 /* 6.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A251BDAA10100709011 /* 6.m4a */; };
3793E6E81F7F6052000B1A19 /* 7.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A261BDAA10100709011 /* 7.m4a */; };
3793E6E91F7F6059000B1A19 /* hello.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A161BDAA10100709011 /* hello.zip */; };
3793E6EA1F7F6059000B1A19 /* IncorrectHeaders.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */; };
3793E6EB1F7F6059000B1A19 /* RelativeSymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A191BDAA10100709011 /* RelativeSymbolicLink.zip */; };
3793E6EC1F7F6059000B1A19 /* SymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1A1BDAA10100709011 /* SymbolicLink.zip */; };
3793E6ED1F7F6059000B1A19 /* TestArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1B1BDAA10100709011 /* TestArchive.zip */; };
3793E6EE1F7F6059000B1A19 /* TestPasswordArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */; };
3793E6EF1F7F6059000B1A19 /* Unicode.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1D1BDAA10100709011 /* Unicode.zip */; };
3793E6F01F7F605C000B1A19 /* PermissionsTestApp.app in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */; };
37FF0CB31F8533E0006E4361 /* CancelDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB21F8533E0006E4361 /* CancelDelegate.m */; };
37FF0CB41F8533E0006E4361 /* CancelDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB21F8533E0006E4361 /* CancelDelegate.m */; };
37FF0CB51F8533E0006E4361 /* CancelDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB21F8533E0006E4361 /* CancelDelegate.m */; };
37FF0CB81F853459006E4361 /* ProgressDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB71F853459006E4361 /* ProgressDelegate.m */; };
37FF0CB91F853459006E4361 /* ProgressDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB71F853459006E4361 /* ProgressDelegate.m */; };
37FF0CBA1F853459006E4361 /* ProgressDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB71F853459006E4361 /* ProgressDelegate.m */; };
6BFA1E5841DFEC4E21BA7543 /* Pods_core_ObjectiveCExampleTests_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 38A85B006A1C84E475375AE1 /* Pods_core_ObjectiveCExampleTests_macOS.framework */; };
8DFE19EF1BDA9FF300709011 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19EE1BDA9FF300709011 /* main.m */; };
8DFE19F21BDA9FF300709011 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19F11BDA9FF300709011 /* AppDelegate.m */; };
8DFE19F51BDA9FF300709011 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19F41BDA9FF300709011 /* ViewController.m */; };
@@ -33,22 +74,25 @@
8DFE1A341BDAA10100709011 /* 5.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A241BDAA10100709011 /* 5.m4a */; };
8DFE1A351BDAA10100709011 /* 6.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A251BDAA10100709011 /* 6.m4a */; };
8DFE1A361BDAA10100709011 /* 7.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A261BDAA10100709011 /* 7.m4a */; };
C77CFC8C1852DCA7782A7CCB /* Pods_core_ObjectiveCExampleTests_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5FBFA6A604DC4631E2B97F9 /* Pods_core_ObjectiveCExampleTests_iOS.framework */; };
E31E9B694ECEB2E3932D8597 /* Pods_core_ObjectiveCExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49974600DB985CD98FC3AD39 /* Pods_core_ObjectiveCExample.framework */; };
F70E9D3A6F1E9FF335385D4A /* Pods_core_ObjectiveCExampleTests_tvOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D314711A618CA3AC838E95C1 /* Pods_core_ObjectiveCExampleTests_tvOS.framework */; };
F7D6D86D1CFB2C4900DA6DA6 /* Sample Data in Resources */ = {isa = PBXBuildFile; fileRef = F7D6D86C1CFB2C4900DA6DA6 /* Sample Data */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
8DFE1A041BDA9FF300709011 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 8DFE19E21BDA9FF300709011 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8DFE19E91BDA9FF300709011;
remoteInfo = ObjectiveCExample;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
78F9C8623D65380774875E92 /* Pods-ObjectiveCExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectiveCExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample.debug.xcconfig"; sourceTree = "<group>"; };
7BC9C4E518D9F4FF7C026523 /* Pods_ObjectiveCExampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ObjectiveCExampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
04CB37570807602F7E5C66D9 /* Pods-core-ObjectiveCExampleTests_macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExampleTests_macOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_macOS/Pods-core-ObjectiveCExampleTests_macOS.release.xcconfig"; sourceTree = "<group>"; };
254DE0B206EE66F57BBE7EEE /* Pods-core-ObjectiveCExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExample/Pods-core-ObjectiveCExample.release.xcconfig"; sourceTree = "<group>"; };
3773ADAE1F7F44D8009A4B2D /* ObjectiveCExampleTests_macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests_macOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3793E6D71F7F5F93000B1A19 /* ObjectiveCExampleTests_tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests_tvOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
37FF0CB11F8533E0006E4361 /* CancelDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CancelDelegate.h; sourceTree = "<group>"; };
37FF0CB21F8533E0006E4361 /* CancelDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CancelDelegate.m; sourceTree = "<group>"; };
37FF0CB61F853459006E4361 /* ProgressDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProgressDelegate.h; sourceTree = "<group>"; };
37FF0CB71F853459006E4361 /* ProgressDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProgressDelegate.m; sourceTree = "<group>"; };
38A85B006A1C84E475375AE1 /* Pods_core_ObjectiveCExampleTests_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_core_ObjectiveCExampleTests_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
48AB7DF053F85FCC6AFB0C26 /* Pods-core-ObjectiveCExampleTests_macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExampleTests_macOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_macOS/Pods-core-ObjectiveCExampleTests_macOS.debug.xcconfig"; sourceTree = "<group>"; };
49974600DB985CD98FC3AD39 /* Pods_core_ObjectiveCExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_core_ObjectiveCExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
51F30FF220ECFD8DC810E21A /* Pods-core-ObjectiveCExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExample/Pods-core-ObjectiveCExample.debug.xcconfig"; sourceTree = "<group>"; };
8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ObjectiveCExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
8DFE19EE1BDA9FF300709011 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8DFE19F01BDA9FF300709011 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@@ -59,8 +103,8 @@
8DFE19F91BDA9FF300709011 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
8DFE19FC1BDA9FF300709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
8DFE19FE1BDA9FF300709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSZipArchiveTests.m; sourceTree = "<group>"; };
8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests_iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchiveTests.m; sourceTree = "<group>"; };
8DFE1A091BDA9FF300709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DFE1A121BDAA0A800709011 /* CollectingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectingDelegate.h; sourceTree = "<group>"; };
8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectingDelegate.m; sourceTree = "<group>"; };
@@ -80,19 +124,37 @@
8DFE1A241BDAA10100709011 /* 5.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 5.m4a; sourceTree = "<group>"; };
8DFE1A251BDAA10100709011 /* 6.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 6.m4a; sourceTree = "<group>"; };
8DFE1A261BDAA10100709011 /* 7.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 7.m4a; sourceTree = "<group>"; };
B263C1FEBD2BEC1D1C4133CC /* Pods-ObjectiveCExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectiveCExampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectiveCExampleTests/Pods-ObjectiveCExampleTests.release.xcconfig"; sourceTree = "<group>"; };
BF4E88C3450A127B14A949C2 /* Pods-ObjectiveCExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectiveCExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample.release.xcconfig"; sourceTree = "<group>"; };
C12D647350722C151A02D17C /* Pods-ObjectiveCExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectiveCExampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectiveCExampleTests/Pods-ObjectiveCExampleTests.debug.xcconfig"; sourceTree = "<group>"; };
E647562E4F5D61128404422A /* Pods_ObjectiveCExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ObjectiveCExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A2E5B3BB819D409D02E989BC /* Pods-core-ObjectiveCExampleTests_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExampleTests_iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_iOS/Pods-core-ObjectiveCExampleTests_iOS.debug.xcconfig"; sourceTree = "<group>"; };
A5FBFA6A604DC4631E2B97F9 /* Pods_core_ObjectiveCExampleTests_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_core_ObjectiveCExampleTests_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CD7C1D2CFA646F90A02312F4 /* Pods-core-ObjectiveCExampleTests_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExampleTests_iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_iOS/Pods-core-ObjectiveCExampleTests_iOS.release.xcconfig"; sourceTree = "<group>"; };
D314711A618CA3AC838E95C1 /* Pods_core_ObjectiveCExampleTests_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_core_ObjectiveCExampleTests_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DC1DEADE9E9CE0AF5B487DCF /* Pods-core-ObjectiveCExampleTests_tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExampleTests_tvOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_tvOS/Pods-core-ObjectiveCExampleTests_tvOS.release.xcconfig"; sourceTree = "<group>"; };
F7D6D86C1CFB2C4900DA6DA6 /* Sample Data */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Sample Data"; sourceTree = "<group>"; };
FB7EEC7952E1561D1E668B3B /* Pods-core-ObjectiveCExampleTests_tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExampleTests_tvOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_tvOS/Pods-core-ObjectiveCExampleTests_tvOS.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
3773ADAB1F7F44D8009A4B2D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6BFA1E5841DFEC4E21BA7543 /* Pods_core_ObjectiveCExampleTests_macOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3793E6D41F7F5F93000B1A19 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F70E9D3A6F1E9FF335385D4A /* Pods_core_ObjectiveCExampleTests_tvOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8DFE19E71BDA9FF300709011 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
60F2CD131F797840FEEF41BF /* Pods_ObjectiveCExample.framework in Frameworks */,
E31E9B694ECEB2E3932D8597 /* Pods_core_ObjectiveCExample.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -100,7 +162,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
09C572016004B12D6A6F9BFD /* Pods_ObjectiveCExampleTests.framework in Frameworks */,
C77CFC8C1852DCA7782A7CCB /* Pods_core_ObjectiveCExampleTests_iOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -110,10 +172,14 @@
133E0B9323A7D3A1E738A45C /* Pods */ = {
isa = PBXGroup;
children = (
78F9C8623D65380774875E92 /* Pods-ObjectiveCExample.debug.xcconfig */,
BF4E88C3450A127B14A949C2 /* Pods-ObjectiveCExample.release.xcconfig */,
C12D647350722C151A02D17C /* Pods-ObjectiveCExampleTests.debug.xcconfig */,
B263C1FEBD2BEC1D1C4133CC /* Pods-ObjectiveCExampleTests.release.xcconfig */,
51F30FF220ECFD8DC810E21A /* Pods-core-ObjectiveCExample.debug.xcconfig */,
254DE0B206EE66F57BBE7EEE /* Pods-core-ObjectiveCExample.release.xcconfig */,
48AB7DF053F85FCC6AFB0C26 /* Pods-core-ObjectiveCExampleTests_macOS.debug.xcconfig */,
04CB37570807602F7E5C66D9 /* Pods-core-ObjectiveCExampleTests_macOS.release.xcconfig */,
A2E5B3BB819D409D02E989BC /* Pods-core-ObjectiveCExampleTests_iOS.debug.xcconfig */,
CD7C1D2CFA646F90A02312F4 /* Pods-core-ObjectiveCExampleTests_iOS.release.xcconfig */,
FB7EEC7952E1561D1E668B3B /* Pods-core-ObjectiveCExampleTests_tvOS.debug.xcconfig */,
DC1DEADE9E9CE0AF5B487DCF /* Pods-core-ObjectiveCExampleTests_tvOS.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
@@ -133,7 +199,9 @@
isa = PBXGroup;
children = (
8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */,
8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests.xctest */,
8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests_iOS.xctest */,
3773ADAE1F7F44D8009A4B2D /* ObjectiveCExampleTests_macOS.xctest */,
3793E6D71F7F5F93000B1A19 /* ObjectiveCExampleTests_tvOS.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -170,6 +238,10 @@
8DFE1A1E1BDAA10100709011 /* Multi_Zip_Test */,
8DFE1A121BDAA0A800709011 /* CollectingDelegate.h */,
8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */,
37FF0CB11F8533E0006E4361 /* CancelDelegate.h */,
37FF0CB21F8533E0006E4361 /* CancelDelegate.m */,
37FF0CB61F853459006E4361 /* ProgressDelegate.h */,
37FF0CB71F853459006E4361 /* ProgressDelegate.m */,
8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */,
8DFE1A091BDA9FF300709011 /* Info.plist */,
);
@@ -209,8 +281,10 @@
C0E3885084B2150B8F297B76 /* Frameworks */ = {
isa = PBXGroup;
children = (
E647562E4F5D61128404422A /* Pods_ObjectiveCExample.framework */,
7BC9C4E518D9F4FF7C026523 /* Pods_ObjectiveCExampleTests.framework */,
49974600DB985CD98FC3AD39 /* Pods_core_ObjectiveCExample.framework */,
A5FBFA6A604DC4631E2B97F9 /* Pods_core_ObjectiveCExampleTests_iOS.framework */,
38A85B006A1C84E475375AE1 /* Pods_core_ObjectiveCExampleTests_macOS.framework */,
D314711A618CA3AC838E95C1 /* Pods_core_ObjectiveCExampleTests_tvOS.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -218,6 +292,46 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
3773ADAD1F7F44D8009A4B2D /* ObjectiveCExampleTests_macOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 3773ADB51F7F44D9009A4B2D /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests_macOS" */;
buildPhases = (
9118978BA07845D66F76FA15 /* [CP] Check Pods Manifest.lock */,
3773ADAA1F7F44D8009A4B2D /* Sources */,
3773ADAB1F7F44D8009A4B2D /* Frameworks */,
3773ADAC1F7F44D8009A4B2D /* Resources */,
CAB5CA5258A34C1F6C699857 /* [CP] Embed Pods Frameworks */,
E2575624354B48B09E5AC0D8 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = ObjectiveCExampleTests_macOS;
productName = ObjectiveCExample_macOS_test;
productReference = 3773ADAE1F7F44D8009A4B2D /* ObjectiveCExampleTests_macOS.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
3793E6D61F7F5F93000B1A19 /* ObjectiveCExampleTests_tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 3793E6DC1F7F5F93000B1A19 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests_tvOS" */;
buildPhases = (
5F7F9AC51A6CCCF0FB33CC1E /* [CP] Check Pods Manifest.lock */,
3793E6D31F7F5F93000B1A19 /* Sources */,
3793E6D41F7F5F93000B1A19 /* Frameworks */,
3793E6D51F7F5F93000B1A19 /* Resources */,
E494A9BD8D1B57040775206F /* [CP] Embed Pods Frameworks */,
44EE5B4B0C619E2040D8D890 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = ObjectiveCExampleTests_tvOS;
productName = ObjectiveCExampleTests_tvOS;
productReference = 3793E6D71F7F5F93000B1A19 /* ObjectiveCExampleTests_tvOS.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
8DFE19E91BDA9FF300709011 /* ObjectiveCExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8DFE1A0C1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExample" */;
@@ -238,9 +352,9 @@
productReference = 8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */;
productType = "com.apple.product-type.application";
};
8DFE1A021BDA9FF300709011 /* ObjectiveCExampleTests */ = {
8DFE1A021BDA9FF300709011 /* ObjectiveCExampleTests_iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8DFE1A0F1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests" */;
buildConfigurationList = 8DFE1A0F1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests_iOS" */;
buildPhases = (
3849EE691EA1B366503B4C96 /* [CP] Check Pods Manifest.lock */,
8DFE19FF1BDA9FF300709011 /* Sources */,
@@ -252,11 +366,10 @@
buildRules = (
);
dependencies = (
8DFE1A051BDA9FF300709011 /* PBXTargetDependency */,
);
name = ObjectiveCExampleTests;
name = ObjectiveCExampleTests_iOS;
productName = ObjectiveCExampleTests;
productReference = 8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests.xctest */;
productReference = 8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests_iOS.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
@@ -265,19 +378,26 @@
8DFE19E21BDA9FF300709011 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0900;
TargetAttributes = {
3773ADAD1F7F44D8009A4B2D = {
CreatedOnToolsVersion = 9.1;
ProvisioningStyle = Automatic;
};
3793E6D61F7F5F93000B1A19 = {
CreatedOnToolsVersion = 9.1;
ProvisioningStyle = Automatic;
};
8DFE19E91BDA9FF300709011 = {
CreatedOnToolsVersion = 7.1;
};
8DFE1A021BDA9FF300709011 = {
CreatedOnToolsVersion = 7.1;
TestTargetID = 8DFE19E91BDA9FF300709011;
};
};
};
buildConfigurationList = 8DFE19E51BDA9FF300709011 /* Build configuration list for PBXProject "ObjectiveCExample" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 6.3";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
@@ -290,12 +410,60 @@
projectRoot = "";
targets = (
8DFE19E91BDA9FF300709011 /* ObjectiveCExample */,
8DFE1A021BDA9FF300709011 /* ObjectiveCExampleTests */,
8DFE1A021BDA9FF300709011 /* ObjectiveCExampleTests_iOS */,
3773ADAD1F7F44D8009A4B2D /* ObjectiveCExampleTests_macOS */,
3793E6D61F7F5F93000B1A19 /* ObjectiveCExampleTests_tvOS */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
3773ADAC1F7F44D8009A4B2D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3773ADC31F7F4D1C009A4B2D /* 3.m4a in Resources */,
3773ADC21F7F4D1C009A4B2D /* 2.m4a in Resources */,
3773ADC41F7F4D1C009A4B2D /* 4.m4a in Resources */,
3773ADC01F7F4D1C009A4B2D /* 0.m4a in Resources */,
3773ADC51F7F4D1C009A4B2D /* 5.m4a in Resources */,
3773ADB91F7F4D13009A4B2D /* IncorrectHeaders.zip in Resources */,
3773ADC11F7F4D1C009A4B2D /* 1.m4a in Resources */,
3773ADBE1F7F4D13009A4B2D /* Unicode.zip in Resources */,
3773ADBF1F7F4D16009A4B2D /* PermissionsTestApp.app in Resources */,
3773ADBB1F7F4D13009A4B2D /* SymbolicLink.zip in Resources */,
3773ADBA1F7F4D13009A4B2D /* RelativeSymbolicLink.zip in Resources */,
3773ADB81F7F4D13009A4B2D /* hello.zip in Resources */,
3773ADC71F7F4D1C009A4B2D /* 7.m4a in Resources */,
3773ADC61F7F4D1C009A4B2D /* 6.m4a in Resources */,
3773ADBC1F7F4D13009A4B2D /* TestArchive.zip in Resources */,
3773ADBD1F7F4D13009A4B2D /* TestPasswordArchive.zip in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3793E6D51F7F5F93000B1A19 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3793E6E71F7F6052000B1A19 /* 6.m4a in Resources */,
3793E6E91F7F6059000B1A19 /* hello.zip in Resources */,
3793E6F01F7F605C000B1A19 /* PermissionsTestApp.app in Resources */,
3793E6ED1F7F6059000B1A19 /* TestArchive.zip in Resources */,
3793E6E61F7F6052000B1A19 /* 5.m4a in Resources */,
3793E6E41F7F6052000B1A19 /* 3.m4a in Resources */,
3793E6EB1F7F6059000B1A19 /* RelativeSymbolicLink.zip in Resources */,
3793E6EF1F7F6059000B1A19 /* Unicode.zip in Resources */,
3793E6EA1F7F6059000B1A19 /* IncorrectHeaders.zip in Resources */,
3793E6EE1F7F6059000B1A19 /* TestPasswordArchive.zip in Resources */,
3793E6E51F7F6052000B1A19 /* 4.m4a in Resources */,
3793E6E81F7F6052000B1A19 /* 7.m4a in Resources */,
3793E6E31F7F6052000B1A19 /* 2.m4a in Resources */,
3793E6EC1F7F6059000B1A19 /* SymbolicLink.zip in Resources */,
3793E6E21F7F6052000B1A19 /* 1.m4a in Resources */,
3793E6E11F7F6052000B1A19 /* 0.m4a in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8DFE19E81BDA9FF300709011 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -344,11 +512,26 @@
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-testing_pods-ObjectiveCExampleTests-checkManifestLockResult.txt",
"$(DERIVED_FILE_DIR)/Pods-core-ObjectiveCExampleTests_iOS-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
44EE5B4B0C619E2040D8D890 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_tvOS/Pods-core-ObjectiveCExampleTests_tvOS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
486F364061BAD3921A1CA2C8 /* [CP] Embed Pods Frameworks */ = {
@@ -357,8 +540,8 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-testing_pods-ObjectiveCExampleTests/Pods-testing_pods-ObjectiveCExampleTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework",
"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_iOS/Pods-core-ObjectiveCExampleTests_iOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SSZipArchive-iOS/SSZipArchive.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@@ -366,7 +549,25 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ObjectiveCExampleTests/Pods-ObjectiveCExampleTests-frameworks.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_iOS/Pods-core-ObjectiveCExampleTests_iOS-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
5F7F9AC51A6CCCF0FB33CC1E /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-core-ObjectiveCExampleTests_tvOS-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
8328CABE589F0AEC0D43D7CC /* [CP] Copy Pods Resources */ = {
@@ -381,7 +582,25 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExample/Pods-core-ObjectiveCExample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9118978BA07845D66F76FA15 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-core-ObjectiveCExampleTests_macOS-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
B17DD0CEF4553EDB98836D32 /* [CP] Check Pods Manifest.lock */ = {
@@ -395,11 +614,11 @@
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-testing_pods-ObjectiveCExample-checkManifestLockResult.txt",
"$(DERIVED_FILE_DIR)/Pods-core-ObjectiveCExample-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
CA0F9A9BDCCC5F900FD55CF3 /* [CP] Embed Pods Frameworks */ = {
@@ -408,8 +627,8 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-testing_pods-ObjectiveCExample/Pods-testing_pods-ObjectiveCExample-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework",
"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExample/Pods-core-ObjectiveCExample-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SSZipArchive-iOS/SSZipArchive.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@@ -417,7 +636,58 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample-frameworks.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExample/Pods-core-ObjectiveCExample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
CAB5CA5258A34C1F6C699857 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_macOS/Pods-core-ObjectiveCExampleTests_macOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SSZipArchive-macOS/SSZipArchive.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_macOS/Pods-core-ObjectiveCExampleTests_macOS-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E2575624354B48B09E5AC0D8 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_macOS/Pods-core-ObjectiveCExampleTests_macOS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
E494A9BD8D1B57040775206F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_tvOS/Pods-core-ObjectiveCExampleTests_tvOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SSZipArchive-tvOS/SSZipArchive.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_tvOS/Pods-core-ObjectiveCExampleTests_tvOS-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
ED17275C640D443076C514CE /* [CP] Copy Pods Resources */ = {
@@ -432,12 +702,34 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ObjectiveCExampleTests/Pods-ObjectiveCExampleTests-resources.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_iOS/Pods-core-ObjectiveCExampleTests_iOS-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
3773ADAA1F7F44D8009A4B2D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3773ADB71F7F4541009A4B2D /* SSZipArchiveTests.m in Sources */,
37FF0CB91F853459006E4361 /* ProgressDelegate.m in Sources */,
3773ADB61F7F453E009A4B2D /* CollectingDelegate.m in Sources */,
37FF0CB41F8533E0006E4361 /* CancelDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
3793E6D31F7F5F93000B1A19 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3793E6E01F7F604B000B1A19 /* SSZipArchiveTests.m in Sources */,
37FF0CBA1F853459006E4361 /* ProgressDelegate.m in Sources */,
3793E6DF1F7F6048000B1A19 /* CollectingDelegate.m in Sources */,
37FF0CB51F8533E0006E4361 /* CancelDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8DFE19E61BDA9FF300709011 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -453,20 +745,14 @@
buildActionMask = 2147483647;
files = (
8DFE1A141BDAA0A800709011 /* CollectingDelegate.m in Sources */,
37FF0CB81F853459006E4361 /* ProgressDelegate.m in Sources */,
8DFE1A081BDA9FF300709011 /* SSZipArchiveTests.m in Sources */,
37FF0CB31F8533E0006E4361 /* CancelDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
8DFE1A051BDA9FF300709011 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8DFE19E91BDA9FF300709011 /* ObjectiveCExample */;
targetProxy = 8DFE1A041BDA9FF300709011 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
8DFE19F61BDA9FF300709011 /* Main.storyboard */ = {
isa = PBXVariantGroup;
@@ -487,6 +773,94 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
3773ADB31F7F44D9009A4B2D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 48AB7DF053F85FCC6AFB0C26 /* Pods-core-ObjectiveCExampleTests_macOS.debug.xcconfig */;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
};
name = Debug;
};
3773ADB41F7F44D9009A4B2D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 04CB37570807602F7E5C66D9 /* Pods-core-ObjectiveCExampleTests_macOS.release.xcconfig */;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
};
name = Release;
};
3793E6DD1F7F5F93000B1A19 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FB7EEC7952E1561D1E668B3B /* Pods-core-ObjectiveCExampleTests_tvOS.debug.xcconfig */;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_STYLE = Automatic;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 11.1;
};
name = Debug;
};
3793E6DE1F7F5F93000B1A19 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = DC1DEADE9E9CE0AF5B487DCF /* Pods-core-ObjectiveCExampleTests_tvOS.release.xcconfig */;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_STYLE = Automatic;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-tvOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 11.1;
};
name = Release;
};
8DFE1A0A1BDA9FF300709011 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -506,14 +880,17 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES_AGGRESSIVE;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_ACTIVITY_MODE = "";
"DEBUG_ACTIVITY_MODE[sdk=iphonesimulator*]" = default;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -531,7 +908,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -558,14 +936,16 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES_AGGRESSIVE;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_ACTIVITY_MODE = "";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -577,7 +957,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -587,57 +968,71 @@
};
8DFE1A0D1BDA9FF300709011 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 78F9C8623D65380774875E92 /* Pods-ObjectiveCExample.debug.xcconfig */;
baseConfigurationReference = 51F30FF220ECFD8DC810E21A /* Pods-core-ObjectiveCExample.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = ObjectiveCExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExample;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ObjectiveCExample;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
8DFE1A0E1BDA9FF300709011 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = BF4E88C3450A127B14A949C2 /* Pods-ObjectiveCExample.release.xcconfig */;
baseConfigurationReference = 254DE0B206EE66F57BBE7EEE /* Pods-core-ObjectiveCExample.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = ObjectiveCExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExample;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ObjectiveCExample;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
8DFE1A101BDA9FF300709011 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = C12D647350722C151A02D17C /* Pods-ObjectiveCExampleTests.debug.xcconfig */;
baseConfigurationReference = A2E5B3BB819D409D02E989BC /* Pods-core-ObjectiveCExampleTests_iOS.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExampleTests;
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectiveCExample.app/ObjectiveCExample";
};
name = Debug;
};
8DFE1A111BDA9FF300709011 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B263C1FEBD2BEC1D1C4133CC /* Pods-ObjectiveCExampleTests.release.xcconfig */;
baseConfigurationReference = CD7C1D2CFA646F90A02312F4 /* Pods-core-ObjectiveCExampleTests_iOS.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExampleTests;
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectiveCExample.app/ObjectiveCExample";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
3773ADB51F7F44D9009A4B2D /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests_macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3773ADB31F7F44D9009A4B2D /* Debug */,
3773ADB41F7F44D9009A4B2D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
3793E6DC1F7F5F93000B1A19 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests_tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3793E6DD1F7F5F93000B1A19 /* Debug */,
3793E6DE1F7F5F93000B1A19 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8DFE19E51BDA9FF300709011 /* Build configuration list for PBXProject "ObjectiveCExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -656,7 +1051,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8DFE1A0F1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests" */ = {
8DFE1A0F1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests_iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8DFE1A101BDA9FF300709011 /* Debug */,

View File

@@ -7,7 +7,7 @@
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
@@ -20,12 +20,27 @@
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE1A021BDA9FF300709011"
BuildableName = "ObjectiveCExampleTests_iOS.xctest"
BlueprintName = "ObjectiveCExampleTests_iOS"
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -33,8 +48,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE1A021BDA9FF300709011"
BuildableName = "ObjectiveCExampleTests.xctest"
BlueprintName = "ObjectiveCExampleTests"
BuildableName = "ObjectiveCExampleTests_iOS.xctest"
BlueprintName = "ObjectiveCExampleTests_iOS"
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
</BuildableReference>
</TestableReference>
@@ -55,6 +70,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -71,6 +87,13 @@
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "${DEBUG_ACTIVITY_MODE}"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3773ADAD1F7F44D8009A4B2D"
BuildableName = "ObjectiveCExampleTests_macOS.xctest"
BlueprintName = "ObjectiveCExampleTests_macOS"
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3773ADAD1F7F44D8009A4B2D"
BuildableName = "ObjectiveCExampleTests_macOS.xctest"
BlueprintName = "ObjectiveCExampleTests_macOS"
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3793E6D61F7F5F93000B1A19"
BuildableName = "ObjectiveCExampleTests_tvOS.xctest"
BlueprintName = "ObjectiveCExampleTests_tvOS"
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3793E6D61F7F5F93000B1A19"
BuildableName = "ObjectiveCExampleTests_tvOS.xctest"
BlueprintName = "ObjectiveCExampleTests_tvOS"
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina3_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
@@ -14,19 +19,18 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="password" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="KJF-p6-1px">
<rect key="frame" x="258.5" y="46" width="83" height="30"/>
<rect key="frame" x="118.5" y="46" width="83" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uTp-oA-6Sj">
<rect key="frame" x="244" y="84" width="113" height="30"/>
<rect key="frame" x="103.5" y="84" width="113" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="113" id="4gB-hu-j54"/>
<constraint firstAttribute="height" constant="30" id="ZCc-Jb-Nvy"/>
</constraints>
<state key="normal" title="Zip Sample Data"/>
@@ -35,10 +39,9 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2Ts-JV-yCW">
<rect key="frame" x="235" y="122" width="131" height="30"/>
<rect key="frame" x="94.5" y="122" width="131" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="slo-YK-c1X"/>
<constraint firstAttribute="width" constant="131" id="tp1-M2-kBk"/>
</constraints>
<state key="normal" title="Unzip Sample Data"/>
<connections>
@@ -46,9 +49,8 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="84L-OB-eyZ">
<rect key="frame" x="281" y="247" width="39" height="30"/>
<rect key="frame" x="140.5" y="247" width="39" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="39" id="ZIK-Ed-EMM"/>
<constraint firstAttribute="height" constant="30" id="kpA-B8-VhI"/>
</constraints>
<state key="normal" title="Reset"/>
@@ -56,50 +58,50 @@
<action selector="resetPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="8v0-hm-kIr"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b0V-gX-SgI" userLabel="File3">
<rect key="frame" x="60" y="218" width="480" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3gB-ZC-0ON" userLabel="File1">
<rect key="frame" x="16" y="160" width="288" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="OSM-wR-5Cr"/>
<constraint firstAttribute="width" constant="480" id="Sm6-aF-Af6"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3gB-ZC-0ON" userLabel="File1">
<rect key="frame" x="60" y="160" width="480" height="21"/>
<constraints>
<constraint firstAttribute="width" constant="480" id="Ng7-H8-Pfv"/>
<constraint firstAttribute="height" constant="21" id="yRA-t9-obB"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZxR-a0-kva" userLabel="File2">
<rect key="frame" x="60" y="189" width="480" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZxR-a0-kva" userLabel="File2">
<rect key="frame" x="16" y="189" width="288" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="NgQ-SV-D07"/>
<constraint firstAttribute="width" constant="480" id="yJ1-K6-arr"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File3" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b0V-gX-SgI" userLabel="File3">
<rect key="frame" x="16" y="218" width="288" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="OSM-wR-5Cr"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="ZxR-a0-kva" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="0Aj-Zl-ubb"/>
<constraint firstItem="uTp-oA-6Sj" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="33K-W3-McX"/>
<constraint firstItem="3gB-ZC-0ON" firstAttribute="top" secondItem="2Ts-JV-yCW" secondAttribute="bottom" constant="8" id="3iw-LW-JkX"/>
<constraint firstItem="b0V-gX-SgI" firstAttribute="top" secondItem="ZxR-a0-kva" secondAttribute="bottom" constant="8" id="8Av-3o-ggw"/>
<constraint firstAttribute="trailingMargin" secondItem="ZxR-a0-kva" secondAttribute="trailing" id="ABK-aX-afX"/>
<constraint firstItem="84L-OB-eyZ" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="B64-sj-Ihu"/>
<constraint firstItem="b0V-gX-SgI" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="EEE-ae-qrN"/>
<constraint firstItem="3gB-ZC-0ON" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="RQc-UF-4I6"/>
<constraint firstItem="KJF-p6-1px" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="26" id="CrE-OB-0QR"/>
<constraint firstItem="b0V-gX-SgI" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="N3d-Wl-5jq"/>
<constraint firstAttribute="trailingMargin" secondItem="3gB-ZC-0ON" secondAttribute="trailing" id="Scb-te-5GB"/>
<constraint firstItem="ZxR-a0-kva" firstAttribute="top" secondItem="3gB-ZC-0ON" secondAttribute="bottom" constant="8" id="bUv-Zd-r4D"/>
<constraint firstItem="uTp-oA-6Sj" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="64" id="hwP-xO-UvR"/>
<constraint firstItem="ZxR-a0-kva" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="jRJ-c6-8LV"/>
<constraint firstAttribute="trailingMargin" secondItem="b0V-gX-SgI" secondAttribute="trailing" id="epM-dg-mgw"/>
<constraint firstItem="2Ts-JV-yCW" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="lEj-O2-aka"/>
<constraint firstItem="2Ts-JV-yCW" firstAttribute="top" secondItem="uTp-oA-6Sj" secondAttribute="bottom" constant="8" id="mnz-Ae-5eG"/>
<constraint firstItem="3gB-ZC-0ON" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="twp-26-8CL"/>
<constraint firstItem="uTp-oA-6Sj" firstAttribute="top" secondItem="KJF-p6-1px" secondAttribute="bottom" constant="8" symbolic="YES" id="uLh-xJ-Xc6"/>
<constraint firstItem="KJF-p6-1px" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="wVb-JQ-3pN"/>
<constraint firstItem="84L-OB-eyZ" firstAttribute="top" secondItem="b0V-gX-SgI" secondAttribute="bottom" constant="8" id="xAV-Uy-dqy"/>

View File

@@ -50,6 +50,8 @@
if (success) {
_unzipButton.enabled = YES;
_zipButton.enabled = NO;
} else {
NSLog(@"No success");
}
_resetButton.enabled = YES;
}

View File

@@ -0,0 +1,17 @@
//
// CancelDelegate.h
// ObjectiveCExample
//
// Created by Antoine Cœur on 04/10/2017.
//
#import <Foundation/Foundation.h>
#import "SSZipArchive.h"
@interface CancelDelegate : NSObject <SSZipArchiveDelegate>
@property (nonatomic, assign) int numFilesUnzipped;
@property (nonatomic, assign) int numFilesToUnzip;
@property (nonatomic, assign) BOOL didUnzipArchive;
@property (nonatomic, assign) int loaded;
@property (nonatomic, assign) int total;
@end

View File

@@ -0,0 +1,29 @@
//
// CancelDelegate.m
// ObjectiveCExample
//
// Created by Antoine Cœur on 04/10/2017.
//
#import "CancelDelegate.h"
@implementation CancelDelegate
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
{
_numFilesUnzipped = (int)fileIndex + 1;
}
- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
{
//return YES;
return _numFilesUnzipped < _numFilesToUnzip;
}
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath
{
_didUnzipArchive = YES;
}
- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total
{
_loaded = (int)loaded;
_total = (int)total;
}
@end

View File

@@ -5,5 +5,5 @@
* Test delegate by collecting its calls
*/
@interface CollectingDelegate : NSObject <SSZipArchiveDelegate>
@property(nonatomic, retain) NSMutableArray *files;
@end
@property(nonatomic, retain) NSMutableArray<NSString *> *files;
@end

View File

@@ -7,11 +7,9 @@
#import "CollectingDelegate.h"
@implementation CollectingDelegate {
}
@synthesize files = _files;
@implementation CollectingDelegate
@synthesize files = _files;
- (instancetype)init {
self = [super init];
@@ -21,11 +19,8 @@
return self;
}
- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath {
[self.files addObject:entryPath];
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath {
[self.files addObject:unzippedFilePath];
}
@end
@end

View File

@@ -0,0 +1,17 @@
//
// ProgressDelegate.h
// ObjectiveCExample
//
// Created by Antoine Cœur on 04/10/2017.
//
#import <Foundation/Foundation.h>
#import "SSZipArchive.h"
@interface ProgressDelegate : NSObject <SSZipArchiveDelegate>
{
@public
NSMutableArray *progressEvents;
}
@end

View File

@@ -0,0 +1,46 @@
//
// ProgressDelegate.m
// ObjectiveCExample
//
// Created by Antoine Cœur on 04/10/2017.
//
#import "ProgressDelegate.h"
@implementation ProgressDelegate
- (instancetype)init
{
self = super.init;
progressEvents = [NSMutableArray array];
return self;
}
- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo {
NSLog(@"*** zipArchiveWillUnzipArchiveAtPath: `%@` zipInfo:", path);
}
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath {
NSLog(@"*** zipArchiveDidUnzipArchiveAtPath: `%@` zipInfo: unzippedPath: `%@`", path, unzippedPath);
}
- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
{
NSLog(@"*** zipArchiveShouldUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
return YES;
}
- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo {
NSLog(@"*** zipArchiveWillUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
}
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo {
NSLog(@"*** zipArchiveDidUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
}
- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total {
NSLog(@"*** zipArchiveProgressEvent: loaded: `%llu` total: `%llu`", loaded, total);
[progressEvents addObject:@(loaded)];
}
@end

View File

@@ -11,46 +11,16 @@
#import <CommonCrypto/CommonDigest.h>
#import "CollectingDelegate.h"
#import "CancelDelegate.h"
#import "ProgressDelegate.h"
@interface CancelDelegate : NSObject <SSZipArchiveDelegate>
@property (nonatomic, assign) int numFilesUnzipped;
@property (nonatomic, assign) int numFilesToUnzip;
@property (nonatomic, assign) BOOL didUnzipArchive;
@property (nonatomic, assign) int loaded;
@property (nonatomic, assign) int total;
@interface SSZipArchiveTests : XCTestCase
@end
@implementation CancelDelegate
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
{
_numFilesUnzipped = (int)fileIndex + 1;
}
- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
{
//return YES;
return _numFilesUnzipped < _numFilesToUnzip;
}
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath
{
_didUnzipArchive = YES;
}
- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total
{
_loaded = (int)loaded;
_total = (int)total;
}
@end
@interface SSZipArchiveTests : XCTestCase <SSZipArchiveDelegate>
@end
@implementation SSZipArchiveTests {
NSMutableArray *progressEvents;
}
@implementation SSZipArchiveTests
- (void)setUp {
[super setUp];
progressEvents = [NSMutableArray array];
}
- (void)tearDown {
@@ -61,6 +31,8 @@
- (void)testZipping {
// use extracted files from [-testUnzipping]
[self testUnzipping];
NSString *inputPath = [self _cachesPath:@"Regular"];
NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"],
[inputPath stringByAppendingPathComponent:@"LICENSE"]];
@@ -68,8 +40,9 @@
NSString *outputPath = [self _cachesPath:@"Zipped"];
NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"];
[SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
BOOL success = [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
XCTAssertTrue(success);
// TODO: Make sure the files are actually unzipped. They are, but the test should be better.
XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Archive created");
}
@@ -82,13 +55,13 @@
NSString *outputPath = [self _cachesPath:@"FolderZipped"];
NSString *archivePath = [outputPath stringByAppendingPathComponent:@"ArchiveWithFolders.zip"];
[SSZipArchive createZipFileAtPath:archivePath withContentsOfDirectory:inputPath];
BOOL success = [SSZipArchive createZipFileAtPath:archivePath withContentsOfDirectory:inputPath];
XCTAssertTrue(success);
XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Folder Archive created");
}
- (void)testMultipleZippping{
NSArray *inputPaths = @[[[NSBundle bundleForClass: [self class]]pathForResource:@"0" ofType:@"m4a"],
[[NSBundle bundleForClass: [self class]]pathForResource:@"1" ofType:@"m4a"],
[[NSBundle bundleForClass: [self class]]pathForResource:@"2" ofType:@"m4a"],
[[NSBundle bundleForClass: [self class]]pathForResource:@"3" ofType:@"m4a"],
@@ -104,23 +77,25 @@
for (int test = 0; test < 20; test++)
{
// Zipping
NSString *archivePath = [outputPath stringByAppendingPathComponent:[NSString stringWithFormat:@"queue_test_%d.zip",test]];
[SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
NSString *archivePath = [outputPath stringByAppendingPathComponent:[NSString stringWithFormat:@"queue_test_%d.zip", test]];
BOOL success = [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
XCTAssertTrue(success);
long long threshold = 510000; // 510kB:size slightly smaller than a successful zip, but much larger than a failed one
long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:nil][NSFileSize] longLongValue];
XCTAssertTrue(fileSize > threshold, @"zipping failed at %@!",archivePath);
XCTAssertTrue(fileSize > threshold, @"zipping failed at %@!", archivePath);
}
}
- (void)testUnzipping {
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
NSString *outputPath = [self _cachesPath:@"Regular"];
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
XCTAssertTrue(success);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
@@ -128,12 +103,15 @@
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
}
- (void)testSmallFileUnzipping {
NSString *zipPath = [[NSBundle bundleForClass: [self class]] pathForResource:@"TestArchive" ofType:@"zip"];
NSString *outputPath = [self _cachesPath:@"Regular"];
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
XCTAssertTrue(success);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
@@ -141,20 +119,21 @@
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
}
- (void)testUnzippingProgress {
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
NSString *outputPath = [self _cachesPath:@"Progress"];
[progressEvents removeAllObjects];
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
ProgressDelegate *delegate = [ProgressDelegate new];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
XCTAssertTrue(success);
// 4 events: the first, then for each of the two files one, then the final event
XCTAssertTrue(4 == [progressEvents count], @"Expected 4 progress events");
XCTAssertTrue(0 == [progressEvents[0] intValue]);
XCTAssertTrue(619 == [progressEvents[1] intValue]);
XCTAssertTrue(1114 == [progressEvents[2] intValue]);
XCTAssertTrue(1436 == [progressEvents[3] intValue]);
XCTAssertTrue(4 == [delegate->progressEvents count], @"Expected 4 progress events");
XCTAssertTrue(0 == [delegate->progressEvents[0] intValue]);
XCTAssertTrue(619 == [delegate->progressEvents[1] intValue]);
XCTAssertTrue(1114 == [delegate->progressEvents[2] intValue]);
XCTAssertTrue(1436 == [delegate->progressEvents[3] intValue]);
}
@@ -163,8 +142,10 @@
NSString *outputPath = [self _cachesPath:@"Password"];
NSError *error = nil;
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd" error:&error delegate:self];
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd" error:&error delegate:delegate];
XCTAssertTrue(success);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
@@ -178,7 +159,9 @@
NSString *outputPath = [self _cachesPath:@"Password"];
NSError *error = nil;
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd123" error:&error delegate:self];
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd123" error:&error delegate:delegate];
XCTAssertFalse(success);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
@@ -196,12 +179,11 @@
BOOL fileHasValidPassword = [SSZipArchive isPasswordValidForArchiveAtPath:zipPath password:@"passw0rd" error:&error];
XCTAssertTrue(fileHasValidPassword,@"Valid password reports false.");
XCTAssertTrue(fileHasValidPassword, @"Valid password reports false.");
BOOL fileHasInvalidValidPassword = [SSZipArchive isPasswordValidForArchiveAtPath:zipPath password:@"passw0rd123" error:&error];
XCTAssertFalse(fileHasInvalidValidPassword,@"Invalid password reports true.");
XCTAssertFalse(fileHasInvalidValidPassword, @"Invalid password reports true.");
}
- (void)testIsFilePasswordProtectedAtPath {
@@ -217,31 +199,70 @@
XCTAssertTrue(protected, @"has password");
}
- (void)testZippingAndUnzippingWithUnicodePassword {
/********** Zipping ********/
// use extracted files from [-testUnzipping]
[self testUnzipping];
NSString *inputPath = [self _cachesPath:@"Regular"];
NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"],
[inputPath stringByAppendingPathComponent:@"LICENSE"]];
NSString *outputPath = [self _cachesPath:@"Zipped"];
NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedUnicodePasswordArchive.zip"];
BOOL success = [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths withPassword:@"ꊐ⌒Ⅳ🤐"];
XCTAssertTrue(success);
XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Archive created");
/********** Unzipping ********/
outputPath = [self _cachesPath:@"UnicodePassword"];
NSError *error = nil;
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
success = [SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath overwrite:YES password:@"ꊐ⌒Ⅳ🤐" error:&error delegate:delegate];
XCTAssertTrue(success);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
}
//Temp Disabled test, fix is not yet in the AES version of the unzip lib
//- (void)testUnzippingTruncatedFileFix {
// NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"IncorrectHeaders" ofType:@"zip"];
// NSString* outputPath = [self _cachesPath:@"IncorrectHeaders"];
// NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"IncorrectHeaders" ofType:@"zip"];
// NSString *outputPath = [self _cachesPath:@"IncorrectHeaders"];
//
// [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
// id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
// BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
// XCTAssertTrue(success);
//
// NSString* intendedReadmeTxtMD5 = @"31ac96301302eb388070c827447290b5";
// NSString *intendedReadmeTxtMD5 = @"31ac96301302eb388070c827447290b5";
//
// NSString* filePath = [outputPath stringByAppendingPathComponent:@"IncorrectHeaders/Readme.txt"];
// NSData* data = [NSData dataWithContentsOfFile:filePath];
// NSString *filePath = [outputPath stringByAppendingPathComponent:@"IncorrectHeaders/Readme.txt"];
// NSData *data = [NSData dataWithContentsOfFile:filePath];
//
// NSString* actualReadmeTxtMD5 = [self _calculateMD5Digest:data];
// NSString *actualReadmeTxtMD5 = [self _calculateMD5Digest:data];
// XCTAssertTrue([actualReadmeTxtMD5 isEqualToString:intendedReadmeTxtMD5], @"Readme.txt MD5 digest should match original.");
//}
- (void)testUnzippingWithSymlinkedFileInside {
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SymbolicLink" ofType:@"zip"];
NSString* outputPath = [self _cachesPath:@"SymbolicLink"];
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SymbolicLink" ofType:@"zip"];
NSString *outputPath = [self _cachesPath:@"SymbolicLink"];
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
XCTAssertTrue(success);
NSString *testSymlink = [outputPath stringByAppendingPathComponent:@"SymbolicLink/Xcode.app"];
NSError *error = nil;
@@ -253,11 +274,13 @@
- (void)testUnzippingWithRelativeSymlink {
NSString *resourceName = @"RelativeSymbolicLink";
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:resourceName ofType:@"zip"];
NSString* outputPath = [self _cachesPath:resourceName];
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:resourceName ofType:@"zip"];
NSString *outputPath = [self _cachesPath:resourceName];
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
XCTAssertTrue(success);
// Determine where the symlinks are
NSString *subfolderName = @"symlinks";
NSString *testBasePath = [NSString pathWithComponents:@[outputPath]];
@@ -275,11 +298,13 @@
- (void)testUnzippingWithUnicodeFilenameInside {
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Unicode" ofType:@"zip"];
NSString* outputPath = [self _cachesPath:@"Unicode"];
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Unicode" ofType:@"zip"];
NSString *outputPath = [self _cachesPath:@"Unicode"];
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
XCTAssertTrue(success);
bool unicodeFilenameWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Accént.txt"]];
bool unicodeFolderWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Fólder/Nothing.txt"]];
@@ -291,6 +316,8 @@
- (void)testZippingAndUnzippingForDate {
// use extracted files from [-testUnzipping]
[self testUnzipping];
NSString *inputPath = [self _cachesPath:@"Regular"];
NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"]];
@@ -299,12 +326,15 @@
NSString *outputPath = [self _cachesPath:@"ZippedDate"];
NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"];
[SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
[SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath delegate:self];
BOOL success = [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
XCTAssertTrue(success);
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
success = [SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath delegate:delegate];
XCTAssertTrue(success);
NSDictionary *createdFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[outputPath stringByAppendingPathComponent:@"Readme.markdown"] error:nil];
XCTAssertEqualObjects(originalFileAttributes[NSFileCreationDate], createdFileAttributes[@"NSFileCreationDate"], @"Orginal file creationDate should match created one");
XCTAssertEqualObjects(originalFileAttributes[NSFileCreationDate], createdFileAttributes[@"NSFileCreationDate"], @"Original file creationDate should match created one");
}
@@ -330,14 +360,15 @@
NSString *archivePath = [outputDir stringByAppendingPathComponent:@"TestAppArchive.zip"];
// Create the zip file using the contents of the .app file as the input
[SSZipArchive createZipFileAtPath:archivePath withContentsOfDirectory:inputFile];
BOOL success = [SSZipArchive createZipFileAtPath:archivePath withContentsOfDirectory:inputFile];
XCTAssertTrue(success);
/********** Un-zipping *******/
// Using this newly created zip file, unzip it
[SSZipArchive unzipFileAtPath:archivePath toDestination:outputDir];
success = [SSZipArchive unzipFileAtPath:archivePath toDestination:outputDir];
XCTAssertTrue(success);
// Get the path to the target file after unzipping
NSString *targetFilePath = [outputDir stringByAppendingPathComponent:@"/Contents/MacOS/TestProject"];
@@ -359,8 +390,8 @@
CancelDelegate *delegate = [[CancelDelegate alloc] init];
delegate.numFilesToUnzip = 1;
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
XCTAssertFalse(success);
XCTAssertEqual(delegate.numFilesUnzipped, 1);
XCTAssertFalse(delegate.didUnzipArchive);
XCTAssertNotEqual(delegate.loaded, delegate.total);
@@ -370,12 +401,11 @@
delegate = [[CancelDelegate alloc] init];
delegate.numFilesToUnzip = 1000;
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
XCTAssertTrue(success);
XCTAssertEqual(delegate.numFilesUnzipped, 2);
XCTAssertTrue(delegate.didUnzipArchive);
XCTAssertEqual(delegate.loaded, delegate.total);
}
// Commented out to avoid checking in several gig file into the repository. Simply add a file named
@@ -385,65 +415,32 @@
// NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"LargeArchive" ofType:@"zip"];
// NSString *outputPath = [self _cachesPath:@"Large"];
//
// [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath];
// BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath];
// XCTAssertTrue(success);
//}
-(void)testShouldProvidePathOfUnzippedFileInDelegateCallback {
CollectingDelegate *collector = [CollectingDelegate new];
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
NSString *outputPath = [self _cachesPath:@"Regular"];
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:collector];
// STAssertEqualObjects([collector.files objectAtIndex:0], @"LICENSE.txt", nil);
// STAssertEqualObjects([collector.files objectAtIndex:1], @"README.md", nil);
NSString *outputPath = [self _cachesPath:@"Regular"];
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:collector];
XCTAssertTrue(success);
XCTAssertEqualObjects(collector.files[0], [outputPath stringByAppendingString:@"/LICENSE"]);
XCTAssertEqualObjects(collector.files[1], [outputPath stringByAppendingString:@"/Readme.markdown"]);
}
#pragma mark - SSZipArchiveDelegate
- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo {
NSLog(@"*** zipArchiveWillUnzipArchiveAtPath: `%@` zipInfo:", path);
}
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath {
NSLog(@"*** zipArchiveDidUnzipArchiveAtPath: `%@` zipInfo: unzippedPath: `%@`", path, unzippedPath);
}
- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
{
NSLog(@"*** zipArchiveShouldUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
return YES;
}
- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo {
NSLog(@"*** zipArchiveWillUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
}
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo {
NSLog(@"*** zipArchiveDidUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
}
- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total {
NSLog(@"*** zipArchiveProgressEvent: loaded: `%llu` total: `%llu`", loaded, total);
[progressEvents addObject:@(loaded)];
}
#pragma mark - Private
- (NSString *)_cachesPath:(NSString *)directory {
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]
NSString *path = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject
stringByAppendingPathComponent:@"com.samsoffes.ssziparchive.tests"];
if (directory) {
path = [path stringByAppendingPathComponent:directory];
}
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:path]) {
[fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
}
[[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
return path;
}

View File

@@ -3,16 +3,24 @@ source 'https://github.com/CocoaPods/Specs.git'
# inhibit_all_warnings!
use_frameworks!
def testing_pods
pod 'SSZipArchive', :path => '..'
end
abstract_target 'core' do
target 'ObjectiveCExample' do
testing_pods
platform :ios
end
pod 'SSZipArchive', :path => '..'
target 'ObjectiveCExample' do
platform :ios
end
target 'ObjectiveCExampleTests_iOS' do
platform :ios
end
target 'ObjectiveCExampleTests_macOS' do
platform :osx, '10.8'
end
target 'ObjectiveCExampleTests_tvOS' do
platform :tvos, '9.0'
end
target 'ObjectiveCExampleTests' do
testing_pods
platform :ios
end

View File

@@ -1,16 +1,16 @@
PODS:
- SSZipArchive (2.0.2)
- SSZipArchive (2.1.0)
DEPENDENCIES:
- SSZipArchive (from `..`)
EXTERNAL SOURCES:
SSZipArchive:
:path: ".."
:path: ..
SPEC CHECKSUMS:
SSZipArchive: 5fdf578dbbb60000b23439f80fa04e81d00740ee
SSZipArchive: faba11d882f0bcaf608c1dab320e2900a70537aa
PODFILE CHECKSUM: 7f4058a9cbc69b4e63808729577a8bb2098bc527
PODFILE CHECKSUM: 5e250843c66c607960128ebfe02ab7d6569102be
COCOAPODS: 1.2.1
COCOAPODS: 1.3.1

View File

@@ -14,7 +14,9 @@ ZipArchive is a simple utility class for zipping and unzipping files on iOS and
## Installation and Setup
*The main release branch is configured to support Objective C and Swift 3. There is a 'swift23' branch which is a tied to a older 1.x release and will not be upgraded. Xcode 8.3+ removes support for Swift 2.3*
*The main release branch is configured to support Objective C and Swift 3+. There is a 'swift23' branch which is a tied to a older 1.x release and will not be upgraded. Xcode 8.3+ removes support for Swift 2.3*
SSZipArchive works on Xcode 7-9 and above, iOS 8-11 and above.
### CocoaPods
In your Podfile:

View File

@@ -1,17 +1,17 @@
Pod::Spec.new do |s|
s.name = 'SSZipArchive'
s.version = '2.0.2'
s.version = '2.1.0'
s.summary = 'Utility class for zipping and unzipping files on iOS, tvOS, watchOS, and Mac.'
s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS, tvOS, watchOS, and Mac.'
s.homepage = 'https://github.com/ZipArchive/ZipArchive'
s.license = { :type => 'MIT', :file => 'LICENSE.txt' }
s.authors = { 'Sam Soffes' => 'sam@soff.es', 'Joshua Hudson' => nil }
s.authors = { 'Sam Soffes' => 'sam@soff.es', 'Joshua Hudson' => nil, 'Antoine Cœur' => nil }
s.source = { :git => 'https://github.com/ZipArchive/ZipArchive.git', :tag => "v#{s.version}" }
s.ios.deployment_target = '4.0'
s.tvos.deployment_target = '9.0'
s.osx.deployment_target = '10.6'
s.osx.deployment_target = '10.8'
s.watchos.deployment_target = '2.0'
s.source_files = 'SSZipArchive/*.{m,h}', 'SSZipArchive/minizip/*.{c,h}', 'SSZipArchive/minizip/aes/*.{c,h}'
s.source_files = 'SSZipArchive/*.{m,h}', 'SSZipArchive/minizip/**/*.{c,h}'
s.public_header_files = 'SSZipArchive/*.h'
s.library = 'z'
end

View File

@@ -21,6 +21,7 @@ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
SSZipArchiveErrorCodeFileInfoNotLoadable = -3,
SSZipArchiveErrorCodeFileContentNotReadable = -4,
SSZipArchiveErrorCodeFailedToWriteFile = -5,
SSZipArchiveErrorCodeInvalidArguments = -6,
};
@protocol SSZipArchiveDelegate;
@@ -29,14 +30,24 @@ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
// Password check
+ (BOOL)isFilePasswordProtectedAtPath:(NSString *)path;
+ (BOOL)isPasswordValidForArchiveAtPath:(NSString *)path password:(NSString *)pw error:(NSError * __nullable * __nullable)error NS_SWIFT_NOTHROW;
+ (BOOL)isPasswordValidForArchiveAtPath:(NSString *)path password:(NSString *)pw error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NOTHROW;
// Unzip
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination;
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(nullable id<SSZipArchiveDelegate>)delegate;
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(nullable NSString *)password error:(NSError * *)error;
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(nullable NSString *)password error:(NSError * *)error delegate:(nullable id<SSZipArchiveDelegate>)delegate NS_REFINED_FOR_SWIFT;
+ (BOOL)unzipFileAtPath:(NSString *)path
toDestination:(NSString *)destination
overwrite:(BOOL)overwrite
password:(nullable NSString *)password
error:(NSError * *)error;
+ (BOOL)unzipFileAtPath:(NSString *)path
toDestination:(NSString *)destination
overwrite:(BOOL)overwrite
password:(nullable NSString *)password
error:(NSError * *)error
delegate:(nullable id<SSZipArchiveDelegate>)delegate NS_REFINED_FOR_SWIFT;
+ (BOOL)unzipFileAtPath:(NSString *)path
toDestination:(NSString *)destination
@@ -47,38 +58,43 @@ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
delegate:(nullable id<SSZipArchiveDelegate>)delegate;
+ (BOOL)unzipFileAtPath:(NSString *)path
toDestination:(NSString *)destination
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * __nullable error))completionHandler;
toDestination:(NSString *)destination
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
+ (BOOL)unzipFileAtPath:(NSString *)path
toDestination:(NSString *)destination
overwrite:(BOOL)overwrite
password:(nullable NSString *)password
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * __nullable error))completionHandler;
toDestination:(NSString *)destination
overwrite:(BOOL)overwrite
password:(nullable NSString *)password
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
// Zip
// without password
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths;
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths;
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath;
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory;
// with password, password could be nil
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(nullable NSString *)password;
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password;
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password;
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password;
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
+ (BOOL)createZipFileAtPath:(NSString *)path
withContentsOfDirectory:(NSString *)directoryPath
keepParentDirectory:(BOOL)keepParentDirectory
withPassword:(nullable NSString *)password
andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
- (instancetype)initWithPath:(NSString *)path;
@property (NS_NONATOMIC_IOSONLY, readonly) BOOL open;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER;
- (BOOL)open;
- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password;
- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password;
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password;
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password;
@property (NS_NONATOMIC_IOSONLY, readonly) BOOL close;
- (BOOL)close;
@end
@@ -95,7 +111,6 @@ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath;
- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total;
- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath;
@end

View File

@@ -5,12 +5,12 @@
// Created by Sam Soffes on 7/21/10.
// Copyright (c) Sam Soffes 2010-2015. All rights reserved.
//
#import "SSZipArchive.h"
#include "unzip.h"
#include "zip.h"
#include "minishared.h"
#import "zlib.h"
#import "zconf.h"
#include "mz_error.h"
#include "mz_os.h"
#include "mz_unzip.h"
#include "mz_zip.h"
#include <sys/stat.h>
@@ -18,46 +18,68 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
#define CHUNK 16384
BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo);
#ifndef API_AVAILABLE
// Xcode 7- compatibility
#define API_AVAILABLE(...)
#endif
@interface NSData(SSZipArchive)
- (NSString *)_base64RFC4648 API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
- (NSString *)_hexString;
@end
@interface SSZipArchive ()
+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
@end
@implementation SSZipArchive
{
/// path for zip file
NSString *_path;
NSString *_filename;
zipFile _zip;
}
#pragma mark - Password check
+ (BOOL)isFilePasswordProtectedAtPath:(NSString *)path {
// Begin opening
zipFile zip = unzOpen((const char*)[path fileSystemRepresentation]);
if (zip == NULL) {
void *stream = NULL;
mz_stream_os_create(&stream);
if (mz_stream_open(stream, path.fileSystemRepresentation, MZ_STREAM_MODE_READ) != MZ_OK)
{
mz_stream_os_delete(&stream);
return NO;
}
int ret = unzGoToFirstFile(zip);
if (ret == UNZ_OK) {
// Begin opening
void *zip = mz_unzip_open(stream);
if (zip == NULL) {
mz_stream_os_delete(&stream);
return NO;
}
int ret = mz_unzip_goto_first_entry(zip);
if (ret == MZ_OK) {
do {
ret = unzOpenCurrentFile(zip);
if (ret != UNZ_OK) {
mz_unzip_file *fileInfo = NULL;
ret = mz_unzip_entry_get_info(zip, &fileInfo);
if (ret != MZ_OK) {
mz_unzip_close(stream);
mz_stream_os_delete(&stream);
return NO;
}
unz_file_info fileInfo = {0};
ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
if (ret != UNZ_OK) {
return NO;
} else if ((fileInfo.flag & 1) == 1) {
} else if ((fileInfo->flag & 1) == 1) {
mz_unzip_close(stream);
mz_stream_os_delete(&stream);
return YES;
}
unzCloseCurrentFile(zip);
ret = unzGoToNextFile(zip);
} while (ret == UNZ_OK && UNZ_OK != UNZ_END_OF_LIST_OF_FILE);
ret = mz_unzip_goto_next_entry(zip);
} while (ret == MZ_OK);
}
mz_unzip_close(stream);
mz_stream_os_delete(&stream);
return NO;
}
@@ -66,7 +88,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
*error = nil;
}
zipFile zip = unzOpen((const char*)[path fileSystemRepresentation]);
zipFile zip = unzOpen(path.fileSystemRepresentation);
if (zip == NULL) {
if (error) {
*error = [NSError errorWithDomain:SSZipArchiveErrorDomain
@@ -77,14 +99,14 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
}
int ret = unzGoToFirstFile(zip);
if (ret == UNZ_OK) {
if (ret == MZ_OK) {
do {
if ([pw length] == 0) {
if (pw.length == 0) {
ret = unzOpenCurrentFile(zip);
} else {
ret = unzOpenCurrentFilePassword(zip, [pw cStringUsingEncoding:NSASCIIStringEncoding]);
ret = unzOpenCurrentFilePassword(zip, [pw cStringUsingEncoding:NSUTF8StringEncoding]);
}
if (ret != UNZ_OK) {
if (ret != MZ_OK) {
if (ret != UNZ_BADPASSWORD) {
if (error) {
*error = [NSError errorWithDomain:SSZipArchiveErrorDomain
@@ -94,9 +116,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
}
return NO;
}
unz_file_info fileInfo = {0};
unz_file_info fileInfo = {};
ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
if (ret != UNZ_OK) {
if (ret != MZ_OK) {
if (error) {
*error = [NSError errorWithDomain:SSZipArchiveErrorDomain
code:SSZipArchiveErrorCodeFileInfoNotLoadable
@@ -107,7 +129,8 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
unsigned char buffer[10] = {0};
int readBytes = unzReadCurrentFile(zip, buffer, (unsigned)MIN(10UL,fileInfo.uncompressed_size));
if (readBytes < 0) {
// Let's assume the invalid password caused this error
// Let's assume error Z_DATA_ERROR is caused by an invalid password
// Let's assume other errors are caused by Content Not Readable
if (readBytes != Z_DATA_ERROR) {
if (error) {
*error = [NSError errorWithDomain:SSZipArchiveErrorDomain
@@ -122,9 +145,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
unzCloseCurrentFile(zip);
ret = unzGoToNextFile(zip);
} while (ret == UNZ_OK && UNZ_OK != UNZ_END_OF_LIST_OF_FILE);
} while (ret == MZ_OK && MZ_OK != UNZ_END_OF_LIST_OF_FILE);
}
// No password required
return YES;
}
@@ -146,7 +169,12 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:YES password:nil error:nil delegate:delegate progressHandler:nil completionHandler:nil];
}
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(nullable NSString *)password error:(NSError **)error delegate:(nullable id<SSZipArchiveDelegate>)delegate
+ (BOOL)unzipFileAtPath:(NSString *)path
toDestination:(NSString *)destination
overwrite:(BOOL)overwrite
password:(nullable NSString *)password
error:(NSError **)error
delegate:(nullable id<SSZipArchiveDelegate>)delegate
{
return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:overwrite password:password error:error delegate:delegate progressHandler:nil completionHandler:nil];
}
@@ -156,7 +184,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
overwrite:(BOOL)overwrite
password:(NSString *)password
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *__nullable error))completionHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler
{
return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:overwrite password:password error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler];
}
@@ -164,7 +192,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
+ (BOOL)unzipFileAtPath:(NSString *)path
toDestination:(NSString *)destination
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * __nullable error))completionHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler
{
return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:YES password:nil error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler];
}
@@ -184,14 +212,30 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
toDestination:(NSString *)destination
preserveAttributes:(BOOL)preserveAttributes
overwrite:(BOOL)overwrite
password:(NSString *)password
password:(nullable NSString *)password
error:(NSError **)error
delegate:(id<SSZipArchiveDelegate>)delegate
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * __nullable error))completionHandler
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler
{
// Guard against empty strings
if (path.length == 0 || destination.length == 0)
{
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"received invalid argument(s)"};
NSError *err = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeInvalidArguments userInfo:userInfo];
if (error)
{
*error = err;
}
if (completionHandler)
{
completionHandler(nil, NO, err);
}
return NO;
}
// Begin opening
zipFile zip = unzOpen((const char*)[path fileSystemRepresentation]);
zipFile zip = unzOpen(path.fileSystemRepresentation);
if (zip == NULL)
{
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open zip file"};
@@ -211,11 +255,11 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
unsigned long long fileSize = [fileAttributes[NSFileSize] unsignedLongLongValue];
unsigned long long currentPosition = 0;
unz_global_info globalInfo = {0ul, 0ul};
unz_global_info globalInfo = {};
unzGetGlobalInfo(zip, &globalInfo);
// Begin unzipping
if (unzGoToFirstFile(zip) != UNZ_OK)
if (unzGoToFirstFile(zip) != MZ_OK)
{
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open first file in zip file"};
NSError *err = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeFailedOpenFileInZip userInfo:userInfo];
@@ -236,7 +280,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
int crc_ret = 0;
unsigned char buffer[4096] = {0};
NSFileManager *fileManager = [NSFileManager defaultManager];
NSMutableArray *directoriesModificationDates = [[NSMutableArray alloc] init];
NSMutableArray<NSDictionary *> *directoriesModificationDates = [[NSMutableArray alloc] init];
// Message delegate
if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipArchiveAtPath:zipInfo:)]) {
@@ -250,13 +294,13 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
NSError *unzippingError;
do {
@autoreleasepool {
if ([password length] == 0) {
if (password.length == 0) {
ret = unzOpenCurrentFile(zip);
} else {
ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSASCIIStringEncoding]);
ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSUTF8StringEncoding]);
}
if (ret != UNZ_OK) {
if (ret != MZ_OK) {
unzippingError = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:SSZipArchiveErrorCodeFailedOpenFileInZip userInfo:@{NSLocalizedDescriptionKey: @"failed to open file in zip file"}];
success = NO;
break;
@@ -267,7 +311,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
memset(&fileInfo, 0, sizeof(unz_file_info));
ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
if (ret != UNZ_OK) {
if (ret != MZ_OK) {
unzippingError = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:SSZipArchiveErrorCodeFileInfoNotLoadable userInfo:@{NSLocalizedDescriptionKey: @"failed to retrieve info for file"}];
success = NO;
unzCloseCurrentFile(zip);
@@ -304,36 +348,15 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0);
filename[fileInfo.size_filename] = '\0';
//
// Determine whether this is a symbolic link:
// - File is stored with 'version made by' value of UNIX (3),
// as per http://www.pkware.com/documents/casestudies/APPNOTE.TXT
// in the upper byte of the version field.
// - BSD4.4 st_mode constants are stored in the high 16 bits of the
// external file attributes (defacto standard, verified against libarchive)
//
// The original constants can be found here:
// http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/include/sys/stat.h
//
const uLong ZipUNIXVersion = 3;
const uLong BSD_SFMT = 0170000;
const uLong BSD_IFLNK = 0120000;
BOOL fileIsSymbolicLink = _fileIsSymbolicLink(&fileInfo);
BOOL fileIsSymbolicLink = NO;
if (((fileInfo.version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo.external_fa >> 16))) {
fileIsSymbolicLink = YES;
NSString * strPath = [SSZipArchive _filenameStringWithCString:filename size:fileInfo.size_filename];
if (!strPath.length) {
// if filename data is unsalvageable, we default to currentFileNumber
strPath = @(currentFileNumber).stringValue;
}
// Check if it contains directory
// NSString * strPath = @(filename);
NSString * strPath = [NSString stringWithCString:filename encoding:NSUTF8StringEncoding];
//if filename contains chinese dir transform Encoding
if (!strPath) {
NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
strPath = [NSString stringWithCString:filename encoding:enc];
}
//end by skyfox
BOOL isDirectory = NO;
if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') {
isDirectory = YES;
@@ -354,9 +377,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
[directoriesModificationDates addObject: @{@"path": fullPath, @"modDate": modDate}];
}
if (isDirectory) {
[fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err];
[fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err];
} else {
[fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:directoryAttr error:&err];
[fileManager createDirectoryAtPath:fullPath.stringByDeletingLastPathComponent withIntermediateDirectories:YES attributes:directoryAttr error:&err];
}
if (nil != err) {
if ([err.domain isEqualToString:NSCocoaErrorDomain] &&
@@ -380,7 +403,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
// ensure we are not creating stale file entries
int readBytes = unzReadCurrentFile(zip, buffer, 4096);
if (readBytes >= 0) {
FILE *fp = fopen((const char*)[fullPath fileSystemRepresentation], "wb");
FILE *fp = fopen(fullPath.fileSystemRepresentation, "wb");
while (fp) {
if (readBytes > 0) {
if (0 == fwrite(buffer, readBytes, 1, fp)) {
@@ -388,7 +411,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
NSString *message = [NSString stringWithFormat:@"Failed to write file (check your free space)"];
NSLog(@"[SSZipArchive] %@", message);
success = NO;
*error = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:SSZipArchiveErrorCodeFailedToWriteFile userInfo:@{NSLocalizedDescriptionKey: message}];
unzippingError = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:SSZipArchiveErrorCodeFailedToWriteFile userInfo:@{NSLocalizedDescriptionKey: message}];
break;
}
}
@@ -396,47 +419,52 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
break;
}
readBytes = unzReadCurrentFile(zip, buffer, 4096);
if (readBytes < 0) {
// Let's assume error Z_DATA_ERROR is caused by an invalid password
// Let's assume other errors are caused by Content Not Readable
success = NO;
}
}
if (fp) {
if ([[[fullPath pathExtension] lowercaseString] isEqualToString:@"zip"]) {
NSLog(@"Unzipping nested .zip file: %@", [fullPath lastPathComponent]);
if ([self unzipFileAtPath:fullPath toDestination:[fullPath stringByDeletingLastPathComponent] overwrite:overwrite password:password error:nil delegate:nil]) {
if ([fullPath.pathExtension.lowercaseString isEqualToString:@"zip"]) {
NSLog(@"Unzipping nested .zip file: %@", fullPath.lastPathComponent);
if ([self unzipFileAtPath:fullPath toDestination:fullPath.stringByDeletingLastPathComponent overwrite:overwrite password:password error:nil delegate:nil]) {
[[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil];
}
}
fclose(fp);
if (preserveAttributes) {
// Set the original datetime property
if (fileInfo.dos_date != 0) {
NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dos_date];
NSDictionary *attr = @{NSFileModificationDate: orgDate};
if (attr) {
if ([fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] == NO) {
if (![fileManager setAttributes:attr ofItemAtPath:fullPath error:nil]) {
// Can't set attributes
NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting modification date");
}
}
}
// Set the original permissions on the file (+read/write to solve #293)
uLong permissions = fileInfo.external_fa >> 16 | 0b110000000;
if (permissions != 0) {
// Store it into a NSNumber
NSNumber *permissionsValue = @(permissions);
// Retrieve any existing attributes
NSMutableDictionary *attrs = [[NSMutableDictionary alloc] initWithDictionary:[fileManager attributesOfItemAtPath:fullPath error:nil]];
// Set the value in the attributes dict
attrs[NSFilePosixPermissions] = permissionsValue;
// Update attributes
if ([fileManager setAttributes:attrs ofItemAtPath:fullPath error:nil] == NO) {
if (![fileManager setAttributes:attrs ofItemAtPath:fullPath error:nil]) {
// Unable to set the permissions attribute
NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting permissions");
}
@@ -456,17 +484,28 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
break;
}
}
} else {
// Let's assume error Z_DATA_ERROR is caused by an invalid password
// Let's assume other errors are caused by Content Not Readable
success = NO;
break;
}
}
else
{
// Assemble the path for the symbolic link
NSMutableString* destinationPath = [NSMutableString string];
NSMutableString *destinationPath = [NSMutableString string];
int bytesRead = 0;
while ((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0)
{
buffer[bytesRead] = (int)0;
[destinationPath appendString:@((const char*)buffer)];
buffer[bytesRead] = 0;
[destinationPath appendString:@((const char *)buffer)];
}
if (bytesRead < 0) {
// Let's assume error Z_DATA_ERROR is caused by an invalid password
// Let's assume other errors are caused by Content Not Readable
success = NO;
break;
}
// Check if the symlink exists and delete it if we're overwriting
@@ -475,8 +514,8 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
if ([fileManager fileExistsAtPath:fullPath])
{
NSError *error = nil;
BOOL success = [fileManager removeItemAtPath:fullPath error:&error];
if (!success)
BOOL removeSuccess = [fileManager removeItemAtPath:fullPath error:&error];
if (!removeSuccess)
{
NSString *message = [NSString stringWithFormat:@"Failed to delete existing symbolic link at \"%@\"", error.localizedDescription];
NSLog(@"[SSZipArchive] %@", message);
@@ -523,7 +562,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
progressHandler(strPath, fileInfo, currentFileNumber, globalInfo.number_entry);
}
}
} while (ret == UNZ_OK && YES == success);
} while (ret == MZ_OK && success);
// Close
unzClose(zip);
@@ -538,7 +577,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
NSLog(@"[SSZipArchive] Set attributes failed for directory: %@.", d[@"path"]);
}
if (err) {
NSLog(@"[SSZipArchive] Error setting directory file modification date attribute: %@",err.localizedDescription);
NSLog(@"[SSZipArchive] Error setting directory file modification date attribute: %@", err.localizedDescription);
}
}
}
@@ -581,37 +620,37 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
}
#pragma mark - Zipping
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths
{
return [SSZipArchive createZipFileAtPath:path withFilesAtPaths:paths withPassword:nil];
}
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath{
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath {
return [SSZipArchive createZipFileAtPath:path withContentsOfDirectory:directoryPath withPassword:nil];
}
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory{
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory {
return [SSZipArchive createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:keepParentDirectory withPassword:nil];
}
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(NSString *)password
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(NSString *)password
{
BOOL success = NO;
SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path];
if ([zipArchive open]) {
BOOL success = [zipArchive open];
if (success) {
for (NSString *filePath in paths) {
[zipArchive writeFile:filePath withPassword:password];
success &= [zipArchive writeFile:filePath withPassword:password];
}
success = [zipArchive close];
success &= [zipArchive close];
}
return success;
}
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password{
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password {
return [SSZipArchive createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:NO withPassword:password];
}
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password{
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password {
return [SSZipArchive createZipFileAtPath:path
withContentsOfDirectory:directoryPath
keepParentDirectory:keepParentDirectory
@@ -620,17 +659,19 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
];
}
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler {
BOOL success = NO;
+ (BOOL)createZipFileAtPath:(NSString *)path
withContentsOfDirectory:(NSString *)directoryPath
keepParentDirectory:(BOOL)keepParentDirectory
withPassword:(nullable NSString *)password
andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler {
NSFileManager *fileManager = nil;
SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path];
if ([zipArchive open]) {
// use a local filemanager (queue/thread compatibility)
fileManager = [[NSFileManager alloc] init];
BOOL success = [zipArchive open];
if (success) {
// use a local fileManager (queue/thread compatibility)
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSDirectoryEnumerator *dirEnumerator = [fileManager enumeratorAtPath:directoryPath];
NSArray *allObjects = dirEnumerator.allObjects;
NSArray<NSString *> *allObjects = dirEnumerator.allObjects;
NSUInteger total = allObjects.count, complete = 0;
NSString *fileName;
for (fileName in allObjects) {
@@ -640,11 +681,11 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
if (keepParentDirectory)
{
fileName = [[directoryPath lastPathComponent] stringByAppendingPathComponent:fileName];
fileName = [directoryPath.lastPathComponent stringByAppendingPathComponent:fileName];
}
if (!isDir) {
[zipArchive writeFileAtPath:fullFilePath withFileName:fileName withPassword:password];
success &= [zipArchive writeFileAtPath:fullFilePath withFileName:fileName withPassword:password];
}
else
{
@@ -652,7 +693,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
{
NSString *tempFilePath = [self _temporaryPathForDiscardableFile];
NSString *tempFileFilename = [fileName stringByAppendingPathComponent:tempFilePath.lastPathComponent];
[zipArchive writeFileAtPath:tempFilePath withFileName:tempFileFilename withPassword:password];
success &= [zipArchive writeFileAtPath:tempFilePath withFileName:tempFileFilename withPassword:password];
}
}
complete++;
@@ -660,12 +701,15 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
progressHandler(complete, total);
}
}
success = [zipArchive close];
success &= [zipArchive close];
}
return success;
}
// disabling `init` because designated initializer is `initWithPath:`
- (instancetype)init { @throw nil; }
// designated initializer
- (instancetype)initWithPath:(NSString *)path
{
if ((self = [super init])) {
@@ -677,28 +721,26 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
- (BOOL)open
{
NSAssert((_zip == NULL), @"Attempting open an archive which is already open");
_zip = zipOpen([_path fileSystemRepresentation], APPEND_STATUS_CREATE);
NSAssert((_zip == NULL), @"Attempting to open an archive which is already open");
_zip = zipOpen(_path.fileSystemRepresentation, APPEND_STATUS_CREATE);
return (NULL != _zip);
}
- (void)zipInfo:(zip_fileinfo*)zipInfo setDate:(NSDate*)date
- (void)zipInfo:(zip_fileinfo *)zipInfo setDate:(NSDate *)date
{
NSCalendar *currentCalendar = [NSCalendar currentCalendar];
#if defined(__IPHONE_8_0) || defined(__MAC_10_10)
uint flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
#else
uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
#endif
NSCalendar *currentCalendar = SSZipArchive._gregorian;
NSCalendarUnit flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
NSDateComponents *components = [currentCalendar components:flags fromDate:date];
struct tm tmz_date;
tmz_date.tm_sec = (unsigned int)components.second;
tmz_date.tm_min = (unsigned int)components.minute;
tmz_date.tm_hour = (unsigned int)components.hour;
tmz_date.tm_mday = (unsigned int)components.day;
// ISO/IEC 9899 struct tm is 0-indexed for January but NSDateComponents for gregorianCalendar is 1-indexed for January
tmz_date.tm_mon = (unsigned int)components.month - 1;
tmz_date.tm_year = (unsigned int)components.year;
// ISO/IEC 9899 struct tm is 0-indexed for AD 1900 but NSDateComponents for gregorianCalendar is 1-indexed for AD 1
tmz_date.tm_year = (unsigned int)components.year - 1900;
zipInfo->dos_date = tm_to_dosdate(&tmz_date);
}
@@ -706,7 +748,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
{
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
zip_fileinfo zipInfo = {0,0,0};
zip_fileinfo zipInfo = {};
NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil];
if (attr)
@@ -720,7 +762,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
// Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727
// Get the permissions value from the files attributes
NSNumber *permissionsValue = (NSNumber *)attr[NSFilePosixPermissions];
if (permissionsValue) {
if (permissionsValue != nil) {
// Get the short value for the permissions
short permissionsShort = permissionsValue.shortValue;
@@ -732,17 +774,31 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
// Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte
//Casted back to an unsigned int to match type of external_fa in minizip
// Casted back to an unsigned int to match type of external_fa in minizip
zipInfo.external_fa = (unsigned int)(permissionsLong << 16L);
}
}
int error = zipOpenNewFileInZip3(_zip,
[folderName stringByAppendingString:@"/"].fileSystemRepresentation,
&zipInfo,
NULL,
0,
NULL,
0,
NULL,
Z_DEFLATED,
Z_NO_COMPRESSION,
0,
-MAX_WBITS,
DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY,
password.UTF8String,
0);
unsigned int len = 0;
zipOpenNewFileInZip3(_zip, [[folderName stringByAppendingString:@"/"] fileSystemRepresentation], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_NO_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, [password UTF8String], 0);
zipWriteInFileInZip(_zip, &len, 0);
zipCloseFileInZip(_zip);
return YES;
return error == ZIP_OK;
}
- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password;
@@ -757,20 +813,20 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
{
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
FILE *input = fopen([path fileSystemRepresentation], "r");
FILE *input = fopen(path.fileSystemRepresentation, "r");
if (NULL == input) {
return NO;
}
const char *afileName;
const char *aFileName;
if (!fileName) {
afileName = [path.lastPathComponent fileSystemRepresentation];
aFileName = path.lastPathComponent.fileSystemRepresentation;
}
else {
afileName = [fileName fileSystemRepresentation];
aFileName = fileName.fileSystemRepresentation;
}
zip_fileinfo zipInfo = {0,0,0};
zip_fileinfo zipInfo = {};
NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil];
if (attr)
@@ -784,7 +840,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
// Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727
// Get the permissions value from the files attributes
NSNumber *permissionsValue = (NSNumber *)attr[NSFilePosixPermissions];
if (permissionsValue) {
if (permissionsValue != nil) {
// Get the short value for the permissions
short permissionsShort = permissionsValue.shortValue;
@@ -796,7 +852,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
// Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte
//Casted back to an unsigned int to match type of external_fa in minizip
// Casted back to an unsigned int to match type of external_fa in minizip
zipInfo.external_fa = (unsigned int)(permissionsLong << 16L);
}
}
@@ -804,22 +860,22 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
void *buffer = malloc(CHUNK);
if (buffer == NULL)
{
fclose(input);
return NO;
}
zipOpenNewFileInZip3(_zip, afileName, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, [password UTF8String], 0);
unsigned int len = 0;
int error = zipOpenNewFileInZip3(_zip, aFileName, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, password.UTF8String, 0);
while (!feof(input) && !ferror(input))
{
len = (unsigned int) fread(buffer, 1, CHUNK, input);
unsigned int len = (unsigned int) fread(buffer, 1, CHUNK, input);
zipWriteInFileInZip(_zip, buffer, len);
}
zipCloseFileInZip(_zip);
free(buffer);
fclose(input);
return YES;
return error == ZIP_OK;
}
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password;
@@ -830,34 +886,74 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
if (!data) {
return NO;
}
zip_fileinfo zipInfo = {0,0,0};
zip_fileinfo zipInfo = {};
[self zipInfo:&zipInfo setDate:[NSDate date]];
zipOpenNewFileInZip3(_zip, [filename fileSystemRepresentation], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, [password UTF8String], 0);
int error = zipOpenNewFileInZip3(_zip, filename.fileSystemRepresentation, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, password.UTF8String, 0);
zipWriteInFileInZip(_zip, data.bytes, (unsigned int)data.length);
zipCloseFileInZip(_zip);
return YES;
return error == ZIP_OK;
}
- (BOOL)close
{
NSAssert((_zip != NULL), @"[SSZipArchive] Attempting to close an archive which was never opened");
zipClose(_zip, NULL);
return YES;
int error = zipClose(_zip, NULL);
_zip = nil;
return error == MZ_OK;
}
#pragma mark - Private
+ (NSString *)_filenameStringWithCString:(const char *)filename size:(uint16_t)size_filename
{
NSString * strPath = @(filename);
if (strPath) {
return strPath;
}
// if filename is non-unicode, detect and transform Encoding
NSData *data = [NSData dataWithBytes:(const void *)filename length:sizeof(unsigned char) * size_filename];
#ifdef __MAC_10_13
// Xcode 9+
if (@available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *)) {
// supported encodings are in [NSString availableStringEncodings]
[NSString stringEncodingForData:data encodingOptions:nil convertedString:&strPath usedLossyConversion:nil];
}
#else
// Xcode 8-
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_9_2) {
// supported encodings are in [NSString availableStringEncodings]
[NSString stringEncodingForData:data encodingOptions:nil convertedString:&strPath usedLossyConversion:nil];
}
#endif
else {
// fallback to a simple manual detect for macOS 10.9 or older
NSArray<NSNumber *> *encodings = @[@(kCFStringEncodingGB_18030_2000), @(kCFStringEncodingShiftJIS)];
for (NSNumber *encoding in encodings) {
strPath = [NSString stringWithCString:filename encoding:(NSStringEncoding)CFStringConvertEncodingToNSStringEncoding(encoding.unsignedIntValue)];
if (strPath) {
break;
}
}
}
if (!strPath) {
// if filename encoding is non-detected, we default to something based on data
// _hexString is more readable than _base64RFC4648 for debugging unknown encodings
strPath = [data _hexString];
}
return strPath;
}
+ (NSString *)_temporaryPathForDiscardableFile
{
static NSString *discardableFileName = @".DS_Store";
static NSString *discardableFilePath = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *temporaryDirectoryName = [[NSUUID UUID] UUIDString];
NSString *temporaryDirectoryName = [NSUUID UUID].UUIDString;
NSString *temporaryDirectory = [NSTemporaryDirectory() stringByAppendingPathComponent:temporaryDirectoryName];
BOOL directoryCreated = [[NSFileManager defaultManager] createDirectoryAtPath:temporaryDirectory withIntermediateDirectories:YES attributes:nil error:nil];
if (directoryCreated) {
@@ -868,6 +964,17 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
return discardableFilePath;
}
+ (NSCalendar *)_gregorian
{
static NSCalendar *gregorian;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
});
return gregorian;
}
// Format from http://newsgroups.derkeiler.com/Archive/Comp/comp.os.msdos.programmer/2009-04/msg00060.html
// Two consecutive words, or a longword, YYYYYYYMMMMDDDDD hhhhhmmmmmmsssss
// YYYYYYY is years from 1980 = 0
@@ -877,6 +984,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
// 7423 = 0111 0100 0010 0011 - 01110 100001 00011 = 14 33 3 = 14:33:06
+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime
{
// the whole `_dateWithMSDOSFormat:` method is equivalent but faster than this one line,
// essentially because `mktime` is slow:
//NSDate *date = [NSDate dateWithTimeIntervalSince1970:dosdate_to_time_t(msdosDateTime)];
static const UInt32 kYearMask = 0xFE000000;
static const UInt32 kMonthMask = 0x1E00000;
static const UInt32 kDayMask = 0x1F0000;
@@ -884,29 +994,82 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
static const UInt32 kMinuteMask = 0x7E0;
static const UInt32 kSecondMask = 0x1F;
static NSCalendar *gregorian;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
#if defined(__IPHONE_8_0) || defined(__MAC_10_10)
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
#else
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
#endif
});
NSDateComponents *components = [[NSDateComponents alloc] init];
NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[SSZipArchive] MSDOS date masks don't add up");
[components setYear:1980 + ((msdosDateTime & kYearMask) >> 25)];
[components setMonth:(msdosDateTime & kMonthMask) >> 21];
[components setDay:(msdosDateTime & kDayMask) >> 16];
[components setHour:(msdosDateTime & kHourMask) >> 11];
[components setMinute:(msdosDateTime & kMinuteMask) >> 5];
[components setSecond:(msdosDateTime & kSecondMask) * 2];
NSDateComponents *components = [[NSDateComponents alloc] init];
components.year = 1980 + ((msdosDateTime & kYearMask) >> 25);
components.month = (msdosDateTime & kMonthMask) >> 21;
components.day = (msdosDateTime & kDayMask) >> 16;
components.hour = (msdosDateTime & kHourMask) >> 11;
components.minute = (msdosDateTime & kMinuteMask) >> 5;
components.second = (msdosDateTime & kSecondMask) * 2;
NSDate *date = [NSDate dateWithTimeInterval:0 sinceDate:[gregorian dateFromComponents:components]];
NSDate *date = [self._gregorian dateFromComponents:components];
return date;
}
@end
#pragma mark - Private tools for file info
BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo)
{
//
// Determine whether this is a symbolic link:
// - File is stored with 'version made by' value of UNIX (3),
// as per http://www.pkware.com/documents/casestudies/APPNOTE.TXT
// in the upper byte of the version field.
// - BSD4.4 st_mode constants are stored in the high 16 bits of the
// external file attributes (defacto standard, verified against libarchive)
//
// The original constants can be found here:
// http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/include/sys/stat.h
//
const uLong ZipUNIXVersion = 3;
const uLong BSD_SFMT = 0170000;
const uLong BSD_IFLNK = 0120000;
BOOL fileIsSymbolicLink = ((fileInfo->version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo->external_fa >> 16));
return fileIsSymbolicLink;
}
#pragma mark - Private tools for unreadable encodings
@implementation NSData (SSZipArchive)
// `base64EncodedStringWithOptions` uses a base64 alphabet with '+' and '/'.
// we got those alternatives to make it compatible with filenames: https://en.wikipedia.org/wiki/Base64
// * modified Base64 encoding for IMAP mailbox names (RFC 3501): uses '+' and ','
// * modified Base64 for URL and filenames (RFC 4648): uses '-' and '_'
- (NSString *)_base64RFC4648
{
NSString *strName = [self base64EncodedStringWithOptions:0];
strName = [strName stringByReplacingOccurrencesOfString:@"+" withString:@"-"];
strName = [strName stringByReplacingOccurrencesOfString:@"/" withString:@"_"];
return strName;
}
// initWithBytesNoCopy from NSProgrammer, Jan 25 '12: https://stackoverflow.com/a/9009321/1033581
// hexChars from Peter, Aug 19 '14: https://stackoverflow.com/a/25378464/1033581
// not implemented as too lengthy: a potential mapping improvement from Moose, Nov 3 '15: https://stackoverflow.com/a/33501154/1033581
- (NSString *)_hexString
{
const char *hexChars = "0123456789ABCDEF";
NSUInteger length = self.length;
const unsigned char *bytes = self.bytes;
char *chars = malloc(length * 2);
char *s = chars;
NSUInteger i = length;
while (i--) {
*s++ = hexChars[*bytes >> 4];
*s++ = hexChars[*bytes & 0xF];
bytes++;
}
NSString *str = [[NSString alloc] initWithBytesNoCopy:chars
length:length * 2
encoding:NSASCIIStringEncoding
freeWhenDone:YES];
return str;
}
@end

View File

@@ -14,6 +14,6 @@ FOUNDATION_EXPORT double ZipArchiveVersionNumber;
//! Project version string for ZipArchive.
FOUNDATION_EXPORT const unsigned char ZipArchiveVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <ZipArchive/PublicHeader.h>
// In this header, you should import all the public headers of your framework using statements like #import <ZipArchive/SSZipArchive.h>
#import "SSZipArchive.h"

View File

@@ -42,9 +42,13 @@ INLINE int has_aes_ni(void)
#elif defined( __GNUC__ )
#include <cpuid.h>
#if !defined(__clang__)
#pragma GCC target ("ssse3")
#pragma GCC target ("sse4.1")
#pragma GCC target ("aes")
#endif
#include <x86intrin.h>
#define INLINE static __inline

View File

@@ -30,7 +30,8 @@ Issue Date: 20/12/2007
#elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ )
# include <sys/endian.h>
#elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ )
defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ ) || \
defined(__pnacl__)
# include <machine/endian.h>
#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
# if !defined( __MINGW32__ ) && !defined( _AIX )

View File

@@ -36,7 +36,7 @@
*/
#include <memory.h>
#include <string.h>
#include "fileenc.h"

View File

@@ -24,7 +24,7 @@ This is an implementation of HMAC, the FIPS standard keyed hash function
#define _HMAC2_H
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#if defined(__cplusplus)
extern "C"

View File

@@ -38,7 +38,7 @@
its location in memory.
*/
#include <memory.h>
#include <string.h>
#include "prng.h"
#if defined(__cplusplus)

View File

@@ -21,7 +21,7 @@ This is an implementation of RFC2898, which specifies key derivation from
a password and a salt value.
*/
#include <memory.h>
#include <string.h>
#include "hmac.h"
#if defined(__cplusplus)

View File

@@ -1,158 +0,0 @@
/* crypt.c -- base code for traditional PKWARE encryption
Version 1.01e, February 12th, 2005
Copyright (C) 1998-2005 Gilles Vollant
Modifications for Info-ZIP crypting
Copyright (C) 2003 Terry Thorsen
This code is a modified version of crypting code in Info-ZIP distribution
Copyright (C) 1990-2000 Info-ZIP. All rights reserved.
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
This encryption code is a direct transcription of the algorithm from
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
file (appnote.txt) is distributed with the PKZIP program (even in the
version without encryption capabilities).
If you don't need crypting in your application, just define symbols
NOCRYPT and NOUNCRYPT.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#ifdef _WIN32
# include <windows.h>
# include <wincrypt.h>
#else
# include <sys/stat.h>
# include <fcntl.h>
# include <unistd.h>
#endif
#include "zlib.h"
#include "crypt.h"
/***************************************************************************/
#define CRC32(c, b) ((*(pcrc_32_tab+(((uint32_t)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
#ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
#endif
/***************************************************************************/
uint8_t decrypt_byte(uint32_t *pkeys)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
temp = ((uint32_t)(*(pkeys+2)) & 0xffff) | 2;
return (uint8_t)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
uint8_t update_keys(uint32_t *pkeys, const z_crc_t *pcrc_32_tab, int32_t c)
{
(*(pkeys+0)) = (uint32_t)CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
{
register int32_t keyshift = (int32_t)((*(pkeys + 1)) >> 24);
(*(pkeys+2)) = (uint32_t)CRC32((*(pkeys+2)), keyshift);
}
return c;
}
void init_keys(const char *passwd, uint32_t *pkeys, const z_crc_t *pcrc_32_tab)
{
*(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L;
*(pkeys+2) = 878082192L;
while (*passwd != 0)
{
update_keys(pkeys, pcrc_32_tab, *passwd);
passwd += 1;
}
}
/***************************************************************************/
int cryptrand(unsigned char *buf, unsigned int len)
{
static unsigned calls = 0;
int rlen = 0;
#ifdef _WIN32
HCRYPTPROV provider;
unsigned __int64 pentium_tsc[1];
int result = 0;
if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
{
result = CryptGenRandom(provider, len, buf);
CryptReleaseContext(provider, 0);
if (result)
return len;
}
for (rlen = 0; rlen < (int)len; ++rlen)
{
if (rlen % 8 == 0)
QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc);
buf[rlen] = ((unsigned char*)pentium_tsc)[rlen % 8];
}
#else
int frand = open("/dev/urandom", O_RDONLY);
if (frand != -1)
{
rlen = (int)read(frand, buf, len);
close(frand);
}
#endif
if (rlen < (int)len)
{
/* Ensure different random header each time */
if (++calls == 1)
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
while (rlen < (int)len)
buf[rlen++] = (rand() >> 7) & 0xff;
}
return rlen;
}
int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys,
const z_crc_t *pcrc_32_tab, uint8_t verify1, uint8_t verify2)
{
uint8_t n = 0; /* index in random header */
uint8_t header[RAND_HEAD_LEN-2]; /* random header */
uint16_t t = 0; /* temporary */
if (buf_size < RAND_HEAD_LEN)
return 0;
init_keys(passwd, pkeys, pcrc_32_tab);
/* First generate RAND_HEAD_LEN-2 random bytes. */
cryptrand(header, RAND_HEAD_LEN-2);
/* Encrypt random header (last two bytes is high word of crc) */
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
buf[n] = (uint8_t)zencode(pkeys, pcrc_32_tab, header[n], t);
buf[n++] = (uint8_t)zencode(pkeys, pcrc_32_tab, verify1, t);
buf[n++] = (uint8_t)zencode(pkeys, pcrc_32_tab, verify2, t);
return n;
}
/***************************************************************************/

View File

@@ -1,57 +0,0 @@
/* crypt.h -- base code for traditional PKWARE encryption
Version 1.01e, February 12th, 2005
Copyright (C) 1998-2005 Gilles Vollant
Modifications for Info-ZIP crypting
Copyright (C) 2003 Terry Thorsen
This code is a modified version of crypting code in Info-ZIP distribution
Copyright (C) 1990-2000 Info-ZIP. All rights reserved.
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MINICRYPT_H
#define _MINICRYPT_H
#ifdef __cplusplus
extern "C" {
#endif
#define RAND_HEAD_LEN 12
/***************************************************************************/
#define zdecode(pkeys,pcrc_32_tab,c) \
(update_keys(pkeys,pcrc_32_tab, c ^= decrypt_byte(pkeys)))
#define zencode(pkeys,pcrc_32_tab,c,t) \
(t = decrypt_byte(pkeys), update_keys(pkeys,pcrc_32_tab,c), t^(c))
/***************************************************************************/
/* Return the next byte in the pseudo-random sequence */
uint8_t decrypt_byte(uint32_t *pkeys);
/* Update the encryption keys with the next byte of plain text */
uint8_t update_keys(uint32_t *pkeys, const z_crc_t *pcrc_32_tab, int32_t c);
/* Initialize the encryption keys and the random header according to the given password. */
void init_keys(const char *passwd, uint32_t *pkeys, const z_crc_t *pcrc_32_tab);
/* Generate cryptographically secure random numbers */
int cryptrand(unsigned char *buf, unsigned int len);
/* Create encryption header */
int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys,
const z_crc_t *pcrc_32_tab, uint8_t verify1, uint8_t verify2);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,351 +0,0 @@
/* ioapi.c -- IO base function header for compress/uncompress .zip
part of the MiniZip project
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson
http://result42.com
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdlib.h>
#include <string.h>
#if defined unix || defined __APPLE__
#include <sys/types.h>
#include <unistd.h>
#endif
#include "ioapi.h"
#if defined(_WIN32)
# define snprintf _snprintf
#endif
voidpf call_zopen64(const zlib_filefunc64_32_def *pfilefunc, const void *filename, int mode)
{
if (pfilefunc->zfile_func64.zopen64_file != NULL)
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque, filename, mode);
return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque, (const char*)filename, mode);
}
voidpf call_zopendisk64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream, uint32_t number_disk, int mode)
{
if (pfilefunc->zfile_func64.zopendisk64_file != NULL)
return (*(pfilefunc->zfile_func64.zopendisk64_file)) (pfilefunc->zfile_func64.opaque, filestream, number_disk, mode);
return (*(pfilefunc->zopendisk32_file))(pfilefunc->zfile_func64.opaque, filestream, number_disk, mode);
}
long call_zseek64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream, uint64_t offset, int origin)
{
uint32_t offset_truncated = 0;
if (pfilefunc->zfile_func64.zseek64_file != NULL)
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
offset_truncated = (uint32_t)offset;
if (offset_truncated != offset)
return -1;
return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream, offset_truncated, origin);
}
uint64_t call_ztell64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream)
{
uint64_t position;
if (pfilefunc->zfile_func64.zseek64_file != NULL)
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque, filestream);
position = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque, filestream);
if ((position) == UINT32_MAX)
return (uint64_t)-1;
return position;
}
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def *p_filefunc64_32, const zlib_filefunc_def *p_filefunc32)
{
p_filefunc64_32->zfile_func64.zopen64_file = NULL;
p_filefunc64_32->zfile_func64.zopendisk64_file = NULL;
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
p_filefunc64_32->zopendisk32_file = p_filefunc32->zopendisk_file;
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
p_filefunc64_32->zfile_func64.ztell64_file = NULL;
p_filefunc64_32->zfile_func64.zseek64_file = NULL;
p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file;
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque;
p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file;
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
}
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char *filename, int mode);
static uint32_t ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uint32_t size);
static uint32_t ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void *buf, uint32_t size);
static uint64_t ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream);
static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, uint64_t offset, int origin);
static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream);
static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream);
typedef struct
{
FILE *file;
int filenameLength;
void *filename;
} FILE_IOPOSIX;
static voidpf file_build_ioposix(FILE *file, const char *filename)
{
FILE_IOPOSIX *ioposix = NULL;
if (file == NULL)
return NULL;
ioposix = (FILE_IOPOSIX*)malloc(sizeof(FILE_IOPOSIX));
ioposix->file = file;
ioposix->filenameLength = (int)strlen(filename) + 1;
ioposix->filename = (char*)malloc(ioposix->filenameLength * sizeof(char));
strncpy((char*)ioposix->filename, filename, ioposix->filenameLength);
return (voidpf)ioposix;
}
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char *filename, int mode)
{
FILE* file = NULL;
const char *mode_fopen = NULL;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
mode_fopen = "r+b";
else if (mode & ZLIB_FILEFUNC_MODE_CREATE)
mode_fopen = "wb";
if ((filename != NULL) && (mode_fopen != NULL))
{
file = fopen(filename, mode_fopen);
return file_build_ioposix(file, filename);
}
return file;
}
static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void *filename, int mode)
{
FILE* file = NULL;
const char *mode_fopen = NULL;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
mode_fopen = "r+b";
else if (mode & ZLIB_FILEFUNC_MODE_CREATE)
mode_fopen = "wb";
if ((filename != NULL) && (mode_fopen != NULL))
{
file = fopen64((const char*)filename, mode_fopen);
return file_build_ioposix(file, (const char*)filename);
}
return file;
}
static voidpf ZCALLBACK fopendisk64_file_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode)
{
FILE_IOPOSIX *ioposix = NULL;
char *diskFilename = NULL;
voidpf ret = NULL;
int i = 0;
if (stream == NULL)
return NULL;
ioposix = (FILE_IOPOSIX*)stream;
diskFilename = (char*)malloc(ioposix->filenameLength * sizeof(char));
strncpy(diskFilename, (const char*)ioposix->filename, ioposix->filenameLength);
for (i = ioposix->filenameLength - 1; i >= 0; i -= 1)
{
if (diskFilename[i] != '.')
continue;
snprintf(&diskFilename[i], ioposix->filenameLength - i, ".z%02u", number_disk + 1);
break;
}
if (i >= 0)
ret = fopen64_file_func(opaque, diskFilename, mode);
free(diskFilename);
return ret;
}
static voidpf ZCALLBACK fopendisk_file_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode)
{
FILE_IOPOSIX *ioposix = NULL;
char *diskFilename = NULL;
voidpf ret = NULL;
int i = 0;
if (stream == NULL)
return NULL;
ioposix = (FILE_IOPOSIX*)stream;
diskFilename = (char*)malloc(ioposix->filenameLength * sizeof(char));
strncpy(diskFilename, (const char*)ioposix->filename, ioposix->filenameLength);
for (i = ioposix->filenameLength - 1; i >= 0; i -= 1)
{
if (diskFilename[i] != '.')
continue;
snprintf(&diskFilename[i], ioposix->filenameLength - i, ".z%02u", number_disk + 1);
break;
}
if (i >= 0)
ret = fopen_file_func(opaque, diskFilename, mode);
free(diskFilename);
return ret;
}
static uint32_t ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uint32_t size)
{
FILE_IOPOSIX *ioposix = NULL;
uint32_t read = (uint32_t)-1;
if (stream == NULL)
return read;
ioposix = (FILE_IOPOSIX*)stream;
read = (uint32_t)fread(buf, 1, (size_t)size, ioposix->file);
return read;
}
static uint32_t ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void *buf, uint32_t size)
{
FILE_IOPOSIX *ioposix = NULL;
uint32_t written = (uint32_t)-1;
if (stream == NULL)
return written;
ioposix = (FILE_IOPOSIX*)stream;
written = (uint32_t)fwrite(buf, 1, (size_t)size, ioposix->file);
return written;
}
static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream)
{
FILE_IOPOSIX *ioposix = NULL;
long ret = -1;
if (stream == NULL)
return ret;
ioposix = (FILE_IOPOSIX*)stream;
ret = ftell(ioposix->file);
return ret;
}
static uint64_t ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream)
{
FILE_IOPOSIX *ioposix = NULL;
uint64_t ret = (uint64_t)-1;
if (stream == NULL)
return ret;
ioposix = (FILE_IOPOSIX*)stream;
ret = ftello64(ioposix->file);
return ret;
}
static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uint32_t offset, int origin)
{
FILE_IOPOSIX *ioposix = NULL;
int fseek_origin = 0;
long ret = 0;
if (stream == NULL)
return -1;
ioposix = (FILE_IOPOSIX*)stream;
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR:
fseek_origin = SEEK_CUR;
break;
case ZLIB_FILEFUNC_SEEK_END:
fseek_origin = SEEK_END;
break;
case ZLIB_FILEFUNC_SEEK_SET:
fseek_origin = SEEK_SET;
break;
default:
return -1;
}
if (fseek(ioposix->file, offset, fseek_origin) != 0)
ret = -1;
return ret;
}
static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, uint64_t offset, int origin)
{
FILE_IOPOSIX *ioposix = NULL;
int fseek_origin = 0;
long ret = 0;
if (stream == NULL)
return -1;
ioposix = (FILE_IOPOSIX*)stream;
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR:
fseek_origin = SEEK_CUR;
break;
case ZLIB_FILEFUNC_SEEK_END:
fseek_origin = SEEK_END;
break;
case ZLIB_FILEFUNC_SEEK_SET:
fseek_origin = SEEK_SET;
break;
default:
return -1;
}
if (fseeko64(ioposix->file, offset, fseek_origin) != 0)
ret = -1;
return ret;
}
static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream)
{
FILE_IOPOSIX *ioposix = NULL;
int ret = -1;
if (stream == NULL)
return ret;
ioposix = (FILE_IOPOSIX*)stream;
if (ioposix->filename != NULL)
free(ioposix->filename);
ret = fclose(ioposix->file);
free(ioposix);
return ret;
}
static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream)
{
FILE_IOPOSIX *ioposix = NULL;
int ret = -1;
if (stream == NULL)
return ret;
ioposix = (FILE_IOPOSIX*)stream;
ret = ferror(ioposix->file);
return ret;
}
void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zopendisk_file = fopendisk_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
pzlib_filefunc_def->ztell_file = ftell_file_func;
pzlib_filefunc_def->zseek_file = fseek_file_func;
pzlib_filefunc_def->zclose_file = fclose_file_func;
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}
void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
pzlib_filefunc_def->zopendisk64_file = fopendisk64_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
pzlib_filefunc_def->ztell64_file = ftell64_file_func;
pzlib_filefunc_def->zseek64_file = fseek64_file_func;
pzlib_filefunc_def->zclose_file = fclose_file_func;
pzlib_filefunc_def->zerror_file = ferror_file_func;
pzlib_filefunc_def->opaque = NULL;
}

View File

@@ -1,146 +0,0 @@
/* ioapi.h -- IO base function header for compress/uncompress .zip
part of the MiniZip project
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson
http://result42.com
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _ZLIBIOAPI64_H
#define _ZLIBIOAPI64_H
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "zlib.h"
#if defined(USE_FILE32API)
# define fopen64 fopen
# define ftello64 ftell
# define fseeko64 fseek
#else
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__APPLE__)
# define fopen64 fopen
# define ftello64 ftello
# define fseeko64 fseeko
# endif
# ifdef _MSC_VER
# define fopen64 fopen
# if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
# define ftello64 _ftelli64
# define fseeko64 _fseeki64
# else /* old MSC */
# define ftello64 ftell
# define fseeko64 fseek
# endif
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define ZLIB_FILEFUNC_SEEK_CUR (1)
#define ZLIB_FILEFUNC_SEEK_END (2)
#define ZLIB_FILEFUNC_SEEK_SET (0)
#define ZLIB_FILEFUNC_MODE_READ (1)
#define ZLIB_FILEFUNC_MODE_WRITE (2)
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
#define ZLIB_FILEFUNC_MODE_CREATE (8)
#ifndef ZCALLBACK
# if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || \
defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
# define ZCALLBACK CALLBACK
# else
# define ZCALLBACK
# endif
#endif
typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char *filename, int mode);
typedef voidpf (ZCALLBACK *opendisk_file_func) (voidpf opaque, voidpf stream, uint32_t number_disk, int mode);
typedef uint32_t (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uint32_t size);
typedef uint32_t (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void *buf, uint32_t size);
typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
typedef int (ZCALLBACK *error_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uint32_t offset, int origin);
/* here is the "old" 32 bits structure structure */
typedef struct zlib_filefunc_def_s
{
open_file_func zopen_file;
opendisk_file_func zopendisk_file;
read_file_func zread_file;
write_file_func zwrite_file;
tell_file_func ztell_file;
seek_file_func zseek_file;
close_file_func zclose_file;
error_file_func zerror_file;
voidpf opaque;
} zlib_filefunc_def;
typedef uint64_t (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, uint64_t offset, int origin);
typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void *filename, int mode);
typedef voidpf (ZCALLBACK *opendisk64_file_func)(voidpf opaque, voidpf stream, uint32_t number_disk, int mode);
typedef struct zlib_filefunc64_def_s
{
open64_file_func zopen64_file;
opendisk64_file_func zopendisk64_file;
read_file_func zread_file;
write_file_func zwrite_file;
tell64_file_func ztell64_file;
seek64_file_func zseek64_file;
close_file_func zclose_file;
error_file_func zerror_file;
voidpf opaque;
} zlib_filefunc64_def;
void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def);
void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def);
/* now internal definition, only for zip.c and unzip.h */
typedef struct zlib_filefunc64_32_def_s
{
zlib_filefunc64_def zfile_func64;
open_file_func zopen32_file;
opendisk_file_func zopendisk32_file;
tell_file_func ztell32_file;
seek_file_func zseek32_file;
} zlib_filefunc64_32_def;
#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
/*#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))*/
/*#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))*/
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
voidpf call_zopen64(const zlib_filefunc64_32_def *pfilefunc,const void*filename, int mode);
voidpf call_zopendisk64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream, uint32_t number_disk, int mode);
long call_zseek64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream, uint64_t offset, int origin);
uint64_t call_ztell64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream);
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def *p_filefunc64_32, const zlib_filefunc_def *p_filefunc32);
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
#define ZOPENDISK64(filefunc,filestream,diskn,mode) (call_zopendisk64((&(filefunc)),(filestream),(diskn),(mode)))
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))
#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode)))
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,461 +0,0 @@
/* ioapi_buf.c -- IO base function header for compress/uncompress .zip
files using zlib + zip or unzip API
This version of ioapi is designed to buffer IO.
Copyright (C) 1998-2003 Gilles Vollant
(C) 2012-2014 Nathan Moinvaziri
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "zlib.h"
#include "ioapi.h"
#include "ioapi_buf.h"
#ifndef IOBUF_BUFFERSIZE
# define IOBUF_BUFFERSIZE (UINT16_MAX)
#endif
#if defined(_WIN32)
# include <conio.h>
# define PRINTF _cprintf
# define VPRINTF _vcprintf
#else
# define PRINTF printf
# define VPRINTF vprintf
#endif
//#define IOBUF_VERBOSE
#ifdef __GNUC__
#ifndef max
#define max(x,y) ({ \
const typeof(x) _x = (x); \
const typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x > _y ? _x : _y; })
#endif /* __GNUC__ */
#ifndef min
#define min(x,y) ({ \
const typeof(x) _x = (x); \
const typeof(y) _y = (y); \
(void) (&_x == &_y); \
_x < _y ? _x : _y; })
#endif
#endif
typedef struct ourstream_s {
char readbuf[IOBUF_BUFFERSIZE];
uint32_t readbuf_len;
uint32_t readbuf_pos;
uint32_t readbuf_hits;
uint32_t readbuf_misses;
char writebuf[IOBUF_BUFFERSIZE];
uint32_t writebuf_len;
uint32_t writebuf_pos;
uint32_t writebuf_hits;
uint32_t writebuf_misses;
uint64_t position;
voidpf stream;
} ourstream_t;
#if defined(IOBUF_VERBOSE)
# define print_buf(o,s,f,...) print_buf_internal(o,s,f,__VA_ARGS__);
#else
# define print_buf(o,s,f,...)
#endif
void print_buf_internal(voidpf opaque, voidpf stream, char *format, ...)
{
ourstream_t *streamio = (ourstream_t *)stream;
va_list arglist;
PRINTF("Buf stream %p - ", streamio);
va_start(arglist, format);
VPRINTF(format, arglist);
va_end(arglist);
}
voidpf fopen_buf_internal_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode)
{
ourstream_t *streamio = NULL;
if (stream == NULL)
return NULL;
streamio = (ourstream_t *)malloc(sizeof(ourstream_t));
if (streamio == NULL)
return NULL;
memset(streamio, 0, sizeof(ourstream_t));
streamio->stream = stream;
print_buf(opaque, streamio, "open [num %d mode %d]\n", number_disk, mode);
return streamio;
}
voidpf ZCALLBACK fopen_buf_func(voidpf opaque, const char *filename, int mode)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
voidpf stream = bufio->filefunc.zopen_file(bufio->filefunc.opaque, filename, mode);
return fopen_buf_internal_func(opaque, stream, 0, mode);
}
voidpf ZCALLBACK fopen64_buf_func(voidpf opaque, const void *filename, int mode)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
voidpf stream = bufio->filefunc64.zopen64_file(bufio->filefunc64.opaque, filename, mode);
return fopen_buf_internal_func(opaque, stream, 0, mode);
}
voidpf ZCALLBACK fopendisk_buf_func(voidpf opaque, voidpf stream_cd, uint32_t number_disk, int mode)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream_cd;
voidpf *stream = bufio->filefunc.zopendisk_file(bufio->filefunc.opaque, streamio->stream, number_disk, mode);
return fopen_buf_internal_func(opaque, stream, number_disk, mode);
}
voidpf ZCALLBACK fopendisk64_buf_func(voidpf opaque, voidpf stream_cd, uint32_t number_disk, int mode)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream_cd;
voidpf stream = bufio->filefunc64.zopendisk64_file(bufio->filefunc64.opaque, streamio->stream, number_disk, mode);
return fopen_buf_internal_func(opaque, stream, number_disk, mode);
}
long fflush_buf(voidpf opaque, voidpf stream)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
uint32_t total_bytes_to_write = 0;
uint32_t bytes_to_write = streamio->writebuf_len;
uint32_t bytes_left_to_write = streamio->writebuf_len;
long bytes_written = 0;
while (bytes_left_to_write > 0)
{
if (bufio->filefunc64.zwrite_file != NULL)
bytes_written = bufio->filefunc64.zwrite_file(bufio->filefunc64.opaque, streamio->stream, streamio->writebuf + (bytes_to_write - bytes_left_to_write), bytes_left_to_write);
else
bytes_written = bufio->filefunc.zwrite_file(bufio->filefunc.opaque, streamio->stream, streamio->writebuf + (bytes_to_write - bytes_left_to_write), bytes_left_to_write);
streamio->writebuf_misses += 1;
print_buf(opaque, stream, "write flush [%d:%d len %d]\n", bytes_to_write, bytes_left_to_write, streamio->writebuf_len);
if (bytes_written < 0)
return bytes_written;
total_bytes_to_write += bytes_written;
bytes_left_to_write -= bytes_written;
streamio->position += bytes_written;
}
streamio->writebuf_len = 0;
streamio->writebuf_pos = 0;
return total_bytes_to_write;
}
uint32_t ZCALLBACK fread_buf_func(voidpf opaque, voidpf stream, void *buf, uint32_t size)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
uint32_t buf_len = 0;
uint32_t bytes_to_read = 0;
uint32_t bytes_to_copy = 0;
uint32_t bytes_left_to_read = size;
uint32_t bytes_read = 0;
print_buf(opaque, stream, "read [size %ld pos %lld]\n", size, streamio->position);
if (streamio->writebuf_len > 0)
{
print_buf(opaque, stream, "switch from write to read, not yet supported [%lld]\n", streamio->position);
}
while (bytes_left_to_read > 0)
{
if ((streamio->readbuf_len == 0) || (streamio->readbuf_pos == streamio->readbuf_len))
{
if (streamio->readbuf_len == IOBUF_BUFFERSIZE)
{
streamio->readbuf_pos = 0;
streamio->readbuf_len = 0;
}
bytes_to_read = IOBUF_BUFFERSIZE - (streamio->readbuf_len - streamio->readbuf_pos);
if (bufio->filefunc64.zread_file != NULL)
bytes_read = bufio->filefunc64.zread_file(bufio->filefunc64.opaque, streamio->stream, streamio->readbuf + streamio->readbuf_pos, bytes_to_read);
else
bytes_read = bufio->filefunc.zread_file(bufio->filefunc.opaque, streamio->stream, streamio->readbuf + streamio->readbuf_pos, bytes_to_read);
streamio->readbuf_misses += 1;
streamio->readbuf_len += bytes_read;
streamio->position += bytes_read;
print_buf(opaque, stream, "filled [read %d/%d buf %d:%d pos %lld]\n", bytes_read, bytes_to_read, streamio->readbuf_pos, streamio->readbuf_len, streamio->position);
if (bytes_read == 0)
break;
}
if ((streamio->readbuf_len - streamio->readbuf_pos) > 0)
{
bytes_to_copy = min(bytes_left_to_read, (uint32_t)(streamio->readbuf_len - streamio->readbuf_pos));
memcpy((char *)buf + buf_len, streamio->readbuf + streamio->readbuf_pos, bytes_to_copy);
buf_len += bytes_to_copy;
bytes_left_to_read -= bytes_to_copy;
streamio->readbuf_hits += 1;
streamio->readbuf_pos += bytes_to_copy;
print_buf(opaque, stream, "emptied [copied %d remaining %d buf %d:%d pos %lld]\n", bytes_to_copy, bytes_left_to_read, streamio->readbuf_pos, streamio->readbuf_len, streamio->position);
}
}
return size - bytes_left_to_read;
}
uint32_t ZCALLBACK fwrite_buf_func(voidpf opaque, voidpf stream, const void *buf, uint32_t size)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
uint32_t bytes_to_write = size;
uint32_t bytes_left_to_write = size;
uint32_t bytes_to_copy = 0;
int64_t ret = 0;
print_buf(opaque, stream, "write [size %ld len %d pos %lld]\n", size, streamio->writebuf_len, streamio->position);
if (streamio->readbuf_len > 0)
{
streamio->position -= streamio->readbuf_len;
streamio->position += streamio->readbuf_pos;
streamio->readbuf_len = 0;
streamio->readbuf_pos = 0;
print_buf(opaque, stream, "switch from read to write [%lld]\n", streamio->position);
if (bufio->filefunc64.zseek64_file != NULL)
ret = bufio->filefunc64.zseek64_file(bufio->filefunc64.opaque, streamio->stream, streamio->position, ZLIB_FILEFUNC_SEEK_SET);
else
ret = bufio->filefunc.zseek_file(bufio->filefunc.opaque, streamio->stream, (uint32_t)streamio->position, ZLIB_FILEFUNC_SEEK_SET);
if (ret != 0)
return (uint32_t)-1;
}
while (bytes_left_to_write > 0)
{
bytes_to_copy = min(bytes_left_to_write, (uint32_t)(IOBUF_BUFFERSIZE - min(streamio->writebuf_len, streamio->writebuf_pos)));
if (bytes_to_copy == 0)
{
if (fflush_buf(opaque, stream) <= 0)
return 0;
continue;
}
memcpy(streamio->writebuf + streamio->writebuf_pos, (char *)buf + (bytes_to_write - bytes_left_to_write), bytes_to_copy);
print_buf(opaque, stream, "write copy [remaining %d write %d:%d len %d]\n", bytes_to_copy, bytes_to_write, bytes_left_to_write, streamio->writebuf_len);
bytes_left_to_write -= bytes_to_copy;
streamio->writebuf_pos += bytes_to_copy;
streamio->writebuf_hits += 1;
if (streamio->writebuf_pos > streamio->writebuf_len)
streamio->writebuf_len += streamio->writebuf_pos - streamio->writebuf_len;
}
return size - bytes_left_to_write;
}
uint64_t ftell_buf_internal_func(voidpf opaque, voidpf stream, uint64_t position)
{
ourstream_t *streamio = (ourstream_t *)stream;
streamio->position = position;
print_buf(opaque, stream, "tell [pos %llu readpos %d writepos %d err %d]\n", streamio->position, streamio->readbuf_pos, streamio->writebuf_pos, errno);
if (streamio->readbuf_len > 0)
position -= (streamio->readbuf_len - streamio->readbuf_pos);
if (streamio->writebuf_len > 0)
position += streamio->writebuf_pos;
return position;
}
long ZCALLBACK ftell_buf_func(voidpf opaque, voidpf stream)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
uint64_t position = bufio->filefunc.ztell_file(bufio->filefunc.opaque, streamio->stream);
return (long)ftell_buf_internal_func(opaque, stream, position);
}
uint64_t ZCALLBACK ftell64_buf_func(voidpf opaque, voidpf stream)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
uint64_t position = bufio->filefunc64.ztell64_file(bufio->filefunc64.opaque, streamio->stream);
return ftell_buf_internal_func(opaque, stream, position);
}
int fseek_buf_internal_func(voidpf opaque, voidpf stream, uint64_t offset, int origin)
{
ourstream_t *streamio = (ourstream_t *)stream;
print_buf(opaque, stream, "seek [origin %d offset %llu pos %lld]\n", origin, offset, streamio->position);
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_SET:
if (streamio->writebuf_len > 0)
{
if ((offset >= streamio->position) && (offset <= streamio->position + streamio->writebuf_len))
{
streamio->writebuf_pos = (uint32_t)(offset - streamio->position);
return 0;
}
}
if ((streamio->readbuf_len > 0) && (offset < streamio->position) && (offset >= streamio->position - streamio->readbuf_len))
{
streamio->readbuf_pos = (uint32_t)(offset - (streamio->position - streamio->readbuf_len));
return 0;
}
if (fflush_buf(opaque, stream) < 0)
return -1;
streamio->position = offset;
break;
case ZLIB_FILEFUNC_SEEK_CUR:
if (streamio->readbuf_len > 0)
{
if (offset <= (streamio->readbuf_len - streamio->readbuf_pos))
{
streamio->readbuf_pos += (uint32_t)offset;
return 0;
}
offset -= (streamio->readbuf_len - streamio->readbuf_pos);
streamio->position += offset;
}
if (streamio->writebuf_len > 0)
{
if (offset <= (streamio->writebuf_len - streamio->writebuf_pos))
{
streamio->writebuf_pos += (uint32_t)offset;
return 0;
}
//offset -= (streamio->writebuf_len - streamio->writebuf_pos);
}
if (fflush_buf(opaque, stream) < 0)
return -1;
break;
case ZLIB_FILEFUNC_SEEK_END:
if (streamio->writebuf_len > 0)
{
streamio->writebuf_pos = streamio->writebuf_len;
return 0;
}
break;
}
streamio->readbuf_len = 0;
streamio->readbuf_pos = 0;
streamio->writebuf_len = 0;
streamio->writebuf_pos = 0;
return 1;
}
long ZCALLBACK fseek_buf_func(voidpf opaque, voidpf stream, uint32_t offset, int origin)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
long ret = -1;
if (bufio->filefunc.zseek_file == NULL)
return ret;
ret = fseek_buf_internal_func(opaque, stream, offset, origin);
if (ret == 1)
ret = bufio->filefunc.zseek_file(bufio->filefunc.opaque, streamio->stream, offset, origin);
return ret;
}
long ZCALLBACK fseek64_buf_func(voidpf opaque, voidpf stream, uint64_t offset, int origin)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
long ret = -1;
if (bufio->filefunc64.zseek64_file == NULL)
return ret;
ret = fseek_buf_internal_func(opaque, stream, offset, origin);
if (ret == 1)
ret = bufio->filefunc64.zseek64_file(bufio->filefunc64.opaque, streamio->stream, offset, origin);
return ret;
}
int ZCALLBACK fclose_buf_func(voidpf opaque, voidpf stream)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
int ret = 0;
fflush_buf(opaque, stream);
print_buf(opaque, stream, "close\n");
if (streamio->readbuf_hits + streamio->readbuf_misses > 0)
print_buf(opaque, stream, "read efficency %.02f%%\n", (streamio->readbuf_hits / ((float)streamio->readbuf_hits + streamio->readbuf_misses)) * 100);
if (streamio->writebuf_hits + streamio->writebuf_misses > 0)
print_buf(opaque, stream, "write efficency %.02f%%\n", (streamio->writebuf_hits / ((float)streamio->writebuf_hits + streamio->writebuf_misses)) * 100);
if (bufio->filefunc64.zclose_file != NULL)
ret = bufio->filefunc64.zclose_file(bufio->filefunc64.opaque, streamio->stream);
else
ret = bufio->filefunc.zclose_file(bufio->filefunc.opaque, streamio->stream);
free(streamio);
return ret;
}
int ZCALLBACK ferror_buf_func(voidpf opaque, voidpf stream)
{
ourbuffer_t *bufio = (ourbuffer_t *)opaque;
ourstream_t *streamio = (ourstream_t *)stream;
if (bufio->filefunc64.zerror_file != NULL)
return bufio->filefunc64.zerror_file(bufio->filefunc64.opaque, streamio->stream);
return bufio->filefunc.zerror_file(bufio->filefunc.opaque, streamio->stream);
}
void fill_buffer_filefunc(zlib_filefunc_def *pzlib_filefunc_def, ourbuffer_t *ourbuf)
{
pzlib_filefunc_def->zopen_file = fopen_buf_func;
pzlib_filefunc_def->zopendisk_file = fopendisk_buf_func;
pzlib_filefunc_def->zread_file = fread_buf_func;
pzlib_filefunc_def->zwrite_file = fwrite_buf_func;
pzlib_filefunc_def->ztell_file = ftell_buf_func;
pzlib_filefunc_def->zseek_file = fseek_buf_func;
pzlib_filefunc_def->zclose_file = fclose_buf_func;
pzlib_filefunc_def->zerror_file = ferror_buf_func;
pzlib_filefunc_def->opaque = ourbuf;
}
void fill_buffer_filefunc64(zlib_filefunc64_def *pzlib_filefunc_def, ourbuffer_t *ourbuf)
{
pzlib_filefunc_def->zopen64_file = fopen64_buf_func;
pzlib_filefunc_def->zopendisk64_file = fopendisk64_buf_func;
pzlib_filefunc_def->zread_file = fread_buf_func;
pzlib_filefunc_def->zwrite_file = fwrite_buf_func;
pzlib_filefunc_def->ztell64_file = ftell64_buf_func;
pzlib_filefunc_def->zseek64_file = fseek64_buf_func;
pzlib_filefunc_def->zclose_file = fclose_buf_func;
pzlib_filefunc_def->zerror_file = ferror_buf_func;
pzlib_filefunc_def->opaque = ourbuf;
}

View File

@@ -1,52 +0,0 @@
/* ioapi_buf.h -- IO base function header for compress/uncompress .zip
files using zlib + zip or unzip API
This version of ioapi is designed to buffer IO.
Copyright (C) 1998-2003 Gilles Vollant
(C) 2012-2014 Nathan Moinvaziri
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _IOAPI_BUF_H
#define _IOAPI_BUF_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "ioapi.h"
#ifdef __cplusplus
extern "C" {
#endif
voidpf ZCALLBACK fopen_buf_func(voidpf opaque, const char* filename, int mode);
voidpf ZCALLBACK fopen64_buf_func(voidpf opaque, const void* filename, int mode);
voidpf ZCALLBACK fopendisk_buf_func(voidpf opaque, voidpf stream_cd, uint32_t number_disk, int mode);
voidpf ZCALLBACK fopendisk64_buf_func(voidpf opaque, voidpf stream_cd, uint32_t number_disk, int mode);
uint32_t ZCALLBACK fread_buf_func(voidpf opaque, voidpf stream, void* buf, uint32_t size);
uint32_t ZCALLBACK fwrite_buf_func(voidpf opaque, voidpf stream, const void* buf, uint32_t size);
long ZCALLBACK ftell_buf_func(voidpf opaque, voidpf stream);
uint64_t ZCALLBACK ftell64_buf_func(voidpf opaque, voidpf stream);
long ZCALLBACK fseek_buf_func(voidpf opaque, voidpf stream, uint32_t offset, int origin);
long ZCALLBACK fseek64_buf_func(voidpf opaque, voidpf stream, uint64_t offset, int origin);
int ZCALLBACK fclose_buf_func(voidpf opaque,voidpf stream);
int ZCALLBACK ferror_buf_func(voidpf opaque,voidpf stream);
typedef struct ourbuffer_s {
zlib_filefunc_def filefunc;
zlib_filefunc64_def filefunc64;
} ourbuffer_t;
void fill_buffer_filefunc(zlib_filefunc_def* pzlib_filefunc_def, ourbuffer_t *ourbuf);
void fill_buffer_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def, ourbuffer_t *ourbuf);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,164 +0,0 @@
/* ioapi_mem.c -- IO base function header for compress/uncompress .zip
files using zlib + zip or unzip API
This version of ioapi is designed to access memory rather than files.
We do use a region of memory to put data in to and take it out of. We do
not have auto-extending buffers and do not inform anyone else that the
data has been written. It is really intended for accessing a zip archive
embedded in an application such that I can write an installer with no
external files. Creation of archives has not been attempted, although
parts of the framework are present.
Based on Unzip ioapi.c version 0.22, May 19th, 2003
Copyright (C) 1998-2003 Gilles Vollant
(C) 2003 Justin Fletcher
This file is under the same license as the Unzip tool it is distributed
with.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "ioapi.h"
#include "ioapi_mem.h"
#ifndef IOMEM_BUFFERSIZE
# define IOMEM_BUFFERSIZE (UINT16_MAX)
#endif
voidpf ZCALLBACK fopen_mem_func(voidpf opaque, const char *filename, int mode)
{
ourmemory_t *mem = (ourmemory_t *)opaque;
if (mem == NULL)
return NULL; /* Mem structure passed in was null */
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
{
if (mem->grow)
{
mem->size = IOMEM_BUFFERSIZE;
mem->base = (char *)malloc(mem->size);
}
mem->limit = 0; /* When writing we start with 0 bytes written */
}
else
mem->limit = mem->size;
mem->cur_offset = 0;
return mem;
}
voidpf ZCALLBACK fopendisk_mem_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode)
{
/* Not used */
return NULL;
}
uint32_t ZCALLBACK fread_mem_func(voidpf opaque, voidpf stream, void *buf, uint32_t size)
{
ourmemory_t *mem = (ourmemory_t *)stream;
if (size > mem->size - mem->cur_offset)
size = mem->size - mem->cur_offset;
memcpy(buf, mem->base + mem->cur_offset, size);
mem->cur_offset += size;
return size;
}
uint32_t ZCALLBACK fwrite_mem_func(voidpf opaque, voidpf stream, const void *buf, uint32_t size)
{
ourmemory_t *mem = (ourmemory_t *)stream;
uint32_t newmemsize = 0;
char *newbase = NULL;
if (size > mem->size - mem->cur_offset)
{
if (mem->grow)
{
newmemsize = mem->size;
if (size < IOMEM_BUFFERSIZE)
newmemsize += IOMEM_BUFFERSIZE;
else
newmemsize += size;
newbase = (char *)malloc(newmemsize);
memcpy(newbase, mem->base, mem->size);
free(mem->base);
mem->base = newbase;
mem->size = newmemsize;
}
else
size = mem->size - mem->cur_offset;
}
memcpy(mem->base + mem->cur_offset, buf, size);
mem->cur_offset += size;
if (mem->cur_offset > mem->limit)
mem->limit = mem->cur_offset;
return size;
}
long ZCALLBACK ftell_mem_func(voidpf opaque, voidpf stream)
{
ourmemory_t *mem = (ourmemory_t *)stream;
return mem->cur_offset;
}
long ZCALLBACK fseek_mem_func(voidpf opaque, voidpf stream, uint32_t offset, int origin)
{
ourmemory_t *mem = (ourmemory_t *)stream;
uint32_t new_pos = 0;
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR:
new_pos = mem->cur_offset + offset;
break;
case ZLIB_FILEFUNC_SEEK_END:
new_pos = mem->limit + offset;
break;
case ZLIB_FILEFUNC_SEEK_SET:
new_pos = offset;
break;
default:
return -1;
}
if (new_pos > mem->size)
return 1; /* Failed to seek that far */
mem->cur_offset = new_pos;
return 0;
}
int ZCALLBACK fclose_mem_func(voidpf opaque, voidpf stream)
{
/* Even with grow = 1, caller must always free() memory */
return 0;
}
int ZCALLBACK ferror_mem_func(voidpf opaque, voidpf stream)
{
/* We never return errors */
return 0;
}
void fill_memory_filefunc(zlib_filefunc_def *pzlib_filefunc_def, ourmemory_t *ourmem)
{
pzlib_filefunc_def->zopen_file = fopen_mem_func;
pzlib_filefunc_def->zopendisk_file = fopendisk_mem_func;
pzlib_filefunc_def->zread_file = fread_mem_func;
pzlib_filefunc_def->zwrite_file = fwrite_mem_func;
pzlib_filefunc_def->ztell_file = ftell_mem_func;
pzlib_filefunc_def->zseek_file = fseek_mem_func;
pzlib_filefunc_def->zclose_file = fclose_mem_func;
pzlib_filefunc_def->zerror_file = ferror_mem_func;
pzlib_filefunc_def->opaque = ourmem;
}

View File

@@ -1,51 +0,0 @@
/* ioapi_mem.h -- IO base function header for compress/uncompress .zip
files using zlib + zip or unzip API
This version of ioapi is designed to access memory rather than files.
We do use a region of memory to put data in to and take it out of.
Copyright (C) 1998-2003 Gilles Vollant
(C) 2003 Justin Fletcher
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _IOAPI_MEM_H
#define _IOAPI_MEM_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "ioapi.h"
#ifdef __cplusplus
extern "C" {
#endif
voidpf ZCALLBACK fopen_mem_func(voidpf opaque, const char* filename, int mode);
voidpf ZCALLBACK fopendisk_mem_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode);
uint32_t ZCALLBACK fread_mem_func(voidpf opaque, voidpf stream, void* buf, uint32_t size);
uint32_t ZCALLBACK fwrite_mem_func(voidpf opaque, voidpf stream, const void* buf, uint32_t size);
long ZCALLBACK ftell_mem_func(voidpf opaque, voidpf stream);
long ZCALLBACK fseek_mem_func(voidpf opaque, voidpf stream, uint32_t offset, int origin);
int ZCALLBACK fclose_mem_func(voidpf opaque, voidpf stream);
int ZCALLBACK ferror_mem_func(voidpf opaque, voidpf stream);
typedef struct ourmemory_s {
char *base; /* Base of the region of memory we're using */
uint32_t size; /* Size of the region of memory we're using */
uint32_t limit; /* Furthest we've written */
uint32_t cur_offset; /* Current offset in the area */
int grow; /* Growable memory buffer */
} ourmemory_t;
void fill_memory_filefunc(zlib_filefunc_def* pzlib_filefunc_def, ourmemory_t *ourmem);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,264 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include "zlib.h"
#include "ioapi.h"
#ifdef _WIN32
# include <direct.h>
# include <io.h>
#else
# include <unistd.h>
# include <utime.h>
# include <sys/types.h>
# include <sys/stat.h>
#endif
#include "minishared.h"
#ifdef _WIN32
# define USEWIN32IOAPI
# include "iowin32.h"
#endif
uint32_t get_file_date(const char *path, uint32_t *dos_date)
{
int ret = 0;
#ifdef _WIN32
FILETIME ftm_local;
HANDLE find = NULL;
WIN32_FIND_DATAA ff32;
find = FindFirstFileA(path, &ff32);
if (find != INVALID_HANDLE_VALUE)
{
FileTimeToLocalFileTime(&(ff32.ftLastWriteTime), &ftm_local);
FileTimeToDosDateTime(&ftm_local, ((LPWORD)dos_date) + 1, ((LPWORD)dos_date) + 0);
FindClose(find);
ret = 1;
}
#else
struct stat s = { 0 };
struct tm *filedate = NULL;
time_t tm_t = 0;
if (strcmp(path, "-") != 0)
{
size_t len = strlen(path);
char *name = (char *)malloc(len + 1);
strncpy(name, path, len + 1);
name[len] = 0;
if (name[len - 1] == '/')
name[len - 1] = 0;
/* not all systems allow stat'ing a file with / appended */
if (stat(name, &s) == 0)
{
tm_t = s.st_mtime;
ret = 1;
}
free(name);
}
filedate = localtime(&tm_t);
*dos_date = tm_to_dosdate(filedate);
#endif
return ret;
}
void change_file_date(const char *path, uint32_t dos_date)
{
#ifdef _WIN32
HANDLE handle = NULL;
FILETIME ftm, ftm_local, ftm_create, ftm_access, ftm_modified;
handle = CreateFileA(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (handle != INVALID_HANDLE_VALUE)
{
GetFileTime(handle, &ftm_create, &ftm_access, &ftm_modified);
DosDateTimeToFileTime((WORD)(dos_date >> 16), (WORD)dos_date, &ftm_local);
LocalFileTimeToFileTime(&ftm_local, &ftm);
SetFileTime(handle, &ftm, &ftm_access, &ftm);
CloseHandle(handle);
}
#else
struct utimbuf ut;
struct tm newdate;
dosdate_to_tm(dos_date, &newdate);
ut.actime = ut.modtime = mktime(&newdate);
utime(path, &ut);
#endif
}
int dosdate_to_tm(uint64_t dos_date, struct tm *ptm)
{
uint64_t date = (uint64_t)(dos_date >> 16);
ptm->tm_mday = (uint16_t)(date & 0x1f);
ptm->tm_mon = (uint16_t)(((date & 0x1E0) / 0x20) - 1);
ptm->tm_year = (uint16_t)(((date & 0x0FE00) / 0x0200) + 1980);
ptm->tm_hour = (uint16_t)((dos_date & 0xF800) / 0x800);
ptm->tm_min = (uint16_t)((dos_date & 0x7E0) / 0x20);
ptm->tm_sec = (uint16_t)(2 * (dos_date & 0x1f));
ptm->tm_isdst = -1;
#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
if (!datevalue_in_range(0, 11, ptm->tm_mon) ||
!datevalue_in_range(1, 31, ptm->tm_mday) ||
!datevalue_in_range(0, 23, ptm->tm_hour) ||
!datevalue_in_range(0, 59, ptm->tm_min) ||
!datevalue_in_range(0, 59, ptm->tm_sec))
{
/* Invalid date stored, so don't return it. */
memset(ptm, 0, sizeof(struct tm));
return -1;
}
#undef datevalue_in_range
return 0;
}
uint32_t tm_to_dosdate(const struct tm *ptm)
{
uint32_t year = 0;
#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
/* Years supported:
* [00, 79] (assumed to be between 2000 and 2079)
* [80, 207] (assumed to be between 1980 and 2107, typical output of old
software that does 'year-1900' to get a double digit year)
* [1980, 2107]
Due to the date format limitations, only years between 1980 and 2107 can be stored.
*/
if (!(datevalue_in_range(1980, 2107, ptm->tm_year) || datevalue_in_range(0, 207, ptm->tm_year)) ||
!datevalue_in_range(0, 11, ptm->tm_mon) ||
!datevalue_in_range(1, 31, ptm->tm_mday) ||
!datevalue_in_range(0, 23, ptm->tm_hour) ||
!datevalue_in_range(0, 59, ptm->tm_min) ||
!datevalue_in_range(0, 59, ptm->tm_sec))
{
return 0;
}
#undef datevalue_in_range
year = (uint32_t)ptm->tm_year;
if (year >= 1980) /* range [1980, 2107] */
year -= 1980;
else if (year >= 80) /* range [80, 99] */
year -= 80;
else /* range [00, 79] */
year += 20;
return (uint32_t)(((ptm->tm_mday) + (32 * (ptm->tm_mon + 1)) + (512 * year)) << 16) |
((ptm->tm_sec / 2) + (32 * ptm->tm_min) + (2048 * (uint32_t)ptm->tm_hour));
}
int makedir(const char *newdir)
{
char *buffer = NULL;
char *p = NULL;
int len = (int)strlen(newdir);
if (len <= 0)
return 0;
buffer = (char*)malloc(len + 1);
if (buffer == NULL)
{
printf("Error allocating memory\n");
return -1;
}
strcpy(buffer, newdir);
if (buffer[len - 1] == '/')
buffer[len - 1] = 0;
if (MKDIR(buffer) == 0)
{
free(buffer);
return 1;
}
p = buffer + 1;
while (1)
{
char hold;
while (*p && *p != '\\' && *p != '/')
p++;
hold = *p;
*p = 0;
if ((MKDIR(buffer) == -1) && (errno == ENOENT))
{
printf("couldn't create directory %s (%d)\n", buffer, errno);
free(buffer);
return 0;
}
if (hold == 0)
break;
*p++ = hold;
}
free(buffer);
return 1;
}
int check_file_exists(const char *path)
{
FILE* handle = fopen64(path, "rb");
if (handle == NULL)
return 0;
fclose(handle);
return 1;
}
int is_large_file(const char *path)
{
uint64_t pos = 0;
FILE* handle = fopen64(path, "rb");
if (handle == NULL)
return 0;
fseeko64(handle, 0, SEEK_END);
pos = ftello64(handle);
fclose(handle);
printf("file : %s is %lld bytes\n", path, pos);
return (pos >= UINT32_MAX);
}
void display_zpos64(uint64_t n, int size_char)
{
/* To avoid compatibility problem we do here the conversion */
char number[21] = { 0 };
int offset = 19;
int pos_string = 19;
int size_display_string = 19;
while (1)
{
number[offset] = (char)((n % 10) + '0');
if (number[offset] != '0')
pos_string = offset;
n /= 10;
if (offset == 0)
break;
offset--;
}
size_display_string -= pos_string;
while (size_char-- > size_display_string)
printf(" ");
printf("%s", &number[pos_string]);
}

View File

@@ -1,48 +0,0 @@
#ifndef _MINISHARED_H
#define _MINISHARED_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
# define MKDIR(d) _mkdir(d)
# define CHDIR(d) _chdir(d)
#else
# define MKDIR(d) mkdir(d, 0775)
# define CHDIR(d) chdir(d)
#endif
/***************************************************************************/
/* Get a file's date and time in dos format */
uint32_t get_file_date(const char *path, uint32_t *dos_date);
/* Sets a file's date and time in dos format */
void change_file_date(const char *path, uint32_t dos_date);
/* Convert dos date/time format to struct tm */
int dosdate_to_tm(uint64_t dos_date, struct tm *ptm);
/* Convert struct tm to dos date/time format */
uint32_t tm_to_dosdate(const struct tm *ptm);
/* Create a directory and all subdirectories */
int makedir(const char *newdir);
/* Check to see if a file exists */
int check_file_exists(const char *path);
/* Check to see if a file is over 4GB and needs ZIP64 extension */
int is_large_file(const char *path);
/* Print a 64-bit number for compatibility */
void display_zpos64(uint64_t n, int size_char);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* _MINISHARED_H */

View File

@@ -0,0 +1,40 @@
/* mz_error.h -- List of function return codes
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_ERROR_H
#define _MZ_ERROR_H
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
#define MZ_OK (0)
#define MZ_EOF (MZ_OK)
#define MZ_STREAM_ERROR (-1)
#define MZ_END_OF_LIST (-100)
#define MZ_PARAM_ERROR (-102)
#define MZ_FORMAT_ERROR (-103)
#define MZ_INTERNAL_ERROR (-104)
#define MZ_CRC_ERROR (-105)
#define MZ_CRYPT_ERROR (-106)
#define MZ_EXIST_ERROR (-107)
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,133 @@
/* mz_os.c -- System functions
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include "mz_error.h"
#include "mz_strm.h"
#include "mz_os.h"
/***************************************************************************/
int32_t mz_os_file_exists(const char *path)
{
void *stream = NULL;
int opened = 0;
mz_stream_os_create(&stream);
if (mz_stream_os_open(stream, path, MZ_STREAM_MODE_READ) == MZ_OK)
{
mz_stream_os_close(stream);
opened = 1;
}
mz_stream_os_delete(&stream);
return opened;
}
int64_t mz_os_file_get_size(const char *path)
{
void *stream = NULL;
int64_t size = 0;
mz_stream_os_create(&stream);
if (mz_stream_os_open(stream, path, MZ_STREAM_MODE_READ) == MZ_OK)
{
mz_stream_os_seek(stream, 0, MZ_STREAM_SEEK_END);
size = mz_stream_os_tell(stream);
mz_stream_os_close(stream);
}
mz_stream_os_delete(&stream);
return size;
}
/***************************************************************************/
int mz_invalid_date(const struct tm *ptm)
{
#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max))
return (!datevalue_in_range(0, 207, ptm->tm_year) ||
!datevalue_in_range(0, 11, ptm->tm_mon) ||
!datevalue_in_range(1, 31, ptm->tm_mday) ||
!datevalue_in_range(0, 23, ptm->tm_hour) ||
!datevalue_in_range(0, 59, ptm->tm_min) ||
!datevalue_in_range(0, 59, ptm->tm_sec));
#undef datevalue_in_range
}
// Conversion without validation
void mz_dosdate_to_raw_tm(uint64_t dos_date, struct tm *ptm)
{
uint64_t date = (uint64_t)(dos_date >> 16);
ptm->tm_mday = (uint16_t)(date & 0x1f);
ptm->tm_mon = (uint16_t)(((date & 0x1E0) / 0x20) - 1);
ptm->tm_year = (uint16_t)(((date & 0x0FE00) / 0x0200) + 80);
ptm->tm_hour = (uint16_t)((dos_date & 0xF800) / 0x800);
ptm->tm_min = (uint16_t)((dos_date & 0x7E0) / 0x20);
ptm->tm_sec = (uint16_t)(2 * (dos_date & 0x1f));
ptm->tm_isdst = -1;
}
int32_t mz_dosdate_to_tm(uint64_t dos_date, struct tm *ptm)
{
mz_dosdate_to_raw_tm(dos_date, ptm);
if (mz_invalid_date(ptm))
{
// Invalid date stored, so don't return it.
memset(ptm, 0, sizeof(struct tm));
return -1;
}
return 0;
}
time_t mz_dosdate_to_time_t(uint64_t dos_date)
{
struct tm ptm;
mz_dosdate_to_raw_tm(dos_date, &ptm);
return mktime(&ptm);
}
uint32_t mz_tm_to_dosdate(const struct tm *ptm)
{
struct tm fixed_tm = { 0 };
// Years supported:
// [00, 79] (assumed to be between 2000 and 2079)
// [80, 207] (assumed to be between 1980 and 2107, typical output of old
// software that does 'year-1900' to get a double digit year)
// [1980, 2107] (due to the date format limitations, only years between 1980 and 2107 can be stored.)
memcpy(&fixed_tm, ptm, sizeof(struct tm));
if (fixed_tm.tm_year >= 1980) // range [1980, 2107]
fixed_tm.tm_year -= 1980;
else if (fixed_tm.tm_year >= 80) // range [80, 99]
fixed_tm.tm_year -= 80;
else // range [00, 79]
fixed_tm.tm_year += 20;
if (mz_invalid_date(ptm))
return 0;
return (uint32_t)(((fixed_tm.tm_mday) + (32 * (fixed_tm.tm_mon + 1)) + (512 * fixed_tm.tm_year)) << 16) |
((fixed_tm.tm_sec / 2) + (32 * fixed_tm.tm_min) + (2048 * (uint32_t)fixed_tm.tm_hour));
}

View File

@@ -0,0 +1,51 @@
/* mz_os.h -- System functions
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_OS_H
#define _MZ_OS_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
#if !defined(_WIN32) && !defined(USEWIN32IOAPI)
#include "mz_os_posix.h"
#include "mz_strm_posix.h"
#else
#include "mz_os_win32.h"
#include "mz_strm_win32.h"
#endif
/***************************************************************************/
int32_t mz_os_file_exists(const char *path);
int64_t mz_os_file_get_size(const char *path);
/***************************************************************************/
int32_t mz_dosdate_to_tm(uint64_t dos_date, struct tm *ptm);
// Convert dos date/time format to struct tm
time_t mz_dosdate_to_time_t(uint64_t dos_date);
// Convert dos date/time format to time_t
uint32_t mz_tm_to_dosdate(const struct tm *ptm);
// Convert struct tm to dos date/time format
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,164 @@
/* mz_os_posix.c -- System functions for posix
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined unix || defined __APPLE__
# include <unistd.h>
# include <utime.h>
# include <fcntl.h>
#endif
#include "mz_error.h"
#include "mz_strm.h"
#include "mz_os.h"
#include "mz_os_posix.h"
/***************************************************************************/
#ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL // use PI as default pattern
#endif
/***************************************************************************/
int32_t mz_posix_rand(uint8_t *buf, int32_t size)
{
static unsigned calls = 0;
void *rand_stream = NULL;
int32_t len = 0;
if (mz_stream_posix_create(&rand_stream) == NULL)
return 0;
if (mz_stream_posix_open(rand_stream, "/dev/urandom", MZ_STREAM_MODE_READ) == MZ_OK)
{
len = mz_stream_posix_read(rand_stream, buf, size);
mz_stream_posix_close(rand_stream);
}
mz_stream_posix_delete(&rand_stream);
if (len < (int)size)
{
// Ensure different random header each time
if (++calls == 1)
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
while (len < (int)size)
buf[len++] = (rand() >> 7) & 0xff;
}
return len;
}
int16_t mz_posix_get_file_date(const char *path, uint32_t *dos_date)
{
struct stat stat_info;
struct tm *filedate = NULL;
time_t tm_t = 0;
int16_t err = MZ_INTERNAL_ERROR;
memset(&stat_info, 0, sizeof(stat_info));
if (strcmp(path, "-") != 0)
{
size_t len = strlen(path);
char *name = (char *)malloc(len + 1);
strncpy(name, path, len + 1);
name[len] = 0;
if (name[len - 1] == '/')
name[len - 1] = 0;
/* Not all systems allow stat'ing a file with / appended */
if (stat(name, &stat_info) == 0)
{
tm_t = stat_info.st_mtime;
err = MZ_OK;
}
free(name);
}
filedate = localtime(&tm_t);
*dos_date = mz_tm_to_dosdate(filedate);
return err;
}
int16_t mz_posix_set_file_date(const char *path, uint32_t dos_date)
{
struct utimbuf ut;
ut.actime = mz_dosdate_to_time_t(dos_date);
ut.modtime = mz_dosdate_to_time_t(dos_date);
if (utime(path, &ut) != 0)
return MZ_INTERNAL_ERROR;
return MZ_OK;
}
int16_t mz_posix_change_dir(const char *path)
{
if (chdir(path) != 0)
return MZ_INTERNAL_ERROR;
return MZ_OK;
}
int16_t mz_posix_make_dir(const char *path)
{
int16_t err = 0;
err = mkdir(path, 0755);
if (err != 0 && errno != EEXIST)
return MZ_INTERNAL_ERROR;
return MZ_OK;
}
DIR* mz_posix_open_dir(const char *path)
{
return opendir(path);
}
struct dirent* mz_posix_read_dir(DIR *dir)
{
if (dir == NULL)
return NULL;
return readdir(dir);
}
int32_t mz_posix_close_dir(DIR *dir)
{
if (dir == NULL)
return MZ_PARAM_ERROR;
if (closedir(dir) == -1)
return MZ_INTERNAL_ERROR;
return MZ_OK;
}
int32_t mz_posix_is_dir(const char *path)
{
struct stat path_stat;
stat(path, &path_stat);
if (S_ISREG(path_stat.st_mode))
return MZ_OK;
return MZ_EXIST_ERROR;
}

View File

@@ -0,0 +1,61 @@
/* mz_os_posix.h -- System functions for posix
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_OS_POSIX_H
#define _MZ_OS_POSIX_H
#include <stdint.h>
#include <dirent.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
#if defined(__APPLE__)
#define MZ_VERSION_MADEBY (19)
#elif defined(unix)
#define MZ_VERSION_MADEBY (3)
#endif
/***************************************************************************/
int32_t mz_posix_rand(uint8_t *buf, int32_t size);
int16_t mz_posix_get_file_date(const char *path, uint32_t *dos_date);
int16_t mz_posix_set_file_date(const char *path, uint32_t dos_date);
int16_t mz_posix_change_dir(const char *path);
int16_t mz_posix_make_dir(const char *path);
DIR* mz_posix_open_dir(const char *path);
struct
dirent* mz_posix_read_dir(DIR *dir);
int32_t mz_posix_close_dir(DIR *dir);
int32_t mz_posix_is_dir(const char *path);
/***************************************************************************/
#define mz_os_rand mz_posix_rand
#define mz_os_get_file_date mz_posix_get_file_date
#define mz_os_set_file_date mz_posix_set_file_date
#define mz_os_change_dir mz_posix_change_dir
#define mz_os_make_dir mz_posix_make_dir
#define mz_os_open_dir mz_posix_open_dir
#define mz_os_read_dir mz_posix_read_dir
#define mz_os_close_dir mz_posix_close_dir
#define mz_os_is_dir mz_posix_is_dir
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

403
SSZipArchive/minizip/mz_strm.c Executable file
View File

@@ -0,0 +1,403 @@
/* mz_strm.c -- Stream interface
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson
http://result42.com
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include "mz_error.h"
#include "mz_strm.h"
/***************************************************************************/
int32_t mz_stream_open(void *stream, const char *path, int32_t mode)
{
mz_stream *strm = (mz_stream *)stream;
if (strm == NULL || strm->open == NULL)
return MZ_STREAM_ERROR;
return strm->open(strm, path, mode);
}
int32_t mz_stream_is_open(void *stream)
{
mz_stream *strm = (mz_stream *)stream;
if (strm == NULL || strm->is_open == NULL)
return MZ_STREAM_ERROR;
return strm->is_open(strm);
}
int32_t mz_stream_read(void *stream, void *buf, int32_t size)
{
mz_stream *strm = (mz_stream *)stream;
if (strm == NULL || strm->read == NULL)
return MZ_STREAM_ERROR;
if (strm->is_open != NULL && strm->is_open(strm) != MZ_OK)
return MZ_STREAM_ERROR;
return strm->read(strm, buf, size);
}
int32_t mz_stream_read_uint8(void *stream, uint8_t *value)
{
uint8_t c = 0;
if (mz_stream_read(stream, &c, 1) == 1)
*value = (uint8_t)c;
else if (mz_stream_error(stream))
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_read_uint16(void *stream, uint16_t *value)
{
uint8_t c = 0;
*value = 0;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value = (uint16_t)c;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint16_t)c) << 8;
return MZ_OK;
}
int32_t mz_stream_read_uint32(void *stream, uint32_t *value)
{
uint8_t c = 0;
*value = 0;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value = (uint32_t)c;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint32_t)c) << 8;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint32_t)c) << 16;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint32_t)c) << 24;
return MZ_OK;
}
int32_t mz_stream_read_uint64(void *stream, uint64_t *value)
{
uint8_t c = 0;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value = (uint64_t)c;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint64_t)c) << 8;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint64_t)c) << 16;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint64_t)c) << 24;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint64_t)c) << 32;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint64_t)c) << 40;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint64_t)c) << 48;
if (mz_stream_read_uint8(stream, &c) != MZ_OK)
return MZ_STREAM_ERROR;
*value += ((uint64_t)c) << 56;
return MZ_OK;
}
int32_t mz_stream_write(void *stream, const void *buf, int32_t size)
{
mz_stream *strm = (mz_stream *)stream;
if (strm == NULL || strm->write == NULL)
return MZ_STREAM_ERROR;
if (size == 0)
return size;
if (strm->is_open != NULL && strm->is_open(strm) != MZ_OK)
return MZ_STREAM_ERROR;
return strm->write(strm, buf, size);
}
static int32_t mz_stream_write_value(void *stream, uint64_t value, uint32_t len)
{
uint8_t buf[8];
uint32_t n = 0;
for (n = 0; n < len; n++)
{
buf[n] = (uint8_t)(value & 0xff);
value >>= 8;
}
if (value != 0)
{
// Data overflow - hack for ZIP64 (X Roche)
for (n = 0; n < len; n++)
buf[n] = 0xff;
}
if (mz_stream_write(stream, buf, len) != len)
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_write_uint8(void *stream, uint8_t value)
{
return mz_stream_write_value(stream, value, sizeof(uint8_t));
}
int32_t mz_stream_write_uint16(void *stream, uint16_t value)
{
return mz_stream_write_value(stream, value, sizeof(uint16_t));
}
int32_t mz_stream_write_uint32(void *stream, uint32_t value)
{
return mz_stream_write_value(stream, value, sizeof(uint32_t));
}
int32_t mz_stream_write_uint64(void *stream, uint64_t value)
{
return mz_stream_write_value(stream, value, sizeof(uint64_t));
}
int32_t mz_stream_copy(void *target, void *source, int32_t len)
{
uint8_t buf[UINT16_MAX];
int32_t bytes_to_copy = 0;
int32_t read = 0;
int32_t written = 0;
while (len > 0)
{
bytes_to_copy = len;
if (bytes_to_copy > UINT16_MAX)
bytes_to_copy = UINT16_MAX;
read = mz_stream_read(source, buf, bytes_to_copy);
if (read < 0)
return MZ_STREAM_ERROR;
written = mz_stream_write(target, buf, read);
if (written != read)
return MZ_STREAM_ERROR;
len -= read;
}
return MZ_OK;
}
int64_t mz_stream_tell(void *stream)
{
mz_stream *strm = (mz_stream *)stream;
if (strm == NULL || strm->tell == NULL)
return MZ_STREAM_ERROR;
if (strm->is_open != NULL && strm->is_open(strm) != MZ_OK)
return MZ_STREAM_ERROR;
return strm->tell(strm);
}
int32_t mz_stream_seek(void *stream, int64_t offset, int32_t origin)
{
mz_stream *strm = (mz_stream *)stream;
if (strm == NULL || strm->seek == NULL)
return MZ_STREAM_ERROR;
if (strm->is_open != NULL && strm->is_open(strm) != MZ_OK)
return MZ_STREAM_ERROR;
return strm->seek(strm, offset, origin);
}
int32_t mz_stream_close(void *stream)
{
mz_stream *strm = (mz_stream *)stream;
if (strm == NULL || strm->close == NULL)
return MZ_STREAM_ERROR;
return strm->close(strm);
}
int32_t mz_stream_error(void *stream)
{
mz_stream *strm = (mz_stream *)stream;
if (strm == NULL || strm->error == NULL)
return MZ_STREAM_ERROR;
return strm->error(strm);
}
int32_t mz_stream_set_base(void *stream, void *base)
{
mz_stream *strm = (mz_stream *)stream;
strm->base = (mz_stream *)base;
return MZ_OK;
}
int64_t mz_stream_get_total_in(void *stream)
{
mz_stream *strm = (mz_stream *)stream;
if (strm->get_total_in == NULL)
return MZ_STREAM_ERROR;
return strm->get_total_in(stream);
}
int64_t mz_stream_get_total_out(void *stream)
{
mz_stream *strm = (mz_stream *)stream;
if (strm->get_total_out == NULL)
return MZ_STREAM_ERROR;
return strm->get_total_out(stream);
}
void *mz_stream_create(void **stream)
{
mz_stream *strm = NULL;
if (stream == NULL)
return NULL;
strm = (mz_stream *)*stream;
return strm->create(stream);
}
void mz_stream_delete(void **stream)
{
mz_stream *strm = NULL;
if (stream == NULL)
return;
strm = (mz_stream *)*stream;
strm->delete(stream);
*stream = NULL;
}
/***************************************************************************/
typedef struct mz_stream_passthru_s {
mz_stream stream;
int64_t total_in;
int64_t total_out;
} mz_stream_passthru;
/***************************************************************************/
int32_t mz_stream_passthru_open(void *stream, const char *path, int32_t mode)
{
return MZ_OK;
}
int32_t mz_stream_passthru_is_open(void *stream)
{
mz_stream_passthru *passthru = (mz_stream_passthru *)stream;
return mz_stream_is_open(passthru->stream.base);
}
int32_t mz_stream_passthru_read(void *stream, void *buf, int32_t size)
{
mz_stream_passthru *passthru = (mz_stream_passthru *)stream;
int32_t read = mz_stream_read(passthru->stream.base, buf, size);
if (read > 0)
passthru->total_in += read;
return read;
}
int32_t mz_stream_passthru_write(void *stream, const void *buf, int32_t size)
{
mz_stream_passthru *passthru = (mz_stream_passthru *)stream;
int32_t written = mz_stream_write(passthru->stream.base, buf, size);
if (written > 0)
passthru->total_out += written;
return written;
}
int64_t mz_stream_passthru_tell(void *stream)
{
mz_stream_passthru *passthru = (mz_stream_passthru *)stream;
return mz_stream_tell(passthru->stream.base);
}
int32_t mz_stream_passthru_seek(void *stream, int64_t offset, int32_t origin)
{
mz_stream_passthru *passthru = (mz_stream_passthru *)stream;
return mz_stream_seek(passthru->stream.base, offset, origin);
}
int32_t mz_stream_passthru_close(void *stream)
{
return MZ_OK;
}
int32_t mz_stream_passthru_error(void *stream)
{
mz_stream_passthru *passthru = (mz_stream_passthru *)stream;
return mz_stream_error(passthru->stream.base);
}
int64_t mz_stream_passthru_get_total_in(void *stream)
{
mz_stream_passthru *passthru = (mz_stream_passthru *)stream;
return passthru->total_in;
}
int64_t mz_stream_passthru_get_total_out(void *stream)
{
mz_stream_passthru *passthru = (mz_stream_passthru *)stream;
return passthru->total_out;
}
void *mz_stream_passthru_create(void **stream)
{
mz_stream_passthru *passthru = NULL;
passthru = (mz_stream_passthru *)malloc(sizeof(mz_stream_passthru));
if (passthru != NULL)
{
memset(passthru, 0, sizeof(mz_stream_passthru));
passthru->stream.open = mz_stream_passthru_open;
passthru->stream.is_open = mz_stream_passthru_is_open;
passthru->stream.read = mz_stream_passthru_read;
passthru->stream.write = mz_stream_passthru_write;
passthru->stream.tell = mz_stream_passthru_tell;
passthru->stream.seek = mz_stream_passthru_seek;
passthru->stream.close = mz_stream_passthru_close;
passthru->stream.error = mz_stream_passthru_error;
passthru->stream.create = mz_stream_passthru_create;
passthru->stream.delete = mz_stream_passthru_delete;
passthru->stream.get_total_in = mz_stream_passthru_get_total_in;
passthru->stream.get_total_out = mz_stream_passthru_get_total_out;
}
if (stream != NULL)
*stream = passthru;
return passthru;
}
void mz_stream_passthru_delete(void **stream)
{
mz_stream_passthru *passthru = NULL;
if (stream == NULL)
return;
passthru = (mz_stream_passthru *)*stream;
if (passthru != NULL)
free(passthru);
*stream = NULL;
}

109
SSZipArchive/minizip/mz_strm.h Executable file
View File

@@ -0,0 +1,109 @@
/* mz_strm.h -- Stream interface
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2009-2010 Mathias Svensson
Modifications for Zip64 support
http://result42.com
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_STREAM_H
#define _MZ_STREAM_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
#define MZ_STREAM_SEEK_CUR (1)
#define MZ_STREAM_SEEK_END (2)
#define MZ_STREAM_SEEK_SET (0)
#define MZ_STREAM_MODE_READ (0x01)
#define MZ_STREAM_MODE_WRITE (0x02)
#define MZ_STREAM_MODE_READWRITE (MZ_STREAM_MODE_READ | MZ_STREAM_MODE_WRITE)
#define MZ_STREAM_MODE_APPEND (0x04)
#define MZ_STREAM_MODE_CREATE (0x08)
#define MZ_STREAM_MODE_EXISTING (0x10)
/***************************************************************************/
typedef int32_t (*mz_stream_open_cb) (void *stream, const char *path, int32_t mode);
typedef int32_t (*mz_stream_is_open_cb) (void *stream);
typedef int32_t (*mz_stream_read_cb) (void *stream, void *buf, int32_t size);
typedef int32_t (*mz_stream_write_cb) (void *stream, const void *buf, int32_t size);
typedef int64_t (*mz_stream_tell_cb) (void *stream);
typedef int32_t (*mz_stream_seek_cb) (void *stream, int64_t offset, int32_t origin);
typedef int32_t (*mz_stream_close_cb) (void *stream);
typedef int32_t (*mz_stream_error_cb) (void *stream);
typedef void* (*mz_stream_create_cb) (void **stream);
typedef void (*mz_stream_delete_cb) (void **stream);
typedef int64_t (*mz_stream_get_total_in_cb) (void *stream);
typedef int64_t (*mz_stream_get_total_out_cb) (void *stream);
/***************************************************************************/
typedef struct mz_stream_s
{
struct mz_stream_s *base;
mz_stream_open_cb open;
mz_stream_is_open_cb is_open;
mz_stream_read_cb read;
mz_stream_write_cb write;
mz_stream_tell_cb tell;
mz_stream_seek_cb seek;
mz_stream_close_cb close;
mz_stream_error_cb error;
mz_stream_create_cb create;
mz_stream_delete_cb delete;
mz_stream_get_total_in_cb get_total_in;
mz_stream_get_total_out_cb get_total_out;
} mz_stream;
/***************************************************************************/
int32_t mz_stream_open(void *stream, const char *path, int32_t mode);
int32_t mz_stream_is_open(void *stream);
int32_t mz_stream_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_read_uint8(void *stream, uint8_t *value);
int32_t mz_stream_read_uint16(void *stream, uint16_t *value);
int32_t mz_stream_read_uint32(void *stream, uint32_t *value);
int32_t mz_stream_read_uint64(void *stream, uint64_t *value);
int32_t mz_stream_write(void *stream, const void *buf, int32_t size);
int32_t mz_stream_write_uint8(void *stream, uint8_t value);
int32_t mz_stream_write_uint16(void *stream, uint16_t value);
int32_t mz_stream_write_uint32(void *stream, uint32_t value);
int32_t mz_stream_write_uint64(void *stream, uint64_t value);
int32_t mz_stream_copy(void *target, void *source, int32_t len);
int64_t mz_stream_tell(void *stream);
int32_t mz_stream_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_close(void *stream);
int32_t mz_stream_error(void *stream);
int32_t mz_stream_set_base(void *stream, void *base);
int64_t mz_stream_get_total_in(void *stream);
int64_t mz_stream_get_total_out(void *stream);
void* mz_stream_create(void **stream);
void mz_stream_delete(void **stream);
void* mz_stream_passthru_create(void **stream);
void mz_stream_passthru_delete(void **stream);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,264 @@
/* mz_strm_aes.c -- Stream for WinZip AES encryption
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mz_error.h"
#include "mz_os.h"
#include "mz_strm.h"
#include "mz_strm_aes.h"
#include "aes/aes.h"
#include "aes/fileenc.h"
/***************************************************************************/
#define MZ_AES_PWVERIFYSIZE (2)
#define MZ_AES_AUTHCODESIZE (10)
#define MZ_AES_MAXSALTLENGTH (16)
/***************************************************************************/
typedef struct mz_stream_aes_s {
mz_stream stream;
fcrypt_ctx crypt_ctx;
int16_t mode;
int16_t initialized;
int16_t error;
int16_t encryption_mode;
const char *password;
int64_t total_in;
int64_t total_out;
uint8_t buffer[UINT16_MAX];
} mz_stream_aes;
/***************************************************************************/
int32_t mz_stream_aes_open(void *stream, const char *path, int32_t mode)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
uint16_t salt_length = 0;
uint8_t verify[MZ_AES_PWVERIFYSIZE];
uint8_t verify_expected[MZ_AES_PWVERIFYSIZE];
uint8_t salt_value[MZ_AES_MAXSALTLENGTH];
const char *password = path;
aes->total_in = 0;
aes->total_out = 0;
aes->initialized = 0;
if (mz_stream_is_open(aes->stream.base) != MZ_OK)
return MZ_STREAM_ERROR;
if (password == NULL)
password = aes->password;
if (password == NULL)
return MZ_STREAM_ERROR;
salt_length = SALT_LENGTH(aes->encryption_mode);
if (mode & MZ_STREAM_MODE_WRITE)
{
mz_os_rand(salt_value, salt_length);
if (fcrypt_init(aes->encryption_mode, (uint8_t *)password,
(uint32_t)strlen(password), salt_value, verify, &aes->crypt_ctx) != 0)
return MZ_STREAM_ERROR;
if (mz_stream_write(aes->stream.base, salt_value, salt_length) != salt_length)
return MZ_STREAM_ERROR;
aes->total_out += salt_length;
if (mz_stream_write(aes->stream.base, verify, MZ_AES_PWVERIFYSIZE) != MZ_AES_PWVERIFYSIZE)
return MZ_STREAM_ERROR;
aes->total_out += MZ_AES_PWVERIFYSIZE;
}
else if (mode & MZ_STREAM_MODE_READ)
{
if (mz_stream_read(aes->stream.base, salt_value, salt_length) != salt_length)
return MZ_STREAM_ERROR;
aes->total_in += salt_length;
if (mz_stream_read(aes->stream.base, verify_expected, MZ_AES_PWVERIFYSIZE) != MZ_AES_PWVERIFYSIZE)
return MZ_STREAM_ERROR;
aes->total_in += MZ_AES_PWVERIFYSIZE;
if (fcrypt_init(aes->encryption_mode, (uint8_t *)password,
(uint32_t)strlen(password), salt_value, verify, &aes->crypt_ctx) != 0)
return MZ_STREAM_ERROR;
if (memcmp(verify_expected, verify, MZ_AES_PWVERIFYSIZE) != 0)
return MZ_STREAM_ERROR;
}
aes->mode = mode;
aes->initialized = 1;
return MZ_OK;
}
int32_t mz_stream_aes_is_open(void *stream)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
if (aes->initialized == 0)
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_aes_read(void *stream, void *buf, int32_t size)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
int32_t read = 0;
read = mz_stream_read(aes->stream.base, buf, size);
if (read > 0)
fcrypt_decrypt((uint8_t *)buf, read, &aes->crypt_ctx);
aes->total_in += read;
return read;
}
int32_t mz_stream_aes_write(void *stream, const void *buf, int32_t size)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
int32_t written = 0;
if (size > sizeof(aes->buffer))
return MZ_STREAM_ERROR;
memcpy(aes->buffer, buf, size);
fcrypt_encrypt((uint8_t *)aes->buffer, size, &aes->crypt_ctx);
written = mz_stream_write(aes->stream.base, aes->buffer, size);
if (written > 0)
aes->total_out += written;
return written;
}
int64_t mz_stream_aes_tell(void *stream)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
return mz_stream_tell(aes->stream.base);
}
int32_t mz_stream_aes_seek(void *stream, int64_t offset, int32_t origin)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
return mz_stream_seek(aes->stream.base, offset, origin);
}
int32_t mz_stream_aes_close(void *stream)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
unsigned char authcode[MZ_AES_AUTHCODESIZE];
unsigned char rauthcode[MZ_AES_AUTHCODESIZE];
if (aes->mode & MZ_STREAM_MODE_WRITE)
{
fcrypt_end(authcode, &aes->crypt_ctx);
if (mz_stream_write(aes->stream.base, authcode, MZ_AES_AUTHCODESIZE) != MZ_AES_AUTHCODESIZE)
return MZ_STREAM_ERROR;
aes->total_out += MZ_AES_AUTHCODESIZE;
}
else if (aes->mode & MZ_STREAM_MODE_READ)
{
if (mz_stream_read(aes->stream.base, authcode, MZ_AES_AUTHCODESIZE) != MZ_AES_AUTHCODESIZE)
return MZ_STREAM_ERROR;
aes->total_in += MZ_AES_AUTHCODESIZE;
if (fcrypt_end(rauthcode, &aes->crypt_ctx) != MZ_AES_AUTHCODESIZE)
return MZ_STREAM_ERROR;
if (memcmp(authcode, rauthcode, MZ_AES_AUTHCODESIZE) != 0)
return MZ_CRC_ERROR;
}
aes->initialized = 0;
return MZ_OK;
}
int32_t mz_stream_aes_error(void *stream)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
return aes->error;
}
void mz_stream_aes_set_password(void *stream, const char *password)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
aes->password = password;
}
void mz_stream_aes_set_encryption_mode(void *stream, int16_t encryption_mode)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
aes->encryption_mode = encryption_mode;
}
int64_t mz_stream_aes_get_total_in(void *stream)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
return aes->total_in;
}
int64_t mz_stream_aes_get_total_out(void *stream)
{
mz_stream_aes *aes = (mz_stream_aes *)stream;
return aes->total_out;
}
int32_t mz_stream_aes_get_footer_size(void *stream)
{
return MZ_AES_AUTHCODESIZE;
}
void *mz_stream_aes_create(void **stream)
{
mz_stream_aes *aes = NULL;
aes = (mz_stream_aes *)malloc(sizeof(mz_stream_aes));
if (aes != NULL)
{
memset(aes, 0, sizeof(mz_stream_aes));
aes->stream.open = mz_stream_aes_open;
aes->stream.is_open = mz_stream_aes_is_open;
aes->stream.read = mz_stream_aes_read;
aes->stream.write = mz_stream_aes_write;
aes->stream.tell = mz_stream_aes_tell;
aes->stream.seek = mz_stream_aes_seek;
aes->stream.close = mz_stream_aes_close;
aes->stream.error = mz_stream_aes_error;
aes->stream.create = mz_stream_aes_create;
aes->stream.delete = mz_stream_aes_delete;
aes->stream.get_total_in = mz_stream_aes_get_total_in;
aes->stream.get_total_out = mz_stream_aes_get_total_out;
aes->encryption_mode = MZ_AES_ENCRYPTIONMODE;
}
if (stream != NULL)
*stream = aes;
return aes;
}
void mz_stream_aes_delete(void **stream)
{
mz_stream_aes *aes = NULL;
if (stream == NULL)
return;
aes = (mz_stream_aes *)*stream;
if (aes != NULL)
free(aes);
*stream = NULL;
}

View File

@@ -0,0 +1,52 @@
/* mz_strm_aes.h -- Stream for WinZIP AES encryption
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_STREAM_AES_H
#define _MZ_STREAM_AES_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
#define MZ_AES_METHOD (99)
#define MZ_AES_VERSION (0x0001)
#define MZ_AES_ENCRYPTIONMODE (0x03)
/***************************************************************************/
int32_t mz_stream_aes_open(void *stream, const char *filename, int32_t mode);
int32_t mz_stream_aes_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_aes_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_aes_tell(void *stream);
int32_t mz_stream_aes_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_aes_close(void *stream);
int32_t mz_stream_aes_error(void *stream);
void mz_stream_aes_set_password(void *stream, const char *password);
void mz_stream_aes_set_encryption_mode(void *stream, int16_t encryption_mode);
int64_t mz_stream_aes_get_total_in(void *stream);
int64_t mz_stream_aes_get_total_out(void *stream);
int32_t mz_stream_aes_get_footer_size(void *stream);
void* mz_stream_aes_create(void **stream);
void mz_stream_aes_delete(void **stream);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,381 @@
/* mz_strm_buf.c -- Stream for buffering reads/writes
Version 2.0.0, October 4th, 2017
part of the MiniZip project
This version of ioapi is designed to buffer IO.
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "mz_error.h"
#include "mz_strm.h"
#include "mz_strm_buf.h"
/***************************************************************************/
#define MZ_BUF_BUFFERSIZE (UINT16_MAX)
#if 0
# define mz_stream_buffered_print(o,s,f,...) printf(o,s,f,__VA_ARGS__);
#else
# define mz_stream_buffered_print(o,s,f,...)
#endif
/***************************************************************************/
typedef struct mz_stream_buffered_s {
mz_stream stream;
char readbuf[MZ_BUF_BUFFERSIZE];
uint32_t readbuf_len;
uint32_t readbuf_pos;
uint32_t readbuf_hits;
uint32_t readbuf_misses;
char writebuf[MZ_BUF_BUFFERSIZE];
uint32_t writebuf_len;
uint32_t writebuf_pos;
uint32_t writebuf_hits;
uint32_t writebuf_misses;
uint64_t position;
int32_t error;
} mz_stream_buffered;
/***************************************************************************/
int32_t mz_stream_buffered_open(void *stream, const char *path, int32_t mode)
{
//mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
//mz_stream_buffered_print(opaque, buffered, "open [num %d mode %d]\n", number_disk, mode);
return mz_stream_open(stream, path, mode);
}
int32_t mz_stream_buffered_flush(void *stream, uint32_t *written)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
uint32_t total_bytes_written = 0;
uint32_t bytes_to_write = buffered->writebuf_len;
uint32_t bytes_left_to_write = buffered->writebuf_len;
uint32_t bytes_written = 0;
*written = 0;
while (bytes_left_to_write > 0)
{
bytes_written = mz_stream_write(buffered->stream.base, buffered->writebuf + (bytes_to_write - bytes_left_to_write), bytes_left_to_write);
if (bytes_written != bytes_left_to_write)
return MZ_STREAM_ERROR;
buffered->writebuf_misses += 1;
mz_stream_buffered_print(opaque, stream, "write flush [%d:%d len %d]\n",
bytes_to_write, bytes_left_to_write, buffered->writebuf_len);
total_bytes_written += bytes_written;
bytes_left_to_write -= bytes_written;
buffered->position += bytes_written;
}
buffered->writebuf_len = 0;
buffered->writebuf_pos = 0;
*written = total_bytes_written;
return MZ_OK;
}
int32_t mz_stream_buffered_read(void *stream, void *buf, int32_t size)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
uint32_t buf_len = 0;
uint32_t bytes_to_read = 0;
uint32_t bytes_to_copy = 0;
uint32_t bytes_left_to_read = size;
uint32_t bytes_read = 0;
mz_stream_buffered_print(opaque, stream, "read [size %ld pos %lld]\n", size, buffered->position);
if (buffered->writebuf_len > 0)
mz_stream_buffered_print(opaque, stream, "switch from write to read, not yet supported [%lld]\n", buffered->position);
while (bytes_left_to_read > 0)
{
if ((buffered->readbuf_len == 0) || (buffered->readbuf_pos == buffered->readbuf_len))
{
if (buffered->readbuf_len == MZ_BUF_BUFFERSIZE)
{
buffered->readbuf_pos = 0;
buffered->readbuf_len = 0;
}
bytes_to_read = MZ_BUF_BUFFERSIZE - (buffered->readbuf_len - buffered->readbuf_pos);
if (mz_stream_read(buffered->stream.base, buffered->readbuf + buffered->readbuf_pos, bytes_to_read) != bytes_to_read)
return 0;
buffered->readbuf_misses += 1;
buffered->readbuf_len += bytes_read;
buffered->position += bytes_read;
mz_stream_buffered_print(opaque, stream, "filled [read %d/%d buf %d:%d pos %lld]\n",
bytes_read, bytes_to_read, buffered->readbuf_pos, buffered->readbuf_len, buffered->position);
if (bytes_read == 0)
break;
}
if ((buffered->readbuf_len - buffered->readbuf_pos) > 0)
{
bytes_to_copy = (uint32_t)(buffered->readbuf_len - buffered->readbuf_pos);
if (bytes_to_copy > bytes_left_to_read)
bytes_to_copy = bytes_left_to_read;
memcpy((char *)buf + buf_len, buffered->readbuf + buffered->readbuf_pos, bytes_to_copy);
buf_len += bytes_to_copy;
bytes_left_to_read -= bytes_to_copy;
buffered->readbuf_hits += 1;
buffered->readbuf_pos += bytes_to_copy;
mz_stream_buffered_print(opaque, stream, "emptied [copied %d remaining %d buf %d:%d pos %lld]\n",
bytes_to_copy, bytes_left_to_read, buffered->readbuf_pos, buffered->readbuf_len, buffered->position);
}
}
return size - bytes_left_to_read;
}
int32_t mz_stream_buffered_write(void *stream, const void *buf, int32_t size)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
uint32_t bytes_to_write = size;
uint32_t bytes_left_to_write = size;
uint32_t bytes_to_copy = 0;
uint32_t bytes_used = 0;
uint32_t bytes_flushed = 0;
mz_stream_buffered_print(opaque, stream, "write [size %ld len %d pos %lld]\n", size, buffered->writebuf_len, buffered->position);
if (buffered->readbuf_len > 0)
{
buffered->position -= buffered->readbuf_len;
buffered->position += buffered->readbuf_pos;
buffered->readbuf_len = 0;
buffered->readbuf_pos = 0;
mz_stream_buffered_print(opaque, stream, "switch from read to write [%lld]\n", buffered->position);
if (mz_stream_seek(buffered->stream.base, buffered->position, MZ_STREAM_SEEK_SET) != MZ_OK)
return MZ_STREAM_ERROR;
}
while (bytes_left_to_write > 0)
{
bytes_used = buffered->writebuf_len;
if (bytes_used > buffered->writebuf_pos)
bytes_used = buffered->writebuf_pos;
bytes_to_copy = (uint32_t)(MZ_BUF_BUFFERSIZE - bytes_used);
if (bytes_to_copy > bytes_left_to_write)
bytes_to_copy = bytes_left_to_write;
if (bytes_to_copy == 0)
{
if (mz_stream_buffered_flush(stream, &bytes_flushed) != MZ_OK)
return MZ_STREAM_ERROR;
if (bytes_flushed == 0)
return 0;
continue;
}
memcpy(buffered->writebuf + buffered->writebuf_pos, (char *)buf + (bytes_to_write - bytes_left_to_write), bytes_to_copy);
mz_stream_buffered_print(opaque, stream, "write copy [remaining %d write %d:%d len %d]\n",
bytes_to_copy, bytes_to_write, bytes_left_to_write, buffered->writebuf_len);
bytes_left_to_write -= bytes_to_copy;
buffered->writebuf_pos += bytes_to_copy;
buffered->writebuf_hits += 1;
if (buffered->writebuf_pos > buffered->writebuf_len)
buffered->writebuf_len += buffered->writebuf_pos - buffered->writebuf_len;
}
return size - bytes_left_to_write;
}
int64_t mz_stream_buffered_tellinternal(void *stream, uint64_t position)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
buffered->position = position;
mz_stream_buffered_print(opaque, stream, "tell [pos %llu readpos %d writepos %d err %d]\n",
buffered->position, buffered->readbuf_pos, buffered->writebuf_pos, errno);
if (buffered->readbuf_len > 0)
position -= (buffered->readbuf_len - buffered->readbuf_pos);
if (buffered->writebuf_len > 0)
position += buffered->writebuf_pos;
return position;
}
int64_t mz_stream_buffered_tell(void *stream)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
int64_t position = mz_stream_tell(buffered->stream.base);
return mz_stream_buffered_tellinternal(stream, position);
}
int mz_stream_buffered_seekinternal(void *stream, uint64_t offset, int32_t origin)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
uint32_t bytes_flushed = 0;
mz_stream_buffered_print(opaque, stream, "seek [origin %d offset %llu pos %lld]\n", origin, offset, buffered->position);
switch (origin)
{
case MZ_STREAM_SEEK_SET:
if (buffered->writebuf_len > 0)
{
if ((offset >= buffered->position) && (offset <= buffered->position + buffered->writebuf_len))
{
buffered->writebuf_pos = (uint32_t)(offset - buffered->position);
return MZ_OK;
}
}
if ((buffered->readbuf_len > 0) && (offset < buffered->position) && (offset >= buffered->position - buffered->readbuf_len))
{
buffered->readbuf_pos = (uint32_t)(offset - (buffered->position - buffered->readbuf_len));
return MZ_OK;
}
if (mz_stream_buffered_flush(stream, &bytes_flushed) != MZ_OK)
return MZ_STREAM_ERROR;
buffered->position = offset;
break;
case MZ_STREAM_SEEK_CUR:
if (buffered->readbuf_len > 0)
{
if (offset <= (buffered->readbuf_len - buffered->readbuf_pos))
{
buffered->readbuf_pos += (uint32_t)offset;
return MZ_OK;
}
offset -= (buffered->readbuf_len - buffered->readbuf_pos);
buffered->position += offset;
}
if (buffered->writebuf_len > 0)
{
if (offset <= (buffered->writebuf_len - buffered->writebuf_pos))
{
buffered->writebuf_pos += (uint32_t)offset;
return MZ_OK;
}
//offset -= (buffered->writebuf_len - buffered->writebuf_pos);
}
if (mz_stream_buffered_flush(stream, &bytes_flushed) != MZ_OK)
return MZ_STREAM_ERROR;
break;
case MZ_STREAM_SEEK_END:
if (buffered->writebuf_len > 0)
{
buffered->writebuf_pos = buffered->writebuf_len;
return MZ_OK;
}
break;
}
buffered->readbuf_len = 0;
buffered->readbuf_pos = 0;
buffered->writebuf_len = 0;
buffered->writebuf_pos = 0;
return MZ_STREAM_ERROR;
}
int32_t mz_stream_buffered_seek(void *stream, int64_t offset, int32_t origin)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
if (mz_stream_buffered_seekinternal(stream, offset, origin) != MZ_OK)
return MZ_STREAM_ERROR;
return mz_stream_seek(buffered->stream.base, offset, origin);
}
int32_t mz_stream_buffered_close(void *stream)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
uint32_t bytes_flushed = 0;
mz_stream_buffered_flush(stream, &bytes_flushed);
mz_stream_buffered_print(opaque, stream, "close\n");
if (buffered->readbuf_hits + buffered->readbuf_misses > 0)
mz_stream_buffered_print(opaque, stream, "read efficency %.02f%%\n",
(buffered->readbuf_hits / ((float)buffered->readbuf_hits + buffered->readbuf_misses)) * 100);
if (buffered->writebuf_hits + buffered->writebuf_misses > 0)
mz_stream_buffered_print(opaque, stream, "write efficency %.02f%%\n",
(buffered->writebuf_hits / ((float)buffered->writebuf_hits + buffered->writebuf_misses)) * 100);
return mz_stream_close(&buffered->stream.base);
}
int32_t mz_stream_buffered_error(void *stream)
{
mz_stream_buffered *buffered = (mz_stream_buffered *)stream;
return mz_stream_error(&buffered->stream.base);
}
void *mz_stream_buffered_create(void **stream)
{
mz_stream_buffered *buffered = NULL;
buffered = (mz_stream_buffered *)malloc(sizeof(mz_stream_buffered));
if (buffered != NULL)
{
memset(buffered, 0, sizeof(mz_stream_buffered));
buffered->stream.open = mz_stream_buffered_open;
buffered->stream.read = mz_stream_buffered_read;
buffered->stream.write = mz_stream_buffered_write;
buffered->stream.tell = mz_stream_buffered_tell;
buffered->stream.seek = mz_stream_buffered_seek;
buffered->stream.close = mz_stream_buffered_close;
buffered->stream.error = mz_stream_buffered_error;
buffered->stream.create = mz_stream_buffered_create;
buffered->stream.delete = mz_stream_buffered_delete;
}
if (stream != NULL)
*stream = buffered;
return buffered;
}
void mz_stream_buffered_delete(void **stream)
{
mz_stream_buffered *buffered = NULL;
if (stream == NULL)
return;
buffered = (mz_stream_buffered *)*stream;
if (buffered != NULL)
free(buffered);
*stream = NULL;
}

View File

@@ -0,0 +1,42 @@
/* mz_strm_buf.h -- Stream for buffering reads/writes
Version 2.0.0, October 4th, 2017
part of the MiniZip project
This version of ioapi is designed to buffer IO.
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_STREAM_BUFFERED_H
#define _MZ_STREAM_BUFFERED_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
int32_t mz_stream_buffered_open(void *stream, const char *path, int32_t mode);
int32_t mz_stream_buffered_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_buffered_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_buffered_tell(void *stream);
int32_t mz_stream_buffered_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_buffered_close(void *stream);
int32_t mz_stream_buffered_error(void *stream);
void* mz_stream_buffered_create(void **stream);
void mz_stream_buffered_delete(void **stream);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,310 @@
/* mz_strm_crypt.c -- Code for traditional PKWARE encryption
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 1998-2005 Gilles Vollant
Modifications for Info-ZIP crypting
http://www.winimage.com/zLibDll/minizip.html
Copyright (C) 2003 Terry Thorsen
This code is a modified version of crypting code in Info-ZIP distribution
Copyright (C) 1990-2000 Info-ZIP. All rights reserved.
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
This encryption code is a direct transcription of the algorithm from
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
file (appnote.txt) is distributed with the PKZIP program (even in the
version without encryption capabilities).
If you don't need crypting in your application, just define symbols
NOCRYPT and NOUNCRYPT.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "mz_error.h"
#include "mz_os.h"
#include "mz_strm.h"
#include "mz_strm_crypt.h"
/***************************************************************************/
#define RAND_HEAD_LEN 12
/***************************************************************************/
typedef struct mz_stream_crypt_s {
mz_stream stream;
uint32_t keys[3]; // keys defining the pseudo-random sequence
const z_crc_t *crc_32_tab;
int16_t initialized;
int16_t error;
uint8_t verify1;
uint8_t verify2;
const char *password;
uint8_t buffer[UINT16_MAX];
int64_t total_in;
int64_t total_out;
} mz_stream_crypt;
/***************************************************************************/
#define zdecode(keys,crc_32_tab,c) \
(mz_stream_crypt_update_keys(keys,crc_32_tab, c ^= mz_stream_crypt_decrypt_byte(keys)))
#define zencode(keys,crc_32_tab,c,t) \
(t = mz_stream_crypt_decrypt_byte(keys), mz_stream_crypt_update_keys(keys,crc_32_tab,c), t^(c))
/***************************************************************************/
uint8_t mz_stream_crypt_decrypt_byte(uint32_t *keys)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
temp = ((uint32_t)(*(keys+2)) & 0xffff) | 2;
return (uint8_t)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
uint8_t mz_stream_crypt_update_keys(uint32_t *keys, const z_crc_t *crc_32_tab, int32_t c)
{
#define CRC32(c, b) ((*(crc_32_tab+(((uint32_t)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
(*(keys+0)) = (uint32_t)CRC32((*(keys+0)), c);
(*(keys+1)) += (*(keys+0)) & 0xff;
(*(keys+1)) = (*(keys+1)) * 134775813L + 1;
{
register int32_t keyshift = (int32_t)((*(keys + 1)) >> 24);
(*(keys+2)) = (uint32_t)CRC32((*(keys+2)), keyshift);
}
return c;
}
void mz_stream_crypt_init_keys(const char *password, uint32_t *keys, const z_crc_t *crc_32_tab)
{
*(keys+0) = 305419896L;
*(keys+1) = 591751049L;
*(keys+2) = 878082192L;
while (*password != 0)
{
mz_stream_crypt_update_keys(keys, crc_32_tab, *password);
password += 1;
}
}
/***************************************************************************/
int32_t mz_stream_crypt_open(void *stream, const char *path, int32_t mode)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
uint16_t t = 0;
int16_t i = 0;
uint8_t header[RAND_HEAD_LEN];
const char *password = path;
crypt->total_in = 0;
crypt->total_out = 0;
crypt->initialized = 0;
if (mz_stream_is_open(crypt->stream.base) != MZ_OK)
return MZ_STREAM_ERROR;
if (password == NULL)
password = crypt->password;
if (password == NULL)
return MZ_STREAM_ERROR;
crypt->crc_32_tab = get_crc_table();
if (crypt->crc_32_tab == NULL)
return MZ_STREAM_ERROR;
mz_stream_crypt_init_keys(password, crypt->keys, crypt->crc_32_tab);
if (mode & MZ_STREAM_MODE_WRITE)
{
// First generate RAND_HEAD_LEN - 2 random bytes.
mz_os_rand(header, RAND_HEAD_LEN - 2);
// Encrypt random header (last two bytes is high word of crc)
for (i = 0; i < RAND_HEAD_LEN - 2; i++)
header[i] = (uint8_t)zencode(crypt->keys, crypt->crc_32_tab, header[i], t);
header[i++] = (uint8_t)zencode(crypt->keys, crypt->crc_32_tab, crypt->verify1, t);
header[i++] = (uint8_t)zencode(crypt->keys, crypt->crc_32_tab, crypt->verify2, t);
if (mz_stream_write(crypt->stream.base, header, RAND_HEAD_LEN) != RAND_HEAD_LEN)
return MZ_STREAM_ERROR;
crypt->total_out += RAND_HEAD_LEN;
}
else if (mode & MZ_STREAM_MODE_READ)
{
if (mz_stream_read(crypt->stream.base, header, RAND_HEAD_LEN) != RAND_HEAD_LEN)
return MZ_STREAM_ERROR;
for (i = 0; i < RAND_HEAD_LEN - 2; i++)
header[i] = (uint8_t)zdecode(crypt->keys, crypt->crc_32_tab, header[i]);
crypt->verify1 = (uint8_t)zdecode(crypt->keys, crypt->crc_32_tab, header[i++]);
crypt->verify2 = (uint8_t)zdecode(crypt->keys, crypt->crc_32_tab, header[i++]);
crypt->total_in += RAND_HEAD_LEN;
}
crypt->initialized = 1;
return MZ_OK;
}
int32_t mz_stream_crypt_is_open(void *stream)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
if (crypt->initialized == 0)
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_crypt_read(void *stream, void *buf, int32_t size)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
uint8_t *buf_ptr = (uint8_t *)buf;
uint32_t read = 0;
uint32_t i = 0;
read = mz_stream_read(crypt->stream.base, buf, size);
for (i = 0; i < read; i++)
buf_ptr[i] = (uint8_t)zdecode(crypt->keys, crypt->crc_32_tab, buf_ptr[i]);
crypt->total_in += read;
return read;
}
int32_t mz_stream_crypt_write(void *stream, const void *buf, int32_t size)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
uint8_t *buf_ptr = (uint8_t *)buf;
uint32_t written = 0;
uint16_t t = 0;
int32_t i = 0;
if (size > sizeof(crypt->buffer))
return MZ_STREAM_ERROR;
for (i = 0; i < size; i++)
crypt->buffer[i] = (uint8_t)zencode(crypt->keys, crypt->crc_32_tab, buf_ptr[i], t);
written = mz_stream_write(crypt->stream.base, crypt->buffer, size);
if (written > 0)
crypt->total_out += written;
return written;
}
int64_t mz_stream_crypt_tell(void *stream)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
return mz_stream_tell(crypt->stream.base);
}
int32_t mz_stream_crypt_seek(void *stream, int64_t offset, int32_t origin)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
return mz_stream_seek(crypt->stream.base, offset, origin);
}
int32_t mz_stream_crypt_close(void *stream)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
crypt->initialized = 0;
return MZ_OK;
}
int32_t mz_stream_crypt_error(void *stream)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
return crypt->error;
}
void mz_stream_crypt_set_password(void *stream, const char *password)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
crypt->password = password;
}
void mz_stream_crypt_set_verify(void *stream, uint8_t verify1, uint8_t verify2)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
crypt->verify1 = verify1;
crypt->verify2 = verify2;
}
void mz_stream_crypt_get_verify(void *stream, uint8_t *verify1, uint8_t *verify2)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
*verify1 = crypt->verify1;
*verify2 = crypt->verify2;
}
int64_t mz_stream_crypt_get_total_in(void *stream)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
return crypt->total_in;
}
int64_t mz_stream_crypt_get_total_out(void *stream)
{
mz_stream_crypt *crypt = (mz_stream_crypt *)stream;
return crypt->total_out;
}
void *mz_stream_crypt_create(void **stream)
{
mz_stream_crypt *crypt = NULL;
crypt = (mz_stream_crypt *)malloc(sizeof(mz_stream_crypt));
if (crypt != NULL)
{
memset(crypt, 0, sizeof(mz_stream_crypt));
crypt->stream.open = mz_stream_crypt_open;
crypt->stream.is_open = mz_stream_crypt_is_open;
crypt->stream.read = mz_stream_crypt_read;
crypt->stream.write = mz_stream_crypt_write;
crypt->stream.tell = mz_stream_crypt_tell;
crypt->stream.seek = mz_stream_crypt_seek;
crypt->stream.close = mz_stream_crypt_close;
crypt->stream.error = mz_stream_crypt_error;
crypt->stream.create = mz_stream_crypt_create;
crypt->stream.delete = mz_stream_crypt_delete;
crypt->stream.get_total_in = mz_stream_crypt_get_total_in;
crypt->stream.get_total_out = mz_stream_crypt_get_total_out;
}
if (stream != NULL)
*stream = crypt;
return crypt;
}
void mz_stream_crypt_delete(void **stream)
{
mz_stream_crypt *crypt = NULL;
if (stream == NULL)
return;
crypt = (mz_stream_crypt *)*stream;
if (crypt != NULL)
free(crypt);
*stream = NULL;
}

View File

@@ -0,0 +1,54 @@
/* mz_strm_crypt.h -- Code for traditional PKWARE encryption
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 1998-2005 Gilles Vollant
Modifications for Info-ZIP crypting
http://www.winimage.com/zLibDll/minizip.html
Copyright (C) 2003 Terry Thorsen
This code is a modified version of crypting code in Info-ZIP distribution
Copyright (C) 1990-2000 Info-ZIP. All rights reserved.
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_STREAM_CRYPT_H
#define _MZ_STREAM_CRYPT_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
int32_t mz_stream_crypt_open(void *stream, const char *filename, int32_t mode);
int32_t mz_stream_crypt_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_crypt_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_crypt_tell(void *stream);
int32_t mz_stream_crypt_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_crypt_close(void *stream);
int32_t mz_stream_crypt_error(void *stream);
void mz_stream_crypt_set_password(void *stream, const char *password);
void mz_stream_crypt_set_verify(void *stream, uint8_t verify1, uint8_t verify2);
void mz_stream_crypt_get_verify(void *stream, uint8_t *verify1, uint8_t *verify2);
int64_t mz_stream_crypt_get_total_in(void *stream);
int64_t mz_stream_crypt_get_total_out(void *stream);
void* mz_stream_crypt_create(void **stream);
void mz_stream_crypt_delete(void **stream);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,249 @@
/* mz_strm_mem.c -- Stream for memory access
Version 2.0.0, October 4th, 2017
part of the MiniZip project
This interface is designed to access memory rather than files.
We do use a region of memory to put data in to and take it out of.
Based on Unzip ioapi.c version 0.22, May 19th, 2003
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2003 Justin Fletcher
Copyright (C) 1998-2003 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This file is under the same license as the Unzip tool it is distributed
with.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mz_error.h"
#include "mz_strm.h"
#include "mz_strm_mem.h"
/***************************************************************************/
typedef struct mz_stream_mem_s {
mz_stream stream;
char *buffer; // Memory buffer pointer
int32_t size; // Size of the memory buffer
int32_t limit; // Furthest we've written
int32_t position; // Current position in the memory
int8_t grow; // Memory buffer can grow
int32_t grow_size; // Size to grow when full
} mz_stream_mem;
/***************************************************************************/
int32_t mz_stream_mem_open(void *stream, const char *path, int32_t mode)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
if (mode & MZ_STREAM_MODE_CREATE)
{
if (mem->grow)
{
mem->size = mem->grow_size;
mem->buffer = (char *)malloc(mem->size);
}
// When writing we start with 0 bytes written
mem->limit = 0;
}
else
{
mem->limit = mem->size;
}
mem->position = 0;
return MZ_OK;
}
int32_t mz_stream_mem_is_open(void *stream)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
if (mem->buffer == NULL)
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_mem_read(void *stream, void *buf, int32_t size)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
if (size > mem->size - mem->position)
size = mem->size - mem->position;
memcpy(buf, mem->buffer + mem->position, size);
mem->position += size;
return size;
}
int32_t mz_stream_mem_write(void *stream, const void *buf, int32_t size)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
int32_t new_size = 0;
char *new_buf = NULL;
if (size == 0)
return size;
if (size > mem->size - mem->position)
{
if (mem->grow)
{
new_size = mem->size;
if (size < mem->grow_size)
new_size += mem->grow_size;
else
new_size += size;
new_buf = (char *)malloc(new_size);
memcpy(new_buf, mem->buffer, mem->size);
free(mem->buffer);
mem->buffer = new_buf;
mem->size = new_size;
}
else
{
size = mem->size - mem->position;
}
}
memcpy(mem->buffer + mem->position, buf, size);
mem->position += size;
if (mem->position > mem->limit)
mem->limit = mem->position;
return size;
}
int64_t mz_stream_mem_tell(void *stream)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
return mem->position;
}
int32_t mz_stream_mem_seek(void *stream, int64_t offset, int32_t origin)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
uint64_t new_pos = 0;
switch (origin)
{
case MZ_STREAM_SEEK_CUR:
new_pos = mem->position + offset;
break;
case MZ_STREAM_SEEK_END:
new_pos = mem->limit + offset;
break;
case MZ_STREAM_SEEK_SET:
new_pos = offset;
break;
default:
return MZ_STREAM_ERROR;
}
if (new_pos > mem->size)
return MZ_STREAM_ERROR;
mem->position = (uint32_t)new_pos;
return MZ_OK;
}
int32_t mz_stream_mem_close(void *stream)
{
// We never return errors
return MZ_OK;
}
int32_t mz_stream_mem_error(void *stream)
{
// We never return errors
return MZ_OK;
}
void mz_stream_mem_set_buffer(void *stream, void *buf, int32_t size)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
mem->buffer = buf;
mem->size = size;
}
int8_t mz_stream_mem_get_buffer(void *stream, void **buf)
{
return mz_stream_mem_get_buffer_at(stream, 0, buf);
}
int8_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, void **buf)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
if (buf == NULL || position < 0 || mem->size < position || mem->buffer == NULL)
return MZ_STREAM_ERROR;
*buf = mem->buffer + position;
return MZ_OK;
}
void mz_stream_mem_set_grow(void *stream, int8_t grow)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
mem->grow = grow;
}
void mz_stream_mem_set_grow_size(void *stream, int32_t grow_size)
{
mz_stream_mem *mem = (mz_stream_mem *)stream;
mem->grow_size = grow_size;
}
void *mz_stream_mem_create(void **stream)
{
mz_stream_mem *mem = NULL;
mem = (mz_stream_mem *)malloc(sizeof(mz_stream_mem));
if (mem != NULL)
{
memset(mem, 0, sizeof(mz_stream_mem));
mem->stream.open = mz_stream_mem_open;
mem->stream.is_open = mz_stream_mem_is_open;
mem->stream.read = mz_stream_mem_read;
mem->stream.write = mz_stream_mem_write;
mem->stream.tell = mz_stream_mem_tell;
mem->stream.seek = mz_stream_mem_seek;
mem->stream.close = mz_stream_mem_close;
mem->stream.error = mz_stream_mem_error;
mem->stream.create = mz_stream_mem_create;
mem->stream.delete = mz_stream_mem_delete;
mem->grow_size = 16384;
}
if (stream != NULL)
*stream = mem;
return mem;
}
void mz_stream_mem_delete(void **stream)
{
mz_stream_mem *mem = NULL;
if (stream == NULL)
return;
mem = (mz_stream_mem *)*stream;
if (mem != NULL)
{
if (mem->grow && mem->buffer != NULL)
free(mem->buffer);
free(mem);
}
*stream = NULL;
}

View File

@@ -0,0 +1,47 @@
/* mz_strm_mem.h -- Stream for memory access
part of MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2003 Justin Fletcher
Copyright (C) 1998-2003 Gilles Vollant
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_STREAM_MEM_H
#define _MZ_STREAM_MEM_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
int32_t mz_stream_mem_open(void *stream, const char *filename, int32_t mode);
int32_t mz_stream_mem_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_mem_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_mem_tell(void *stream);
int32_t mz_stream_mem_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_mem_close(void *stream);
int32_t mz_stream_mem_error(void *stream);
void mz_stream_mem_set_buffer(void *stream, void *buf, int32_t size);
int8_t mz_stream_mem_get_buffer(void *stream, void **buf);
int8_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, void **buf);
void mz_stream_mem_set_grow(void *stream, int8_t grow);
void mz_stream_mem_set_grow_size(void *stream, int32_t grow_size);
void* mz_stream_mem_create(void **stream);
void mz_stream_mem_delete(void **stream);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,225 @@
/* mz_strm_posix.c -- Stream for filesystem access for posix/linux
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson
http://result42.com
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined unix || defined __APPLE__
# include <unistd.h>
# include <utime.h>
# include <fcntl.h>
#endif
#include "mz_error.h"
#include "mz_strm.h"
#include "mz_strm_posix.h"
/***************************************************************************/
#if defined(USE_FILE32API)
# define fopen64 fopen
# define ftello64 ftell
# define fseeko64 fseek
#else
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
defined(__OpenBSD__) || defined(__APPLE__) || defined(__ANDROID__)
# define fopen64 fopen
# define ftello64 ftello
# define fseeko64 fseeko
# endif
# ifdef _MSC_VER
# define fopen64 fopen
# if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
# define ftello64 _ftelli64
# define fseeko64 _fseeki64
# else /* old MSC */
# define ftello64 ftell
# define fseeko64 fseek
# endif
# endif
#endif
/***************************************************************************/
typedef struct mz_stream_posix_s
{
mz_stream stream;
FILE *handle;
int16_t error;
} mz_stream_posix;
/***************************************************************************/
int32_t mz_stream_posix_open(void *stream, const char *path, int32_t mode)
{
mz_stream_posix *posix = (mz_stream_posix *)stream;
const char *mode_fopen = NULL;
if (path == NULL)
return MZ_STREAM_ERROR;
if ((mode & MZ_STREAM_MODE_READWRITE) == MZ_STREAM_MODE_READ)
mode_fopen = "rb";
else if (mode & MZ_STREAM_MODE_APPEND)
mode_fopen = "ab";
else if (mode & MZ_STREAM_MODE_CREATE)
mode_fopen = "wb";
else
return MZ_STREAM_ERROR;
posix->handle = fopen64(path, mode_fopen);
if (posix->handle == NULL)
{
posix->error = errno;
return MZ_STREAM_ERROR;
}
return MZ_OK;
}
int32_t mz_stream_posix_is_open(void *stream)
{
mz_stream_posix *posix = (mz_stream_posix*)stream;
if (posix->handle == NULL)
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_posix_read(void *stream, void *buf, int32_t size)
{
mz_stream_posix *posix = (mz_stream_posix*)stream;
int32_t read = (int32_t)fread(buf, 1, (size_t)size, posix->handle);
if (read < 0)
{
posix->error = ferror(posix->handle);
return MZ_STREAM_ERROR;
}
return read;
}
int32_t mz_stream_posix_write(void *stream, const void *buf, int32_t size)
{
mz_stream_posix *posix = (mz_stream_posix*)stream;
int32_t written = (int32_t)fwrite(buf, 1, (size_t)size, posix->handle);
if (written < 0)
{
posix->error = ferror(posix->handle);
return MZ_STREAM_ERROR;
}
return written;
}
int64_t mz_stream_posix_tell(void *stream)
{
mz_stream_posix *posix = (mz_stream_posix*)stream;
int64_t position = ftello64(posix->handle);
if (position == -1)
{
posix->error = ferror(posix->handle);
return MZ_STREAM_ERROR;
}
return position;
}
int32_t mz_stream_posix_seek(void *stream, int64_t offset, int32_t origin)
{
mz_stream_posix *posix = (mz_stream_posix*)stream;
int32_t fseek_origin = 0;
switch (origin)
{
case MZ_STREAM_SEEK_CUR:
fseek_origin = SEEK_CUR;
break;
case MZ_STREAM_SEEK_END:
fseek_origin = SEEK_END;
break;
case MZ_STREAM_SEEK_SET:
fseek_origin = SEEK_SET;
break;
default:
return MZ_STREAM_ERROR;
}
if (fseeko64(posix->handle, offset, fseek_origin) != 0)
{
posix->error = ferror(posix->handle);
return MZ_STREAM_ERROR;
}
return MZ_OK;
}
int32_t mz_stream_posix_close(void *stream)
{
mz_stream_posix *posix = (mz_stream_posix*)stream;
int32_t closed = fclose(posix->handle);
posix->handle = NULL;
if (closed != 0)
{
posix->error = errno;
return MZ_STREAM_ERROR;
}
return MZ_OK;
}
int32_t mz_stream_posix_error(void *stream)
{
mz_stream_posix *posix = (mz_stream_posix*)stream;
return posix->error;
}
void *mz_stream_posix_create(void **stream)
{
mz_stream_posix *posix = NULL;
posix = (mz_stream_posix *)malloc(sizeof(mz_stream_posix));
if (posix != NULL)
{
posix->stream.open = mz_stream_posix_open;
posix->stream.is_open = mz_stream_posix_is_open;
posix->stream.read = mz_stream_posix_read;
posix->stream.write = mz_stream_posix_write;
posix->stream.tell = mz_stream_posix_tell;
posix->stream.seek = mz_stream_posix_seek;
posix->stream.close = mz_stream_posix_close;
posix->stream.error = mz_stream_posix_error;
posix->stream.create = mz_stream_posix_create;
posix->stream.delete = mz_stream_posix_delete;
}
if (stream != NULL)
*stream = posix;
return posix;
}
void mz_stream_posix_delete(void **stream)
{
mz_stream_posix *posix = NULL;
if (stream == NULL)
return;
posix = (mz_stream_posix *)*stream;
if (posix != NULL)
free(posix);
*stream = NULL;
}

View File

@@ -0,0 +1,62 @@
/* mz_strm_posix.h -- Stream for filesystem access for posix/linux
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2009-2010 Mathias Svensson
Modifications for Zip64 support
http://result42.com
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_STREAM_POSIX_H
#define _MZ_STREAM_POSIX_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
int32_t mz_stream_posix_open(void *stream, const char *path, int32_t mode);
int32_t mz_stream_posix_is_open(void *stream);
int32_t mz_stream_posix_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_posix_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_posix_tell(void *stream);
int32_t mz_stream_posix_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_posix_close(void *stream);
int32_t mz_stream_posix_error(void *stream);
void* mz_stream_posix_create(void **stream);
void mz_stream_posix_delete(void **stream);
/***************************************************************************/
#if !defined(_WIN32) && !defined(USEWIN32IOAPI)
#define mz_stream_os_open mz_stream_posix_open
#define mz_stream_os_is_open mz_stream_posix_is_open
#define mz_stream_os_read mz_stream_posix_read
#define mz_stream_os_write mz_stream_posix_write
#define mz_stream_os_tell mz_stream_posix_tell
#define mz_stream_os_seek mz_stream_posix_seek
#define mz_stream_os_close mz_stream_posix_close
#define mz_stream_os_error mz_stream_posix_error
#define mz_stream_os_create mz_stream_posix_create
#define mz_stream_os_delete mz_stream_posix_delete
#endif
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,509 @@
/* mz_strm_zlib.c -- Stream for zlib inflate/deflate
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "zlib.h"
#include "mz_error.h"
#include "mz_strm.h"
#include "mz_strm_zlib.h"
/***************************************************************************/
#ifndef DEF_MEM_LEVEL
# if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
# else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
# endif
#endif
/***************************************************************************/
typedef struct mz_stream_zlib_s {
mz_stream stream;
z_stream zstream;
uint8_t buffer[UINT16_MAX];
int32_t buffer_len;
int64_t total_in;
int64_t total_out;
int64_t max_total_in;
int8_t initialized;
int16_t level;
int16_t window_bits;
int16_t mem_level;
int16_t strategy;
int16_t mode;
int16_t error;
} mz_stream_zlib;
/***************************************************************************/
int32_t mz_stream_zlib_open(void *stream, const char *path, int32_t mode)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
int16_t window_bits = 0;
zlib->zstream.data_type = Z_BINARY;
zlib->zstream.zalloc = Z_NULL;
zlib->zstream.zfree = Z_NULL;
zlib->zstream.opaque = Z_NULL;
zlib->zstream.total_in = 0;
zlib->zstream.total_out = 0;
zlib->total_in = 0;
zlib->total_out = 0;
window_bits = zlib->window_bits;
if (window_bits > 0)
window_bits = -window_bits;
if (mode & MZ_STREAM_MODE_READ)
{
zlib->zstream.next_in = zlib->buffer;
zlib->zstream.avail_in = 0;
zlib->error = inflateInit2(&zlib->zstream, window_bits);
}
else if (mode & MZ_STREAM_MODE_WRITE)
{
zlib->zstream.next_out = zlib->buffer;
zlib->zstream.avail_out = sizeof(zlib->buffer);
zlib->error = deflateInit2(&zlib->zstream, (int8_t)zlib->level, Z_DEFLATED, window_bits, zlib->mem_level, zlib->strategy);
}
if (zlib->error != Z_OK)
return MZ_STREAM_ERROR;
zlib->initialized = 1;
zlib->mode = mode;
return MZ_OK;
}
int32_t mz_stream_zlib_is_open(void *stream)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
if (zlib->initialized != 1)
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_zlib_read(void *stream, void *buf, int32_t size)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
uint64_t total_out_before = 0;
uint64_t total_out_after = 0;
uint32_t out_bytes = 0;
uint32_t total_out = 0;
int32_t bytes_to_read = 0;
int32_t read = 0;
int16_t err = Z_OK;
zlib->zstream.next_out = (uint8_t*)buf;
zlib->zstream.avail_out = (uint16_t)size;
do
{
if (zlib->zstream.avail_in == 0)
{
bytes_to_read = sizeof(zlib->buffer);
if (zlib->max_total_in > 0)
{
if ((zlib->max_total_in - zlib->total_in) < sizeof(zlib->buffer))
bytes_to_read = (int32_t)(zlib->max_total_in - zlib->total_in);
}
read = mz_stream_read(zlib->stream.base, zlib->buffer, bytes_to_read);
if (read < 0)
{
zlib->error = Z_STREAM_ERROR;
break;
}
if (read == 0)
break;
zlib->total_in += read;
zlib->zstream.next_in = zlib->buffer;
zlib->zstream.avail_in = read;
}
total_out_before = zlib->zstream.total_out;
err = inflate(&zlib->zstream, Z_SYNC_FLUSH);
if ((err >= Z_OK) && (zlib->zstream.msg != NULL))
{
zlib->error = Z_DATA_ERROR;
break;
}
total_out_after = zlib->zstream.total_out;
out_bytes = (uint32_t)(total_out_after - total_out_before);
total_out += out_bytes;
if (err == Z_STREAM_END)
{
break;
}
if (err != Z_OK)
{
zlib->error = err;
break;
}
}
while (zlib->zstream.avail_out > 0);
zlib->total_out += total_out;
return total_out;
}
int32_t mz_stream_zlib_flush(void *stream)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
if (mz_stream_write(zlib->stream.base, zlib->buffer, zlib->buffer_len) != zlib->buffer_len)
return MZ_STREAM_ERROR;
return MZ_OK;
}
uint32_t mz_stream_zlib_deflate(void *stream, int flush)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
uint64_t total_out_before = 0;
uint64_t total_out_after = 0;
uint32_t out_bytes = 0;
int16_t err = Z_OK;
total_out_before = zlib->zstream.total_out;
err = deflate(&zlib->zstream, flush);
total_out_after = zlib->zstream.total_out;
out_bytes = (uint32_t)(total_out_after - total_out_before);
if (err != Z_OK && err != Z_STREAM_END)
{
zlib->error = err;
return MZ_STREAM_ERROR;
}
return out_bytes;
}
int32_t mz_stream_zlib_write(void *stream, const void *buf, int32_t size)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
uint32_t out_bytes = 0;
uint32_t total_out = 0;
zlib->zstream.next_in = (uint8_t*)buf;
zlib->zstream.avail_in = size;
while ((zlib->error == Z_OK) && (zlib->zstream.avail_in > 0))
{
if (zlib->zstream.avail_out == 0)
{
if (mz_stream_zlib_flush(zlib) != MZ_OK)
{
zlib->error = Z_STREAM_ERROR;
return 0;
}
zlib->zstream.avail_out = sizeof(zlib->buffer);
zlib->zstream.next_out = zlib->buffer;
zlib->buffer_len = 0;
}
out_bytes = mz_stream_zlib_deflate(stream, Z_NO_FLUSH);
total_out += out_bytes;
zlib->buffer_len += out_bytes;
}
zlib->total_in += size;
zlib->total_out += total_out;
return size;
}
int64_t mz_stream_zlib_tell(void *stream)
{
return MZ_STREAM_ERROR;
}
int32_t mz_stream_zlib_seek(void *stream, int64_t offset, int32_t origin)
{
return MZ_STREAM_ERROR;
}
int32_t mz_stream_zlib_close(void *stream)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
uint32_t out_bytes = 0;
if (zlib->mode & MZ_STREAM_MODE_READ)
{
inflateEnd(&zlib->zstream);
}
else if (zlib->mode & MZ_STREAM_MODE_WRITE)
{
out_bytes = mz_stream_zlib_deflate(stream, Z_FINISH);
zlib->buffer_len += out_bytes;
zlib->total_out += out_bytes;
mz_stream_zlib_flush(stream);
zlib->error = deflateEnd(&zlib->zstream);
}
zlib->initialized = 0;
if (zlib->error != Z_OK)
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_zlib_error(void *stream)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
return zlib->error;
}
void mz_stream_zlib_set_level(void *stream, int16_t level)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
zlib->level = level;
}
void mz_stream_zlib_set_window_bits(void *stream, int16_t window_bits)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
if (window_bits == 0)
window_bits = -MAX_WBITS;
zlib->window_bits = window_bits;
}
void mz_stream_zlib_set_mem_level(void *stream, int16_t mem_level)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
if (mem_level == 0)
mem_level = DEF_MEM_LEVEL;
zlib->mem_level = mem_level;
}
void mz_stream_zlib_set_strategy(void *stream, int16_t strategy)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
zlib->strategy = strategy;
}
int64_t mz_stream_zlib_get_total_in(void *stream)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
return zlib->total_in;
}
int64_t mz_stream_zlib_get_total_out(void *stream)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
return zlib->total_out;
}
void mz_stream_zlib_set_max_total_in(void *stream, int64_t max_total_in)
{
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
zlib->max_total_in = max_total_in;
}
void *mz_stream_zlib_create(void **stream)
{
mz_stream_zlib *zlib = NULL;
zlib = (mz_stream_zlib *)malloc(sizeof(mz_stream_zlib));
if (zlib != NULL)
{
memset(zlib, 0, sizeof(mz_stream_zlib));
zlib->stream.open = mz_stream_zlib_open;
zlib->stream.is_open = mz_stream_zlib_is_open;
zlib->stream.read = mz_stream_zlib_read;
zlib->stream.write = mz_stream_zlib_write;
zlib->stream.tell = mz_stream_zlib_tell;
zlib->stream.seek = mz_stream_zlib_seek;
zlib->stream.close = mz_stream_zlib_close;
zlib->stream.error = mz_stream_zlib_error;
zlib->stream.create = mz_stream_zlib_create;
zlib->stream.delete = mz_stream_zlib_delete;
zlib->stream.get_total_in = mz_stream_zlib_get_total_in;
zlib->stream.get_total_out = mz_stream_zlib_get_total_out;
zlib->level = Z_DEFAULT_COMPRESSION;
zlib->window_bits = -MAX_WBITS;
zlib->mem_level = DEF_MEM_LEVEL;
zlib->strategy = Z_DEFAULT_STRATEGY;
}
if (stream != NULL)
*stream = zlib;
return zlib;
}
void mz_stream_zlib_delete(void **stream)
{
mz_stream_zlib *zlib = NULL;
if (stream == NULL)
return;
zlib = (mz_stream_zlib *)*stream;
if (zlib != NULL)
free(zlib);
*stream = NULL;
}
/***************************************************************************/
typedef struct mz_stream_crc32_s {
mz_stream stream;
int8_t initialized;
int32_t value;
int64_t total_in;
int64_t total_out;
} mz_stream_crc32;
/***************************************************************************/
int32_t mz_stream_crc32_open(void *stream, const char *path, int32_t mode)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
crc32->initialized = 1;
crc32->value = 0;
return MZ_OK;
}
int32_t mz_stream_crc32_is_open(void *stream)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
if (crc32->initialized != 1)
return MZ_STREAM_ERROR;
return MZ_OK;
}
int32_t mz_stream_crc32_read(void *stream, void *buf, int32_t size)
{
mz_stream_crc32 *crc32x = (mz_stream_crc32 *)stream;
int32_t read = mz_stream_read(crc32x->stream.base, buf, size);
if (read > 0)
crc32x->value = (int32_t)crc32(crc32x->value, buf, read);
crc32x->total_in += read;
return read;
}
int32_t mz_stream_crc32_write(void *stream, const void *buf, int32_t size)
{
mz_stream_crc32 *crc32x = (mz_stream_crc32 *)stream;
int32_t written = 0;
crc32x->value = (int32_t)crc32(crc32x->value, buf, size);
written = mz_stream_write(crc32x->stream.base, buf, size);
crc32x->total_out += written;
return written;
}
int64_t mz_stream_crc32_tell(void *stream)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
return mz_stream_tell(crc32->stream.base);
}
int32_t mz_stream_crc32_seek(void *stream, int64_t offset, int32_t origin)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
return mz_stream_seek(crc32->stream.base, offset, origin);
}
int32_t mz_stream_crc32_close(void *stream)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
crc32->initialized = 0;
return MZ_OK;
}
int32_t mz_stream_crc32_error(void *stream)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
return mz_stream_error(crc32->stream.base);
}
int32_t mz_stream_crc32_get_value(void *stream)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
return crc32->value;
}
int64_t mz_stream_crc32_get_total_in(void *stream)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
return crc32->total_in;
}
int64_t mz_stream_crc32_get_total_out(void *stream)
{
mz_stream_crc32 *crc32 = (mz_stream_crc32 *)stream;
return crc32->total_out;
}
void *mz_stream_crc32_create(void **stream)
{
mz_stream_crc32 *crc32 = NULL;
crc32 = (mz_stream_crc32 *)malloc(sizeof(mz_stream_crc32));
if (crc32 != NULL)
{
memset(crc32, 0, sizeof(mz_stream_crc32));
crc32->stream.open = mz_stream_crc32_open;
crc32->stream.is_open = mz_stream_crc32_is_open;
crc32->stream.read = mz_stream_crc32_read;
crc32->stream.write = mz_stream_crc32_write;
crc32->stream.tell = mz_stream_crc32_tell;
crc32->stream.seek = mz_stream_crc32_seek;
crc32->stream.close = mz_stream_crc32_close;
crc32->stream.error = mz_stream_crc32_error;
crc32->stream.create = mz_stream_crc32_create;
crc32->stream.delete = mz_stream_crc32_delete;
crc32->stream.get_total_in = mz_stream_crc32_get_total_in;
crc32->stream.get_total_out = mz_stream_crc32_get_total_out;
}
if (stream != NULL)
*stream = crc32;
return crc32;
}
void mz_stream_crc32_delete(void **stream)
{
mz_stream_crc32 *crc32 = NULL;
if (stream == NULL)
return;
crc32 = (mz_stream_crc32 *)*stream;
if (crc32 != NULL)
free(crc32);
*stream = NULL;
}

View File

@@ -0,0 +1,65 @@
/* mz_strm_zlib.h -- Stream for zlib inflate/deflate
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_STREAM_ZLIB_H
#define _MZ_STREAM_ZLIB_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************/
int32_t mz_stream_zlib_open(void *stream, const char *filename, int32_t mode);
int32_t mz_stream_zlib_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_zlib_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_zlib_tell(void *stream);
int32_t mz_stream_zlib_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_zlib_close(void *stream);
int32_t mz_stream_zlib_error(void *stream);
void mz_stream_zlib_set_level(void *stream, int16_t level);
void mz_stream_zlib_set_window_bits(void *stream, int16_t window_bits);
void mz_stream_zlib_set_mem_level(void *stream, int16_t mem_level);
void mz_stream_zlib_set_strategy(void *stream, int16_t strategy);
int64_t mz_stream_zlib_get_total_in(void *stream);
int64_t mz_stream_zlib_get_total_out(void *stream);
void mz_stream_zlib_set_max_total_in(void *stream, int64_t max_total_in);
void* mz_stream_zlib_create(void **stream);
void mz_stream_zlib_delete(void **stream);
/***************************************************************************/
int32_t mz_stream_crc32_open(void *stream, const char *filename, int32_t mode);
int32_t mz_stream_crc32_read(void *stream, void *buf, int32_t size);
int32_t mz_stream_crc32_write(void *stream, const void *buf, int32_t size);
int64_t mz_stream_crc32_tell(void *stream);
int32_t mz_stream_crc32_seek(void *stream, int64_t offset, int32_t origin);
int32_t mz_stream_crc32_close(void *stream);
int32_t mz_stream_crc32_error(void *stream);
int32_t mz_stream_crc32_get_value(void *stream);
int64_t mz_stream_crc32_get_total_in(void *stream);
int64_t mz_stream_crc32_get_total_out(void *stream);
void* mz_stream_crc32_create(void **stream);
void mz_stream_crc32_delete(void **stream);
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,143 @@
/* mz_unzip.h -- Zip manipulation
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2009-2010 Mathias Svensson
Modifications for Zip64 support on both zip and unzip
http://result42.com
Copyright (C) 2007-2008 Even Rouault
Modifications of Unzip for Zip64
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_UNZIP_H
#define _MZ_UNZIP_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ZLIB_H
#include "zlib.h"
#endif
#include "mz_strm.h"
/***************************************************************************/
#ifndef MZ_METHOD
# define MZ_METHOD_RAW (0)
# define MZ_METHOD_DEFLATE (8)
# define MZ_METHOD_BZIP2 (12)
# define MZ_METHOD_LZMA (14)
#endif
/***************************************************************************/
// Global data about the zip file that come from the end of central dir
typedef struct mz_unzip_global_s
{
uint64_t number_entry; // total number of entries in the central dir on this disk
uint32_t number_disk_with_CD; // number the the disk with central dir, used for spanning ZIP
uint16_t comment_size; // size of the global comment of the zip file
} mz_unzip_global;
// Info about a file in the zip file at the central directory
typedef struct mz_unzip_file_s
{
uint16_t version; // version made by 2 bytes
uint16_t version_needed; // version needed to extract 2 bytes
uint16_t flag; // general purpose bit flag 2 bytes
uint16_t compression_method; // compression method 2 bytes
uint32_t dos_date; // last mod file date in Dos fmt 4 bytes
uint32_t crc; // crc-32 4 bytes
uint64_t compressed_size; // compressed size 8 bytes
uint64_t uncompressed_size; // uncompressed size 8 bytes
uint16_t filename_size; // filename length 2 bytes
uint16_t extrafield_size; // extra field length 2 bytes
uint16_t comment_size; // file comment length 2 bytes
uint32_t disk_num_start; // disk number start 4 bytes
uint16_t internal_fa; // internal file attributes 2 bytes
uint32_t external_fa; // external file attributes 4 bytes
uint64_t disk_offset; // relative offset of local header 8 bytes
char *filename; // filename string
uint8_t *extrafield; // extrafield data
char *comment; // comment string
} mz_unzip_file;
/***************************************************************************/
// Opening and close a zip file
// Open a zip file
extern void* ZEXPORT mz_unzip_open(void *stream);
// Close a zip file
extern int ZEXPORT mz_unzip_close(void *handle);
// Get global info about the zip file
extern int ZEXPORT mz_unzip_get_global_info(void *handle, mz_unzip_global *global_info);
// Get the global comment string of the zip file, in the comment buffer
extern int ZEXPORT mz_unzip_get_global_comment(void *handle, char *comment, uint16_t comment_size);
/***************************************************************************/
// Reading the content of the current zip file, you can open it, read it, and close it
extern int ZEXPORT mz_unzip_entry_open(void *handle, int raw, const char *password);
// Open for reading data the current file in the zip file
extern int ZEXPORT mz_unzip_entry_read(void *handle, void *buf, uint32_t len);
// Read bytes from the current file
extern int ZEXPORT mz_unzip_entry_get_info(void *handle, mz_unzip_file **file_info);
// Get info about the current file
extern int ZEXPORT mz_unzip_entry_get_extrafield_local(void *handle, void *buf, uint32_t len);
// Read extra field from the current file
//
// This is the local-header version of the extra field (sometimes, there is
// more info in the local-header version than in the central-header)
//
// if buf == NULL, it return the size of the local extra field
// if buf != NULL, len is the size of the buffer, the extra header is copied in buf.
//
// return number of bytes copied in buf, or (if <0) the error code
extern int ZEXPORT mz_unzip_entry_close(void *handle);
// Close the file in zip
/***************************************************************************/
// Navigate the directory of the zip file
typedef int (*mz_filename_compare_cb)(void *handle, const char *filename1, const char *filename2);
extern int ZEXPORT mz_unzip_locate_entry(void *file, const char *filename, mz_filename_compare_cb filename_compare_cb);
// Locate the file with the specified name in the zip file
//
// if filename_compare_cb == NULL, it uses strcmp
//
// return MZ_OK if the file is found (it becomes the current file)
// return MZ_END_OF_LIST if the file is not found
extern int ZEXPORT mz_unzip_goto_first_entry(void *handle);
// Go to the first entry in the zip file
extern int ZEXPORT mz_unzip_goto_next_entry(void *handle);
// Go to the next entry in the zip file or MZ_END_OF_LIST if reaching the end
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* _UNZ_H */

988
SSZipArchive/minizip/mz_zip.c Executable file
View File

@@ -0,0 +1,988 @@
/* zip.c -- Zip manipulation
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2010-2017 Nathan Moinvaziri
Modifications for AES, PKWARE disk spanning
https://github.com/nmoinvaz/minizip
Copyright (C) 2009-2010 Mathias Svensson
Modifications for Zip64 support
http://result42.com
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include "zlib.h"
#include "mz_error.h"
#include "mz_strm.h"
#ifdef HAVE_AES
# include "mz_strm_aes.h"
#endif
#ifdef HAVE_BZIP2
# include "mz_strm_bzip.h"
#endif
#ifndef NOCRYPT
# include "mz_strm_crypt.h"
#endif
#ifdef HAVE_LZMA
# include "mz_strm_lzma.h"
#endif
#include "mz_strm_mem.h"
#include "mz_strm_zlib.h"
#include "mz_zip.h"
/***************************************************************************/
#define DISKHEADERMAGIC (0x08074b50)
#define LOCALHEADERMAGIC (0x04034b50)
#define CENTRALHEADERMAGIC (0x02014b50)
#define ENDHEADERMAGIC (0x06054b50)
#define ZIP64ENDHEADERMAGIC (0x06064b50)
#define ZIP64ENDLOCHEADERMAGIC (0x07064b50)
#define DATADESCRIPTORMAGIC (0x08074b50)
#define SIZECENTRALHEADER (0x2e) // 46
#define SIZECENTRALHEADERLOCATOR (0x14) // 20
#define SIZECENTRALDIRITEM (0x2e)
#define SIZEZIPLOCALHEADER (0x1e)
#ifndef BUFREADCOMMENT
# define BUFREADCOMMENT (0x400)
#endif
/***************************************************************************/
typedef struct mz_zip_s
{
mz_zip_file file_info;
mz_zip_crypt crypt_info;
mz_zip_compress compress_info;
void *stream; // main stream
void *cd_stream; // memory stream for central directory
void *compress_stream; // compression stream
void *crc32_stream; // crc32 stream
void *crypt_stream; // encryption stream
uint64_t pos_local_header; // offset of the local header of the file currently writing
uint64_t add_position_when_writting_offset;
uint64_t number_entry;
uint16_t entry_opened; // 1 if a file in the zip is currently writ.
uint64_t disk_size; // size of each disk
uint32_t number_disk; // number of the current disk, used for spanning ZIP
uint32_t number_disk_with_CD; // number the the disk with central dir, used for spanning ZIP
#ifndef NO_ADDFILEINEXISTINGZIP
char *comment;
#endif
} mz_zip;
/***************************************************************************/
// Locate the central directory of a zip file (at the end, just before the global comment)
static uint64_t mz_zip_search_cd(void *stream)
{
uint8_t buf[BUFREADCOMMENT + 4];
uint64_t file_size = 0;
uint64_t back_read = 4;
uint64_t max_back = UINT16_MAX; // maximum size of global comment
uint64_t pos_found = 0;
uint32_t read_size = 0;
uint64_t read_pos = 0;
uint32_t i = 0;
if (mz_stream_seek(stream, 0, MZ_STREAM_SEEK_END) != MZ_OK)
return 0;
file_size = mz_stream_tell(stream);
if (max_back > file_size)
max_back = file_size;
while (back_read < max_back)
{
if (back_read + BUFREADCOMMENT > max_back)
back_read = max_back;
else
back_read += BUFREADCOMMENT;
read_pos = file_size-back_read;
read_size = ((BUFREADCOMMENT + 4) < (file_size - read_pos)) ?
(BUFREADCOMMENT + 4) : (uint32_t)(file_size - read_pos);
if (mz_stream_seek(stream, read_pos, MZ_STREAM_SEEK_SET) != MZ_OK)
break;
if (mz_stream_read(stream, buf, read_size) != read_size)
break;
for (i = read_size - 3; (i--) > 0;)
{
if ((*(buf + i)) == (ENDHEADERMAGIC & 0xff) &&
(*(buf + i + 1)) == (ENDHEADERMAGIC >> 8 & 0xff) &&
(*(buf + i + 2)) == (ENDHEADERMAGIC >> 16 & 0xff) &&
(*(buf + i + 3)) == (ENDHEADERMAGIC >> 24 & 0xff))
{
pos_found = read_pos + i;
break;
}
}
if (pos_found != 0)
break;
}
return pos_found;
}
// Locate the central directory 64 of a zip file (at the end, just before the global comment)
static uint64_t mz_zip_search_zip64_cd(void *stream, const uint64_t endcentraloffset)
{
uint64_t offset = 0;
uint32_t value32 = 0;
// Zip64 end of central directory locator
if (mz_stream_seek(stream, endcentraloffset - SIZECENTRALHEADERLOCATOR, MZ_STREAM_SEEK_SET) != MZ_OK)
return 0;
// Read locator signature
if (mz_stream_read_uint32(stream, &value32) != MZ_OK)
return 0;
if (value32 != ZIP64ENDLOCHEADERMAGIC)
return 0;
// Number of the disk with the start of the zip64 end of central directory
if (mz_stream_read_uint32(stream, &value32) != MZ_OK)
return 0;
// Relative offset of the zip64 end of central directory record
if (mz_stream_read_uint64(stream, &offset) != MZ_OK)
return 0;
// Total number of disks
if (mz_stream_read_uint32(stream, &value32) != MZ_OK)
return 0;
// Goto end of central directory record
if (mz_stream_seek(stream, offset, MZ_STREAM_SEEK_SET) != 0)
return 0;
// The signature
if (mz_stream_read_uint32(stream, &value32) != MZ_OK)
return 0;
if (value32 != ZIP64ENDHEADERMAGIC)
return 0;
return offset;
}
extern void* ZEXPORT mz_zip_open(uint8_t open_existing, uint64_t disk_size, void *stream)
{
mz_zip *zip = NULL;
#ifndef NO_ADDFILEINEXISTINGZIP
uint64_t byte_before_the_zipfile = 0; // byte before the zip file, (>0 for sfx)
uint64_t size_central_dir = 0; // size of the central directory
uint64_t offset_central_dir = 0; // offset of start of central directory
uint64_t number_entry_CD = 0; // total number of entries in the central dir
uint64_t number_entry = 0;
uint64_t central_pos = 0;
uint16_t value16 = 0;
uint32_t value32 = 0;
uint64_t value64 = 0;
uint16_t comment_size = 0;
#endif
int16_t err = MZ_OK;
zip = (mz_zip*)malloc(sizeof(mz_zip));
if (zip == NULL)
return NULL;
memset(zip, 0, sizeof(mz_zip));
zip->stream = stream;
zip->disk_size = disk_size;
mz_stream_mem_create(&zip->cd_stream);
mz_stream_mem_set_grow(zip->cd_stream, 1);
mz_stream_mem_open(zip->cd_stream, NULL, MZ_STREAM_MODE_CREATE);
#ifndef NO_ADDFILEINEXISTINGZIP
// Add file in a zip file
if (open_existing)
{
// Read and cache central directory records
central_pos = mz_zip_search_cd(zip->stream);
// Disable to allow appending to empty ZIP archive (must be standard zip, not zip64)
// if (central_pos == 0)
// err = MZ_FORMAT_ERROR;
if (err == MZ_OK)
{
// Read end of central directory info
if (mz_stream_seek(zip->stream, central_pos, MZ_STREAM_SEEK_SET) != MZ_OK)
err = MZ_STREAM_ERROR;
// The signature, already checked
if (mz_stream_read_uint32(zip->stream, &value32) != MZ_OK)
err = MZ_STREAM_ERROR;
// Number of this disk
if (mz_stream_read_uint16(zip->stream, &value16) != MZ_OK)
err = MZ_STREAM_ERROR;
zip->number_disk = value16;
// Number of the disk with the start of the central directory
if (mz_stream_read_uint16(zip->stream, &value16) != MZ_OK)
err = MZ_STREAM_ERROR;
zip->number_disk_with_CD = value16;
// Total number of entries in the central dir on this disk
number_entry = 0;
if (mz_stream_read_uint16(zip->stream, &value16) != MZ_OK)
err = MZ_STREAM_ERROR;
else
number_entry = value16;
// Total number of entries in the central dir
number_entry_CD = 0;
if (mz_stream_read_uint16(zip->stream, &value16) != MZ_OK)
err = MZ_STREAM_ERROR;
else
number_entry_CD = value16;
if (number_entry_CD != number_entry)
err = MZ_FORMAT_ERROR;
// Size of the central directory
size_central_dir = 0;
if (mz_stream_read_uint32(zip->stream, &value32) != MZ_OK)
err = MZ_STREAM_ERROR;
else
size_central_dir = value32;
// Offset of start of central directory with respect to the starting disk number
offset_central_dir = 0;
if (mz_stream_read_uint32(zip->stream, &value32) != MZ_OK)
err = MZ_STREAM_ERROR;
else
offset_central_dir = value32;
// Zipfile global comment length
if (mz_stream_read_uint16(zip->stream, &comment_size) != MZ_OK)
err = MZ_STREAM_ERROR;
if ((err == MZ_OK) && ((number_entry_CD == UINT16_MAX) || (offset_central_dir == UINT32_MAX)))
{
// Format should be Zip64, as the central directory or file size is too large
central_pos = mz_zip_search_zip64_cd(zip->stream, central_pos);
if (central_pos)
{
if (mz_stream_seek(zip->stream, central_pos, MZ_STREAM_SEEK_SET) != 0)
err = MZ_STREAM_ERROR;
// The signature, already checked
if (mz_stream_read_uint32(zip->stream, &value32) != MZ_OK)
err = MZ_STREAM_ERROR;
// Size of zip64 end of central directory record
if (mz_stream_read_uint64(zip->stream, &value64) != MZ_OK)
err = MZ_STREAM_ERROR;
// Version made by
if (mz_stream_read_uint16(zip->stream, &value16) != MZ_OK)
err = MZ_STREAM_ERROR;
// Version needed to extract
if (mz_stream_read_uint16(zip->stream, &value16) != MZ_OK)
err = MZ_STREAM_ERROR;
// Number of this disk
if (mz_stream_read_uint32(zip->stream, &zip->number_disk) != MZ_OK)
err = MZ_STREAM_ERROR;
// Number of the disk with the start of the central directory
if (mz_stream_read_uint32(zip->stream, &zip->number_disk_with_CD) != MZ_OK)
err = MZ_STREAM_ERROR;
// Total number of entries in the central directory on this disk
if (mz_stream_read_uint64(zip->stream, &number_entry) != MZ_OK)
err = MZ_STREAM_ERROR;
// Total number of entries in the central directory
if (mz_stream_read_uint64(zip->stream, &number_entry_CD) != MZ_OK)
err = MZ_STREAM_ERROR;
if (number_entry_CD != number_entry)
err = MZ_FORMAT_ERROR;
// Size of the central directory
if (mz_stream_read_uint64(zip->stream, &size_central_dir) != MZ_OK)
err = MZ_STREAM_ERROR;
// Offset of start of central directory with respect to the starting disk number
if (mz_stream_read_uint64(zip->stream, &offset_central_dir) != MZ_OK)
err = MZ_STREAM_ERROR;
}
else
{
err = MZ_FORMAT_ERROR;
}
}
}
if (err == MZ_OK)
{
if (central_pos < offset_central_dir + size_central_dir)
err = MZ_FORMAT_ERROR;
}
if ((err == MZ_OK) && (comment_size > 0))
{
zip->comment = (char *)malloc(comment_size + 1);
if (zip->comment)
{
if (mz_stream_read(zip->stream, zip->comment, comment_size) != comment_size)
err = MZ_STREAM_ERROR;
zip->comment[comment_size] = 0;
}
}
if (err == MZ_OK)
{
byte_before_the_zipfile = central_pos - (offset_central_dir + size_central_dir);
zip->add_position_when_writting_offset = byte_before_the_zipfile;
// Store central directory in memory
if (mz_stream_seek(zip->stream, offset_central_dir + byte_before_the_zipfile, MZ_STREAM_SEEK_SET) != MZ_OK)
err = MZ_STREAM_ERROR;
if (mz_stream_copy(zip->cd_stream, zip->stream, (uint32_t)size_central_dir) != MZ_OK)
err = MZ_STREAM_ERROR;
zip->number_entry = number_entry_CD;
if (mz_stream_seek(zip->stream, offset_central_dir + byte_before_the_zipfile, MZ_STREAM_SEEK_SET) != MZ_OK)
err = MZ_STREAM_ERROR;
}
}
#endif
if (err != MZ_OK)
{
mz_stream_close(zip->cd_stream);
mz_stream_delete(&zip->cd_stream);
#ifndef NO_ADDFILEINEXISTINGZIP
if (zip->comment)
free(zip->comment);
#endif
free(zip);
return NULL;
}
return zip;
}
extern int ZEXPORT mz_zip_get_global_comment(void *handle, const char **global_comment)
{
mz_zip *zip = NULL;
if (handle == NULL || global_comment == NULL)
return MZ_PARAM_ERROR;
zip = (mz_zip*)handle;
*global_comment = zip->comment;
return MZ_OK;
}
extern int ZEXPORT mz_zip_entry_open(void *handle, const mz_zip_file *file_info,
const mz_zip_compress *compress_info, const mz_zip_crypt *crypt_info)
{
mz_zip *zip = NULL;
uint16_t filename_size = 0;
uint16_t version_needed = 0;
int16_t err = MZ_OK;
#ifdef NOCRYPT
if (password != NULL)
return MZ_PARAM_ERROR;
#endif
if (handle == NULL)
return MZ_PARAM_ERROR;
if (file_info == NULL || file_info->filename == NULL)
return MZ_PARAM_ERROR;
if (compress_info == NULL)
return MZ_PARAM_ERROR;
if (crypt_info == NULL)
return MZ_PARAM_ERROR;
switch (compress_info->method)
{
case MZ_METHOD_RAW:
case MZ_METHOD_DEFLATE:
#ifdef HAVE_BZIP2
case MZ_METHOD_BZIP2:
#endif
#if HAVE_LZMA
case MZ_METHOD_LZMA:
#endif
err = MZ_OK;
break;
default:
return MZ_PARAM_ERROR;
}
zip = (mz_zip*)handle;
if (zip->entry_opened == 1)
{
err = mz_zip_entry_close(handle);
if (err != MZ_OK)
return err;
}
memcpy(&zip->file_info, file_info, sizeof(mz_zip_file));
memcpy(&zip->crypt_info, crypt_info, sizeof(mz_zip_crypt));
memcpy(&zip->compress_info, compress_info, sizeof(mz_zip_compress));
zip->file_info.flag |= 8; // data descriptor
#ifdef HAVE_LZMA
zip->file_info.flag |= 2; // end of stream marker
#endif
if ((zip->compress_info.level == 8) || (zip->compress_info.level == 9))
zip->file_info.flag |= 2;
if (zip->compress_info.level == 2)
zip->file_info.flag |= 4;
if (zip->compress_info.level == 1)
zip->file_info.flag |= 6;
if (zip->crypt_info.password != NULL)
zip->file_info.flag |= 1;
else
zip->file_info.flag &= ~1;
filename_size = (uint16_t)strlen(zip->file_info.filename);
zip->pos_local_header = mz_stream_tell(zip->stream);
if (zip->pos_local_header >= UINT32_MAX)
zip->file_info.zip64 = 1;
// Write the local header
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, (uint32_t)LOCALHEADERMAGIC);
version_needed = 20;
if (zip->file_info.zip64)
version_needed = 45;
#ifdef HAVE_AES
if ((zip->file_info.flag & 1) && (zip->crypt_info.aes))
version_needed = 51;
#endif
#ifdef HAVE_LZMA
if (zip->compress_info.method == MZ_METHOD_LZMA)
version_needed = 63;
#endif
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, version_needed);
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, zip->file_info.flag);
if (err == MZ_OK)
{
#ifdef HAVE_AES
if ((zip->file_info.flag & 1) && (zip->crypt_info.aes))
err = mz_stream_write_uint16(zip->stream, MZ_AES_METHOD);
else
#endif
err = mz_stream_write_uint16(zip->stream, zip->compress_info.method);
}
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, zip->file_info.dos_date);
// CRC & compressed size & uncompressed size is in data descriptor
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, 0); // crc 32
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, 0); // compressed size
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, 0); // uncompressed size
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, filename_size);
if (err == MZ_OK)
{
uint16_t extrafield_size = zip->file_info.extrafield_local_size;
#ifdef HAVE_AES
if ((zip->file_info.flag & 1) && (zip->crypt_info.aes))
extrafield_size += 4 + 7;
#endif
err = mz_stream_write_uint16(zip->stream, extrafield_size);
}
if (err == MZ_OK)
{
if (mz_stream_write(zip->stream, zip->file_info.filename, filename_size) != filename_size)
err = MZ_STREAM_ERROR;
}
if (err == MZ_OK)
{
if (mz_stream_write(zip->stream, zip->file_info.extrafield_local,
zip->file_info.extrafield_local_size) != zip->file_info.extrafield_local_size)
err = MZ_STREAM_ERROR;
}
#ifdef HAVE_AES
// Write the AES extended info
if ((err == MZ_OK) && (zip->file_info.flag & 1) && (zip->crypt_info.aes))
{
err = mz_stream_write_uint16(zip->stream, 0x9901);
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, 7);
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, MZ_AES_VERSION);
if (err == MZ_OK)
err = mz_stream_write_uint8(zip->stream, 'A');
if (err == MZ_OK)
err = mz_stream_write_uint8(zip->stream, 'E');
if (err == MZ_OK)
err = mz_stream_write_uint8(zip->stream, MZ_AES_ENCRYPTIONMODE);
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, zip->compress_info.method);
}
#endif
#ifndef NOCRYPT
if (err == Z_OK)
{
if (zip->crypt_info.password == NULL)
{
mz_stream_passthru_create(&zip->crypt_stream);
mz_stream_set_base(zip->crypt_stream, zip->stream);
}
#ifdef HAVE_AES
else if (zip->crypt_info.aes)
{
mz_stream_aes_create(&zip->crypt_stream);
mz_stream_aes_set_password(zip->crypt_stream, zip->crypt_info.password);
mz_stream_set_base(zip->crypt_stream, zip->stream);
if (mz_stream_open(zip->crypt_stream, NULL, MZ_STREAM_MODE_WRITE) != MZ_OK)
err = MZ_INTERNAL_ERROR;
}
else
#endif
{
uint8_t verify1 = 0;
uint8_t verify2 = 0;
// Info-ZIP modification to ZipCrypto format:
// If bit 3 of the general purpose bit flag is set, it uses high byte of 16-bit File Time.
verify1 = (uint8_t)((zip->file_info.dos_date >> 16) & 0xff);
verify2 = (uint8_t)((zip->file_info.dos_date >> 8) & 0xff);
mz_stream_crypt_create(&zip->crypt_stream);
mz_stream_crypt_set_password(zip->crypt_stream, zip->crypt_info.password);
mz_stream_crypt_set_verify(zip->crypt_stream, verify1, verify2);
mz_stream_set_base(zip->crypt_stream, zip->stream);
if (mz_stream_open(zip->crypt_stream, NULL, MZ_STREAM_MODE_WRITE) != MZ_OK)
err = MZ_INTERNAL_ERROR;
}
}
#endif
if (err == MZ_OK)
{
if (zip->compress_info.method == 0) // raw
{
mz_stream_passthru_create(&zip->compress_stream);
mz_stream_set_base(zip->compress_stream, zip->crypt_stream);
}
else if (zip->compress_info.method == MZ_METHOD_DEFLATE)
{
mz_stream_zlib_create(&zip->compress_stream);
mz_stream_zlib_set_level(zip->compress_stream, zip->compress_info.level);
mz_stream_zlib_set_window_bits(zip->compress_stream, zip->compress_info.window_bits);
mz_stream_zlib_set_mem_level(zip->compress_stream, zip->compress_info.mem_level);
mz_stream_zlib_set_strategy(zip->compress_stream, zip->compress_info.strategy);
mz_stream_set_base(zip->compress_stream, zip->crypt_stream);
if (mz_stream_open(zip->compress_stream, NULL, MZ_STREAM_MODE_WRITE) != MZ_OK)
err = MZ_INTERNAL_ERROR;
}
#ifdef HAVE_BZIP2
else if (zip->compress_info.method == MZ_METHOD_BZIP2)
{
mz_stream_bzip_create(&zip->compress_stream);
mz_stream_bzip_set_level(zip->compress_stream, zip->compress_info.level);
mz_stream_set_base(zip->compress_stream, zip->crypt_stream);
if (mz_stream_open(zip->compress_stream, NULL, MZ_STREAM_MODE_WRITE) != MZ_OK)
err = MZ_INTERNAL_ERROR;
}
#endif
#ifdef HAVE_LZMA
else if (zip->compress_info.method == MZ_METHOD_LZMA)
{
mz_stream_lzma_create(&zip->compress_stream);
mz_stream_lzma_set_level(zip->compress_stream, zip->compress_info.level);
mz_stream_set_base(zip->compress_stream, zip->crypt_stream);
if (mz_stream_open(zip->compress_stream, NULL, MZ_STREAM_MODE_WRITE) != MZ_OK)
err = MZ_INTERNAL_ERROR;
}
#endif
}
if (err == Z_OK)
{
mz_stream_crc32_create(&zip->crc32_stream);
mz_stream_set_base(zip->crc32_stream, zip->compress_stream);
if (mz_stream_open(zip->crc32_stream, NULL, MZ_STREAM_MODE_WRITE) != MZ_OK)
err = MZ_INTERNAL_ERROR;
}
if (err == Z_OK)
zip->entry_opened = 1;
return err;
}
extern int ZEXPORT mz_zip_entry_write(void *handle, const void *buf, uint32_t len)
{
mz_zip *zip = NULL;
if (handle == NULL)
return MZ_PARAM_ERROR;
zip = (mz_zip*)handle;
if (zip->entry_opened == 0)
return MZ_PARAM_ERROR;
if (mz_stream_write(zip->crc32_stream, buf, len) == MZ_STREAM_ERROR)
return MZ_STREAM_ERROR;
return MZ_OK;
}
extern int ZEXPORT mz_zip_entry_close_raw(void *handle, uint64_t uncompressed_size, uint32_t crc32)
{
mz_zip *zip = NULL;
uint64_t compressed_size = 0;
uint16_t extrafield_size = 0;
uint16_t extrafield_zip64_size = 0;
uint16_t filename_size = 0;
uint16_t comment_size = 0;
uint16_t version_needed = 0;
int16_t err = MZ_OK;
if (handle == NULL)
return MZ_PARAM_ERROR;
zip = (mz_zip*)handle;
if (zip->entry_opened == 0)
return MZ_PARAM_ERROR;
mz_stream_close(zip->compress_stream);
if ((zip->compress_info.method != 0) || (uncompressed_size == 0))
{
crc32 = mz_stream_crc32_get_value(zip->crc32_stream);
uncompressed_size = mz_stream_get_total_out(zip->crc32_stream);
compressed_size = mz_stream_get_total_out(zip->compress_stream);
}
if (zip->file_info.flag & 1)
{
mz_stream_set_base(zip->crypt_stream, zip->stream);
err = mz_stream_close(zip->crypt_stream);
if ((zip->compress_info.method != 0) || (uncompressed_size == 0))
compressed_size = mz_stream_get_total_out(zip->crypt_stream);
mz_stream_delete(&zip->crypt_stream);
}
mz_stream_delete(&zip->compress_stream);
mz_stream_crc32_delete(&zip->crc32_stream);
// Write data descriptor
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, (uint32_t)DATADESCRIPTORMAGIC);
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, crc32);
if (err == MZ_OK)
{
if (zip->file_info.zip64)
err = mz_stream_write_uint64(zip->stream, compressed_size);
else
err = mz_stream_write_uint32(zip->stream, (uint32_t)compressed_size);
}
if (err == MZ_OK)
{
if (zip->file_info.zip64)
err = mz_stream_write_uint64(zip->stream, uncompressed_size);
else
err = mz_stream_write_uint32(zip->stream, (uint32_t)uncompressed_size);
}
// Write central directory header
// Calculate extra field size
version_needed = 20;
extrafield_size = zip->file_info.extrafield_global_size;
if (zip->file_info.zip64)
{
version_needed = 45;
extrafield_zip64_size += 4;
if (uncompressed_size >= UINT32_MAX)
extrafield_zip64_size += 8;
if (compressed_size >= UINT32_MAX)
extrafield_zip64_size += 8;
if (zip->pos_local_header >= UINT32_MAX)
extrafield_zip64_size += 8;
extrafield_size += extrafield_zip64_size;
}
#ifdef HAVE_AES
if ((zip->file_info.flag & 1) && (zip->crypt_info.aes))
{
version_needed = 51;
extrafield_size += 4 + 7;
}
#endif
#ifdef HAVE_LZMA
if (zip->compress_info.method == MZ_METHOD_LZMA)
version_needed = 63;
#endif
filename_size = (uint16_t)strlen(zip->file_info.filename);
if (zip->file_info.comment != NULL)
comment_size = (uint16_t)strlen(zip->file_info.comment);
mz_stream_write_uint32(zip->cd_stream, (uint32_t)CENTRALHEADERMAGIC);
mz_stream_write_uint16(zip->cd_stream, zip->file_info.version_madeby);
mz_stream_write_uint16(zip->cd_stream, version_needed);
mz_stream_write_uint16(zip->cd_stream, zip->file_info.flag);
mz_stream_write_uint16(zip->cd_stream, zip->compress_info.method);
mz_stream_write_uint32(zip->cd_stream, zip->file_info.dos_date);
mz_stream_write_uint32(zip->cd_stream, crc32); // crc
if (compressed_size >= UINT32_MAX) // compr size
mz_stream_write_uint32(zip->cd_stream, UINT32_MAX);
else
mz_stream_write_uint32(zip->cd_stream, (uint32_t)compressed_size);
if (uncompressed_size >= UINT32_MAX) // uncompr size
mz_stream_write_uint32(zip->cd_stream, UINT32_MAX);
else
mz_stream_write_uint32(zip->cd_stream, (uint32_t)uncompressed_size);
mz_stream_write_uint16(zip->cd_stream, filename_size);
mz_stream_write_uint16(zip->cd_stream, extrafield_size);
mz_stream_write_uint16(zip->cd_stream, comment_size);
mz_stream_write_uint16(zip->cd_stream, (uint16_t)zip->number_disk); // disk nm start
mz_stream_write_uint16(zip->cd_stream, zip->file_info.internal_fa);
mz_stream_write_uint32(zip->cd_stream, zip->file_info.external_fa);
if (zip->pos_local_header >= UINT32_MAX)
mz_stream_write_uint32(zip->cd_stream, UINT32_MAX);
else
mz_stream_write_uint32(zip->cd_stream,
(uint32_t)(zip->pos_local_header - zip->add_position_when_writting_offset));
mz_stream_write(zip->cd_stream, zip->file_info.filename, filename_size);
mz_stream_write(zip->cd_stream, zip->file_info.extrafield_global, zip->file_info.extrafield_global_size);
// Add ZIP64 extra info header to central directory
if (zip->file_info.zip64)
{
mz_stream_write_uint16(zip->cd_stream, 0x0001);
mz_stream_write_uint16(zip->cd_stream, extrafield_zip64_size);
if (uncompressed_size >= UINT32_MAX)
mz_stream_write_uint64(zip->cd_stream, uncompressed_size);
if (compressed_size >= UINT32_MAX)
mz_stream_write_uint64(zip->cd_stream, compressed_size);
if (zip->pos_local_header >= UINT32_MAX)
mz_stream_write_uint64(zip->cd_stream, zip->pos_local_header);
}
#ifdef HAVE_AES
// Write AES extra info header to central directory
if ((zip->file_info.flag & 1) && (zip->crypt_info.aes))
{
mz_stream_write_uint16(zip->cd_stream, 0x9901);
mz_stream_write_uint16(zip->cd_stream, 7);
mz_stream_write_uint16(zip->cd_stream, MZ_AES_VERSION);
mz_stream_write_uint8(zip->cd_stream, 'A');
mz_stream_write_uint8(zip->cd_stream, 'E');
mz_stream_write_uint8(zip->cd_stream, MZ_AES_ENCRYPTIONMODE);
mz_stream_write_uint16(zip->cd_stream, zip->compress_info.method);
}
#endif
// Write comment
if (zip->file_info.comment != NULL)
{
mz_stream_write(zip->cd_stream, zip->file_info.comment, comment_size);
free(zip->comment);
}
zip->number_entry += 1;
zip->entry_opened = 0;
return err;
}
extern int ZEXPORT mz_zip_entry_close(void *handle)
{
return mz_zip_entry_close_raw(handle, 0, 0);
}
extern int ZEXPORT mz_zip_close(void *handle, const char *global_comment, uint16_t version_madeby)
{
mz_zip *zip = NULL;
uint32_t size_centraldir = 0;
uint16_t comment_size = 0;
uint64_t centraldir_pos_inzip = 0;
uint64_t pos = 0;
uint64_t cd_pos = 0;
int16_t err = MZ_OK;
if (handle == NULL)
return MZ_PARAM_ERROR;
zip = (mz_zip*)handle;
if (zip->entry_opened == 1)
{
err = mz_zip_entry_close(handle);
if (err != MZ_OK)
return err;
}
#ifndef NO_ADDFILEINEXISTINGZIP
if (global_comment == NULL)
global_comment = zip->comment;
#endif
centraldir_pos_inzip = mz_stream_tell(zip->stream);
mz_stream_seek(zip->cd_stream, 0, MZ_STREAM_SEEK_END);
size_centraldir = (uint32_t)mz_stream_tell(zip->cd_stream);
mz_stream_seek(zip->cd_stream, 0, MZ_STREAM_SEEK_SET);
err = mz_stream_copy(zip->stream, zip->cd_stream, size_centraldir);
mz_stream_close(zip->cd_stream);
mz_stream_delete(&zip->cd_stream);
pos = centraldir_pos_inzip - zip->add_position_when_writting_offset;
// Write the ZIP64 central directory header
if (pos >= UINT32_MAX || zip->number_entry > UINT32_MAX)
{
uint64_t zip64_eocd_pos_inzip = mz_stream_tell(zip->stream);
err = mz_stream_write_uint32(zip->stream, (uint32_t)ZIP64ENDHEADERMAGIC);
// Size of this 'zip64 end of central directory'
if (err == MZ_OK)
err = mz_stream_write_uint64(zip->stream, (uint64_t)44);
// Version made by
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, version_madeby);
// Version needed
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, (uint16_t)45);
// Number of this disk
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, zip->number_disk_with_CD);
// Number of the disk with the start of the central directory
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, zip->number_disk_with_CD);
// Total number of entries in the central dir on this disk
if (err == MZ_OK)
err = mz_stream_write_uint64(zip->stream, zip->number_entry);
// Total number of entries in the central dir
if (err == MZ_OK)
err = mz_stream_write_uint64(zip->stream, zip->number_entry);
// Size of the central directory
if (err == MZ_OK)
err = mz_stream_write_uint64(zip->stream, (uint64_t)size_centraldir);
if (err == MZ_OK)
{
// Offset of start of central directory with respect to the starting disk number
cd_pos = centraldir_pos_inzip - zip->add_position_when_writting_offset;
err = mz_stream_write_uint64(zip->stream, cd_pos);
}
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, (uint32_t)ZIP64ENDLOCHEADERMAGIC);
// Number of the disk with the start of the central directory
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, zip->number_disk_with_CD);
// Relative offset to the end of zip64 central directory
if (err == MZ_OK)
{
cd_pos = zip64_eocd_pos_inzip - zip->add_position_when_writting_offset;
err = mz_stream_write_uint64(zip->stream, cd_pos);
}
// Number of the disk with the start of the central directory
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, zip->number_disk_with_CD + 1);
}
// Write the central directory header
// Signature
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, (uint32_t)ENDHEADERMAGIC);
// Number of this disk
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_disk_with_CD);
// Number of the disk with the start of the central directory
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_disk_with_CD);
// Total number of entries in the central dir on this disk
if (err == MZ_OK)
{
if (zip->number_entry >= UINT16_MAX)
err = mz_stream_write_uint16(zip->stream, UINT16_MAX);
else
err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_entry);
}
// Total number of entries in the central dir
if (err == MZ_OK)
{
if (zip->number_entry >= UINT16_MAX)
err = mz_stream_write_uint16(zip->stream, UINT16_MAX);
else
err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_entry);
}
// Size of the central directory
if (err == MZ_OK)
err = mz_stream_write_uint32(zip->stream, size_centraldir);
// Offset of start of central directory with respect to the starting disk number
if (err == MZ_OK)
{
cd_pos = centraldir_pos_inzip - zip->add_position_when_writting_offset;
if (pos >= UINT32_MAX)
err = mz_stream_write_uint32(zip->stream, UINT32_MAX);
else
err = mz_stream_write_uint32(zip->stream, (uint32_t)cd_pos);
}
// Write global comment
if (global_comment != NULL)
comment_size = (uint16_t)strlen(global_comment);
if (err == MZ_OK)
err = mz_stream_write_uint16(zip->stream, comment_size);
if (err == MZ_OK)
{
if (mz_stream_write(zip->stream, global_comment, comment_size) != comment_size)
err = MZ_STREAM_ERROR;
}
#ifndef NO_ADDFILEINEXISTINGZIP
if (zip->comment)
free(zip->comment);
#endif
free(zip);
return err;
}

View File

@@ -0,0 +1,113 @@
/* mz_zip.h -- Zip manipulation
Version 2.0.0, October 4th, 2017
part of the MiniZip project
Copyright (C) 2012-2017 Nathan Moinvaziri
https://github.com/nmoinvaz/minizip
Copyright (C) 2009-2010 Mathias Svensson
Modifications for Zip64 support
http://result42.com
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _MZ_ZIP_H
#define _MZ_ZIP_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ZLIB_H
# include "zlib.h"
#endif
#include "mz_strm.h"
/***************************************************************************/
#ifndef MZ_METHOD
# define MZ_METHOD_RAW (0)
# define MZ_METHOD_DEFLATE (8)
# define MZ_METHOD_BZIP2 (12)
# define MZ_METHOD_LZMA (14)
#endif
#define MZ_COMPRESS_LEVEL_DEFAULT (-1)
#define MZ_COMPRESS_WINDOW_BITS_DEFAULT (0)
#define MZ_COMPRESS_MEM_LEVEL_DEFAULT (0)
#define MZ_COMPRESS_STRATEGY_DEFAULT (-1)
/***************************************************************************/
typedef struct mz_zip_file_s
{
uint32_t dos_date; // ms-dos date and time
uint16_t internal_fa; // internal file attributes
uint32_t external_fa; // external file attributes
const uint8_t *extrafield_local; // extra fields in local header
uint16_t extrafield_local_size; // size of additional extra fields in local header
const uint8_t *extrafield_global; // extra fields in global header
uint16_t extrafield_global_size; // size of extra fields in global header
uint16_t version_madeby; // version made by
const char *comment; // file comment
const char *filename; // filename
uint8_t zip64; // enable zip64 extensions if 1
uint16_t flag; // base flag value
} mz_zip_file;
typedef struct mz_zip_compress_s
{
uint16_t method; // compression method
int level; // compression level
int window_bits; // deflate window bits
int mem_level; // deflate memory level
int strategy; // deflate strategy
} mz_zip_compress;
typedef struct mz_zip_crypt_s
{
const char *password; // encryption password
#if defined(HAVE_AES)
uint8_t aes; // enable winzip aes encryption if 1
#endif
} mz_zip_crypt;
/***************************************************************************/
extern void* ZEXPORT mz_zip_open(uint8_t open_existing, uint64_t disk_size, void *stream);
// Create a zip file
//
// NOTE: There is no delete function into a zip file. If you want delete file in a zip file,
// you must open a zip file, and create another. You can use RAW reading and writing to copy
// the file you did not want delete.
extern int ZEXPORT mz_zip_get_global_comment(void *handle, const char **global_comment);
// Gets the global comments if opening an existing zip
extern int ZEXPORT mz_zip_entry_open(void *handle, const mz_zip_file *file_info,
const mz_zip_compress *compress_info, const mz_zip_crypt *crypt_info);
// Open a file in the ZIP for writing
extern int ZEXPORT mz_zip_entry_write(void *handle, const void *buf, uint32_t len);
// Write data in the zip file
extern int ZEXPORT mz_zip_entry_close(void *handle);
// Close the current file in the zip file
extern int ZEXPORT mz_zip_entry_close_raw(void *handle, uint64_t uncompressed_size, uint32_t crc32);
// Close the current file in the zip file where raw is compressed data
extern int ZEXPORT mz_zip_close(void *handle, const char *global_comment, uint16_t version_madeby);
// Close the zip file
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* _ZIP_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,250 +0,0 @@
/* unzip.h -- IO for uncompress .zip files using zlib
Version 1.1, February 14h, 2010
part of the MiniZip project
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
Modifications of Unzip for Zip64
Copyright (C) 2007-2008 Even Rouault
Modifications for Zip64 support on both zip and unzip
Copyright (C) 2009-2010 Mathias Svensson
http://result42.com
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _UNZ_H
#define _UNZ_H
#include "SSZipCommon.h"
#define HAVE_AES
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ZLIB_H
#include "zlib.h"
#endif
#ifndef _ZLIBIOAPI_H
#include "ioapi.h"
#endif
#ifdef HAVE_BZIP2
#include "bzlib.h"
#endif
#define Z_BZIP2ED 12
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted
from (void*) without cast */
typedef struct TagunzFile__ { int unused; } unz_file__;
typedef unz_file__ *unzFile;
#else
typedef voidp unzFile;
#endif
#define UNZ_OK (0)
#define UNZ_END_OF_LIST_OF_FILE (-100)
#define UNZ_ERRNO (Z_ERRNO)
#define UNZ_EOF (0)
#define UNZ_PARAMERROR (-102)
#define UNZ_BADZIPFILE (-103)
#define UNZ_INTERNALERROR (-104)
#define UNZ_CRCERROR (-105)
#define UNZ_BADPASSWORD (-106)
/***************************************************************************/
/* Opening and close a zip file */
extern unzFile ZEXPORT unzOpen(const char *path);
extern unzFile ZEXPORT unzOpen64(const void *path);
/* Open a Zip file.
path should contain the full path (by example, on a Windows XP computer
"c:\\zlib\\zlib113.zip" or on an Unix computer "zlib/zlib113.zip".
return NULL if zipfile cannot be opened or doesn't exist
return unzFile handle if no error
NOTE: The "64" function take a const void *pointer, because the path is just the value passed to the
open64_file_func callback. Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path
is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char *does not describe the reality */
extern unzFile ZEXPORT unzOpen2(const char *path, zlib_filefunc_def *pzlib_filefunc_def);
/* Open a Zip file, like unzOpen, but provide a set of file low level API for read/write operations */
extern unzFile ZEXPORT unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def);
/* Open a Zip file, like unz64Open, but provide a set of file low level API for read/write 64-bit operations */
extern int ZEXPORT unzClose(unzFile file);
/* Close a ZipFile opened with unzOpen. If there is files inside the .Zip opened with unzOpenCurrentFile,
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
return UNZ_OK if there is no error */
extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info *pglobal_info);
extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64 *pglobal_info);
/* Write info about the ZipFile in the *pglobal_info structure.
return UNZ_OK if no error */
extern int ZEXPORT unzGetGlobalComment(unzFile file, char *comment, uint16_t comment_size);
/* Get the global comment string of the ZipFile, in the comment buffer.
uSizeBuf is the size of the szComment buffer.
return the number of byte copied or an error code <0 */
/***************************************************************************/
/* Reading the content of the current zipfile, you can open it, read data from it, and close it
(you can close it before reading all the file) */
extern int ZEXPORT unzOpenCurrentFile(unzFile file);
/* Open for reading data the current file in the zipfile.
return UNZ_OK if no error */
extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char *password);
/* Open for reading data the current file in the zipfile.
password is a crypting password
return UNZ_OK if no error */
extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int *method, int *level, int raw);
/* Same as unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1 *method will receive method of compression, *level will receive level of compression
NOTE: you can set level parameter as NULL (if you did not want known level,
but you CANNOT set method parameter as NULL */
extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password);
/* Same as unzOpenCurrentFile, but takes extra parameter password for encrypted files */
extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, uint32_t len);
/* Read bytes from the current file (opened by unzOpenCurrentFile)
buf contain buffer where data must be copied
len the size of buf.
return the number of byte copied if somes bytes are copied
return 0 if the end of file was reached
return <0 with error code if there is an error (UNZ_ERRNO for IO error, or zLib error for uncompress error) */
extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, unz_file_info *pfile_info, char *filename,
uint16_t filename_size, void *extrafield, uint16_t extrafield_size, char *comment, uint16_t comment_size);
extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *filename,
uint16_t filename_size, void *extrafield, uint16_t extrafield_size, char *comment, uint16_t comment_size);
/* Get Info about the current file
pfile_info if != NULL, the *pfile_info structure will contain somes info about the current file
filename if != NULL, the file name string will be copied in filename
filename_size is the size of the filename buffer
extrafield if != NULL, the extra field information from the central header will be copied in to
extrafield_size is the size of the extraField buffer
comment if != NULL, the comment string of the file will be copied in to
comment_size is the size of the comment buffer */
extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, uint32_t len);
/* Read extra field from the current file (opened by unzOpenCurrentFile)
This is the local-header version of the extra field (sometimes, there is
more info in the local-header version than in the central-header)
if buf == NULL, it return the size of the local extra field
if buf != NULL, len is the size of the buffer, the extra header is copied in buf.
return number of bytes copied in buf, or (if <0) the error code */
extern int ZEXPORT unzCloseCurrentFile(unzFile file);
/* Close the file in zip opened with unzOpenCurrentFile
return UNZ_CRCERROR if all the file was read but the CRC is not good */
/***************************************************************************/
/* Browse the directory of the zipfile */
typedef int (*unzFileNameComparer)(unzFile file, const char *filename1, const char *filename2);
typedef int (*unzIteratorFunction)(unzFile file);
typedef int (*unzIteratorFunction2)(unzFile file, unz_file_info64 *pfile_info, char *filename,
uint16_t filename_size, void *extrafield, uint16_t extrafield_size, char *comment, uint16_t comment_size);
extern int ZEXPORT unzGoToFirstFile(unzFile file);
/* Set the current file of the zipfile to the first file.
return UNZ_OK if no error */
extern int ZEXPORT unzGoToFirstFile2(unzFile file, unz_file_info64 *pfile_info, char *filename,
uint16_t filename_size, void *extrafield, uint16_t extrafield_size, char *comment, uint16_t comment_size);
/* Set the current file of the zipfile to the first file and retrieves the current info on success.
Not as seek intensive as unzGoToFirstFile + unzGetCurrentFileInfo.
return UNZ_OK if no error */
extern int ZEXPORT unzGoToNextFile(unzFile file);
/* Set the current file of the zipfile to the next file.
return UNZ_OK if no error
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest */
extern int ZEXPORT unzGoToNextFile2(unzFile file, unz_file_info64 *pfile_info, char *filename,
uint16_t filename_size, void *extrafield, uint16_t extrafield_size, char *comment, uint16_t comment_size);
/* Set the current file of the zipfile to the next file and retrieves the current
info on success. Does less seeking around than unzGotoNextFile + unzGetCurrentFileInfo.
return UNZ_OK if no error
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest */
extern int ZEXPORT unzLocateFile(unzFile file, const char *filename, unzFileNameComparer filename_compare_func);
/* Try locate the file szFileName in the zipfile. For custom filename comparison pass in comparison function.
return UNZ_OK if the file is found (it becomes the current file)
return UNZ_END_OF_LIST_OF_FILE if the file is not found */
/***************************************************************************/
/* Raw access to zip file */
typedef struct unz_file_pos_s
{
uint32_t pos_in_zip_directory; /* offset in zip file directory */
uint32_t num_of_file; /* # of file */
} unz_file_pos;
extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos *file_pos);
extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos *file_pos);
typedef struct unz64_file_pos_s
{
uint64_t pos_in_zip_directory; /* offset in zip file directory */
uint64_t num_of_file; /* # of file */
} unz64_file_pos;
extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos *file_pos);
extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos *file_pos);
extern int32_t ZEXPORT unzGetOffset(unzFile file);
extern int64_t ZEXPORT unzGetOffset64(unzFile file);
/* Get the current file offset */
extern int ZEXPORT unzSetOffset(unzFile file, uint32_t pos);
extern int ZEXPORT unzSetOffset64(unzFile file, uint64_t pos);
/* Set the current file offset */
extern int32_t ZEXPORT unzTell(unzFile file);
extern int64_t ZEXPORT unzTell64(unzFile file);
/* return current position in uncompressed data */
extern int ZEXPORT unzSeek(unzFile file, uint32_t offset, int origin);
extern int ZEXPORT unzSeek64(unzFile file, uint64_t offset, int origin);
/* Seek within the uncompressed data if compression method is storage */
extern int ZEXPORT unzEndOfFile(unzFile file);
/* return 1 if the end of file was reached, 0 elsewhere */
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* _UNZ_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,192 +0,0 @@
/* zip.h -- IO on .zip files using zlib
Version 1.1, February 14h, 2010
part of the MiniZip project
Copyright (C) 1998-2010 Gilles Vollant
http://www.winimage.com/zLibDll/minizip.html
Modifications for Zip64 support
Copyright (C) 2009-2010 Mathias Svensson
http://result42.com
This program is distributed under the terms of the same license as zlib.
See the accompanying LICENSE file for the full text of the license.
*/
#ifndef _ZIP_H
#define _ZIP_H
#define HAVE_AES
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ZLIB_H
# include "zlib.h"
#endif
#ifndef _ZLIBIOAPI_H
# include "ioapi.h"
#endif
#ifdef HAVE_BZIP2
# include "bzlib.h"
#endif
#define Z_BZIP2ED 12
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted
from (void*) without cast */
typedef struct TagzipFile__ { int unused; } zip_file__;
typedef zip_file__ *zipFile;
#else
typedef voidp zipFile;
#endif
#define ZIP_OK (0)
#define ZIP_EOF (0)
#define ZIP_ERRNO (Z_ERRNO)
#define ZIP_PARAMERROR (-102)
#define ZIP_BADZIPFILE (-103)
#define ZIP_INTERNALERROR (-104)
#ifndef DEF_MEM_LEVEL
# if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
# else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
# endif
#endif
typedef struct
{
uint32_t dos_date;
uint16_t internal_fa; /* internal file attributes 2 bytes */
uint32_t external_fa; /* external file attributes 4 bytes */
} zip_fileinfo;
#define APPEND_STATUS_CREATE (0)
#define APPEND_STATUS_CREATEAFTER (1)
#define APPEND_STATUS_ADDINZIP (2)
/***************************************************************************/
/* Writing a zip file */
extern zipFile ZEXPORT zipOpen(const char *path, int append);
extern zipFile ZEXPORT zipOpen64(const void *path, int append);
/* Create a zipfile.
path should contain the full path (by example, on a Windows XP computer
"c:\\zlib\\zlib113.zip" or on an Unix computer "zlib/zlib113.zip".
return NULL if zipfile cannot be opened
return zipFile handle if no error
If the file path exist and append == APPEND_STATUS_CREATEAFTER, the zip
will be created at the end of the file. (useful if the file contain a self extractor code)
If the file path exist and append == APPEND_STATUS_ADDINZIP, we will add files in existing
zip (be sure you don't add file that doesn't exist)
NOTE: There is no delete function into a zipfile. If you want delete file into a zipfile,
you must open a zipfile, and create another. Of course, you can use RAW reading and writing to copy
the file you did not want delete. */
extern zipFile ZEXPORT zipOpen2(const char *path, int append, const char **globalcomment,
zlib_filefunc_def *pzlib_filefunc_def);
extern zipFile ZEXPORT zipOpen2_64(const void *path, int append, const char **globalcomment,
zlib_filefunc64_def *pzlib_filefunc_def);
extern zipFile ZEXPORT zipOpen3(const char *path, int append, uint64_t disk_size,
const char **globalcomment, zlib_filefunc_def *pzlib_filefunc_def);
/* Same as zipOpen2 but allows specification of spanned zip size */
extern zipFile ZEXPORT zipOpen3_64(const void *path, int append, uint64_t disk_size,
const char **globalcomment, zlib_filefunc64_def *pzlib_filefunc_def);
extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level);
/* Open a file in the ZIP for writing.
filename : the filename in zip (if NULL, '-' without quote will be used
*zipfi contain supplemental information
extrafield_local buffer to store the local header extra field data, can be NULL
size_extrafield_local size of extrafield_local buffer
extrafield_global buffer to store the global header extra field data, can be NULL
size_extrafield_global size of extrafield_local buffer
comment buffer for comment string
method contain the compression method (0 for store, Z_DEFLATED for deflate)
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
this MUST be '1' if the uncompressed size is >= 0xffffffff. */
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int zip64);
/* Same as zipOpenNewFileInZip with zip64 support */
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw);
/* Same as zipOpenNewFileInZip, except if raw=1, we write raw file */
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int zip64);
/* Same as zipOpenNewFileInZip3 with zip64 support */
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
int strategy, const char *password, uint32_t crcForCrypting);
/* Same as zipOpenNewFileInZip2, except
windowBits, memLevel, strategy : see parameter strategy in deflateInit2
password : crypting password (NULL for no crypting)
crcForCrypting : crc of file to compress (needed for crypting) */
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
int strategy, const char *password, uint32_t crc_for_crypting, int zip64);
/* Same as zipOpenNewFileInZip3 with zip64 support */
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
int strategy, const char *password, uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base);
/* Same as zipOpenNewFileInZip3 except versionMadeBy & flag fields */
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, const zip_fileinfo *zipfi,
const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global,
uint16_t size_extrafield_global, const char *comment, uint16_t method, int level, int raw, int windowBits, int memLevel,
int strategy, const char *password, uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64);
/* Same as zipOpenNewFileInZip4 with zip64 support */
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void *buf, uint32_t len);
/* Write data in the zipfile */
extern int ZEXPORT zipCloseFileInZip(zipFile file);
/* Close the current file in the zipfile */
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uint32_t uncompressed_size, uint32_t crc32);
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, uint64_t uncompressed_size, uint32_t crc32);
/* Close the current file in the zipfile, for file opened with parameter raw=1 in zipOpenNewFileInZip2
where raw is compressed data. Parameters uncompressed_size and crc32 are value for the uncompressed data. */
extern int ZEXPORT zipClose(zipFile file, const char *global_comment);
/* Close the zipfile */
extern int ZEXPORT zipClose_64(zipFile file, const char *global_comment);
extern int ZEXPORT zipClose2_64(zipFile file, const char *global_comment, uint16_t version_madeby);
/* Same as zipClose_64 except version_madeby field */
/***************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* _ZIP_H */

View File

@@ -1,16 +1,16 @@
PODS:
- SSZipArchive (2.0.2)
- SSZipArchive (2.0.8)
DEPENDENCIES:
- SSZipArchive (from `..`)
EXTERNAL SOURCES:
SSZipArchive:
:path: ".."
:path: ..
SPEC CHECKSUMS:
SSZipArchive: 5fdf578dbbb60000b23439f80fa04e81d00740ee
SSZipArchive: e6ab66e1936fac7e3b5073e9f5eb364d91dfbfc7
PODFILE CHECKSUM: 0dc500eb72745751ccba7677de4da5534fcef36d
COCOAPODS: 1.2.1
COCOAPODS: 1.3.1

View File

@@ -339,7 +339,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@@ -412,7 +412,7 @@
INFOPLIST_FILE = SwiftExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_SWIFT_FLAGS = "-DUseCarthage";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
@@ -429,7 +429,7 @@
INFOPLIST_FILE = SwiftExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_SWIFT_FLAGS = "-DUseCarthage";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
@@ -462,6 +462,8 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_ACTIVITY_MODE = "";
"DEBUG_ACTIVITY_MODE[sdk=iphonesimulator*]" = default;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -479,7 +481,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -515,6 +517,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_ACTIVITY_MODE = "";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -526,7 +529,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -542,7 +545,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = SwiftExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
@@ -555,7 +558,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = SwiftExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
@@ -567,7 +570,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
INFOPLIST_FILE = SwiftExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExampleTests;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample";
@@ -580,7 +583,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
INFOPLIST_FILE = SwiftExampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExampleTests;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample";

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE19081BDA74F800709011"
BuildableName = "SwiftExample.app"
BlueprintName = "SwiftExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE191C1BDA74F800709011"
BuildableName = "SwiftExampleTests.xctest"
BlueprintName = "SwiftExampleTests"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE19081BDA74F800709011"
BuildableName = "SwiftExample.app"
BlueprintName = "SwiftExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE19081BDA74F800709011"
BuildableName = "SwiftExample.app"
BlueprintName = "SwiftExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "${DEBUG_ACTIVITY_MODE}"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DFE19081BDA74F800709011"
BuildableName = "SwiftExample.app"
BlueprintName = "SwiftExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2B4B24641C21500E00CC99E5"
BuildableName = "SwiftExampleCarthage.app"
BlueprintName = "SwiftExampleCarthage"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2B4B24641C21500E00CC99E5"
BuildableName = "SwiftExampleCarthage.app"
BlueprintName = "SwiftExampleCarthage"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2B4B24641C21500E00CC99E5"
BuildableName = "SwiftExampleCarthage.app"
BlueprintName = "SwiftExampleCarthage"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2B4B24641C21500E00CC99E5"
BuildableName = "SwiftExampleCarthage.app"
BlueprintName = "SwiftExampleCarthage"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
@@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
@@ -59,6 +79,11 @@
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina5_5" orientation="portrait">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina3_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -19,50 +19,50 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="password" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Tal-c0-sro">
<rect key="frame" x="166" y="13" width="83" height="30"/>
<rect key="frame" x="118.5" y="46" width="83" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Uwd-kM-cdh">
<rect key="frame" x="150.66666666666669" y="51" width="113.00000000000006" height="30"/>
<rect key="frame" x="103.5" y="84" width="113" height="30"/>
<state key="normal" title="Zip Sample Data"/>
<connections>
<action selector="zipPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="dQS-RP-2Yl"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XUJ-IR-RIS">
<rect key="frame" x="141.66666666666669" y="89" width="131.00000000000006" height="30"/>
<rect key="frame" x="94.5" y="122" width="131" height="30"/>
<state key="normal" title="Unzip Sample Data"/>
<connections>
<action selector="unzipPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="gGR-nU-aS3"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lbq-oS-Rlj">
<rect key="frame" x="187.66666666666666" y="212.66666666666666" width="39" height="30"/>
<rect key="frame" x="140.5" y="245" width="39" height="30"/>
<state key="normal" title="Reset"/>
<connections>
<action selector="resetPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="n8G-qy-egF"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="09F-6Q-slx" userLabel="File1">
<rect key="frame" x="67" y="126.99999999999999" width="294" height="20.666666666666643"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="09F-6Q-slx" userLabel="File1">
<rect key="frame" x="16" y="160" width="288" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PSK-Jd-Mwc" userLabel="File2">
<rect key="frame" x="67" y="155.66666666666663" width="294" height="20.333333333333343"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PSK-Jd-Mwc" userLabel="File2">
<rect key="frame" x="16" y="188" width="288" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pW5-rw-iqM" userLabel="File3">
<rect key="frame" x="67" y="184" width="294" height="20.666666666666657"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File3" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pW5-rw-iqM" userLabel="File3">
<rect key="frame" x="16" y="217" width="288" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
@@ -70,21 +70,21 @@
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="09F-6Q-slx" secondAttribute="trailing" constant="33" id="3S4-8t-aQA"/>
<constraint firstAttribute="trailingMargin" secondItem="09F-6Q-slx" secondAttribute="trailing" id="3S4-8t-aQA"/>
<constraint firstItem="XUJ-IR-RIS" firstAttribute="centerX" secondItem="Lbq-oS-Rlj" secondAttribute="centerX" id="AYF-iB-SJU"/>
<constraint firstItem="Uwd-kM-cdh" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="CTF-Hv-dt4"/>
<constraint firstItem="Tal-c0-sro" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="Czk-W6-E7s"/>
<constraint firstItem="XUJ-IR-RIS" firstAttribute="top" secondItem="Uwd-kM-cdh" secondAttribute="bottom" constant="8" symbolic="YES" id="OIr-Yf-tdY"/>
<constraint firstItem="09F-6Q-slx" firstAttribute="trailing" secondItem="PSK-Jd-Mwc" secondAttribute="trailing" id="TGC-ob-dm0"/>
<constraint firstItem="Uwd-kM-cdh" firstAttribute="top" secondItem="Tal-c0-sro" secondAttribute="bottom" constant="8" symbolic="YES" id="Udb-33-mrs"/>
<constraint firstItem="Uwd-kM-cdh" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="31" id="Uh0-R8-WFe"/>
<constraint firstItem="pW5-rw-iqM" firstAttribute="top" secondItem="PSK-Jd-Mwc" secondAttribute="bottom" constant="8" symbolic="YES" id="VfM-Vg-Yai"/>
<constraint firstItem="09F-6Q-slx" firstAttribute="top" secondItem="XUJ-IR-RIS" secondAttribute="bottom" constant="8" symbolic="YES" id="Wpv-VU-gb1"/>
<constraint firstItem="Uwd-kM-cdh" firstAttribute="centerX" secondItem="XUJ-IR-RIS" secondAttribute="centerX" id="dW9-nF-tLe"/>
<constraint firstItem="PSK-Jd-Mwc" firstAttribute="leading" secondItem="pW5-rw-iqM" secondAttribute="leading" id="eJr-2x-5k4"/>
<constraint firstItem="Tal-c0-sro" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="26" id="nXL-ng-YDN"/>
<constraint firstItem="09F-6Q-slx" firstAttribute="leading" secondItem="PSK-Jd-Mwc" secondAttribute="leading" id="ndV-Ni-q25"/>
<constraint firstItem="Lbq-oS-Rlj" firstAttribute="top" secondItem="pW5-rw-iqM" secondAttribute="bottom" constant="8" symbolic="YES" id="qRj-kV-fEA"/>
<constraint firstItem="09F-6Q-slx" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="47" id="rLi-aF-EpY"/>
<constraint firstItem="09F-6Q-slx" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="rLi-aF-EpY"/>
<constraint firstItem="PSK-Jd-Mwc" firstAttribute="top" secondItem="09F-6Q-slx" secondAttribute="bottom" constant="8" symbolic="YES" id="waq-c1-rAn"/>
<constraint firstItem="PSK-Jd-Mwc" firstAttribute="trailing" secondItem="pW5-rw-iqM" secondAttribute="trailing" id="wix-Cp-XH9"/>
</constraints>

View File

@@ -52,6 +52,8 @@ class ViewController: UIViewController {
if success {
unzipButton.isEnabled = true
zipButton.isEnabled = false
} else {
print("No success")
}
resetButton.isEnabled = true
}
@@ -66,7 +68,10 @@ class ViewController: UIViewController {
}
let password = passwordField.text
let success: Void? = try? SSZipArchive.unzipFile(atPath: zipPath, toDestination: unzipPath, overwrite: true, password: password?.isEmpty == false ? password : nil)
let success: Void? = try? SSZipArchive.unzipFile(atPath: zipPath,
toDestination: unzipPath,
overwrite: true,
password: password?.isEmpty == false ? password : nil)
if success == nil {
print("No success")
return
@@ -123,7 +128,6 @@ class ViewController: UIViewController {
return nil
}
return url.path
}

View File

@@ -62,6 +62,86 @@
373914331F000A000094DB3B /* pwd2key.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F81F0009310094DB3B /* pwd2key.h */; };
373914341F000A000094DB3B /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F91F0009310094DB3B /* sha1.c */; };
373914351F000A000094DB3B /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FA1F0009310094DB3B /* sha1.h */; };
37952C311F63B6EF00DD6677 /* SSZipCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 389869341D5BC30100F18782 /* SSZipCommon.h */; settings = {ATTRIBUTES = (Public, ); }; };
37952C321F63B6FB00DD6677 /* SSZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE481C0DF7950004A2F1 /* SSZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
37952C331F63B70000DD6677 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = B423AE491C0DF7950004A2F1 /* SSZipArchive.m */; };
37952C341F63B71400DD6677 /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE4A1C0DF7950004A2F1 /* ZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
37952C351F63B75B00DD6677 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B423AE6E1C0DF83F0004A2F1 /* libz.tbd */; };
37952C361F63B76C00DD6677 /* zip.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE471C0DF7950004A2F1 /* zip.h */; };
37952C371F63B76F00DD6677 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = B423AE461C0DF7950004A2F1 /* zip.c */; };
37952C381F63B77200DD6677 /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE451C0DF7950004A2F1 /* unzip.h */; };
37952C391F63B77500DD6677 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = B423AE441C0DF7950004A2F1 /* unzip.c */; };
37952C3A1F63B77800DD6677 /* ioapi.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE411C0DF7950004A2F1 /* ioapi.h */; };
37952C3B1F63B77C00DD6677 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = B423AE401C0DF7950004A2F1 /* ioapi.c */; };
37952C3C1F63B77F00DD6677 /* crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE3F1C0DF7950004A2F1 /* crypt.h */; };
37952C3D1F63B78100DD6677 /* minishared.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FE1F0009320094DB3B /* minishared.h */; };
37952C3E1F63B78400DD6677 /* minishared.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913FB1F0009320094DB3B /* minishared.c */; };
37952C3F1F63B78700DD6677 /* ioapi_mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FF1F0009320094DB3B /* ioapi_mem.h */; };
37952C401F63B78A00DD6677 /* ioapi_mem.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913FD1F0009320094DB3B /* ioapi_mem.c */; };
37952C411F63B78D00DD6677 /* ioapi_buf.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913E51F0009310094DB3B /* ioapi_buf.h */; };
37952C421F63B78F00DD6677 /* ioapi_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913E41F0009310094DB3B /* ioapi_buf.c */; };
37952C431F63B79300DD6677 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913FC1F0009320094DB3B /* crypt.c */; };
37952C441F63B79900DD6677 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913E71F0009310094DB3B /* aes.h */; };
37952C451F63B7A000DD6677 /* aes_ni.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913E81F0009310094DB3B /* aes_ni.c */; };
37952C461F63B7A000DD6677 /* aes_ni.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913E91F0009310094DB3B /* aes_ni.h */; };
37952C471F63B7A000DD6677 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913EA1F0009310094DB3B /* aescrypt.c */; };
37952C481F63B7A000DD6677 /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913EB1F0009310094DB3B /* aeskey.c */; };
37952C491F63B7A000DD6677 /* aesopt.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913EC1F0009310094DB3B /* aesopt.h */; };
37952C4A1F63B7A000DD6677 /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913ED1F0009310094DB3B /* aestab.c */; };
37952C4B1F63B7A000DD6677 /* aestab.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913EE1F0009310094DB3B /* aestab.h */; };
37952C4C1F63B7A000DD6677 /* brg_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913EF1F0009310094DB3B /* brg_endian.h */; };
37952C4D1F63B7A000DD6677 /* brg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F01F0009310094DB3B /* brg_types.h */; };
37952C4E1F63B7A000DD6677 /* fileenc.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F11F0009310094DB3B /* fileenc.c */; };
37952C4F1F63B7A000DD6677 /* fileenc.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F21F0009310094DB3B /* fileenc.h */; };
37952C501F63B7A000DD6677 /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F31F0009310094DB3B /* hmac.c */; };
37952C511F63B7A000DD6677 /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F41F0009310094DB3B /* hmac.h */; };
37952C521F63B7A000DD6677 /* prng.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F51F0009310094DB3B /* prng.c */; };
37952C531F63B7A000DD6677 /* prng.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F61F0009310094DB3B /* prng.h */; };
37952C541F63B7A000DD6677 /* pwd2key.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F71F0009310094DB3B /* pwd2key.c */; };
37952C551F63B7A000DD6677 /* pwd2key.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F81F0009310094DB3B /* pwd2key.h */; };
37952C561F63B7A000DD6677 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F91F0009310094DB3B /* sha1.c */; };
37952C571F63B7A000DD6677 /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FA1F0009310094DB3B /* sha1.h */; };
37952C581F63B8C400DD6677 /* SSZipArchive+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */; };
37952C661F63BBBB00DD6677 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913FC1F0009320094DB3B /* crypt.c */; };
37952C671F63BBBB00DD6677 /* ioapi_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913E41F0009310094DB3B /* ioapi_buf.c */; };
37952C681F63BBBB00DD6677 /* ioapi_buf.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913E51F0009310094DB3B /* ioapi_buf.h */; };
37952C691F63BBBB00DD6677 /* ioapi_mem.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913FD1F0009320094DB3B /* ioapi_mem.c */; };
37952C6A1F63BBBB00DD6677 /* ioapi_mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FF1F0009320094DB3B /* ioapi_mem.h */; };
37952C6B1F63BBBB00DD6677 /* minishared.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913FB1F0009320094DB3B /* minishared.c */; };
37952C6C1F63BBBB00DD6677 /* minishared.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FE1F0009320094DB3B /* minishared.h */; };
37952C6D1F63BBBB00DD6677 /* crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE3F1C0DF7950004A2F1 /* crypt.h */; };
37952C6E1F63BBBB00DD6677 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = B423AE401C0DF7950004A2F1 /* ioapi.c */; };
37952C6F1F63BBBB00DD6677 /* ioapi.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE411C0DF7950004A2F1 /* ioapi.h */; };
37952C701F63BBBB00DD6677 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = B423AE441C0DF7950004A2F1 /* unzip.c */; };
37952C711F63BBBB00DD6677 /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE451C0DF7950004A2F1 /* unzip.h */; };
37952C721F63BBBB00DD6677 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = B423AE461C0DF7950004A2F1 /* zip.c */; };
37952C731F63BBBB00DD6677 /* zip.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE471C0DF7950004A2F1 /* zip.h */; };
37952C741F63BBC000DD6677 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913E71F0009310094DB3B /* aes.h */; };
37952C751F63BBC000DD6677 /* aes_ni.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913E81F0009310094DB3B /* aes_ni.c */; };
37952C761F63BBC000DD6677 /* aes_ni.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913E91F0009310094DB3B /* aes_ni.h */; };
37952C771F63BBC000DD6677 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913EA1F0009310094DB3B /* aescrypt.c */; };
37952C781F63BBC000DD6677 /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913EB1F0009310094DB3B /* aeskey.c */; };
37952C791F63BBC000DD6677 /* aesopt.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913EC1F0009310094DB3B /* aesopt.h */; };
37952C7A1F63BBC000DD6677 /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913ED1F0009310094DB3B /* aestab.c */; };
37952C7B1F63BBC000DD6677 /* aestab.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913EE1F0009310094DB3B /* aestab.h */; };
37952C7C1F63BBC000DD6677 /* brg_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913EF1F0009310094DB3B /* brg_endian.h */; };
37952C7D1F63BBC000DD6677 /* brg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F01F0009310094DB3B /* brg_types.h */; };
37952C7E1F63BBC000DD6677 /* fileenc.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F11F0009310094DB3B /* fileenc.c */; };
37952C7F1F63BBC000DD6677 /* fileenc.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F21F0009310094DB3B /* fileenc.h */; };
37952C801F63BBC000DD6677 /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F31F0009310094DB3B /* hmac.c */; };
37952C811F63BBC000DD6677 /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F41F0009310094DB3B /* hmac.h */; };
37952C821F63BBC000DD6677 /* prng.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F51F0009310094DB3B /* prng.c */; };
37952C831F63BBC000DD6677 /* prng.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F61F0009310094DB3B /* prng.h */; };
37952C841F63BBC000DD6677 /* pwd2key.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F71F0009310094DB3B /* pwd2key.c */; };
37952C851F63BBC000DD6677 /* pwd2key.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F81F0009310094DB3B /* pwd2key.h */; };
37952C861F63BBC000DD6677 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F91F0009310094DB3B /* sha1.c */; };
37952C871F63BBC000DD6677 /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FA1F0009310094DB3B /* sha1.h */; };
37952C881F63BBD500DD6677 /* SSZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE481C0DF7950004A2F1 /* SSZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
37952C891F63BBDA00DD6677 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = B423AE491C0DF7950004A2F1 /* SSZipArchive.m */; };
37952C8A1F63BBE100DD6677 /* SSZipArchive+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */; };
37952C8B1F63BBE400DD6677 /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE4A1C0DF7950004A2F1 /* ZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
37952C8C1F63BBED00DD6677 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B423AE6E1C0DF83F0004A2F1 /* libz.tbd */; };
37952C8D1F63BBF300DD6677 /* SSZipCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 389869341D5BC30100F18782 /* SSZipCommon.h */; settings = {ATTRIBUTES = (Public, ); }; };
389869351D5BC30100F18782 /* SSZipCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 389869341D5BC30100F18782 /* SSZipCommon.h */; settings = {ATTRIBUTES = (Public, ); }; };
87ACF3EA1D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */; };
AFF75A2D1C3727F000F450AC /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE4A1C0DF7950004A2F1 /* ZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -116,6 +196,8 @@
373913FD1F0009320094DB3B /* ioapi_mem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ioapi_mem.c; sourceTree = "<group>"; };
373913FE1F0009320094DB3B /* minishared.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = minishared.h; sourceTree = "<group>"; };
373913FF1F0009320094DB3B /* ioapi_mem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ioapi_mem.h; sourceTree = "<group>"; };
37952C261F63B50D00DD6677 /* ZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; };
37952C5E1F63BB7100DD6677 /* ZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; };
389869341D5BC30100F18782 /* SSZipCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipCommon.h; sourceTree = "<group>"; };
87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SSZipArchive+Swift.swift"; sourceTree = "<group>"; };
AFF75A241C37279600F450AC /* ZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -135,6 +217,22 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
37952C221F63B50D00DD6677 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
37952C351F63B75B00DD6677 /* libz.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
37952C5A1F63BB7100DD6677 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
37952C8C1F63BBED00DD6677 /* libz.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AFF75A201C37279600F450AC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -195,6 +293,8 @@
children = (
B423AE1A1C0DF76A0004A2F1 /* ZipArchive.framework */,
AFF75A241C37279600F450AC /* ZipArchive.framework */,
37952C261F63B50D00DD6677 /* ZipArchive.framework */,
37952C5E1F63BB7100DD6677 /* ZipArchive.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -218,15 +318,15 @@
children = (
373913E61F0009310094DB3B /* aes */,
373913FC1F0009320094DB3B /* crypt.c */,
B423AE3F1C0DF7950004A2F1 /* crypt.h */,
373913E41F0009310094DB3B /* ioapi_buf.c */,
373913E51F0009310094DB3B /* ioapi_buf.h */,
373913FD1F0009320094DB3B /* ioapi_mem.c */,
373913FF1F0009320094DB3B /* ioapi_mem.h */,
373913FB1F0009320094DB3B /* minishared.c */,
373913FE1F0009320094DB3B /* minishared.h */,
B423AE3F1C0DF7950004A2F1 /* crypt.h */,
B423AE401C0DF7950004A2F1 /* ioapi.c */,
B423AE411C0DF7950004A2F1 /* ioapi.h */,
373913FB1F0009320094DB3B /* minishared.c */,
373913FE1F0009320094DB3B /* minishared.h */,
B423AE441C0DF7950004A2F1 /* unzip.c */,
B423AE451C0DF7950004A2F1 /* unzip.h */,
B423AE461C0DF7950004A2F1 /* zip.c */,
@@ -238,6 +338,62 @@
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
37952C231F63B50D00DD6677 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
37952C4D1F63B7A000DD6677 /* brg_types.h in Headers */,
37952C551F63B7A000DD6677 /* pwd2key.h in Headers */,
37952C441F63B79900DD6677 /* aes.h in Headers */,
37952C321F63B6FB00DD6677 /* SSZipArchive.h in Headers */,
37952C4C1F63B7A000DD6677 /* brg_endian.h in Headers */,
37952C491F63B7A000DD6677 /* aesopt.h in Headers */,
37952C381F63B77200DD6677 /* unzip.h in Headers */,
37952C571F63B7A000DD6677 /* sha1.h in Headers */,
37952C311F63B6EF00DD6677 /* SSZipCommon.h in Headers */,
37952C511F63B7A000DD6677 /* hmac.h in Headers */,
37952C3F1F63B78700DD6677 /* ioapi_mem.h in Headers */,
37952C4B1F63B7A000DD6677 /* aestab.h in Headers */,
37952C461F63B7A000DD6677 /* aes_ni.h in Headers */,
37952C531F63B7A000DD6677 /* prng.h in Headers */,
37952C3A1F63B77800DD6677 /* ioapi.h in Headers */,
37952C411F63B78D00DD6677 /* ioapi_buf.h in Headers */,
37952C361F63B76C00DD6677 /* zip.h in Headers */,
37952C3C1F63B77F00DD6677 /* crypt.h in Headers */,
37952C3D1F63B78100DD6677 /* minishared.h in Headers */,
37952C4F1F63B7A000DD6677 /* fileenc.h in Headers */,
37952C341F63B71400DD6677 /* ZipArchive.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
37952C5B1F63BB7100DD6677 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
37952C791F63BBC000DD6677 /* aesopt.h in Headers */,
37952C851F63BBC000DD6677 /* pwd2key.h in Headers */,
37952C7F1F63BBC000DD6677 /* fileenc.h in Headers */,
37952C681F63BBBB00DD6677 /* ioapi_buf.h in Headers */,
37952C831F63BBC000DD6677 /* prng.h in Headers */,
37952C731F63BBBB00DD6677 /* zip.h in Headers */,
37952C7D1F63BBC000DD6677 /* brg_types.h in Headers */,
37952C881F63BBD500DD6677 /* SSZipArchive.h in Headers */,
37952C8D1F63BBF300DD6677 /* SSZipCommon.h in Headers */,
37952C761F63BBC000DD6677 /* aes_ni.h in Headers */,
37952C6A1F63BBBB00DD6677 /* ioapi_mem.h in Headers */,
37952C6C1F63BBBB00DD6677 /* minishared.h in Headers */,
37952C8B1F63BBE400DD6677 /* ZipArchive.h in Headers */,
37952C741F63BBC000DD6677 /* aes.h in Headers */,
37952C711F63BBBB00DD6677 /* unzip.h in Headers */,
37952C811F63BBC000DD6677 /* hmac.h in Headers */,
37952C871F63BBC000DD6677 /* sha1.h in Headers */,
37952C6D1F63BBBB00DD6677 /* crypt.h in Headers */,
37952C7B1F63BBC000DD6677 /* aestab.h in Headers */,
37952C6F1F63BBBB00DD6677 /* ioapi.h in Headers */,
37952C7C1F63BBC000DD6677 /* brg_endian.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AFF75A211C37279600F450AC /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
@@ -297,6 +453,42 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
37952C251F63B50D00DD6677 /* ZipArchive-tvos */ = {
isa = PBXNativeTarget;
buildConfigurationList = 37952C2D1F63B50D00DD6677 /* Build configuration list for PBXNativeTarget "ZipArchive-tvos" */;
buildPhases = (
37952C211F63B50D00DD6677 /* Sources */,
37952C221F63B50D00DD6677 /* Frameworks */,
37952C231F63B50D00DD6677 /* Headers */,
37952C241F63B50D00DD6677 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "ZipArchive-tvos";
productName = ZipArchive;
productReference = 37952C261F63B50D00DD6677 /* ZipArchive.framework */;
productType = "com.apple.product-type.framework";
};
37952C5D1F63BB7100DD6677 /* ZipArchive-watchos */ = {
isa = PBXNativeTarget;
buildConfigurationList = 37952C651F63BB7100DD6677 /* Build configuration list for PBXNativeTarget "ZipArchive-watchos" */;
buildPhases = (
37952C591F63BB7100DD6677 /* Sources */,
37952C5A1F63BB7100DD6677 /* Frameworks */,
37952C5B1F63BB7100DD6677 /* Headers */,
37952C5C1F63BB7100DD6677 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "ZipArchive-watchos";
productName = ZipArchive;
productReference = 37952C5E1F63BB7100DD6677 /* ZipArchive.framework */;
productType = "com.apple.product-type.framework";
};
AFF75A231C37279600F450AC /* ZipArchive-Mac */ = {
isa = PBXNativeTarget;
buildConfigurationList = AFF75A291C37279600F450AC /* Build configuration list for PBXNativeTarget "ZipArchive-Mac" */;
@@ -343,6 +535,12 @@
LastUpgradeCheck = 0820;
ORGANIZATIONNAME = smumryak;
TargetAttributes = {
37952C251F63B50D00DD6677 = {
CreatedOnToolsVersion = 8.3.3;
};
37952C5D1F63BB7100DD6677 = {
CreatedOnToolsVersion = 8.3.3;
};
AFF75A231C37279600F450AC = {
CreatedOnToolsVersion = 7.2;
};
@@ -366,11 +564,27 @@
targets = (
B423AE191C0DF76A0004A2F1 /* ZipArchive-iOS */,
AFF75A231C37279600F450AC /* ZipArchive-Mac */,
37952C251F63B50D00DD6677 /* ZipArchive-tvos */,
37952C5D1F63BB7100DD6677 /* ZipArchive-watchos */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
37952C241F63B50D00DD6677 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
37952C5C1F63BB7100DD6677 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
AFF75A221C37279600F450AC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -388,6 +602,56 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
37952C211F63B50D00DD6677 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
37952C541F63B7A000DD6677 /* pwd2key.c in Sources */,
37952C521F63B7A000DD6677 /* prng.c in Sources */,
37952C581F63B8C400DD6677 /* SSZipArchive+Swift.swift in Sources */,
37952C401F63B78A00DD6677 /* ioapi_mem.c in Sources */,
37952C561F63B7A000DD6677 /* sha1.c in Sources */,
37952C4A1F63B7A000DD6677 /* aestab.c in Sources */,
37952C391F63B77500DD6677 /* unzip.c in Sources */,
37952C481F63B7A000DD6677 /* aeskey.c in Sources */,
37952C431F63B79300DD6677 /* crypt.c in Sources */,
37952C421F63B78F00DD6677 /* ioapi_buf.c in Sources */,
37952C4E1F63B7A000DD6677 /* fileenc.c in Sources */,
37952C451F63B7A000DD6677 /* aes_ni.c in Sources */,
37952C501F63B7A000DD6677 /* hmac.c in Sources */,
37952C331F63B70000DD6677 /* SSZipArchive.m in Sources */,
37952C3B1F63B77C00DD6677 /* ioapi.c in Sources */,
37952C371F63B76F00DD6677 /* zip.c in Sources */,
37952C471F63B7A000DD6677 /* aescrypt.c in Sources */,
37952C3E1F63B78400DD6677 /* minishared.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
37952C591F63BB7100DD6677 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
37952C801F63BBC000DD6677 /* hmac.c in Sources */,
37952C841F63BBC000DD6677 /* pwd2key.c in Sources */,
37952C8A1F63BBE100DD6677 /* SSZipArchive+Swift.swift in Sources */,
37952C7E1F63BBC000DD6677 /* fileenc.c in Sources */,
37952C891F63BBDA00DD6677 /* SSZipArchive.m in Sources */,
37952C7A1F63BBC000DD6677 /* aestab.c in Sources */,
37952C861F63BBC000DD6677 /* sha1.c in Sources */,
37952C751F63BBC000DD6677 /* aes_ni.c in Sources */,
37952C701F63BBBB00DD6677 /* unzip.c in Sources */,
37952C691F63BBBB00DD6677 /* ioapi_mem.c in Sources */,
37952C6B1F63BBBB00DD6677 /* minishared.c in Sources */,
37952C671F63BBBB00DD6677 /* ioapi_buf.c in Sources */,
37952C721F63BBBB00DD6677 /* zip.c in Sources */,
37952C661F63BBBB00DD6677 /* crypt.c in Sources */,
37952C771F63BBC000DD6677 /* aescrypt.c in Sources */,
37952C6E1F63BBBB00DD6677 /* ioapi.c in Sources */,
37952C821F63BBC000DD6677 /* prng.c in Sources */,
37952C781F63BBC000DD6677 /* aeskey.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
AFF75A1F1C37279600F450AC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -440,6 +704,112 @@
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
37952C2B1F63B50D00DD6677 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SSZipArchive/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
};
37952C2C1F63B50D00DD6677 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COPY_PHASE_STRIP = NO;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SSZipArchive/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
};
37952C631F63BB7100DD6677 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SSZipArchive/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
name = Debug;
};
37952C641F63BB7100DD6677 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
COPY_PHASE_STRIP = NO;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SSZipArchive/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
name = Release;
};
AFF75A2A1C37279600F450AC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -453,8 +823,8 @@
INFOPLIST_FILE = "$(SRCROOT)/SSZipArchive/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
@@ -475,8 +845,8 @@
INFOPLIST_FILE = "$(SRCROOT)/SSZipArchive/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
@@ -593,6 +963,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = marker;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
@@ -604,7 +975,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
PRODUCT_NAME = "$(PROJECT_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -617,6 +988,7 @@
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
BITCODE_GENERATION_MODE = bitcode;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
@@ -628,7 +1000,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
PRODUCT_NAME = "$(PROJECT_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
@@ -638,6 +1010,24 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
37952C2D1F63B50D00DD6677 /* Build configuration list for PBXNativeTarget "ZipArchive-tvos" */ = {
isa = XCConfigurationList;
buildConfigurations = (
37952C2B1F63B50D00DD6677 /* Debug */,
37952C2C1F63B50D00DD6677 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
37952C651F63BB7100DD6677 /* Build configuration list for PBXNativeTarget "ZipArchive-watchos" */ = {
isa = XCConfigurationList;
buildConfigurations = (
37952C631F63BB7100DD6677 /* Debug */,
37952C641F63BB7100DD6677 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
AFF75A291C37279600F450AC /* Build configuration list for PBXNativeTarget "ZipArchive-Mac" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37952C251F63B50D00DD6677"
BuildableName = "ZipArchive.framework"
BlueprintName = "ZipArchive-tvos"
ReferencedContainer = "container:ZipArchive.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37952C251F63B50D00DD6677"
BuildableName = "ZipArchive.framework"
BlueprintName = "ZipArchive-tvos"
ReferencedContainer = "container:ZipArchive.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37952C251F63B50D00DD6677"
BuildableName = "ZipArchive.framework"
BlueprintName = "ZipArchive-tvos"
ReferencedContainer = "container:ZipArchive.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37952C5D1F63BB7100DD6677"
BuildableName = "ZipArchive.framework"
BlueprintName = "ZipArchive-watchos"
ReferencedContainer = "container:ZipArchive.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37952C5D1F63BB7100DD6677"
BuildableName = "ZipArchive.framework"
BlueprintName = "ZipArchive-watchos"
ReferencedContainer = "container:ZipArchive.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37952C5D1F63BB7100DD6677"
BuildableName = "ZipArchive.framework"
BlueprintName = "ZipArchive-watchos"
ReferencedContainer = "container:ZipArchive.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB