├── .gitignore ├── LICENSE.txt ├── Makefile ├── README.txt ├── Sources ├── google-toolbox-for-mac-1.6.0.zip ├── google-toolbox-for-mac-2.1.4.zip ├── google-toolbox-for-mac-2.3.1.zip ├── google-toolbox-for-mac-3.0.0.tar.gz ├── google-toolbox-for-mac-4.0.0.zip ├── libarchive-3.5.1.tar.gz ├── libarchive-3.5.1.tar.gz.asc ├── libarchive-3.5.2.tar.gz ├── libarchive-3.5.2.tar.gz.asc ├── libarchive-3.6.0.tar.gz ├── libarchive-3.6.0.tar.gz.asc ├── libarchive-3.6.1.tar.gz ├── libarchive-3.6.1.tar.gz.asc ├── libarchive-3.6.2.tar.xz ├── libarchive-3.7.0.tar.gz ├── libarchive-3.7.0.tar.gz.asc ├── libarchive-3.7.1.tar.gz ├── libarchive-3.7.1.tar.gz.asc ├── libarchive-3.7.2.tar.gz ├── libarchive-3.7.2.tar.gz.asc ├── libarchive-3.7.4.tar.gz ├── libarchive-3.7.4.tar.gz.asc ├── libarchive-3.7.7.tar.gz ├── libarchive-3.7.7.tar.gz.asc ├── unzip11.zip ├── xz-5.2.4.tar.xz ├── xz-5.2.5.tar.gz ├── xz-5.2.5.tar.gz.sig ├── xz-5.4.3.tar.gz ├── xz-5.4.3.tar.gz.sig ├── xz-5.4.4.tar.gz ├── xz-5.4.4.tar.gz.sig └── zlib-1.2.11.tar.gz ├── getUTI.sh ├── qlZipInfo.xcodeproj └── project.pbxproj └── qlZipInfo ├── GTM ├── GTMDefines.h ├── GTMNSString+HTML.h └── GTMNSString+HTML.m ├── GeneratePreviewForURL.h ├── GeneratePreviewForURL.m ├── GenerateThumbnailForURL.m ├── Info.plist ├── binhex.c ├── binhex.h ├── libarchive ├── archive.h ├── archive_acl.c ├── archive_acl_private.h ├── archive_blake2.h ├── archive_blake2_impl.h ├── archive_blake2s_ref.c ├── archive_blake2sp_ref.c ├── archive_check_magic.c ├── archive_cmdline.c ├── archive_cmdline_private.h ├── archive_cryptor.c ├── archive_cryptor_private.h ├── archive_digest.c ├── archive_digest_private.h ├── archive_disk_acl_darwin.c ├── archive_endian.h ├── archive_entry.c ├── archive_entry.h ├── archive_entry_copy_bhfi.c ├── archive_entry_copy_stat.c ├── archive_entry_link_resolver.c ├── archive_entry_locale.h ├── archive_entry_private.h ├── archive_entry_sparse.c ├── archive_entry_stat.c ├── archive_entry_strmode.c ├── archive_entry_xattr.c ├── archive_getdate.c ├── archive_getdate.h ├── archive_hmac.c ├── archive_hmac_private.h ├── archive_match.c ├── archive_options.c ├── archive_options_private.h ├── archive_pack_dev.c ├── archive_pack_dev.h ├── archive_pathmatch.c ├── archive_pathmatch.h ├── archive_platform.h ├── archive_platform_acl.h ├── archive_platform_xattr.h ├── archive_ppmd7.c ├── archive_ppmd7_private.h ├── archive_ppmd8.c ├── archive_ppmd8_private.h ├── archive_ppmd_private.h ├── archive_private.h ├── archive_random_private.h ├── archive_rb.c ├── archive_rb.h ├── archive_read.c ├── archive_read_add_passphrase.c ├── archive_read_append_filter.c ├── archive_read_data_into_fd.c ├── archive_read_disk_entry_from_file.c ├── archive_read_disk_posix.c ├── archive_read_disk_private.h ├── archive_read_disk_set_standard_lookup.c ├── archive_read_extract.c ├── archive_read_extract2.c ├── archive_read_open_fd.c ├── archive_read_open_file.c ├── archive_read_open_filename.c ├── archive_read_open_memory.c ├── archive_read_private.h ├── archive_read_support_filter_all.c ├── archive_read_support_filter_by_code.c ├── archive_read_support_filter_bzip2.c ├── archive_read_support_filter_compress.c ├── archive_read_support_filter_grzip.c ├── archive_read_support_filter_gzip.c ├── archive_read_support_filter_lrzip.c ├── archive_read_support_filter_lz4.c ├── archive_read_support_filter_lzop.c ├── archive_read_support_filter_none.c ├── archive_read_support_filter_program.c ├── archive_read_support_filter_rpm.c ├── archive_read_support_filter_uu.c ├── archive_read_support_filter_xz.c ├── archive_read_support_filter_zstd.c ├── archive_read_support_format_7zip.c ├── archive_read_support_format_all.c ├── archive_read_support_format_ar.c ├── archive_read_support_format_by_code.c ├── archive_read_support_format_cab.c ├── archive_read_support_format_cpio.c ├── archive_read_support_format_empty.c ├── archive_read_support_format_iso9660.c ├── archive_read_support_format_lha.c ├── archive_read_support_format_mtree.c ├── archive_read_support_format_rar.c ├── archive_read_support_format_rar5.c ├── archive_read_support_format_raw.c ├── archive_read_support_format_tar.c ├── archive_read_support_format_warc.c ├── archive_read_support_format_xar.c ├── archive_read_support_format_zip.c ├── archive_string.c ├── archive_string.h ├── archive_string_composition.h ├── archive_string_sprintf.c ├── archive_util.c ├── archive_version_details.c ├── archive_virtual.c ├── archive_write_disk_posix.c ├── archive_write_disk_private.h ├── archive_write_disk_set_standard_lookup.c ├── archive_xxhash.h ├── config.h ├── filter_fork.h └── filter_fork_posix.c ├── lzma ├── lzma.h └── lzma │ ├── base.h │ ├── bcj.h │ ├── block.h │ ├── check.h │ ├── container.h │ ├── delta.h │ ├── filter.h │ ├── hardware.h │ ├── index.h │ ├── index_hash.h │ ├── lzma12.h │ ├── stream_flags.h │ ├── version.h │ └── vli.h ├── macosroman2ascii.c ├── macosroman2ascii.h ├── main.c ├── minizip ├── ioapi.c ├── ioapi.h ├── minishared.c ├── minishared.h ├── unzip.c └── unzip.h ├── sit.c └── sit.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | *.mk 3 | .DS_Store 4 | build/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | *.xcworkspace 14 | !default.xcworkspace 15 | xcuserdata 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | .idea/ 20 | *.dmg 21 | qlZipInfo-* 22 | devel/ 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for qlZipInfo 2 | 3 | # project settings 4 | 5 | PROJNAME = qlZipInfo 6 | PROJEXT = qlgenerator 7 | PROJVERS = 1.2.8 8 | BUNDLEID = "org.calalum.ranga.$(PROJNAME)" 9 | 10 | # extra files to include in the package 11 | 12 | SUPPORT_FILES = README.txt LICENSE.txt 13 | 14 | # code signing information 15 | 16 | include ../sign.mk 17 | 18 | # build and packaging tools 19 | 20 | XCODEBUILD = /usr/bin/xcodebuild 21 | XCRUN = /usr/bin/xcrun 22 | HIUTIL = /usr/bin/hiutil 23 | ALTOOL = $(XCRUN) altool 24 | NOTARYTOOL = xcrun notarytool 25 | STAPLER = $(XCRUN) stapler 26 | HDIUTIL = /usr/bin/hdiutil 27 | CODESIGN = /usr/bin/codesign 28 | GPG = /opt/local/bin/gpg 29 | 30 | # code sign arguments 31 | # based on: 32 | # https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow 33 | # https://stackoverflow.com/questions/53112078/how-to-upload-dmg-file-for-notarization-in-xcode 34 | 35 | CODESIGN_ARGS = --force \ 36 | --verify \ 37 | --verbose \ 38 | --timestamp \ 39 | --options runtime \ 40 | --sign $(SIGNID) 41 | 42 | # Xcode build target 43 | 44 | BUILD_CONFIG = Release 45 | 46 | # build results directory 47 | 48 | BUILD_RESULTS_DIR = build/$(BUILD_CONFIG)/$(PROJNAME).$(PROJEXT) 49 | BUILD_RESULTS_FRAMEWORKS_DIR = $(BUILD_RESULTS_DIR)/Contents/Frameworks/ 50 | 51 | # build the app 52 | 53 | all: 54 | $(XCODEBUILD) -project $(PROJNAME).xcodeproj -configuration $(BUILD_CONFIG) 55 | 56 | # sign the app, if frameworks are included, then sign_frameworks should 57 | # be the pre-requisite target instead of "all" 58 | 59 | sign: sign_frameworks 60 | $(CODESIGN) $(CODESIGN_ARGS) $(BUILD_RESULTS_DIR) 61 | 62 | # sign any included frameworks (not always needed) 63 | 64 | sign_frameworks: all 65 | if [ -d $(BUILD_RESULTS_FRAMEWORKS_DIR) ] ; then \ 66 | $(CODESIGN) $(CODESIGN_ARGS) \ 67 | $(BUILD_RESULTS_FRAMEWORKS_DIR) ; \ 68 | fi 69 | 70 | # create a disk image with the signed app 71 | 72 | dmg: all sign 73 | /bin/mkdir $(PROJNAME)-$(PROJVERS) 74 | /bin/mv build/Release/$(PROJNAME).$(PROJEXT) $(PROJNAME)-$(PROJVERS) 75 | /bin/cp $(SUPPORT_FILES) $(PROJNAME)-$(PROJVERS) 76 | $(HDIUTIL) create -srcfolder $(PROJNAME)-$(PROJVERS) \ 77 | -format UDBZ $(PROJNAME)-$(PROJVERS).dmg 78 | 79 | # sign the disk image 80 | 81 | sign_dmg: dmg 82 | $(CODESIGN) $(CODESIGN_ARGS) $(PROJNAME)-$(PROJVERS).dmg 83 | 84 | # notarize the signed disk image 85 | 86 | # Xcode13 notarization 87 | # See: https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow?preferredLanguage=occ 88 | # https://scriptingosx.com/2021/07/notarize-a-command-line-tool-with-notarytool/ 89 | # https://indiespark.top/programming/new-xcode-13-notarization/ 90 | 91 | notarize: sign_dmg 92 | $(NOTARYTOOL) submit $(PROJNAME)-$(PROJVERS).dmg \ 93 | --apple-id $(USERID) --team-id $(TEAMID) \ 94 | --wait 95 | 96 | # Pre-Xcode13 notarization 97 | 98 | notarize_old: sign_dmg 99 | $(ALTOOL) --notarize-app \ 100 | --primary-bundle-id $(BUNDLEID) \ 101 | --username $(USERID) \ 102 | --file $(PROJNAME)-$(PROJVERS).dmg 103 | 104 | # staple the ticket to the dmg 105 | 106 | staple: notarize 107 | $(STAPLER) staple $(PROJNAME)-$(PROJVERS).dmg 108 | $(STAPLER) validate $(PROJNAME)-$(PROJVERS).dmg 109 | 110 | # sign the dmg with a gpg public key 111 | 112 | clearsign: staple 113 | $(GPG) -asb $(PROJNAME)-$(PROJVERS).dmg 114 | 115 | clean: 116 | /bin/rm -rf ./build $(PROJNAME)-$(PROJVERS) $(PROJNAME)-$(PROJVERS).dmg 117 | $(XCODEBUILD) -project $(PROJNAME).xcodeproj -alltargets clean 118 | 119 | -------------------------------------------------------------------------------- /Sources/google-toolbox-for-mac-1.6.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/google-toolbox-for-mac-1.6.0.zip -------------------------------------------------------------------------------- /Sources/google-toolbox-for-mac-2.1.4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/google-toolbox-for-mac-2.1.4.zip -------------------------------------------------------------------------------- /Sources/google-toolbox-for-mac-2.3.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/google-toolbox-for-mac-2.3.1.zip -------------------------------------------------------------------------------- /Sources/google-toolbox-for-mac-3.0.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/google-toolbox-for-mac-3.0.0.tar.gz -------------------------------------------------------------------------------- /Sources/google-toolbox-for-mac-4.0.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/google-toolbox-for-mac-4.0.0.zip -------------------------------------------------------------------------------- /Sources/libarchive-3.5.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.5.1.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.5.1.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQIzBAABCgAdFiEEpaRbEq2S2WS4nu4t7FYMgc7CJ24FAl/mmEEACgkQ7FYMgc7C 4 | J25H3xAAvJIX41jASAriDapw6eTczTBPH4RT032THnPC4fU4simZeVYo3J2eePeD 5 | 4RmUqpsf0LNpI81WgYSbcT7L++j4X/hRZxquJQKGd5wY7z0xJfNYRAYpybZsSwXv 6 | olOUof8bDO4kPM1yHCyCN3uXfOUTPUit5QZzyMuk3/5VNGDgjXXykA/JafC708fE 7 | OO0gvpYEAlzT2/3Q8gKGUQyR3vOiDtawWiaJ3K//APSJbeVu+emRmKroO9QxkgFu 8 | Js//7gTzcVUe+uQFjxCTE4vMBZQ881QWIGtKh8oVCyFKufOEFI5N7/JPVKCJKuol 9 | R/F0UrJHwFSwkBCY0KKbvEz1lHZ5bs7GcP/4oizIsvGrnVR8CdSYC7A+93DF7eMt 10 | PUrdJZNm5kZNp8leFwEA8NI2pG3Ozt6joQ2gjUTOKqGaLcSr/ZeENdo8QXDzh3xn 11 | xZFTGlKa0TvqEJD+IBUsLLvNnOgNda/cf/825CifE0HyQIAnS6zWl+JAMtpcuu7Q 12 | 1I6Ej/npef42/8x7nsrUmPVrEMxiqjhP0LhJVHItMQc8aNQS1or4HoJ8H5u5PS24 13 | +reY/OibmT3RhTa/jPAI4yG2YDIoN6owDTWrrlUleC5YgN9QgphW3YndnpASmFvd 14 | f5dNF3PqyawXh7yp4fAyAR0B3q5IT6X1lXxOa6d4wOOCnn3qNhY= 15 | =/KNq 16 | -----END PGP SIGNATURE----- 17 | -------------------------------------------------------------------------------- /Sources/libarchive-3.5.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.5.2.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.5.2.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQIzBAABCgAdFiEEpaRbEq2S2WS4nu4t7FYMgc7CJ24FAmEi5mkACgkQ7FYMgc7C 4 | J25eHA//bvwmuQy3tf7HtOcGu0Rkhj5EQprtjtgkuLgWBM6Kp2/N3IYDlGE1HTNb 5 | 1B5xp+HkQGm4+4OJJDy99yGSWzBL8wfrp1DnBrxAaPsE0nkpPS4Hh2wLKB+oiFSn 6 | 61NKZd1qQev9C+D/tIyteSyWfy31xkQidBkPlyXo8iEHKQKneIKKleDU4ev1lSK3 7 | 0Ln8z0hQvUKuoCc9YdOhvQMteItWIlD/XQNKE3PtcKCtbaxzgJvAP0nwxJLbHKIr 8 | V7lIXTmiFYV2ghaeLtibUZAoh8MsH/fXDtIqJWitzNW4V7P8OMF/xExlTVU8U79y 9 | LB/7f8hq0Tl3QJmopOo1bG5kH/cbeg1RViJgoWmPuGPzYHyD9TctGZ6rCVz9DEl8 10 | SShgJCgRR36FnT3tgWsGa0VCUKIgPleKnpjU0zGCiJlLabF1qqGPtWTBUxUwt787 11 | YL1XhY/xM/8yu3qRGroeio38+WOeBJo4jVj4z9XTo5wNp828SNCpVuPyByAw9bb4 12 | quC3k61fGvUz70X1otWYOpOvBotFSn4Pb2bse0XbnvnUJYwCo+FY/JYw4GOAXHsl 13 | RIuJdc/9DhEKhXydGrb4i8GpSe+zV5nKAUjIf9tGuwLN5uxHjcG6hphcO8oJE+c0 14 | VOLD+ZHxEaRsf6Qkl2KG51jj4XRtxx0U7w13WcoJ8LpP9lresNk= 15 | =c3bq 16 | -----END PGP SIGNATURE----- 17 | -------------------------------------------------------------------------------- /Sources/libarchive-3.6.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.6.0.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.6.0.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQIzBAABCgAdFiEEpaRbEq2S2WS4nu4t7FYMgc7CJ24FAmIDuEQACgkQ7FYMgc7C 4 | J25pZRAAqJz6yaZc7KRwTornAWvPBX/0CtNZolZsgHTuNK+c9gCAbm7utjEXC2HB 5 | 4JasXtEHle/nV04vuchToyiZ1ZLhxEoYF6SuasIB6ry7cZF2KX7mpwaYPMnny/vf 6 | HZSB5pvADHPB/CGAHfpArSfkTFh3XOIFcEqdUBkN3Ly9YyucSVLqbb0E2yt7MeAS 7 | Xm4EGwP9+1jbYFIaBupckwDASEeR1PZ90KLc/om5cKaBYKUYM5IW4L/nCJC28POI 8 | 8ySteFp4TF4kqns4eLnethCwr0Gy9sqGpgiPq7FvCyMy52faRknCccWibvxSrHoc 9 | EF3TLIIR2LgtV7Ws5r+cclr3wCE83euHiw6D7axvQQ774LIYvnSymOambb7/jH5P 10 | L4/IYV4nY1Q0a6b4YiOeV61n1MDoTJ822RwwDKIOIz9h7SXliEtzX4B+As3QEg6s 11 | WGeXorjFb+2cQ6c0R75OhU379e+uFCMdt9DzcmiOYxTB6Tl4QGYZNQV++Lx9AyVh 12 | Dsw3jLYASj9v8tZ+XWaLIXYrkWAc5D8b7gn69PbX/C4NJPlIY7oHN5qn6Mm4hL6O 13 | mO98Sc7ThuKmhvXNKHM4bD29cy4jxDKYeZVlS2GYRqw2pNO494xzEHHbuN06bAF8 14 | WU0XXRrJHZtvPqeriRskiMW0N2PcMjbu9Rzl0gyc+tXtqJMH54Y= 15 | =q4P/ 16 | -----END PGP SIGNATURE----- 17 | -------------------------------------------------------------------------------- /Sources/libarchive-3.6.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.6.1.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.6.1.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQIzBAABCgAdFiEEpaRbEq2S2WS4nu4t7FYMgc7CJ24FAmJQLNEACgkQ7FYMgc7C 4 | J26CfxAAiVULwEA+13iaXQzTeMq33dmp8rcBtLs3TWptM98pnrmwRQ4tCAeABxqS 5 | VEKZuqEvknsuQVHsDAJt4s2xrcUNjgYZdME3uOiOozQRPchPHPhykb2HXnG919Sf 6 | ayxr5HQLRPOZ7VZfCwGsimRLPLuw4tS9SnC572o7hsp0X6RAaMDXJiQMGq1Wa4Nm 7 | PjJ8hbCOXLis3T/3BJXZ99gko1BOUsKfBfRs/MdiXqW8l5pPeI9LC8YFoK0SCBtd 8 | b+kB4pjp4BcJBxLjyFKvE55KIb1OXEPkGCt/Tmbc4X5s8JHyn2Prl54+8coxAAHh 9 | 96zK+Kb0WV65F1m6Vi8nBv++AWvcpu2EH0TiCLkMt8SR9+hJA8sWkUs0yPwMYBdP 10 | i2ZV64ReccgB5fbCFV69f3NTCLI8mS5vJxfkIqCtH/Vmso7AKKq4iLeRCyBtT5NB 11 | IBt5l0yAJDdQx5BNAREMxGViMJtJI6vjTVWRWHsRtwkbzvx6bSXaGeRX2Th1Apcm 12 | G7KhflzP5zCG5/kooC0maXHoj19YStiHcw8lEW0TWlc+d+nB/zgoeTfcMEr+SIDn 13 | uEVvtErCQwt+SDyruXJonL5cvR0fGmAqLNpSz3munUUSCrYEuS88rI2LDZSof34i 14 | EoTle/hR1/1x0UG+UkdAP1hqWcpEnFdlVXjvtN4RIqf1y4GmutM= 15 | =JYba 16 | -----END PGP SIGNATURE----- 17 | -------------------------------------------------------------------------------- /Sources/libarchive-3.6.2.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.6.2.tar.xz -------------------------------------------------------------------------------- /Sources/libarchive-3.7.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.7.0.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.7.0.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQGzBAABCgAdFiEE2yx88bTCZfrvVuP8WEihi48UGEsFAmS2PmwACgkQWEihi48U 4 | GEtpcAv8DMKAMGP57DfCm1jN8rD3l9o/YEFv0M6wskrjjwThRaN56nGnAfd+bDQS 5 | z0rQay3dc6UIQkEq5+9rlTM/xyg9HhwAgLpnKy6lZWpKmblHY93B6l1ML69bY662 6 | iFhVFnj7ZapwJqcKqHWk3b6pLlxpup6xJVz6raiagZepYCQ7ocBgE4KhH5gcVRoE 7 | hkU8MCGO//L1E6oXwNvLs4gSTuvUP01PcpU+KEw1fPD0knuv5l6YwlHcQT3C/xbW 8 | /OtbXnFVdpXhWiSxYxMmt7hN32tPgx6SCZbBqhWz2A+9jEKfm9HrKXRRN0SMbNsh 9 | +RVxlBHPC0Iypj30slptH7lOxXg738PyUGJlIjT5S3JVnOzCg04arywyDXgf+IpO 10 | GHGOCtMlHK6sPgUcFkBqhZb+J4gEFsHwCi4PGVMV7KOZUl7MZkjbwO+8xFZo4uUD 11 | DrEC3JGkWE9tNtRKGFZlHSF+h8RP8XB+4r6ZCWGUl6kutfMTouKbLleCuVmlnAn/ 12 | ROpu7zYa 13 | =m1wF 14 | -----END PGP SIGNATURE----- 15 | -------------------------------------------------------------------------------- /Sources/libarchive-3.7.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.7.1.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.7.1.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQGzBAABCgAdFiEE2yx88bTCZfrvVuP8WEihi48UGEsFAmTFVGMACgkQWEihi48U 4 | GEv4Owv9HFx6fIVZ/BRypA6Gp3TiWmxEvkl59lkm13X0+I1uY6sgJYCyxA41sJtk 5 | 7KumQizVHx5+S+SZq+5MCzCKBqc6tdVxFllvrTDFNpMQrVjdQobTGRA+eX5YdNAq 6 | 6q5Yog2aE/i1Va0OzGfbV2jUjX8aqFs+iVDAYDAvf9h2G7ntti0hVLSCq0F9W2+G 7 | fbRbLy17vLasMok3pJ0TRi4wrhDDzdbj5qa6968NaNf5fj8RJKDWHWw5z3o1ndto 8 | n/OBFZYxAe6PilhEHnt1TGYCHU17+6NYDFlYIYEhB2kGUgW9PL42TRTdgqo5E977 9 | 56h3vhKlnrxN0yq+xceOBOpJ56mo4jMRAEXlc/hD0Sj9QpQNwRLoIwbGy8I4LYwi 10 | 3BlYEWxZNu/gID11LyC5I/dMbdbahvLOY1HGbD5u2zANhHHlLKSevK860zCGWSyx 11 | bcywwkw8dLep95WKsraNP8eWAb8mq2jTq2hYKNiwF52eKNd3q1nhJMAx50yaq2gX 12 | 4UBA3AjU 13 | =1ekl 14 | -----END PGP SIGNATURE----- 15 | -------------------------------------------------------------------------------- /Sources/libarchive-3.7.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.7.2.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.7.2.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQGzBAABCgAdFiEE2yx88bTCZfrvVuP8WEihi48UGEsFAmT/ktYACgkQWEihi48U 4 | GEs+pgwAxSdbJEG+9G4jYaTX8GkgRqURrUh525jL1zFuVM+e8NNiYRLZum17PqPn 5 | XQhUipXmm86P6OtcZxNg9G7K/+h5R7rUYS7VwOGxxg/3r4V07tkyCGPZBIzC1Wo8 6 | q9fi0Slen7H7Vck7a2EjSIIvG1JovTezvasbEBBsVA1R5r23vc2UnH5hlJ5GcKPy 7 | Beyz41x6nflx2k8mxi8oGWs72dddhsKy5inXSxUh5nyHG8DMlrCHsqVWezNFGFnb 8 | T+w6CKZXOaA9qwUIAEODb9MahJscdFF4srrQkuK5YXn4jrJEm2gEmEWvWVcM8hof 9 | x0ig9J4mg8u8jIYVIX1dhw9jfIAM7nzQj/YlL+t+R0p2ev0qkqTUEygNKIaRYUjO 10 | 0VjpXRMmS+d6SYddmSFxXlz8yTPujqnDHXwOVTOhPWAOP6O1I0rmZIJnUZgm52BV 11 | 0lfia1k3I2RApDJlVPmPnUSilaheTNBNl2gEZzkqQ6Ame3kC800zPRZja/7mXuig 12 | xHDQjONe 13 | =Z734 14 | -----END PGP SIGNATURE----- 15 | -------------------------------------------------------------------------------- /Sources/libarchive-3.7.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.7.4.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.7.4.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQGzBAABCgAdFiEE2yx88bTCZfrvVuP8WEihi48UGEsFAmYre30ACgkQWEihi48U 4 | GEuJiwwAjUiZDVNARAXymQj3safObTRrsZ1MO0PCb6TUVH4m79UDkTIWJRoTJSKe 5 | Zhxm+6FKX4zzmKAixG5PqnV1FFueFyBjSDJQwtsgNdVMvLu3u71TnaVRcdCfqPfL 6 | EjJLoh5qRjs3PkH8UELzwyt8cAtwpVNub+uE0pC7/Do0yVV8cvJhwDEoUmerY7yH 7 | blhEt/iNriDt1eTaOc8ngUpYeZ26re2aqR8Z/yDXgpNrLPAtQUK/Gu2ZJyLsJuh1 8 | tTeEB5o3NBag9jTznszcF2/OtuAumvvUSnV3gSd+kblpvxZ6cXxEBL1SG2O4ZgwZ 9 | tf0YSFEFM3RHQ+txw0zceajAcZ+2zdp01MN4EOIY1q9nUfxFttkGbz0ZOFdgrDVa 10 | iCYQ9x707JyQiuOuBYeCZpKOqtXoyItZSOWurPkZA91DdeCpCWwcG5r3DAf3GvJi 11 | whAnp3tp6lnNunZ4HRjDlqRRXHN4nDeQqSXcWrhitJOKm3Gv5nGRLFS7lT5sOmOL 12 | 9pAgyQZp 13 | =gwhu 14 | -----END PGP SIGNATURE----- 15 | -------------------------------------------------------------------------------- /Sources/libarchive-3.7.7.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/libarchive-3.7.7.tar.gz -------------------------------------------------------------------------------- /Sources/libarchive-3.7.7.tar.gz.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQGzBAABCgAdFiEE2yx88bTCZfrvVuP8WEihi48UGEsFAmcLg/sACgkQWEihi48U 4 | GEvcPAv/VFDcvOuRifDWwPS+ct3f9LwDdrpSfhrdcnig99R6Kom1bZgY9TCmIIv2 5 | 1qGwkLev7ZVQvAGtrzh1J87F4FzGZh50RhvbwurvBXtoiMspYKiHMuu9kbRPUJ8o 6 | vqa1rsQADKXe8uFyhd37LhxDLDEzl+gYfpI2XP2tMZAaRkdte0zc42MzFVJ5bKCg 7 | V/Q2tbyAiOnK8GZAQBjACb5UAB/KBCXPH+eyZKZ8Qbcp3cqRZfCbb49/q0lipv4N 8 | dmzekZmlPD8HGyaIFJmnb4Xq25ZX/AyLo5+TAOPIQyxHv23Zv8kjlhDvnK9s/CI8 9 | tb89wacyrBVZRdkME2TM64kax+g93508R1H3pp/j2pQHq4TId95tCdDwW3yrNlWk 10 | wwgHEwikC8ER1a11mpkqJFa1QeXTikqsumuXujP5GHiup+FICbctWWgeeyvd5Yh/ 11 | sT3ZLRUV1CWmTPQEDYIOPM1Dqd6fYxLB+6veQEnDwIWdjHJUABZ5U9kqoronLd7N 12 | LgMqIziV 13 | =OYQf 14 | -----END PGP SIGNATURE----- 15 | -------------------------------------------------------------------------------- /Sources/unzip11.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/unzip11.zip -------------------------------------------------------------------------------- /Sources/xz-5.2.4.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/xz-5.2.4.tar.xz -------------------------------------------------------------------------------- /Sources/xz-5.2.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/xz-5.2.5.tar.gz -------------------------------------------------------------------------------- /Sources/xz-5.2.5.tar.gz.sig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/xz-5.2.5.tar.gz.sig -------------------------------------------------------------------------------- /Sources/xz-5.4.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/xz-5.4.3.tar.gz -------------------------------------------------------------------------------- /Sources/xz-5.4.3.tar.gz.sig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/xz-5.4.3.tar.gz.sig -------------------------------------------------------------------------------- /Sources/xz-5.4.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/xz-5.4.4.tar.gz -------------------------------------------------------------------------------- /Sources/xz-5.4.4.tar.gz.sig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/xz-5.4.4.tar.gz.sig -------------------------------------------------------------------------------- /Sources/zlib-1.2.11.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srirangav/qlZipInfo/d8a4204c1d06b63357c580a76895c1ec08cd26e5/Sources/zlib-1.2.11.tar.gz -------------------------------------------------------------------------------- /getUTI.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # getUTI.sh - get the Uniform Type Identifier (UTI) for a file 4 | # 5 | # See: https://en.wikipedia.org/wiki/Uniform_Type_Identifier 6 | # 7 | # v0.1.0 - initial release 8 | # v0.1.1 - remove unneeded calls to awk, etc. 9 | # v0.1.2 - fix formatting 10 | # v0.1.3 - minor changes to pass shellcheck 11 | # 12 | # Copyright (c) 2020-2021 Sriranga R. Veeraraghavan 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining 15 | # a copy of this software and associated documentation files (the 16 | # "Software") to deal in the Software without restriction, including 17 | # without limitation the rights to use, copy, modify, merge, publish, 18 | # distribute, sublicense, and/or sell copies of the Software, and to 19 | # permit persons to whom the Software is furnished to do so, subject 20 | # to the following conditions: 21 | # 22 | # The above copyright notice and this permission notice shall be 23 | # included in all copies or substantial portions of the Software. 24 | # 25 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 28 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 29 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 30 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 31 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | # 33 | 34 | MDLS="/usr/bin/mdls" 35 | 36 | # check if at least one file was specified 37 | 38 | if [ z"$1" = "z" ] ; then 39 | echo "Usage: $0 [file1] [file2] ..." >& 2 40 | exit 1; 41 | fi 42 | 43 | # check if mdls is available 44 | 45 | if [ ! -x "$MDLS" ] ; then 46 | echo "ERROR: $MDLS not available" >& 2 47 | exit 1; 48 | fi 49 | 50 | for ARG in "$@" ; 51 | do 52 | if [ ! -r "$ARG" ] ; then 53 | echo "ERROR: $ARG is not readable / does not exist" >& 2 54 | continue 55 | fi 56 | 57 | # if more than one file was specified, print out the file name 58 | 59 | if [ $# -gt 1 ] ; then 60 | echo "--- $ARG ---" 61 | fi 62 | 63 | # print out the UTI using mdls 64 | 65 | "$MDLS" -name kMDItemContentType \ 66 | -name kMDItemContentTypeTree \ 67 | -name kMDItemKind "$ARG" 68 | done 69 | 70 | exit $? 71 | -------------------------------------------------------------------------------- /qlZipInfo/GTM/GTMNSString+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSString+HTML.h 3 | // Dealing with NSStrings that contain HTML 4 | // 5 | // Copyright 2006-2008 Google Inc. 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 8 | // use this file except in compliance with the License. You may obtain a copy 9 | // of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | // License for the specific language governing permissions and limitations under 17 | // the License. 18 | // 19 | 20 | #import 21 | 22 | NS_ASSUME_NONNULL_BEGIN 23 | 24 | /// Utilities for NSStrings containing HTML 25 | @interface NSString (GTMNSStringHTMLAdditions) 26 | 27 | /// Get a string where internal characters that need escaping for HTML are escaped 28 | /// 29 | /// For example, '&' become '&'. This will only cover characters from table 30 | /// A.2.2 of http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters 31 | /// which is what you want for a unicode encoded webpage. If you have a ascii 32 | /// or non-encoded webpage, please use stringByEscapingAsciiHTML which will 33 | /// encode all characters. 34 | /// 35 | /// For obvious reasons this call is only safe once. 36 | /// 37 | /// Returns: 38 | /// Autoreleased NSString 39 | - (NSString *)gtm_stringByEscapingForHTML; 40 | 41 | /// Get a string where internal characters that need escaping for HTML are escaped 42 | /// 43 | /// For example, '&' become '&' 44 | /// All non-mapped characters (unicode that don't have a &keyword; mapping) 45 | /// will be converted to the appropriate &#xxx; value. If your webpage is 46 | /// unicode encoded (UTF16 or UTF8) use stringByEscapingHTML instead as it is 47 | /// faster, and produces less bloated and more readable HTML (as long as you 48 | /// are using a unicode compliant HTML reader). 49 | /// 50 | /// For obvious reasons this call is only safe once. 51 | /// 52 | /// Returns: 53 | /// Autoreleased NSString 54 | - (NSString *)gtm_stringByEscapingForAsciiHTML; 55 | 56 | /// Get a string where internal characters that are escaped for HTML are unescaped 57 | /// 58 | /// For example, '&' becomes '&' 59 | /// Handles and 2 cases as well 60 | /// 61 | /// Returns: 62 | /// Autoreleased NSString 63 | - (NSString *)gtm_stringByUnescapingFromHTML; 64 | 65 | @end 66 | 67 | NS_ASSUME_NONNULL_END 68 | -------------------------------------------------------------------------------- /qlZipInfo/GenerateThumbnailForURL.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize); 6 | void CancelThumbnailGeneration(void *thisInterface, QLThumbnailRequestRef thumbnail); 7 | 8 | /* ----------------------------------------------------------------------------- 9 | Generate a thumbnail for file 10 | 11 | This function's job is to create thumbnail for designated file as fast as possible 12 | ----------------------------------------------------------------------------- */ 13 | 14 | OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize) 15 | { 16 | return noErr; 17 | } 18 | 19 | void CancelThumbnailGeneration(void *thisInterface, QLThumbnailRequestRef thumbnail) 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /qlZipInfo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeRole 11 | QLGenerator 12 | LSItemContentTypes 13 | 14 | com.pkware.zip-archive 15 | com.sun.java-archive 16 | com.winzip.zipx-archive 17 | public.zip-archive 18 | dyn.ah62d4rv4ge8xc6byp77gw6a 19 | org.gnu.gnu-zip-archive 20 | org.gnu.gnu-tar-archive 21 | org.gnu.gnu-zip-tar-archive 22 | public.tar-archive 23 | public.z-archive 24 | public.bzip2-archive 25 | public.tar-bzip2-archive 26 | com.apple.installer-package-archive 27 | com.apple.xar-archive 28 | com.apple.xip-archive 29 | com.apple.disk-image-cdr 30 | com.apple.binhex-archive 31 | com.apple.itunes.ipsw 32 | public.iso-image 33 | com.rarlab.rar-archive 34 | org.debian.deb-archive 35 | dyn.ah62d4rv4ge80k3pc 36 | cx.c3.lha-archive 37 | org.7-zip.7-zip-archive 38 | org.tukaani.xz-archive 39 | com.microsoft.cab 40 | public.uuencoded-archive 41 | com.redhat.rpm-archive 42 | com.roxio.disk-image-toast 43 | com.stuffit.archive.sit 44 | com.allume.stuffit-archive 45 | org.idpf.epub-container 46 | dyn.ah62d4rv4ge80g8dbsmv0u4p0qy 47 | 48 | 49 | 50 | CFBundleExecutable 51 | $(EXECUTABLE_NAME) 52 | CFBundleIdentifier 53 | $(PRODUCT_BUNDLE_IDENTIFIER) 54 | CFBundleInfoDictionaryVersion 55 | 6.0 56 | CFBundleName 57 | $(PRODUCT_NAME) 58 | CFBundleShortVersionString 59 | $(MARKETING_VERSION) 60 | CFBundleSignature 61 | ???? 62 | CFBundleVersion 63 | $(CURRENT_PROJECT_VERSION) 64 | CFPlugInDynamicRegisterFunction 65 | 66 | CFPlugInDynamicRegistration 67 | NO 68 | CFPlugInFactories 69 | 70 | 35007463-8B2B-4759-A3E6-49A74EA453EA 71 | QuickLookGeneratorPluginFactory 72 | 73 | CFPlugInTypes 74 | 75 | 5E2D9680-5022-40FA-B806-43349622E5B9 76 | 77 | 35007463-8B2B-4759-A3E6-49A74EA453EA 78 | 79 | 80 | CFPlugInUnloadFunction 81 | 82 | NSHumanReadableCopyright 83 | Portions Copyright © 2015-2022 Sriranga Veeraraghavan. All rights reserved. 84 | QLNeedsToBeRunInMainThread 85 | 86 | QLPreviewHeight 87 | 320 88 | QLPreviewWidth 89 | 640 90 | QLSupportsConcurrentRequests 91 | 92 | QLThumbnailMinimumSize 93 | 17 94 | 95 | 96 | -------------------------------------------------------------------------------- /qlZipInfo/binhex.h: -------------------------------------------------------------------------------- 1 | /* 2 | binhex.h - decode a binhex file 3 | 4 | History: 5 | 6 | v. 0.1.0 (11/13/2021) - initial release 7 | 8 | Copyright (c) 2021 Sriranga R. Veeraraghavan 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | "Software") to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject 16 | to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 25 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef qlZipInfo_binhex_h 31 | #define qlZipInfo_binhex_h 32 | 33 | /* constants */ 34 | 35 | enum 36 | { 37 | gHqxErr = -1, 38 | gHqxOkay = 0, 39 | }; 40 | 41 | /* maximum length of a file name in a binhex'ed file */ 42 | 43 | #define HQXFNAMEMAX 64 44 | 45 | /* structures */ 46 | 47 | /* binhex 4.0 header, although type and creator are 4 bytes, 48 | we allocate 5 to store the trailing '\0' */ 49 | 50 | typedef struct hqxHeader 51 | { 52 | char name[HQXFNAMEMAX+1]; 53 | char asciiName[HQXFNAMEMAX+1]; 54 | char type[5]; 55 | char creator[5]; 56 | short flags; 57 | long dataLen; 58 | long rsrcLen; 59 | short headerCRC; 60 | } hqxHeader_t; 61 | 62 | /* binhex 4.0 file handle */ 63 | 64 | typedef struct hqxFileHandle 65 | { 66 | const char *fname; 67 | int fd; 68 | FILE *fp; 69 | hqxHeader_t hqxHeader; 70 | short crc; 71 | short dataCRC; 72 | short rsrcCRC; 73 | int haveExtractedDataFork; 74 | int repeat; 75 | int repeatChar; 76 | int eof; 77 | char outputBuffer[3]; 78 | char *outputPtr; 79 | char *outputEnd; 80 | char readBuf[1024]; 81 | ssize_t readBufIndex; 82 | ssize_t readBufSize; 83 | int readBufAtEOF; 84 | } hqxFileHandle_t; 85 | 86 | /* prototypes */ 87 | 88 | int hqxInitFileHandle(const char *fname, hqxFileHandle_t *hqxFile); 89 | int hqxReleaseFileHandle(hqxFileHandle_t *hqxFile); 90 | int hqxGetHeader(hqxFileHandle_t *hqxFile); 91 | 92 | #endif /* qlZipInfo_binhex_h */ 93 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_acl_private.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2010 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef ARCHIVE_ACL_PRIVATE_H_INCLUDED 27 | #define ARCHIVE_ACL_PRIVATE_H_INCLUDED 28 | 29 | #ifndef __LIBARCHIVE_BUILD 30 | #error This header is only to be used internally to libarchive. 31 | #endif 32 | 33 | #include "archive_string.h" 34 | 35 | struct archive_acl_entry { 36 | struct archive_acl_entry *next; 37 | int type; /* E.g., access or default */ 38 | int tag; /* E.g., user/group/other/mask */ 39 | int permset; /* r/w/x bits */ 40 | int id; /* uid/gid for user/group */ 41 | struct archive_mstring name; /* uname/gname */ 42 | }; 43 | 44 | struct archive_acl { 45 | mode_t mode; 46 | struct archive_acl_entry *acl_head; 47 | struct archive_acl_entry *acl_p; 48 | int acl_state; /* See acl_next for details. */ 49 | wchar_t *acl_text_w; 50 | char *acl_text; 51 | int acl_types; 52 | }; 53 | 54 | void archive_acl_clear(struct archive_acl *); 55 | void archive_acl_copy(struct archive_acl *, struct archive_acl *); 56 | int archive_acl_count(struct archive_acl *, int); 57 | int archive_acl_types(struct archive_acl *); 58 | int archive_acl_reset(struct archive_acl *, int); 59 | int archive_acl_next(struct archive *, struct archive_acl *, int, 60 | int *, int *, int *, int *, const char **); 61 | 62 | int archive_acl_add_entry(struct archive_acl *, int, int, int, int, const char *); 63 | int archive_acl_add_entry_w_len(struct archive_acl *, 64 | int, int, int, int, const wchar_t *, size_t); 65 | int archive_acl_add_entry_len(struct archive_acl *, 66 | int, int, int, int, const char *, size_t); 67 | 68 | wchar_t *archive_acl_to_text_w(struct archive_acl *, ssize_t *, int, 69 | struct archive *); 70 | char *archive_acl_to_text_l(struct archive_acl *, ssize_t *, int, 71 | struct archive_string_conv *); 72 | 73 | /* 74 | * ACL text parser. 75 | */ 76 | int archive_acl_from_text_w(struct archive_acl *, const wchar_t * /* wtext */, 77 | int /* type */); 78 | int archive_acl_from_text_l(struct archive_acl *, const char * /* text */, 79 | int /* type */, struct archive_string_conv *); 80 | int archive_acl_from_text_nl(struct archive_acl *, const char * /* text */, 81 | size_t /* size of text */, int /* type */, struct archive_string_conv *); 82 | 83 | #endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */ 84 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_blake2_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | BLAKE2 reference source code package - reference C implementations 3 | 4 | Copyright 2012, Samuel Neves . You may use this under the 5 | terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at 6 | your option. The terms of these licenses can be found at: 7 | 8 | - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 9 | - OpenSSL license : https://www.openssl.org/source/license.html 10 | - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | More information about the BLAKE2 hash function can be found at 13 | https://blake2.net. 14 | */ 15 | 16 | #ifndef ARCHIVE_BLAKE2_IMPL_H 17 | #define ARCHIVE_BLAKE2_IMPL_H 18 | 19 | #include 20 | #include 21 | 22 | #if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) 23 | #if defined(_MSC_VER) 24 | #define BLAKE2_INLINE __inline 25 | #elif defined(__GNUC__) 26 | #define BLAKE2_INLINE __inline__ 27 | #else 28 | #define BLAKE2_INLINE 29 | #endif 30 | #else 31 | #define BLAKE2_INLINE inline 32 | #endif 33 | 34 | static BLAKE2_INLINE uint32_t load32( const void *src ) 35 | { 36 | #if defined(NATIVE_LITTLE_ENDIAN) 37 | uint32_t w; 38 | memcpy(&w, src, sizeof w); 39 | return w; 40 | #else 41 | const uint8_t *p = ( const uint8_t * )src; 42 | return (( uint32_t )( p[0] ) << 0) | 43 | (( uint32_t )( p[1] ) << 8) | 44 | (( uint32_t )( p[2] ) << 16) | 45 | (( uint32_t )( p[3] ) << 24) ; 46 | #endif 47 | } 48 | 49 | static BLAKE2_INLINE uint64_t load64( const void *src ) 50 | { 51 | #if defined(NATIVE_LITTLE_ENDIAN) 52 | uint64_t w; 53 | memcpy(&w, src, sizeof w); 54 | return w; 55 | #else 56 | const uint8_t *p = ( const uint8_t * )src; 57 | return (( uint64_t )( p[0] ) << 0) | 58 | (( uint64_t )( p[1] ) << 8) | 59 | (( uint64_t )( p[2] ) << 16) | 60 | (( uint64_t )( p[3] ) << 24) | 61 | (( uint64_t )( p[4] ) << 32) | 62 | (( uint64_t )( p[5] ) << 40) | 63 | (( uint64_t )( p[6] ) << 48) | 64 | (( uint64_t )( p[7] ) << 56) ; 65 | #endif 66 | } 67 | 68 | static BLAKE2_INLINE uint16_t load16( const void *src ) 69 | { 70 | #if defined(NATIVE_LITTLE_ENDIAN) 71 | uint16_t w; 72 | memcpy(&w, src, sizeof w); 73 | return w; 74 | #else 75 | const uint8_t *p = ( const uint8_t * )src; 76 | return ( uint16_t )((( uint32_t )( p[0] ) << 0) | 77 | (( uint32_t )( p[1] ) << 8)); 78 | #endif 79 | } 80 | 81 | static BLAKE2_INLINE void store16( void *dst, uint16_t w ) 82 | { 83 | #if defined(NATIVE_LITTLE_ENDIAN) 84 | memcpy(dst, &w, sizeof w); 85 | #else 86 | uint8_t *p = ( uint8_t * )dst; 87 | *p++ = ( uint8_t )w; w >>= 8; 88 | *p++ = ( uint8_t )w; 89 | #endif 90 | } 91 | 92 | static BLAKE2_INLINE void store32( void *dst, uint32_t w ) 93 | { 94 | #if defined(NATIVE_LITTLE_ENDIAN) 95 | memcpy(dst, &w, sizeof w); 96 | #else 97 | uint8_t *p = ( uint8_t * )dst; 98 | p[0] = (uint8_t)(w >> 0); 99 | p[1] = (uint8_t)(w >> 8); 100 | p[2] = (uint8_t)(w >> 16); 101 | p[3] = (uint8_t)(w >> 24); 102 | #endif 103 | } 104 | 105 | static BLAKE2_INLINE void store64( void *dst, uint64_t w ) 106 | { 107 | #if defined(NATIVE_LITTLE_ENDIAN) 108 | memcpy(dst, &w, sizeof w); 109 | #else 110 | uint8_t *p = ( uint8_t * )dst; 111 | p[0] = (uint8_t)(w >> 0); 112 | p[1] = (uint8_t)(w >> 8); 113 | p[2] = (uint8_t)(w >> 16); 114 | p[3] = (uint8_t)(w >> 24); 115 | p[4] = (uint8_t)(w >> 32); 116 | p[5] = (uint8_t)(w >> 40); 117 | p[6] = (uint8_t)(w >> 48); 118 | p[7] = (uint8_t)(w >> 56); 119 | #endif 120 | } 121 | 122 | static BLAKE2_INLINE uint64_t load48( const void *src ) 123 | { 124 | const uint8_t *p = ( const uint8_t * )src; 125 | return (( uint64_t )( p[0] ) << 0) | 126 | (( uint64_t )( p[1] ) << 8) | 127 | (( uint64_t )( p[2] ) << 16) | 128 | (( uint64_t )( p[3] ) << 24) | 129 | (( uint64_t )( p[4] ) << 32) | 130 | (( uint64_t )( p[5] ) << 40) ; 131 | } 132 | 133 | static BLAKE2_INLINE void store48( void *dst, uint64_t w ) 134 | { 135 | uint8_t *p = ( uint8_t * )dst; 136 | p[0] = (uint8_t)(w >> 0); 137 | p[1] = (uint8_t)(w >> 8); 138 | p[2] = (uint8_t)(w >> 16); 139 | p[3] = (uint8_t)(w >> 24); 140 | p[4] = (uint8_t)(w >> 32); 141 | p[5] = (uint8_t)(w >> 40); 142 | } 143 | 144 | static BLAKE2_INLINE uint32_t rotr32( const uint32_t w, const unsigned c ) 145 | { 146 | return ( w >> c ) | ( w << ( 32 - c ) ); 147 | } 148 | 149 | static BLAKE2_INLINE uint64_t rotr64( const uint64_t w, const unsigned c ) 150 | { 151 | return ( w >> c ) | ( w << ( 64 - c ) ); 152 | } 153 | 154 | /* prevents compiler optimizing out memset() */ 155 | static BLAKE2_INLINE void secure_zero_memory(void *v, size_t n) 156 | { 157 | static void *(__LA_LIBC_CC *const volatile memset_v)(void *, int, size_t) = &memset; 158 | memset_v(v, 0, n); 159 | } 160 | 161 | #endif 162 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_check_magic.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2010 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_SYS_TYPES_H 29 | #include 30 | #endif 31 | 32 | #include 33 | #ifdef HAVE_STDLIB_H 34 | #include 35 | #endif 36 | #ifdef HAVE_STRING_H 37 | #include 38 | #endif 39 | #ifdef HAVE_UNISTD_H 40 | #include 41 | #endif 42 | #if defined(_WIN32) && !defined(__CYGWIN__) 43 | #include 44 | #include 45 | #endif 46 | 47 | #include "archive_private.h" 48 | 49 | static void 50 | errmsg(const char *m) 51 | { 52 | size_t s = strlen(m); 53 | ssize_t written; 54 | 55 | while (s > 0) { 56 | written = write(2, m, s); 57 | if (written <= 0) 58 | return; 59 | m += written; 60 | s -= written; 61 | } 62 | } 63 | 64 | static __LA_NORETURN void 65 | diediedie(void) 66 | { 67 | #if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG) 68 | /* Cause a breakpoint exception */ 69 | DebugBreak(); 70 | #endif 71 | abort(); /* Terminate the program abnormally. */ 72 | } 73 | 74 | static const char * 75 | state_name(unsigned s) 76 | { 77 | switch (s) { 78 | case ARCHIVE_STATE_NEW: return ("new"); 79 | case ARCHIVE_STATE_HEADER: return ("header"); 80 | case ARCHIVE_STATE_DATA: return ("data"); 81 | case ARCHIVE_STATE_EOF: return ("eof"); 82 | case ARCHIVE_STATE_CLOSED: return ("closed"); 83 | case ARCHIVE_STATE_FATAL: return ("fatal"); 84 | default: return ("??"); 85 | } 86 | } 87 | 88 | static const char * 89 | archive_handle_type_name(unsigned m) 90 | { 91 | switch (m) { 92 | case ARCHIVE_WRITE_MAGIC: return ("archive_write"); 93 | case ARCHIVE_READ_MAGIC: return ("archive_read"); 94 | case ARCHIVE_WRITE_DISK_MAGIC: return ("archive_write_disk"); 95 | case ARCHIVE_READ_DISK_MAGIC: return ("archive_read_disk"); 96 | case ARCHIVE_MATCH_MAGIC: return ("archive_match"); 97 | default: return NULL; 98 | } 99 | } 100 | 101 | static void 102 | write_all_states(char *buff, unsigned int states) 103 | { 104 | unsigned int lowbit; 105 | 106 | *buff = '\0'; 107 | 108 | /* A trick for computing the lowest set bit. */ 109 | while ((lowbit = states & (1 + ~states)) != 0) { 110 | states &= ~lowbit; /* Clear the low bit. */ 111 | strcat(buff, state_name(lowbit)); 112 | if (states != 0) 113 | strcat(buff, "/"); 114 | } 115 | } 116 | 117 | /* 118 | * Check magic value and current state. 119 | * Magic value mismatches are fatal and result in calls to abort(). 120 | * State mismatches return ARCHIVE_FATAL. 121 | * Otherwise, returns ARCHIVE_OK. 122 | * 123 | * This is designed to catch serious programming errors that violate 124 | * the libarchive API. 125 | */ 126 | int 127 | __archive_check_magic(struct archive *a, unsigned int magic, 128 | unsigned int state, const char *function) 129 | { 130 | char states1[64]; 131 | char states2[64]; 132 | const char *handle_type; 133 | 134 | /* 135 | * If this isn't some form of archive handle, 136 | * then the library user has screwed up so bad that 137 | * we don't even have a reliable way to report an error. 138 | */ 139 | handle_type = archive_handle_type_name(a->magic); 140 | 141 | if (!handle_type) { 142 | errmsg("PROGRAMMER ERROR: Function "); 143 | errmsg(function); 144 | errmsg(" invoked with invalid archive handle.\n"); 145 | diediedie(); 146 | } 147 | 148 | if (a->magic != magic) { 149 | archive_set_error(a, -1, 150 | "PROGRAMMER ERROR: Function '%s' invoked" 151 | " on '%s' archive object, which is not supported.", 152 | function, 153 | handle_type); 154 | a->state = ARCHIVE_STATE_FATAL; 155 | return (ARCHIVE_FATAL); 156 | } 157 | 158 | if ((a->state & state) == 0) { 159 | /* If we're already FATAL, don't overwrite the error. */ 160 | if (a->state != ARCHIVE_STATE_FATAL) { 161 | write_all_states(states1, a->state); 162 | write_all_states(states2, state); 163 | archive_set_error(a, -1, 164 | "INTERNAL ERROR: Function '%s' invoked with" 165 | " archive structure in state '%s'," 166 | " should be in state '%s'", 167 | function, 168 | states1, 169 | states2); 170 | } 171 | a->state = ARCHIVE_STATE_FATAL; 172 | return (ARCHIVE_FATAL); 173 | } 174 | return (ARCHIVE_OK); 175 | } 176 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_cmdline_private.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2012 Michihiro NAKAJIMA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef ARCHIVE_CMDLINE_PRIVATE_H 27 | #define ARCHIVE_CMDLINE_PRIVATE_H 28 | 29 | #ifndef __LIBARCHIVE_BUILD 30 | #ifndef __LIBARCHIVE_TEST 31 | #error This header is only to be used internally to libarchive. 32 | #endif 33 | #endif 34 | 35 | struct archive_cmdline { 36 | char *path; 37 | char **argv; 38 | int argc; 39 | }; 40 | 41 | struct archive_cmdline *__archive_cmdline_allocate(void); 42 | int __archive_cmdline_parse(struct archive_cmdline *, const char *); 43 | int __archive_cmdline_free(struct archive_cmdline *); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_endian.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2002 Thomas Moestl 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | * Borrowed from FreeBSD's 27 | */ 28 | 29 | #ifndef ARCHIVE_ENDIAN_H_INCLUDED 30 | #define ARCHIVE_ENDIAN_H_INCLUDED 31 | 32 | /* Note: This is a purely internal header! */ 33 | /* Do not use this outside of libarchive internal code! */ 34 | 35 | #ifndef __LIBARCHIVE_BUILD 36 | #error This header is only to be used internally to libarchive. 37 | #endif 38 | 39 | /* 40 | * Disabling inline keyword for compilers known to choke on it: 41 | * - Watcom C++ in C code. (For any version?) 42 | * - SGI MIPSpro 43 | * - Microsoft Visual C++ 6.0 (supposedly newer versions too) 44 | * - IBM VisualAge 6 (XL v6) 45 | * - Sun WorkShop C (SunPro) before 5.9 46 | */ 47 | #if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__) 48 | #define inline 49 | #elif defined(__IBMC__) && __IBMC__ < 700 50 | #define inline 51 | #elif defined(__SUNPRO_C) && __SUNPRO_C < 0x590 52 | #define inline 53 | #elif defined(_MSC_VER) || defined(__osf__) 54 | #define inline __inline 55 | #endif 56 | 57 | /* Alignment-agnostic encode/decode bytestream to/from little/big endian. */ 58 | 59 | static inline uint16_t 60 | archive_be16dec(const void *pp) 61 | { 62 | unsigned char const *p = (unsigned char const *)pp; 63 | 64 | /* Store into unsigned temporaries before left shifting, to avoid 65 | promotion to signed int and then left shifting into the sign bit, 66 | which is undefined behaviour. */ 67 | unsigned int p1 = p[1]; 68 | unsigned int p0 = p[0]; 69 | 70 | return ((p0 << 8) | p1); 71 | } 72 | 73 | static inline uint32_t 74 | archive_be32dec(const void *pp) 75 | { 76 | unsigned char const *p = (unsigned char const *)pp; 77 | 78 | /* Store into unsigned temporaries before left shifting, to avoid 79 | promotion to signed int and then left shifting into the sign bit, 80 | which is undefined behaviour. */ 81 | unsigned int p3 = p[3]; 82 | unsigned int p2 = p[2]; 83 | unsigned int p1 = p[1]; 84 | unsigned int p0 = p[0]; 85 | 86 | return ((p0 << 24) | (p1 << 16) | (p2 << 8) | p3); 87 | } 88 | 89 | static inline uint64_t 90 | archive_be64dec(const void *pp) 91 | { 92 | unsigned char const *p = (unsigned char const *)pp; 93 | 94 | return (((uint64_t)archive_be32dec(p) << 32) | archive_be32dec(p + 4)); 95 | } 96 | 97 | static inline uint16_t 98 | archive_le16dec(const void *pp) 99 | { 100 | unsigned char const *p = (unsigned char const *)pp; 101 | 102 | /* Store into unsigned temporaries before left shifting, to avoid 103 | promotion to signed int and then left shifting into the sign bit, 104 | which is undefined behaviour. */ 105 | unsigned int p1 = p[1]; 106 | unsigned int p0 = p[0]; 107 | 108 | return ((p1 << 8) | p0); 109 | } 110 | 111 | static inline uint32_t 112 | archive_le32dec(const void *pp) 113 | { 114 | unsigned char const *p = (unsigned char const *)pp; 115 | 116 | /* Store into unsigned temporaries before left shifting, to avoid 117 | promotion to signed int and then left shifting into the sign bit, 118 | which is undefined behaviour. */ 119 | unsigned int p3 = p[3]; 120 | unsigned int p2 = p[2]; 121 | unsigned int p1 = p[1]; 122 | unsigned int p0 = p[0]; 123 | 124 | return ((p3 << 24) | (p2 << 16) | (p1 << 8) | p0); 125 | } 126 | 127 | static inline uint64_t 128 | archive_le64dec(const void *pp) 129 | { 130 | unsigned char const *p = (unsigned char const *)pp; 131 | 132 | return (((uint64_t)archive_le32dec(p + 4) << 32) | archive_le32dec(p)); 133 | } 134 | 135 | static inline void 136 | archive_be16enc(void *pp, uint16_t u) 137 | { 138 | unsigned char *p = (unsigned char *)pp; 139 | 140 | p[0] = (u >> 8) & 0xff; 141 | p[1] = u & 0xff; 142 | } 143 | 144 | static inline void 145 | archive_be32enc(void *pp, uint32_t u) 146 | { 147 | unsigned char *p = (unsigned char *)pp; 148 | 149 | p[0] = (u >> 24) & 0xff; 150 | p[1] = (u >> 16) & 0xff; 151 | p[2] = (u >> 8) & 0xff; 152 | p[3] = u & 0xff; 153 | } 154 | 155 | static inline void 156 | archive_be64enc(void *pp, uint64_t u) 157 | { 158 | unsigned char *p = (unsigned char *)pp; 159 | 160 | archive_be32enc(p, (uint32_t)(u >> 32)); 161 | archive_be32enc(p + 4, (uint32_t)(u & 0xffffffff)); 162 | } 163 | 164 | static inline void 165 | archive_le16enc(void *pp, uint16_t u) 166 | { 167 | unsigned char *p = (unsigned char *)pp; 168 | 169 | p[0] = u & 0xff; 170 | p[1] = (u >> 8) & 0xff; 171 | } 172 | 173 | static inline void 174 | archive_le32enc(void *pp, uint32_t u) 175 | { 176 | unsigned char *p = (unsigned char *)pp; 177 | 178 | p[0] = u & 0xff; 179 | p[1] = (u >> 8) & 0xff; 180 | p[2] = (u >> 16) & 0xff; 181 | p[3] = (u >> 24) & 0xff; 182 | } 183 | 184 | static inline void 185 | archive_le64enc(void *pp, uint64_t u) 186 | { 187 | unsigned char *p = (unsigned char *)pp; 188 | 189 | archive_le32enc(p, (uint32_t)(u & 0xffffffff)); 190 | archive_le32enc(p + 4, (uint32_t)(u >> 32)); 191 | } 192 | 193 | #endif 194 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_entry_copy_bhfi.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #include "archive_private.h" 29 | #include "archive_entry.h" 30 | 31 | #if defined(_WIN32) && !defined(__CYGWIN__) 32 | 33 | #define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) 34 | 35 | __inline static void 36 | fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns) 37 | { 38 | ULARGE_INTEGER utc; 39 | 40 | utc.HighPart = filetime->dwHighDateTime; 41 | utc.LowPart = filetime->dwLowDateTime; 42 | if (utc.QuadPart >= EPOC_TIME) { 43 | utc.QuadPart -= EPOC_TIME; 44 | *t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */ 45 | *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */ 46 | } else { 47 | *t = 0; 48 | *ns = 0; 49 | } 50 | } 51 | 52 | void 53 | archive_entry_copy_bhfi(struct archive_entry *entry, 54 | BY_HANDLE_FILE_INFORMATION *bhfi) 55 | { 56 | time_t secs; 57 | long nsecs; 58 | 59 | fileTimeToUtc(&bhfi->ftLastAccessTime, &secs, &nsecs); 60 | archive_entry_set_atime(entry, secs, nsecs); 61 | fileTimeToUtc(&bhfi->ftLastWriteTime, &secs, &nsecs); 62 | archive_entry_set_mtime(entry, secs, nsecs); 63 | fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs); 64 | archive_entry_set_birthtime(entry, secs, nsecs); 65 | archive_entry_set_ctime(entry, secs, nsecs); 66 | archive_entry_set_dev(entry, bhfi->dwVolumeSerialNumber); 67 | archive_entry_set_ino64(entry, (((int64_t)bhfi->nFileIndexHigh) << 32) 68 | + bhfi->nFileIndexLow); 69 | archive_entry_set_nlink(entry, bhfi->nNumberOfLinks); 70 | archive_entry_set_size(entry, (((int64_t)bhfi->nFileSizeHigh) << 32) 71 | + bhfi->nFileSizeLow); 72 | /* archive_entry_set_mode(entry, st->st_mode); */ 73 | } 74 | #endif 75 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_entry_copy_stat.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_SYS_STAT_H 29 | #include 30 | #endif 31 | 32 | #include "archive.h" 33 | #include "archive_entry.h" 34 | 35 | void 36 | archive_entry_copy_stat(struct archive_entry *entry, const struct stat *st) 37 | { 38 | #if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 39 | archive_entry_set_atime(entry, st->st_atime, st->st_atimespec.tv_nsec); 40 | archive_entry_set_ctime(entry, st->st_ctime, st->st_ctimespec.tv_nsec); 41 | archive_entry_set_mtime(entry, st->st_mtime, st->st_mtimespec.tv_nsec); 42 | #elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 43 | archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec); 44 | archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec); 45 | archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec); 46 | #elif HAVE_STRUCT_STAT_ST_MTIME_NSEC 47 | archive_entry_set_atime(entry, st->st_atime, st->st_atime_nsec); 48 | archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_nsec); 49 | archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_nsec); 50 | #elif HAVE_STRUCT_STAT_ST_MTIME_N 51 | archive_entry_set_atime(entry, st->st_atime, st->st_atime_n); 52 | archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n); 53 | archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_n); 54 | #elif HAVE_STRUCT_STAT_ST_UMTIME 55 | archive_entry_set_atime(entry, st->st_atime, st->st_uatime * 1000); 56 | archive_entry_set_ctime(entry, st->st_ctime, st->st_uctime * 1000); 57 | archive_entry_set_mtime(entry, st->st_mtime, st->st_umtime * 1000); 58 | #elif HAVE_STRUCT_STAT_ST_MTIME_USEC 59 | archive_entry_set_atime(entry, st->st_atime, st->st_atime_usec * 1000); 60 | archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_usec * 1000); 61 | archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_usec * 1000); 62 | #else 63 | archive_entry_set_atime(entry, st->st_atime, 0); 64 | archive_entry_set_ctime(entry, st->st_ctime, 0); 65 | archive_entry_set_mtime(entry, st->st_mtime, 0); 66 | #endif 67 | #if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 68 | archive_entry_set_birthtime(entry, st->st_birthtime, st->st_birthtimespec.tv_nsec); 69 | #elif HAVE_STRUCT_STAT_ST_BIRTHTIME 70 | archive_entry_set_birthtime(entry, st->st_birthtime, 0); 71 | #else 72 | archive_entry_unset_birthtime(entry); 73 | #endif 74 | archive_entry_set_dev(entry, st->st_dev); 75 | archive_entry_set_gid(entry, st->st_gid); 76 | archive_entry_set_uid(entry, st->st_uid); 77 | archive_entry_set_ino(entry, st->st_ino); 78 | archive_entry_set_nlink(entry, st->st_nlink); 79 | archive_entry_set_rdev(entry, st->st_rdev); 80 | archive_entry_set_size(entry, st->st_size); 81 | archive_entry_set_mode(entry, st->st_mode); 82 | } 83 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_entry_locale.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2011 Michihiro NAKAJIMA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef ARCHIVE_ENTRY_LOCALE_H_INCLUDED 27 | #define ARCHIVE_ENTRY_LOCALE_H_INCLUDED 28 | 29 | #ifndef __LIBARCHIVE_BUILD 30 | #error This header is only to be used internally to libarchive. 31 | #endif 32 | 33 | struct archive_entry; 34 | struct archive_string_conv; 35 | 36 | /* 37 | * Utility functions to set and get entry attributes by translating 38 | * character-set. These are designed for use in format readers and writers. 39 | * 40 | * The return code and interface of these are quite different from other 41 | * functions for archive_entry defined in archive_entry.h. 42 | * Common return code are: 43 | * Return 0 if the string conversion succeeded. 44 | * Return -1 if the string conversion failed. 45 | */ 46 | 47 | #define archive_entry_gname_l _archive_entry_gname_l 48 | int _archive_entry_gname_l(struct archive_entry *, 49 | const char **, size_t *, struct archive_string_conv *); 50 | #define archive_entry_hardlink_l _archive_entry_hardlink_l 51 | int _archive_entry_hardlink_l(struct archive_entry *, 52 | const char **, size_t *, struct archive_string_conv *); 53 | #define archive_entry_pathname_l _archive_entry_pathname_l 54 | int _archive_entry_pathname_l(struct archive_entry *, 55 | const char **, size_t *, struct archive_string_conv *); 56 | #define archive_entry_symlink_l _archive_entry_symlink_l 57 | int _archive_entry_symlink_l(struct archive_entry *, 58 | const char **, size_t *, struct archive_string_conv *); 59 | #define archive_entry_uname_l _archive_entry_uname_l 60 | int _archive_entry_uname_l(struct archive_entry *, 61 | const char **, size_t *, struct archive_string_conv *); 62 | #define archive_entry_acl_text_l _archive_entry_acl_text_l 63 | int _archive_entry_acl_text_l(struct archive_entry *, int, 64 | const char **, size_t *, struct archive_string_conv *) __LA_DEPRECATED; 65 | #define archive_entry_acl_to_text_l _archive_entry_acl_to_text_l 66 | char *_archive_entry_acl_to_text_l(struct archive_entry *, ssize_t *, int, 67 | struct archive_string_conv *); 68 | #define archive_entry_acl_from_text_l _archive_entry_acl_from_text_l 69 | int _archive_entry_acl_from_text_l(struct archive_entry *, const char* text, 70 | int type, struct archive_string_conv *); 71 | #define archive_entry_copy_gname_l _archive_entry_copy_gname_l 72 | int _archive_entry_copy_gname_l(struct archive_entry *, 73 | const char *, size_t, struct archive_string_conv *); 74 | #define archive_entry_copy_hardlink_l _archive_entry_copy_hardlink_l 75 | int _archive_entry_copy_hardlink_l(struct archive_entry *, 76 | const char *, size_t, struct archive_string_conv *); 77 | #define archive_entry_copy_link_l _archive_entry_copy_link_l 78 | int _archive_entry_copy_link_l(struct archive_entry *, 79 | const char *, size_t, struct archive_string_conv *); 80 | #define archive_entry_copy_pathname_l _archive_entry_copy_pathname_l 81 | int _archive_entry_copy_pathname_l(struct archive_entry *, 82 | const char *, size_t, struct archive_string_conv *); 83 | #define archive_entry_copy_symlink_l _archive_entry_copy_symlink_l 84 | int _archive_entry_copy_symlink_l(struct archive_entry *, 85 | const char *, size_t, struct archive_string_conv *); 86 | #define archive_entry_copy_uname_l _archive_entry_copy_uname_l 87 | int _archive_entry_copy_uname_l(struct archive_entry *, 88 | const char *, size_t, struct archive_string_conv *); 89 | 90 | #endif /* ARCHIVE_ENTRY_LOCALE_H_INCLUDED */ 91 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_entry_sparse.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * Copyright (c) 2010-2011 Michihiro NAKAJIMA 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #include "archive_platform.h" 28 | 29 | #include "archive.h" 30 | #include "archive_entry.h" 31 | #include "archive_private.h" 32 | #include "archive_entry_private.h" 33 | 34 | /* 35 | * sparse handling 36 | */ 37 | 38 | void 39 | archive_entry_sparse_clear(struct archive_entry *entry) 40 | { 41 | struct ae_sparse *sp; 42 | 43 | while (entry->sparse_head != NULL) { 44 | sp = entry->sparse_head->next; 45 | free(entry->sparse_head); 46 | entry->sparse_head = sp; 47 | } 48 | entry->sparse_tail = NULL; 49 | } 50 | 51 | void 52 | archive_entry_sparse_add_entry(struct archive_entry *entry, 53 | la_int64_t offset, la_int64_t length) 54 | { 55 | struct ae_sparse *sp; 56 | 57 | if (offset < 0 || length < 0) 58 | /* Invalid value */ 59 | return; 60 | if (offset > INT64_MAX - length || 61 | offset + length > archive_entry_size(entry)) 62 | /* A value of "length" parameter is too large. */ 63 | return; 64 | if ((sp = entry->sparse_tail) != NULL) { 65 | if (sp->offset + sp->length > offset) 66 | /* Invalid value. */ 67 | return; 68 | if (sp->offset + sp->length == offset) { 69 | if (sp->offset + sp->length + length < 0) 70 | /* A value of "length" parameter is 71 | * too large. */ 72 | return; 73 | /* Expand existing sparse block size. */ 74 | sp->length += length; 75 | return; 76 | } 77 | } 78 | 79 | if ((sp = malloc(sizeof(*sp))) == NULL) 80 | /* XXX Error XXX */ 81 | return; 82 | 83 | sp->offset = offset; 84 | sp->length = length; 85 | sp->next = NULL; 86 | 87 | if (entry->sparse_head == NULL) 88 | entry->sparse_head = entry->sparse_tail = sp; 89 | else { 90 | /* Add a new sparse block to the tail of list. */ 91 | if (entry->sparse_tail != NULL) 92 | entry->sparse_tail->next = sp; 93 | entry->sparse_tail = sp; 94 | } 95 | } 96 | 97 | 98 | /* 99 | * returns number of the sparse entries 100 | */ 101 | int 102 | archive_entry_sparse_count(struct archive_entry *entry) 103 | { 104 | struct ae_sparse *sp; 105 | int count = 0; 106 | 107 | for (sp = entry->sparse_head; sp != NULL; sp = sp->next) 108 | count++; 109 | 110 | /* 111 | * Sanity check if this entry is exactly sparse. 112 | * If amount of sparse blocks is just one and it indicates the whole 113 | * file data, we should remove it and return zero. 114 | */ 115 | if (count == 1) { 116 | sp = entry->sparse_head; 117 | if (sp->offset == 0 && 118 | sp->length >= archive_entry_size(entry)) { 119 | count = 0; 120 | archive_entry_sparse_clear(entry); 121 | } 122 | } 123 | 124 | return (count); 125 | } 126 | 127 | int 128 | archive_entry_sparse_reset(struct archive_entry * entry) 129 | { 130 | entry->sparse_p = entry->sparse_head; 131 | 132 | return archive_entry_sparse_count(entry); 133 | } 134 | 135 | int 136 | archive_entry_sparse_next(struct archive_entry * entry, 137 | la_int64_t *offset, la_int64_t *length) 138 | { 139 | if (entry->sparse_p) { 140 | *offset = entry->sparse_p->offset; 141 | *length = entry->sparse_p->length; 142 | 143 | entry->sparse_p = entry->sparse_p->next; 144 | 145 | return (ARCHIVE_OK); 146 | } else { 147 | *offset = 0; 148 | *length = 0; 149 | return (ARCHIVE_WARN); 150 | } 151 | } 152 | 153 | /* 154 | * end of sparse handling 155 | */ 156 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_entry_stat.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_SYS_STAT_H 29 | #include 30 | #endif 31 | #ifdef HAVE_STDLIB_H 32 | #include 33 | #endif 34 | 35 | #include "archive_entry.h" 36 | #include "archive_entry_private.h" 37 | 38 | const struct stat * 39 | archive_entry_stat(struct archive_entry *entry) 40 | { 41 | struct stat *st; 42 | if (entry->stat == NULL) { 43 | entry->stat = calloc(1, sizeof(*st)); 44 | if (entry->stat == NULL) 45 | return (NULL); 46 | entry->stat_valid = 0; 47 | } 48 | 49 | /* 50 | * If none of the underlying fields have been changed, we 51 | * don't need to regenerate. In theory, we could use a bitmap 52 | * here to flag only those items that have changed, but the 53 | * extra complexity probably isn't worth it. It will be very 54 | * rare for anyone to change just one field then request a new 55 | * stat structure. 56 | */ 57 | if (entry->stat_valid) 58 | return (entry->stat); 59 | 60 | st = entry->stat; 61 | /* 62 | * Use the public interfaces to extract items, so that 63 | * the appropriate conversions get invoked. 64 | */ 65 | st->st_atime = archive_entry_atime(entry); 66 | #if HAVE_STRUCT_STAT_ST_BIRTHTIME 67 | st->st_birthtime = archive_entry_birthtime(entry); 68 | #endif 69 | st->st_ctime = archive_entry_ctime(entry); 70 | st->st_mtime = archive_entry_mtime(entry); 71 | st->st_dev = archive_entry_dev(entry); 72 | st->st_gid = (gid_t)archive_entry_gid(entry); 73 | st->st_uid = (uid_t)archive_entry_uid(entry); 74 | st->st_ino = (ino_t)archive_entry_ino64(entry); 75 | st->st_nlink = archive_entry_nlink(entry); 76 | st->st_rdev = archive_entry_rdev(entry); 77 | st->st_size = (off_t)archive_entry_size(entry); 78 | st->st_mode = archive_entry_mode(entry); 79 | 80 | /* 81 | * On systems that support high-res timestamps, copy that 82 | * information into struct stat. 83 | */ 84 | #if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 85 | st->st_atimespec.tv_nsec = archive_entry_atime_nsec(entry); 86 | st->st_ctimespec.tv_nsec = archive_entry_ctime_nsec(entry); 87 | st->st_mtimespec.tv_nsec = archive_entry_mtime_nsec(entry); 88 | #elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 89 | st->st_atim.tv_nsec = archive_entry_atime_nsec(entry); 90 | st->st_ctim.tv_nsec = archive_entry_ctime_nsec(entry); 91 | st->st_mtim.tv_nsec = archive_entry_mtime_nsec(entry); 92 | #elif HAVE_STRUCT_STAT_ST_MTIME_N 93 | st->st_atime_n = archive_entry_atime_nsec(entry); 94 | st->st_ctime_n = archive_entry_ctime_nsec(entry); 95 | st->st_mtime_n = archive_entry_mtime_nsec(entry); 96 | #elif HAVE_STRUCT_STAT_ST_UMTIME 97 | st->st_uatime = archive_entry_atime_nsec(entry) / 1000; 98 | st->st_uctime = archive_entry_ctime_nsec(entry) / 1000; 99 | st->st_umtime = archive_entry_mtime_nsec(entry) / 1000; 100 | #elif HAVE_STRUCT_STAT_ST_MTIME_USEC 101 | st->st_atime_usec = archive_entry_atime_nsec(entry) / 1000; 102 | st->st_ctime_usec = archive_entry_ctime_nsec(entry) / 1000; 103 | st->st_mtime_usec = archive_entry_mtime_nsec(entry) / 1000; 104 | #endif 105 | #if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 106 | st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry); 107 | #endif 108 | 109 | /* 110 | * TODO: On Linux, store 32 or 64 here depending on whether 111 | * the cached stat structure is a stat32 or a stat64. This 112 | * will allow us to support both variants interchangeably. 113 | */ 114 | entry->stat_valid = 1; 115 | 116 | return (st); 117 | } 118 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_entry_strmode.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_SYS_STAT_H 29 | #include 30 | #endif 31 | #ifdef HAVE_STRING_H 32 | #include 33 | #endif 34 | 35 | #include "archive_entry.h" 36 | #include "archive_entry_private.h" 37 | 38 | const char * 39 | archive_entry_strmode(struct archive_entry *entry) 40 | { 41 | static const mode_t permbits[] = 42 | { 0400, 0200, 0100, 0040, 0020, 0010, 0004, 0002, 0001 }; 43 | char *bp = entry->strmode; 44 | mode_t mode; 45 | int i; 46 | 47 | /* Fill in a default string, then selectively override. */ 48 | strcpy(bp, "?rwxrwxrwx "); 49 | 50 | mode = archive_entry_mode(entry); 51 | switch (archive_entry_filetype(entry)) { 52 | case AE_IFREG: bp[0] = '-'; break; 53 | case AE_IFBLK: bp[0] = 'b'; break; 54 | case AE_IFCHR: bp[0] = 'c'; break; 55 | case AE_IFDIR: bp[0] = 'd'; break; 56 | case AE_IFLNK: bp[0] = 'l'; break; 57 | case AE_IFSOCK: bp[0] = 's'; break; 58 | case AE_IFIFO: bp[0] = 'p'; break; 59 | default: 60 | if (archive_entry_hardlink(entry) != NULL) { 61 | bp[0] = 'h'; 62 | break; 63 | } 64 | } 65 | 66 | for (i = 0; i < 9; i++) 67 | if (!(mode & permbits[i])) 68 | bp[i+1] = '-'; 69 | 70 | if (mode & S_ISUID) { 71 | if (mode & 0100) bp[3] = 's'; 72 | else bp[3] = 'S'; 73 | } 74 | if (mode & S_ISGID) { 75 | if (mode & 0010) bp[6] = 's'; 76 | else bp[6] = 'S'; 77 | } 78 | if (mode & S_ISVTX) { 79 | if (mode & 0001) bp[9] = 't'; 80 | else bp[9] = 'T'; 81 | } 82 | if (archive_entry_acl_types(entry) != 0) 83 | bp[10] = '+'; 84 | 85 | return (bp); 86 | } 87 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_entry_xattr.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_SYS_STAT_H 29 | #include 30 | #endif 31 | #ifdef HAVE_SYS_TYPES_H 32 | #include 33 | #endif 34 | #ifdef HAVE_LIMITS_H 35 | #include 36 | #endif 37 | #ifdef HAVE_LINUX_FS_H 38 | #include /* for Linux file flags */ 39 | #endif 40 | /* 41 | * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h. 42 | * As the include guards don't agree, the order of include is important. 43 | */ 44 | #ifdef HAVE_LINUX_EXT2_FS_H 45 | #include /* for Linux file flags */ 46 | #endif 47 | #if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__) 48 | #include /* for Linux file flags */ 49 | #endif 50 | #include 51 | #include 52 | #ifdef HAVE_STDLIB_H 53 | #include 54 | #endif 55 | #ifdef HAVE_STRING_H 56 | #include 57 | #endif 58 | #ifdef HAVE_WCHAR_H 59 | #include 60 | #endif 61 | 62 | #include "archive.h" 63 | #include "archive_entry.h" 64 | #include "archive_private.h" 65 | #include "archive_entry_private.h" 66 | 67 | /* 68 | * extended attribute handling 69 | */ 70 | 71 | void 72 | archive_entry_xattr_clear(struct archive_entry *entry) 73 | { 74 | struct ae_xattr *xp; 75 | 76 | while (entry->xattr_head != NULL) { 77 | xp = entry->xattr_head->next; 78 | free(entry->xattr_head->name); 79 | free(entry->xattr_head->value); 80 | free(entry->xattr_head); 81 | entry->xattr_head = xp; 82 | } 83 | 84 | entry->xattr_head = NULL; 85 | } 86 | 87 | void 88 | archive_entry_xattr_add_entry(struct archive_entry *entry, 89 | const char *name, const void *value, size_t size) 90 | { 91 | struct ae_xattr *xp; 92 | 93 | if ((xp = malloc(sizeof(struct ae_xattr))) == NULL) 94 | __archive_errx(1, "Out of memory"); 95 | 96 | if ((xp->name = strdup(name)) == NULL) 97 | __archive_errx(1, "Out of memory"); 98 | 99 | if ((xp->value = malloc(size)) != NULL) { 100 | memcpy(xp->value, value, size); 101 | xp->size = size; 102 | } else 103 | xp->size = 0; 104 | 105 | xp->next = entry->xattr_head; 106 | entry->xattr_head = xp; 107 | } 108 | 109 | 110 | /* 111 | * returns number of the extended attribute entries 112 | */ 113 | int 114 | archive_entry_xattr_count(struct archive_entry *entry) 115 | { 116 | struct ae_xattr *xp; 117 | int count = 0; 118 | 119 | for (xp = entry->xattr_head; xp != NULL; xp = xp->next) 120 | count++; 121 | 122 | return count; 123 | } 124 | 125 | int 126 | archive_entry_xattr_reset(struct archive_entry * entry) 127 | { 128 | entry->xattr_p = entry->xattr_head; 129 | 130 | return archive_entry_xattr_count(entry); 131 | } 132 | 133 | int 134 | archive_entry_xattr_next(struct archive_entry * entry, 135 | const char **name, const void **value, size_t *size) 136 | { 137 | if (entry->xattr_p) { 138 | *name = entry->xattr_p->name; 139 | *value = entry->xattr_p->value; 140 | *size = entry->xattr_p->size; 141 | 142 | entry->xattr_p = entry->xattr_p->next; 143 | 144 | return (ARCHIVE_OK); 145 | } else { 146 | *name = NULL; 147 | *value = NULL; 148 | *size = (size_t)0; 149 | return (ARCHIVE_WARN); 150 | } 151 | } 152 | 153 | /* 154 | * end of xattr handling 155 | */ 156 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_getdate.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2015 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef ARCHIVE_GETDATE_H_INCLUDED 27 | #define ARCHIVE_GETDATE_H_INCLUDED 28 | 29 | #ifndef __LIBARCHIVE_BUILD 30 | #error This header is only to be used internally to libarchive. 31 | #endif 32 | 33 | #include 34 | 35 | time_t __archive_get_date(time_t now, const char *); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_hmac_private.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2014 Michihiro NAKAJIMA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef ARCHIVE_HMAC_PRIVATE_H_INCLUDED 27 | #define ARCHIVE_HMAC_PRIVATE_H_INCLUDED 28 | 29 | #ifndef __LIBARCHIVE_BUILD 30 | #error This header is only to be used internally to libarchive. 31 | #endif 32 | /* 33 | * On systems that do not support any recognized crypto libraries, 34 | * the archive_hmac.c file is expected to define no usable symbols. 35 | * 36 | * But some compilers and linkers choke on empty object files, so 37 | * define a public symbol that will always exist. This could 38 | * be removed someday if this file gains another always-present 39 | * symbol definition. 40 | */ 41 | int __libarchive_hmac_build_hack(void); 42 | 43 | #ifdef __APPLE__ 44 | # include 45 | # if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 46 | # define ARCHIVE_HMAC_USE_Apple_CommonCrypto 47 | # endif 48 | #endif 49 | 50 | #ifdef ARCHIVE_HMAC_USE_Apple_CommonCrypto 51 | #include 52 | 53 | typedef CCHmacContext archive_hmac_sha1_ctx; 54 | 55 | #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA 56 | #include 57 | 58 | typedef struct { 59 | BCRYPT_ALG_HANDLE hAlg; 60 | BCRYPT_HASH_HANDLE hHash; 61 | DWORD hash_len; 62 | PBYTE hash; 63 | 64 | } archive_hmac_sha1_ctx; 65 | 66 | #elif defined(HAVE_LIBMBEDCRYPTO) && defined(HAVE_MBEDTLS_MD_H) 67 | #include 68 | 69 | typedef mbedtls_md_context_t archive_hmac_sha1_ctx; 70 | 71 | #elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H) 72 | #include 73 | 74 | typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx; 75 | 76 | #elif defined(HAVE_LIBCRYPTO) 77 | #include 78 | #include 79 | #if OPENSSL_VERSION_NUMBER >= 0x30000000L 80 | #include 81 | 82 | typedef EVP_MAC_CTX *archive_hmac_sha1_ctx; 83 | 84 | #else 85 | #include "archive_openssl_hmac_private.h" 86 | 87 | typedef HMAC_CTX* archive_hmac_sha1_ctx; 88 | #endif 89 | 90 | #else 91 | 92 | typedef int archive_hmac_sha1_ctx; 93 | 94 | #endif 95 | 96 | 97 | /* HMAC */ 98 | #define archive_hmac_sha1_init(ctx, key, key_len)\ 99 | __archive_hmac.__hmac_sha1_init(ctx, key, key_len) 100 | #define archive_hmac_sha1_update(ctx, data, data_len)\ 101 | __archive_hmac.__hmac_sha1_update(ctx, data, data_len) 102 | #define archive_hmac_sha1_final(ctx, out, out_len)\ 103 | __archive_hmac.__hmac_sha1_final(ctx, out, out_len) 104 | #define archive_hmac_sha1_cleanup(ctx)\ 105 | __archive_hmac.__hmac_sha1_cleanup(ctx) 106 | 107 | 108 | struct archive_hmac { 109 | /* HMAC */ 110 | int (*__hmac_sha1_init)(archive_hmac_sha1_ctx *, const uint8_t *, 111 | size_t); 112 | void (*__hmac_sha1_update)(archive_hmac_sha1_ctx *, const uint8_t *, 113 | size_t); 114 | void (*__hmac_sha1_final)(archive_hmac_sha1_ctx *, uint8_t *, size_t *); 115 | void (*__hmac_sha1_cleanup)(archive_hmac_sha1_ctx *); 116 | }; 117 | 118 | extern const struct archive_hmac __archive_hmac; 119 | #endif /* ARCHIVE_HMAC_PRIVATE_H_INCLUDED */ 120 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_options_private.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2011 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef ARCHIVE_OPTIONS_PRIVATE_H_INCLUDED 27 | #define ARCHIVE_OPTIONS_PRIVATE_H_INCLUDED 28 | 29 | #include "archive_platform.h" 30 | #include "archive_private.h" 31 | 32 | typedef int (*option_handler)(struct archive *a, 33 | const char *mod, const char *opt, const char *val); 34 | 35 | int 36 | _archive_set_option(struct archive *a, 37 | const char *mod, const char *opt, const char *val, 38 | int magic, const char *fn, option_handler use_option); 39 | 40 | int 41 | _archive_set_options(struct archive *a, const char *options, 42 | int magic, const char *fn, option_handler use_option); 43 | 44 | int 45 | _archive_set_either_option(struct archive *a, 46 | const char *m, const char *o, const char *v, 47 | option_handler use_format_option, option_handler use_filter_option); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_pack_dev.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: pack_dev.h,v 1.8 2013/06/14 16:28:20 tsutsui Exp $ */ 2 | 3 | /*- 4 | * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. 5 | * All rights reserved. 6 | * 7 | * This code is derived from software contributed to The NetBSD Foundation 8 | * by Charles M. Hannum. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /* Originally from NetBSD's mknod(8) source. */ 33 | 34 | #ifndef ARCHIVE_PACK_DEV_H 35 | #define ARCHIVE_PACK_DEV_H 36 | 37 | typedef dev_t pack_t(int, unsigned long [], const char **); 38 | 39 | pack_t *pack_find(const char *); 40 | pack_t pack_native; 41 | 42 | #define major_netbsd(x) ((int32_t)((((x) & 0x000fff00) >> 8))) 43 | #define minor_netbsd(x) ((int32_t)((((x) & 0xfff00000) >> 12) | \ 44 | (((x) & 0x000000ff) >> 0))) 45 | #define makedev_netbsd(x,y) ((dev_t)((((x) << 8) & 0x000fff00) | \ 46 | (((y) << 12) & 0xfff00000) | \ 47 | (((y) << 0) & 0x000000ff))) 48 | 49 | #endif /* ARCHIVE_PACK_DEV_H */ 50 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_pathmatch.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer 10 | * in this position and unchanged. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef ARCHIVE_PATHMATCH_H 28 | #define ARCHIVE_PATHMATCH_H 29 | 30 | #ifndef __LIBARCHIVE_BUILD 31 | #ifndef __LIBARCHIVE_TEST 32 | #error This header is only to be used internally to libarchive. 33 | #endif 34 | #endif 35 | 36 | /* Don't anchor at beginning unless the pattern starts with "^" */ 37 | #define PATHMATCH_NO_ANCHOR_START 1 38 | /* Don't anchor at end unless the pattern ends with "$" */ 39 | #define PATHMATCH_NO_ANCHOR_END 2 40 | 41 | /* Note that "^" and "$" are not special unless you set the corresponding 42 | * flag above. */ 43 | 44 | int __archive_pathmatch(const char *p, const char *s, int flags); 45 | int __archive_pathmatch_w(const wchar_t *p, const wchar_t *s, int flags); 46 | 47 | #define archive_pathmatch(p, s, f) __archive_pathmatch(p, s, f) 48 | #define archive_pathmatch_w(p, s, f) __archive_pathmatch_w(p, s, f) 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_platform_acl.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Martin Matuska 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | /* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */ 27 | 28 | #ifndef ARCHIVE_PLATFORM_ACL_H_INCLUDED 29 | #define ARCHIVE_PLATFORM_ACL_H_INCLUDED 30 | 31 | #ifndef __LIBARCHIVE_BUILD 32 | #ifndef __LIBARCHIVE_TEST_COMMON 33 | #error This header is only to be used internally to libarchive. 34 | #endif 35 | #endif 36 | 37 | /* 38 | * Determine what ACL types are supported 39 | */ 40 | #if ARCHIVE_ACL_FREEBSD || ARCHIVE_ACL_SUNOS || ARCHIVE_ACL_LIBACL 41 | #define ARCHIVE_ACL_POSIX1E 1 42 | #endif 43 | 44 | #if ARCHIVE_ACL_FREEBSD_NFS4 || ARCHIVE_ACL_SUNOS_NFS4 || \ 45 | ARCHIVE_ACL_DARWIN || ARCHIVE_ACL_LIBRICHACL 46 | #define ARCHIVE_ACL_NFS4 1 47 | #endif 48 | 49 | #if ARCHIVE_ACL_POSIX1E || ARCHIVE_ACL_NFS4 50 | #define ARCHIVE_ACL_SUPPORT 1 51 | #endif 52 | 53 | #endif /* ARCHIVE_PLATFORM_ACL_H_INCLUDED */ 54 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_platform_xattr.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 Martin Matuska 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | /* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */ 27 | 28 | #ifndef ARCHIVE_PLATFORM_XATTR_H_INCLUDED 29 | #define ARCHIVE_PLATFORM_XATTR_H_INCLUDED 30 | 31 | #ifndef __LIBARCHIVE_BUILD 32 | #ifndef __LIBARCHIVE_TEST_COMMON 33 | #error This header is only to be used internally to libarchive. 34 | #endif 35 | #endif 36 | 37 | /* 38 | * Determine if we support extended attributes 39 | */ 40 | #if ARCHIVE_XATTR_LINUX || ARCHIVE_XATTR_DARWIN || ARCHIVE_XATTR_FREEBSD || \ 41 | ARCHIVE_XATTR_AIX 42 | #define ARCHIVE_XATTR_SUPPORT 1 43 | #endif 44 | 45 | #endif /* ARCHIVE_PLATFORM_XATTR_H_INCLUDED */ 46 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_ppmd7_private.h: -------------------------------------------------------------------------------- 1 | /* Ppmd7.h -- PPMdH compression codec 2 | 2010-03-12 : Igor Pavlov : Public domain 3 | This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ 4 | 5 | /* This code supports virtual RangeDecoder and includes the implementation 6 | of RangeCoder from 7z, instead of RangeCoder from original PPMd var.H. 7 | If you need the compatibility with original PPMd var.H, you can use external RangeDecoder */ 8 | 9 | #ifndef ARCHIVE_PPMD7_PRIVATE_H_INCLUDED 10 | #define ARCHIVE_PPMD7_PRIVATE_H_INCLUDED 11 | 12 | #ifndef __LIBARCHIVE_BUILD 13 | #error This header is only to be used internally to libarchive. 14 | #endif 15 | 16 | #include "archive_ppmd_private.h" 17 | 18 | #define PPMD7_MIN_ORDER 2 19 | #define PPMD7_MAX_ORDER 64 20 | 21 | #define PPMD7_MIN_MEM_SIZE (1 << 11) 22 | #define PPMD7_MAX_MEM_SIZE (0xFFFFFFFFu - 12 * 3) 23 | 24 | struct CPpmd7_Context_; 25 | 26 | typedef 27 | #ifdef PPMD_32BIT 28 | struct CPpmd7_Context_ * 29 | #else 30 | UInt32 31 | #endif 32 | CPpmd7_Context_Ref; 33 | 34 | typedef struct CPpmd7_Context_ 35 | { 36 | UInt16 NumStats; 37 | UInt16 SummFreq; 38 | CPpmd_State_Ref Stats; 39 | CPpmd7_Context_Ref Suffix; 40 | } CPpmd7_Context; 41 | 42 | #define Ppmd7Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq) 43 | 44 | typedef struct 45 | { 46 | CPpmd7_Context *MinContext, *MaxContext; 47 | CPpmd_State *FoundState; 48 | unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder, HiBitsFlag; 49 | Int32 RunLength, InitRL; /* must be 32-bit at least */ 50 | 51 | UInt32 Size; 52 | UInt32 GlueCount; 53 | Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart; 54 | UInt32 AlignOffset; 55 | 56 | Byte Indx2Units[PPMD_NUM_INDEXES]; 57 | Byte Units2Indx[128]; 58 | CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES]; 59 | Byte NS2Indx[256], NS2BSIndx[256], HB2Flag[256]; 60 | CPpmd_See DummySee, See[25][16]; 61 | UInt16 BinSumm[128][64]; 62 | } CPpmd7; 63 | 64 | /* ---------- Decode ---------- */ 65 | 66 | typedef struct 67 | { 68 | UInt32 (*GetThreshold)(void *p, UInt32 total); 69 | void (*Decode)(void *p, UInt32 start, UInt32 size); 70 | UInt32 (*DecodeBit)(void *p, UInt32 size0); 71 | } IPpmd7_RangeDec; 72 | 73 | typedef struct 74 | { 75 | IPpmd7_RangeDec p; 76 | UInt32 Range; 77 | UInt32 Code; 78 | UInt32 Low; 79 | UInt32 Bottom; 80 | IByteIn *Stream; 81 | } CPpmd7z_RangeDec; 82 | 83 | /* ---------- Encode ---------- */ 84 | 85 | typedef struct 86 | { 87 | UInt64 Low; 88 | UInt32 Range; 89 | Byte Cache; 90 | UInt64 CacheSize; 91 | IByteOut *Stream; 92 | } CPpmd7z_RangeEnc; 93 | 94 | typedef struct 95 | { 96 | /* Base Functions */ 97 | void (*Ppmd7_Construct)(CPpmd7 *p); 98 | Bool (*Ppmd7_Alloc)(CPpmd7 *p, UInt32 size); 99 | void (*Ppmd7_Free)(CPpmd7 *p); 100 | void (*Ppmd7_Init)(CPpmd7 *p, unsigned maxOrder); 101 | #define Ppmd7_WasAllocated(p) ((p)->Base != NULL) 102 | 103 | /* Decode Functions */ 104 | void (*Ppmd7z_RangeDec_CreateVTable)(CPpmd7z_RangeDec *p); 105 | void (*PpmdRAR_RangeDec_CreateVTable)(CPpmd7z_RangeDec *p); 106 | Bool (*Ppmd7z_RangeDec_Init)(CPpmd7z_RangeDec *p); 107 | Bool (*PpmdRAR_RangeDec_Init)(CPpmd7z_RangeDec *p); 108 | #define Ppmd7z_RangeDec_IsFinishedOK(p) ((p)->Code == 0) 109 | int (*Ppmd7_DecodeSymbol)(CPpmd7 *p, IPpmd7_RangeDec *rc); 110 | 111 | /* Encode Functions */ 112 | void (*Ppmd7z_RangeEnc_Init)(CPpmd7z_RangeEnc *p); 113 | void (*Ppmd7z_RangeEnc_FlushData)(CPpmd7z_RangeEnc *p); 114 | 115 | void (*Ppmd7_EncodeSymbol)(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol); 116 | } IPpmd7; 117 | 118 | extern const IPpmd7 __archive_ppmd7_functions; 119 | #endif 120 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_ppmd8_private.h: -------------------------------------------------------------------------------- 1 | /* Ppmd8.h -- PPMdI codec 2 | 2011-01-27 : Igor Pavlov : Public domain 3 | This code is based on: 4 | PPMd var.I (2002): Dmitry Shkarin : Public domain 5 | Carryless rangecoder (1999): Dmitry Subbotin : Public domain */ 6 | 7 | #ifndef ARCHIVE_PPMD8_PRIVATE_H_INCLUDED 8 | #define ARCHIVE_PPMD8_PRIVATE_H_INCLUDED 9 | 10 | #include "archive_ppmd_private.h" 11 | 12 | #define PPMD8_MIN_ORDER 2 13 | #define PPMD8_MAX_ORDER 16 14 | 15 | struct CPpmd8_Context_; 16 | 17 | typedef 18 | #ifdef PPMD_32BIT 19 | struct CPpmd8_Context_ * 20 | #else 21 | UInt32 22 | #endif 23 | CPpmd8_Context_Ref; 24 | 25 | #pragma pack(push, 1) 26 | 27 | typedef struct CPpmd8_Context_ 28 | { 29 | Byte NumStats; 30 | Byte Flags; 31 | UInt16 SummFreq; 32 | CPpmd_State_Ref Stats; 33 | CPpmd8_Context_Ref Suffix; 34 | } CPpmd8_Context; 35 | 36 | #pragma pack(pop) 37 | 38 | #define Ppmd8Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq) 39 | 40 | /* The BUG in Shkarin's code for FREEZE mode was fixed, but that fixed 41 | code is not compatible with original code for some files compressed 42 | in FREEZE mode. So we disable FREEZE mode support. */ 43 | 44 | enum 45 | { 46 | PPMD8_RESTORE_METHOD_RESTART, 47 | PPMD8_RESTORE_METHOD_CUT_OFF 48 | #ifdef PPMD8_FREEZE_SUPPORT 49 | , PPMD8_RESTORE_METHOD_FREEZE 50 | #endif 51 | }; 52 | 53 | typedef struct 54 | { 55 | CPpmd8_Context *MinContext, *MaxContext; 56 | CPpmd_State *FoundState; 57 | unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder; 58 | Int32 RunLength, InitRL; /* must be 32-bit at least */ 59 | 60 | UInt32 Size; 61 | UInt32 GlueCount; 62 | Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart; 63 | UInt32 AlignOffset; 64 | unsigned RestoreMethod; 65 | 66 | /* Range Coder */ 67 | UInt32 Range; 68 | UInt32 Code; 69 | UInt32 Low; 70 | union 71 | { 72 | IByteIn *In; 73 | IByteOut *Out; 74 | } Stream; 75 | 76 | Byte Indx2Units[PPMD_NUM_INDEXES]; 77 | Byte Units2Indx[128]; 78 | CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES]; 79 | UInt32 Stamps[PPMD_NUM_INDEXES]; 80 | 81 | Byte NS2BSIndx[256], NS2Indx[260]; 82 | CPpmd_See DummySee, See[24][32]; 83 | UInt16 BinSumm[25][64]; 84 | } CPpmd8; 85 | 86 | void Ppmd8_Construct(CPpmd8 *p); 87 | Bool Ppmd8_Alloc(CPpmd8 *p, UInt32 size); 88 | void Ppmd8_Free(CPpmd8 *p); 89 | void Ppmd8_Init(CPpmd8 *p, unsigned maxOrder, unsigned restoreMethod); 90 | #define Ppmd8_WasAllocated(p) ((p)->Base != NULL) 91 | 92 | 93 | /* ---------- Internal Functions ---------- */ 94 | 95 | extern const Byte PPMD8_kExpEscape[16]; 96 | 97 | #ifdef PPMD_32BIT 98 | #define Ppmd8_GetPtr(p, ptr) (ptr) 99 | #define Ppmd8_GetContext(p, ptr) (ptr) 100 | #define Ppmd8_GetStats(p, ctx) ((ctx)->Stats) 101 | #else 102 | #define Ppmd8_GetPtr(p, offs) ((void *)((p)->Base + (offs))) 103 | #define Ppmd8_GetContext(p, offs) ((CPpmd8_Context *)Ppmd8_GetPtr((p), (offs))) 104 | #define Ppmd8_GetStats(p, ctx) ((CPpmd_State *)Ppmd8_GetPtr((p), ((ctx)->Stats))) 105 | #endif 106 | 107 | void Ppmd8_Update1(CPpmd8 *p); 108 | void Ppmd8_Update1_0(CPpmd8 *p); 109 | void Ppmd8_Update2(CPpmd8 *p); 110 | void Ppmd8_UpdateBin(CPpmd8 *p); 111 | 112 | #define Ppmd8_GetBinSumm(p) \ 113 | &p->BinSumm[p->NS2Indx[Ppmd8Context_OneState(p->MinContext)->Freq - 1]][ \ 114 | p->NS2BSIndx[Ppmd8_GetContext(p, p->MinContext->Suffix)->NumStats] + \ 115 | p->PrevSuccess + p->MinContext->Flags + ((p->RunLength >> 26) & 0x20)] 116 | 117 | CPpmd_See *Ppmd8_MakeEscFreq(CPpmd8 *p, unsigned numMasked, UInt32 *scale); 118 | 119 | 120 | /* ---------- Decode ---------- */ 121 | 122 | Bool Ppmd8_RangeDec_Init(CPpmd8 *p); 123 | #define Ppmd8_RangeDec_IsFinishedOK(p) ((p)->Code == 0) 124 | int Ppmd8_DecodeSymbol(CPpmd8 *p); /* returns: -1 as EndMarker, -2 as DataError */ 125 | 126 | /* ---------- Encode ---------- */ 127 | 128 | #define Ppmd8_RangeEnc_Init(p) { (p)->Low = 0; (p)->Range = 0xFFFFFFFF; } 129 | void Ppmd8_RangeEnc_FlushData(CPpmd8 *p); 130 | void Ppmd8_EncodeSymbol(CPpmd8 *p, int symbol); /* symbol = -1 means EndMarker */ 131 | 132 | typedef struct 133 | { 134 | /* Base Functions */ 135 | void (*Ppmd8_Construct)(CPpmd8 *p); 136 | Bool (*Ppmd8_Alloc)(CPpmd8 *p, UInt32 size); 137 | void (*Ppmd8_Free)(CPpmd8 *p); 138 | void (*Ppmd8_Init)(CPpmd8 *p, unsigned max_order, unsigned restore_method); 139 | #define Ppmd7_WasAllocated(p) ((p)->Base != NULL) 140 | 141 | /* Decode Functions */ 142 | int (*Ppmd8_RangeDec_Init)(CPpmd8 *p); 143 | int (*Ppmd8_DecodeSymbol)(CPpmd8 *p); 144 | } IPpmd8; 145 | 146 | extern const IPpmd8 __archive_ppmd8_functions; 147 | 148 | #endif 149 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_ppmd_private.h: -------------------------------------------------------------------------------- 1 | /* Ppmd.h -- PPMD codec common code 2 | 2010-03-12 : Igor Pavlov : Public domain 3 | This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ 4 | 5 | #ifndef ARCHIVE_PPMD_PRIVATE_H_INCLUDED 6 | #define ARCHIVE_PPMD_PRIVATE_H_INCLUDED 7 | 8 | #ifndef __LIBARCHIVE_BUILD 9 | #error This header is only to be used internally to libarchive. 10 | #endif 11 | 12 | #include 13 | 14 | #include "archive_read_private.h" 15 | 16 | /*** Begin defined in Types.h ***/ 17 | 18 | #if !defined(ZCONF_H) 19 | typedef unsigned char Byte; 20 | #endif 21 | typedef short Int16; 22 | typedef unsigned short UInt16; 23 | 24 | #ifdef _LZMA_UINT32_IS_ULONG 25 | typedef long Int32; 26 | typedef unsigned long UInt32; 27 | #else 28 | typedef int Int32; 29 | typedef unsigned int UInt32; 30 | #endif 31 | 32 | #ifdef _SZ_NO_INT_64 33 | 34 | /* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. 35 | NOTES: Some code will work incorrectly in that case! */ 36 | 37 | typedef long Int64; 38 | typedef unsigned long UInt64; 39 | 40 | #else 41 | 42 | #if defined(_MSC_VER) || defined(__BORLANDC__) 43 | typedef __int64 Int64; 44 | typedef unsigned __int64 UInt64; 45 | #define UINT64_CONST(n) n 46 | #else 47 | typedef long long int Int64; 48 | typedef unsigned long long int UInt64; 49 | #define UINT64_CONST(n) n ## ULL 50 | #endif 51 | 52 | #endif 53 | 54 | typedef int Bool; 55 | #define True 1 56 | #define False 0 57 | 58 | /* The following interfaces use first parameter as pointer to structure */ 59 | 60 | typedef struct 61 | { 62 | struct archive_read *a; 63 | Byte (*Read)(void *p); /* reads one byte, returns 0 in case of EOF or error */ 64 | } IByteIn; 65 | 66 | typedef struct 67 | { 68 | struct archive_write *a; 69 | void (*Write)(void *p, Byte b); 70 | } IByteOut; 71 | 72 | /*** End defined in Types.h ***/ 73 | /*** Begin defined in CpuArch.h ***/ 74 | 75 | #if defined(_M_IX86) || defined(__i386__) 76 | #define MY_CPU_X86 77 | #endif 78 | 79 | #if defined(MY_CPU_X86) || defined(_M_ARM) 80 | #define MY_CPU_32BIT 81 | #endif 82 | 83 | #ifdef MY_CPU_32BIT 84 | #define PPMD_32BIT 85 | #endif 86 | 87 | /*** End defined in CpuArch.h ***/ 88 | 89 | #define PPMD_INT_BITS 7 90 | #define PPMD_PERIOD_BITS 7 91 | #define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS)) 92 | 93 | #define PPMD_GET_MEAN_SPEC(summ, shift, round) (((summ) + (1 << ((shift) - (round)))) >> (shift)) 94 | #define PPMD_GET_MEAN(summ) PPMD_GET_MEAN_SPEC((summ), PPMD_PERIOD_BITS, 2) 95 | #define PPMD_UPDATE_PROB_0(prob) ((prob) + (1 << PPMD_INT_BITS) - PPMD_GET_MEAN(prob)) 96 | #define PPMD_UPDATE_PROB_1(prob) ((prob) - PPMD_GET_MEAN(prob)) 97 | 98 | #define PPMD_N1 4 99 | #define PPMD_N2 4 100 | #define PPMD_N3 4 101 | #define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4) 102 | #define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4) 103 | 104 | /* SEE-contexts for PPM-contexts with masked symbols */ 105 | typedef struct 106 | { 107 | UInt16 Summ; /* Freq */ 108 | Byte Shift; /* Speed of Freq change; low Shift is for fast change */ 109 | Byte Count; /* Count to next change of Shift */ 110 | } CPpmd_See; 111 | 112 | #define Ppmd_See_Update(p) if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \ 113 | { (p)->Summ <<= 1; (p)->Count = (Byte)(3 << (p)->Shift++); } 114 | 115 | typedef struct 116 | { 117 | Byte Symbol; 118 | Byte Freq; 119 | UInt16 SuccessorLow; 120 | UInt16 SuccessorHigh; 121 | } CPpmd_State; 122 | 123 | typedef 124 | #ifdef PPMD_32BIT 125 | CPpmd_State * 126 | #else 127 | UInt32 128 | #endif 129 | CPpmd_State_Ref; 130 | 131 | typedef 132 | #ifdef PPMD_32BIT 133 | void * 134 | #else 135 | UInt32 136 | #endif 137 | CPpmd_Void_Ref; 138 | 139 | typedef 140 | #ifdef PPMD_32BIT 141 | Byte * 142 | #else 143 | UInt32 144 | #endif 145 | CPpmd_Byte_Ref; 146 | 147 | #define PPMD_SetAllBitsIn256Bytes(p) \ 148 | { unsigned j; for (j = 0; j < 256 / sizeof(p[0]); j += 8) { \ 149 | p[j+7] = p[j+6] = p[j+5] = p[j+4] = p[j+3] = p[j+2] = p[j+1] = p[j+0] = ~(size_t)0; }} 150 | 151 | #endif 152 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_random_private.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2014 Michihiro NAKAJIMA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef ARCHIVE_RANDOM_PRIVATE_H_INCLUDED 27 | #define ARCHIVE_RANDOM_PRIVATE_H_INCLUDED 28 | 29 | #ifndef __LIBARCHIVE_BUILD 30 | #error This header is only to be used internally to libarchive. 31 | #endif 32 | 33 | /* Random number generator. */ 34 | int archive_random(void *buf, size_t nbytes); 35 | 36 | #endif /* ARCHIVE_RANDOM_PRIVATE_H_INCLUDED */ 37 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_rb.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2001 The NetBSD Foundation, Inc. 3 | * All rights reserved. 4 | * 5 | * This code is derived from software contributed to The NetBSD Foundation 6 | * by Matt Thomas . 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * Based on NetBSD: rb.h,v 1.13 2009/08/16 10:57:01 yamt Exp 30 | */ 31 | 32 | #ifndef ARCHIVE_RB_H_INCLUDED 33 | #define ARCHIVE_RB_H_INCLUDED 34 | 35 | struct archive_rb_node { 36 | struct archive_rb_node *rb_nodes[2]; 37 | /* 38 | * rb_info contains the two flags and the parent back pointer. 39 | * We put the two flags in the low two bits since we know that 40 | * rb_node will have an alignment of 4 or 8 bytes. 41 | */ 42 | uintptr_t rb_info; 43 | }; 44 | 45 | #define ARCHIVE_RB_DIR_LEFT 0 46 | #define ARCHIVE_RB_DIR_RIGHT 1 47 | 48 | #define ARCHIVE_RB_TREE_MIN(T) \ 49 | __archive_rb_tree_iterate((T), NULL, ARCHIVE_RB_DIR_LEFT) 50 | #define ARCHIVE_RB_TREE_MAX(T) \ 51 | __archive_rb_tree_iterate((T), NULL, ARCHIVE_RB_DIR_RIGHT) 52 | #define ARCHIVE_RB_TREE_NEXT(T, N) \ 53 | __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_RIGHT) 54 | #define ARCHIVE_RB_TREE_PREV(T, N) \ 55 | __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_LEFT) 56 | #define ARCHIVE_RB_TREE_FOREACH(N, T) \ 57 | for ((N) = ARCHIVE_RB_TREE_MIN(T); (N); \ 58 | (N) = ARCHIVE_RB_TREE_NEXT((T), (N))) 59 | #define ARCHIVE_RB_TREE_FOREACH_REVERSE(N, T) \ 60 | for ((N) = ARCHIVE_RB_TREE_MAX(T); (N); \ 61 | (N) = ARCHIVE_RB_TREE_PREV((T), (N))) 62 | #define ARCHIVE_RB_TREE_FOREACH_SAFE(N, T, S) \ 63 | for ((N) = ARCHIVE_RB_TREE_MIN(T); \ 64 | (N) && ((S) = ARCHIVE_RB_TREE_NEXT((T), (N)), 1); \ 65 | (N) = (S)) 66 | #define ARCHIVE_RB_TREE_FOREACH_REVERSE_SAFE(N, T, S) \ 67 | for ((N) = ARCHIVE_RB_TREE_MAX(T); \ 68 | (N) && ((S) = ARCHIVE_RB_TREE_PREV((T), (N)), 1); \ 69 | (N) = (S)) 70 | 71 | /* 72 | * archive_rbto_compare_nodes_fn: 73 | * return a positive value if the first node < the second node. 74 | * return a negative value if the first node > the second node. 75 | * return 0 if they are considered same. 76 | * 77 | * archive_rbto_compare_key_fn: 78 | * return a positive value if the node < the key. 79 | * return a negative value if the node > the key. 80 | * return 0 if they are considered same. 81 | */ 82 | 83 | typedef signed int (*const archive_rbto_compare_nodes_fn)(const struct archive_rb_node *, 84 | const struct archive_rb_node *); 85 | typedef signed int (*const archive_rbto_compare_key_fn)(const struct archive_rb_node *, 86 | const void *); 87 | 88 | struct archive_rb_tree_ops { 89 | archive_rbto_compare_nodes_fn rbto_compare_nodes; 90 | archive_rbto_compare_key_fn rbto_compare_key; 91 | }; 92 | 93 | struct archive_rb_tree { 94 | struct archive_rb_node *rbt_root; 95 | const struct archive_rb_tree_ops *rbt_ops; 96 | }; 97 | 98 | void __archive_rb_tree_init(struct archive_rb_tree *, 99 | const struct archive_rb_tree_ops *); 100 | int __archive_rb_tree_insert_node(struct archive_rb_tree *, 101 | struct archive_rb_node *); 102 | struct archive_rb_node * 103 | __archive_rb_tree_find_node(struct archive_rb_tree *, const void *); 104 | struct archive_rb_node * 105 | __archive_rb_tree_find_node_geq(struct archive_rb_tree *, const void *); 106 | struct archive_rb_node * 107 | __archive_rb_tree_find_node_leq(struct archive_rb_tree *, const void *); 108 | void __archive_rb_tree_remove_node(struct archive_rb_tree *, struct archive_rb_node *); 109 | struct archive_rb_node * 110 | __archive_rb_tree_iterate(struct archive_rb_tree *, 111 | struct archive_rb_node *, const unsigned int); 112 | 113 | #endif /* ARCHIVE_RB_H_*/ 114 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_add_passphrase.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2014 Michihiro NAKAJIMA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_ERRNO_H 29 | #include 30 | #endif 31 | #include "archive_read_private.h" 32 | 33 | static void 34 | add_passphrase_to_tail(struct archive_read *a, 35 | struct archive_read_passphrase *p) 36 | { 37 | *a->passphrases.last = p; 38 | a->passphrases.last = &p->next; 39 | p->next = NULL; 40 | } 41 | 42 | static struct archive_read_passphrase * 43 | remove_passphrases_from_head(struct archive_read *a) 44 | { 45 | struct archive_read_passphrase *p; 46 | 47 | p = a->passphrases.first; 48 | if (p != NULL) 49 | a->passphrases.first = p->next; 50 | return (p); 51 | } 52 | 53 | static void 54 | insert_passphrase_to_head(struct archive_read *a, 55 | struct archive_read_passphrase *p) 56 | { 57 | p->next = a->passphrases.first; 58 | a->passphrases.first = p; 59 | if (&a->passphrases.first == a->passphrases.last) { 60 | a->passphrases.last = &p->next; 61 | p->next = NULL; 62 | } 63 | } 64 | 65 | static struct archive_read_passphrase * 66 | new_read_passphrase(struct archive_read *a, const char *passphrase) 67 | { 68 | struct archive_read_passphrase *p; 69 | 70 | p = malloc(sizeof(*p)); 71 | if (p == NULL) { 72 | archive_set_error(&a->archive, ENOMEM, 73 | "Can't allocate memory"); 74 | return (NULL); 75 | } 76 | p->passphrase = strdup(passphrase); 77 | if (p->passphrase == NULL) { 78 | free(p); 79 | archive_set_error(&a->archive, ENOMEM, 80 | "Can't allocate memory"); 81 | return (NULL); 82 | } 83 | return (p); 84 | } 85 | 86 | int 87 | archive_read_add_passphrase(struct archive *_a, const char *passphrase) 88 | { 89 | struct archive_read *a = (struct archive_read *)_a; 90 | struct archive_read_passphrase *p; 91 | 92 | archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, 93 | "archive_read_add_passphrase"); 94 | 95 | if (passphrase == NULL || passphrase[0] == '\0') { 96 | archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, 97 | "Empty passphrase is unacceptable"); 98 | return (ARCHIVE_FAILED); 99 | } 100 | 101 | p = new_read_passphrase(a, passphrase); 102 | if (p == NULL) 103 | return (ARCHIVE_FATAL); 104 | add_passphrase_to_tail(a, p); 105 | 106 | return (ARCHIVE_OK); 107 | } 108 | 109 | int 110 | archive_read_set_passphrase_callback(struct archive *_a, void *client_data, 111 | archive_passphrase_callback *cb) 112 | { 113 | struct archive_read *a = (struct archive_read *)_a; 114 | 115 | archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, 116 | "archive_read_set_passphrase_callback"); 117 | 118 | a->passphrases.callback = cb; 119 | a->passphrases.client_data = client_data; 120 | return (ARCHIVE_OK); 121 | } 122 | 123 | /* 124 | * Call this in advance when you start to get a passphrase for decryption 125 | * for a entry. 126 | */ 127 | void 128 | __archive_read_reset_passphrase(struct archive_read *a) 129 | { 130 | 131 | a->passphrases.candidate = -1; 132 | } 133 | 134 | /* 135 | * Get a passphrase for decryption. 136 | */ 137 | const char * 138 | __archive_read_next_passphrase(struct archive_read *a) 139 | { 140 | struct archive_read_passphrase *p; 141 | const char *passphrase; 142 | 143 | if (a->passphrases.candidate < 0) { 144 | /* Count out how many passphrases we have. */ 145 | int cnt = 0; 146 | 147 | for (p = a->passphrases.first; p != NULL; p = p->next) 148 | cnt++; 149 | a->passphrases.candidate = cnt; 150 | p = a->passphrases.first; 151 | } else if (a->passphrases.candidate > 1) { 152 | /* Rotate a passphrase list. */ 153 | a->passphrases.candidate--; 154 | p = remove_passphrases_from_head(a); 155 | add_passphrase_to_tail(a, p); 156 | /* Pick a new passphrase candidate up. */ 157 | p = a->passphrases.first; 158 | } else if (a->passphrases.candidate == 1) { 159 | /* This case is that all candidates failed to decrypt. */ 160 | a->passphrases.candidate = 0; 161 | if (a->passphrases.first->next != NULL) { 162 | /* Rotate a passphrase list. */ 163 | p = remove_passphrases_from_head(a); 164 | add_passphrase_to_tail(a, p); 165 | } 166 | p = NULL; 167 | } else /* There is no passphrase candidate. */ 168 | p = NULL; 169 | 170 | if (p != NULL) 171 | passphrase = p->passphrase; 172 | else if (a->passphrases.callback != NULL) { 173 | /* Get a passphrase through a call-back function 174 | * since we tried all passphrases out or we don't 175 | * have it. */ 176 | passphrase = a->passphrases.callback(&a->archive, 177 | a->passphrases.client_data); 178 | if (passphrase != NULL) { 179 | p = new_read_passphrase(a, passphrase); 180 | if (p == NULL) 181 | return (NULL); 182 | insert_passphrase_to_head(a, p); 183 | a->passphrases.candidate = 1; 184 | } 185 | } else 186 | passphrase = NULL; 187 | 188 | return (passphrase); 189 | } 190 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_data_into_fd.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_SYS_TYPES_H 29 | #include 30 | #endif 31 | #ifdef HAVE_ERRNO_H 32 | #include 33 | #endif 34 | #ifdef HAVE_UNISTD_H 35 | #include 36 | #endif 37 | 38 | #include "archive.h" 39 | #include "archive_private.h" 40 | 41 | /* Maximum amount of data to write at one time. */ 42 | #define MAX_WRITE (1024 * 1024) 43 | 44 | /* 45 | * This implementation minimizes copying of data and is sparse-file aware. 46 | */ 47 | static int 48 | pad_to(struct archive *a, int fd, int can_lseek, 49 | size_t nulls_size, const char *nulls, 50 | int64_t target_offset, int64_t actual_offset) 51 | { 52 | size_t to_write; 53 | ssize_t bytes_written; 54 | 55 | if (can_lseek) { 56 | actual_offset = lseek(fd, 57 | target_offset - actual_offset, SEEK_CUR); 58 | if (actual_offset != target_offset) { 59 | archive_set_error(a, errno, "Seek error"); 60 | return (ARCHIVE_FATAL); 61 | } 62 | return (ARCHIVE_OK); 63 | } 64 | while (target_offset > actual_offset) { 65 | to_write = nulls_size; 66 | if (target_offset < actual_offset + (int64_t)nulls_size) 67 | to_write = (size_t)(target_offset - actual_offset); 68 | bytes_written = write(fd, nulls, to_write); 69 | if (bytes_written < 0) { 70 | archive_set_error(a, errno, "Write error"); 71 | return (ARCHIVE_FATAL); 72 | } 73 | actual_offset += bytes_written; 74 | } 75 | return (ARCHIVE_OK); 76 | } 77 | 78 | 79 | int 80 | archive_read_data_into_fd(struct archive *a, int fd) 81 | { 82 | struct stat st; 83 | int r, r2; 84 | const void *buff; 85 | size_t size, bytes_to_write; 86 | ssize_t bytes_written; 87 | int64_t target_offset; 88 | int64_t actual_offset = 0; 89 | int can_lseek; 90 | char *nulls = NULL; 91 | size_t nulls_size = 16384; 92 | 93 | archive_check_magic(a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA, 94 | "archive_read_data_into_fd"); 95 | 96 | can_lseek = (fstat(fd, &st) == 0) && S_ISREG(st.st_mode); 97 | if (!can_lseek) { 98 | nulls = calloc(1, nulls_size); 99 | if (!nulls) { 100 | r = ARCHIVE_FATAL; 101 | goto cleanup; 102 | } 103 | } 104 | 105 | while ((r = archive_read_data_block(a, &buff, &size, &target_offset)) == 106 | ARCHIVE_OK) { 107 | const char *p = buff; 108 | if (target_offset > actual_offset) { 109 | r = pad_to(a, fd, can_lseek, nulls_size, nulls, 110 | target_offset, actual_offset); 111 | if (r != ARCHIVE_OK) 112 | break; 113 | actual_offset = target_offset; 114 | } 115 | while (size > 0) { 116 | bytes_to_write = size; 117 | if (bytes_to_write > MAX_WRITE) 118 | bytes_to_write = MAX_WRITE; 119 | bytes_written = write(fd, p, bytes_to_write); 120 | if (bytes_written < 0) { 121 | archive_set_error(a, errno, "Write error"); 122 | r = ARCHIVE_FATAL; 123 | goto cleanup; 124 | } 125 | actual_offset += bytes_written; 126 | p += bytes_written; 127 | size -= bytes_written; 128 | } 129 | } 130 | 131 | if (r == ARCHIVE_EOF && target_offset > actual_offset) { 132 | r2 = pad_to(a, fd, can_lseek, nulls_size, nulls, 133 | target_offset, actual_offset); 134 | if (r2 != ARCHIVE_OK) 135 | r = r2; 136 | } 137 | 138 | cleanup: 139 | free(nulls); 140 | if (r != ARCHIVE_EOF) 141 | return (r); 142 | return (ARCHIVE_OK); 143 | } 144 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_disk_private.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2009 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer 10 | * in this position and unchanged. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED 28 | #define ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED 29 | 30 | #ifndef __LIBARCHIVE_BUILD 31 | #error This header is only to be used internally to libarchive. 32 | #endif 33 | 34 | #include "archive_platform_acl.h" 35 | 36 | struct tree; 37 | struct archive_entry; 38 | 39 | struct archive_read_disk { 40 | struct archive archive; 41 | 42 | /* Reused by archive_read_next_header() */ 43 | struct archive_entry *entry; 44 | 45 | /* 46 | * Symlink mode is one of 'L'ogical, 'P'hysical, or 'H'ybrid, 47 | * following an old BSD convention. 'L' follows all symlinks, 48 | * 'P' follows none, 'H' follows symlinks only for the first 49 | * item. 50 | */ 51 | char symlink_mode; 52 | 53 | /* 54 | * Since symlink interaction changes, we need to track whether 55 | * we're following symlinks for the current item. 'L' mode above 56 | * sets this true, 'P' sets it false, 'H' changes it as we traverse. 57 | */ 58 | char follow_symlinks; /* Either 'L' or 'P'. */ 59 | 60 | /* Directory traversals. */ 61 | struct tree *tree; 62 | int (*open_on_current_dir)(struct tree*, const char *, int); 63 | int (*tree_current_dir_fd)(struct tree*); 64 | int (*tree_enter_working_dir)(struct tree*); 65 | 66 | /* Bitfield with ARCHIVE_READDISK_* tunables */ 67 | int flags; 68 | 69 | const char * (*lookup_gname)(void *private, int64_t gid); 70 | void (*cleanup_gname)(void *private); 71 | void *lookup_gname_data; 72 | const char * (*lookup_uname)(void *private, int64_t uid); 73 | void (*cleanup_uname)(void *private); 74 | void *lookup_uname_data; 75 | 76 | int (*metadata_filter_func)(struct archive *, void *, 77 | struct archive_entry *); 78 | void *metadata_filter_data; 79 | 80 | /* ARCHIVE_MATCH object. */ 81 | struct archive *matching; 82 | /* Callback function, this will be invoked when ARCHIVE_MATCH 83 | * archive_match_*_excluded_ae return true. */ 84 | void (*excluded_cb_func)(struct archive *, void *, 85 | struct archive_entry *); 86 | void *excluded_cb_data; 87 | }; 88 | 89 | const char * 90 | archive_read_disk_entry_setup_path(struct archive_read_disk *, 91 | struct archive_entry *, int *); 92 | 93 | int 94 | archive_read_disk_entry_setup_acls(struct archive_read_disk *, 95 | struct archive_entry *, int *); 96 | #endif 97 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_extract.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_ERRNO_H 29 | #include 30 | #endif 31 | 32 | #include "archive.h" 33 | #include "archive_entry.h" 34 | #include "archive_private.h" 35 | #include "archive_read_private.h" 36 | 37 | int 38 | archive_read_extract(struct archive *_a, struct archive_entry *entry, int flags) 39 | { 40 | struct archive_read_extract *extract; 41 | struct archive_read * a = (struct archive_read *)_a; 42 | 43 | extract = __archive_read_get_extract(a); 44 | if (extract == NULL) 45 | return (ARCHIVE_FATAL); 46 | 47 | /* If we haven't initialized the archive_write_disk object, do it now. */ 48 | if (extract->ad == NULL) { 49 | extract->ad = archive_write_disk_new(); 50 | if (extract->ad == NULL) { 51 | archive_set_error(&a->archive, ENOMEM, "Can't extract"); 52 | return (ARCHIVE_FATAL); 53 | } 54 | archive_write_disk_set_standard_lookup(extract->ad); 55 | } 56 | 57 | archive_write_disk_set_options(extract->ad, flags); 58 | return (archive_read_extract2(&a->archive, entry, extract->ad)); 59 | } 60 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_extract2.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_SYS_TYPES_H 29 | #include 30 | #endif 31 | #ifdef HAVE_ERRNO_H 32 | #include 33 | #endif 34 | #ifdef HAVE_STRING_H 35 | #include 36 | #endif 37 | 38 | #include "archive.h" 39 | #include "archive_entry.h" 40 | #include "archive_private.h" 41 | #include "archive_read_private.h" 42 | 43 | static int copy_data(struct archive *ar, struct archive *aw); 44 | static int archive_read_extract_cleanup(struct archive_read *); 45 | 46 | 47 | /* Retrieve an extract object without initialising the associated 48 | * archive_write_disk object. 49 | */ 50 | struct archive_read_extract * 51 | __archive_read_get_extract(struct archive_read *a) 52 | { 53 | if (a->extract == NULL) { 54 | a->extract = calloc(1, sizeof(*a->extract)); 55 | if (a->extract == NULL) { 56 | archive_set_error(&a->archive, ENOMEM, "Can't extract"); 57 | return (NULL); 58 | } 59 | a->cleanup_archive_extract = archive_read_extract_cleanup; 60 | } 61 | return (a->extract); 62 | } 63 | 64 | /* 65 | * Cleanup function for archive_extract. 66 | */ 67 | static int 68 | archive_read_extract_cleanup(struct archive_read *a) 69 | { 70 | int ret = ARCHIVE_OK; 71 | 72 | if (a->extract->ad != NULL) { 73 | ret = archive_write_free(a->extract->ad); 74 | } 75 | free(a->extract); 76 | a->extract = NULL; 77 | return (ret); 78 | } 79 | 80 | int 81 | archive_read_extract2(struct archive *_a, struct archive_entry *entry, 82 | struct archive *ad) 83 | { 84 | struct archive_read *a = (struct archive_read *)_a; 85 | int r, r2; 86 | 87 | /* Set up for this particular entry. */ 88 | if (a->skip_file_set) 89 | archive_write_disk_set_skip_file(ad, 90 | a->skip_file_dev, a->skip_file_ino); 91 | r = archive_write_header(ad, entry); 92 | if (r < ARCHIVE_WARN) 93 | r = ARCHIVE_WARN; 94 | if (r != ARCHIVE_OK) 95 | /* If _write_header failed, copy the error. */ 96 | archive_copy_error(&a->archive, ad); 97 | else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) 98 | /* Otherwise, pour data into the entry. */ 99 | r = copy_data(_a, ad); 100 | r2 = archive_write_finish_entry(ad); 101 | if (r2 < ARCHIVE_WARN) 102 | r2 = ARCHIVE_WARN; 103 | /* Use the first message. */ 104 | if (r2 != ARCHIVE_OK && r == ARCHIVE_OK) 105 | archive_copy_error(&a->archive, ad); 106 | /* Use the worst error return. */ 107 | if (r2 < r) 108 | r = r2; 109 | return (r); 110 | } 111 | 112 | void 113 | archive_read_extract_set_progress_callback(struct archive *_a, 114 | void (*progress_func)(void *), void *user_data) 115 | { 116 | struct archive_read *a = (struct archive_read *)_a; 117 | struct archive_read_extract *extract = __archive_read_get_extract(a); 118 | if (extract != NULL) { 119 | extract->extract_progress = progress_func; 120 | extract->extract_progress_user_data = user_data; 121 | } 122 | } 123 | 124 | static int 125 | copy_data(struct archive *ar, struct archive *aw) 126 | { 127 | int64_t offset; 128 | const void *buff; 129 | struct archive_read_extract *extract; 130 | size_t size; 131 | int r; 132 | 133 | extract = __archive_read_get_extract((struct archive_read *)ar); 134 | if (extract == NULL) 135 | return (ARCHIVE_FATAL); 136 | for (;;) { 137 | r = archive_read_data_block(ar, &buff, &size, &offset); 138 | if (r == ARCHIVE_EOF) 139 | return (ARCHIVE_OK); 140 | if (r != ARCHIVE_OK) 141 | return (r); 142 | r = (int)archive_write_data_block(aw, buff, size, offset); 143 | if (r < ARCHIVE_WARN) 144 | r = ARCHIVE_WARN; 145 | if (r < ARCHIVE_OK) { 146 | archive_set_error(ar, archive_errno(aw), 147 | "%s", archive_error_string(aw)); 148 | return (r); 149 | } 150 | if (extract->extract_progress) 151 | (extract->extract_progress) 152 | (extract->extract_progress_user_data); 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_open_file.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_SYS_STAT_H 29 | #include 30 | #endif 31 | #ifdef HAVE_ERRNO_H 32 | #include 33 | #endif 34 | #ifdef HAVE_FCNTL_H 35 | #include 36 | #endif 37 | #ifdef HAVE_IO_H 38 | #include 39 | #endif 40 | #ifdef HAVE_STDLIB_H 41 | #include 42 | #endif 43 | #ifdef HAVE_STRING_H 44 | #include 45 | #endif 46 | #ifdef HAVE_UNISTD_H 47 | #include 48 | #endif 49 | 50 | #include "archive.h" 51 | 52 | struct read_FILE_data { 53 | FILE *f; 54 | size_t block_size; 55 | void *buffer; 56 | char can_skip; 57 | }; 58 | 59 | static int file_close(struct archive *, void *); 60 | static ssize_t file_read(struct archive *, void *, const void **buff); 61 | static int64_t file_skip(struct archive *, void *, int64_t request); 62 | 63 | int 64 | archive_read_open_FILE(struct archive *a, FILE *f) 65 | { 66 | struct stat st; 67 | struct read_FILE_data *mine; 68 | size_t block_size = 128 * 1024; 69 | void *b; 70 | 71 | archive_clear_error(a); 72 | mine = malloc(sizeof(*mine)); 73 | b = malloc(block_size); 74 | if (mine == NULL || b == NULL) { 75 | archive_set_error(a, ENOMEM, "No memory"); 76 | free(mine); 77 | free(b); 78 | return (ARCHIVE_FATAL); 79 | } 80 | mine->block_size = block_size; 81 | mine->buffer = b; 82 | mine->f = f; 83 | /* 84 | * If we can't fstat() the file, it may just be that it's not 85 | * a file. (On some platforms, FILE * objects can wrap I/O 86 | * streams that don't support fileno()). As a result, fileno() 87 | * should be used cautiously.) 88 | */ 89 | if (fstat(fileno(mine->f), &st) == 0 && S_ISREG(st.st_mode)) { 90 | archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino); 91 | /* Enable the seek optimization only for regular files. */ 92 | mine->can_skip = 1; 93 | } else 94 | mine->can_skip = 0; 95 | 96 | #if defined(__CYGWIN__) || defined(_WIN32) 97 | setmode(fileno(mine->f), O_BINARY); 98 | #endif 99 | 100 | archive_read_set_read_callback(a, file_read); 101 | archive_read_set_skip_callback(a, file_skip); 102 | archive_read_set_close_callback(a, file_close); 103 | archive_read_set_callback_data(a, mine); 104 | return (archive_read_open1(a)); 105 | } 106 | 107 | static ssize_t 108 | file_read(struct archive *a, void *client_data, const void **buff) 109 | { 110 | struct read_FILE_data *mine = (struct read_FILE_data *)client_data; 111 | size_t bytes_read; 112 | 113 | *buff = mine->buffer; 114 | bytes_read = fread(mine->buffer, 1, mine->block_size, mine->f); 115 | if (bytes_read < mine->block_size && ferror(mine->f)) { 116 | archive_set_error(a, errno, "Error reading file"); 117 | } 118 | return (bytes_read); 119 | } 120 | 121 | static int64_t 122 | file_skip(struct archive *a, void *client_data, int64_t request) 123 | { 124 | struct read_FILE_data *mine = (struct read_FILE_data *)client_data; 125 | #if HAVE_FSEEKO 126 | off_t skip = (off_t)request; 127 | #elif HAVE__FSEEKI64 128 | int64_t skip = request; 129 | #else 130 | long skip = (long)request; 131 | #endif 132 | int skip_bits = sizeof(skip) * 8 - 1; 133 | 134 | (void)a; /* UNUSED */ 135 | 136 | /* 137 | * If we can't skip, return 0 as the amount we did step and 138 | * the caller will work around by reading and discarding. 139 | */ 140 | if (!mine->can_skip) 141 | return (0); 142 | if (request == 0) 143 | return (0); 144 | 145 | /* If request is too big for a long or an off_t, reduce it. */ 146 | if (sizeof(request) > sizeof(skip)) { 147 | int64_t max_skip = 148 | (((int64_t)1 << (skip_bits - 1)) - 1) * 2 + 1; 149 | if (request > max_skip) 150 | skip = max_skip; 151 | } 152 | 153 | #ifdef __ANDROID__ 154 | /* fileno() isn't safe on all platforms ... see above. */ 155 | if (lseek(fileno(mine->f), skip, SEEK_CUR) < 0) 156 | #elif HAVE__FSEEKI64 157 | if (_fseeki64(mine->f, skip, SEEK_CUR) != 0) 158 | #elif HAVE_FSEEKO 159 | if (fseeko(mine->f, skip, SEEK_CUR) != 0) 160 | #else 161 | if (fseek(mine->f, skip, SEEK_CUR) != 0) 162 | #endif 163 | { 164 | mine->can_skip = 0; 165 | return (0); 166 | } 167 | return (request); 168 | } 169 | 170 | static int 171 | file_close(struct archive *a, void *client_data) 172 | { 173 | struct read_FILE_data *mine = (struct read_FILE_data *)client_data; 174 | 175 | (void)a; /* UNUSED */ 176 | free(mine->buffer); 177 | free(mine); 178 | return (ARCHIVE_OK); 179 | } 180 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_support_filter_all.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2011 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #include "archive.h" 29 | #include "archive_private.h" 30 | 31 | #if ARCHIVE_VERSION_NUMBER < 4000000 32 | /* Deprecated; remove in libarchive 4.0 */ 33 | int 34 | archive_read_support_compression_all(struct archive *a) 35 | { 36 | return archive_read_support_filter_all(a); 37 | } 38 | #endif 39 | 40 | int 41 | archive_read_support_filter_all(struct archive *a) 42 | { 43 | archive_check_magic(a, ARCHIVE_READ_MAGIC, 44 | ARCHIVE_STATE_NEW, "archive_read_support_filter_all"); 45 | 46 | /* Bzip falls back to "bunzip2" command-line */ 47 | archive_read_support_filter_bzip2(a); 48 | /* The decompress code doesn't use an outside library. */ 49 | archive_read_support_filter_compress(a); 50 | /* Gzip decompress falls back to "gzip -d" command-line. */ 51 | archive_read_support_filter_gzip(a); 52 | /* Lzip falls back to "unlzip" command-line program. */ 53 | archive_read_support_filter_lzip(a); 54 | /* The LZMA file format has a very weak signature, so it 55 | * may not be feasible to keep this here, but we'll try. 56 | * This will come back out if there are problems. */ 57 | /* Lzma falls back to "unlzma" command-line program. */ 58 | archive_read_support_filter_lzma(a); 59 | /* Xz falls back to "unxz" command-line program. */ 60 | archive_read_support_filter_xz(a); 61 | /* The decode code doesn't use an outside library. */ 62 | archive_read_support_filter_uu(a); 63 | /* The decode code doesn't use an outside library. */ 64 | archive_read_support_filter_rpm(a); 65 | /* The decode code always uses "lrzip -q -d" command-line. */ 66 | archive_read_support_filter_lrzip(a); 67 | /* Lzop decompress falls back to "lzop -d" command-line. */ 68 | archive_read_support_filter_lzop(a); 69 | /* The decode code always uses "grzip -d" command-line. */ 70 | archive_read_support_filter_grzip(a); 71 | /* Lz4 falls back to "lz4 -d" command-line program. */ 72 | archive_read_support_filter_lz4(a); 73 | /* Zstd falls back to "zstd -d" command-line program. */ 74 | archive_read_support_filter_zstd(a); 75 | 76 | /* Note: We always return ARCHIVE_OK here, even if some of the 77 | * above return ARCHIVE_WARN. The intent here is to enable 78 | * "as much as possible." Clients who need specific 79 | * compression should enable those individually so they can 80 | * verify the level of support. */ 81 | /* Clear any warning messages set by the above functions. */ 82 | archive_clear_error(a); 83 | return (ARCHIVE_OK); 84 | } 85 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_support_filter_by_code.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2020 Martin Matuska 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #include "archive.h" 29 | #include "archive_private.h" 30 | 31 | int 32 | archive_read_support_filter_by_code(struct archive *a, int filter_code) 33 | { 34 | archive_check_magic(a, ARCHIVE_READ_MAGIC, 35 | ARCHIVE_STATE_NEW, "archive_read_support_filter_by_code"); 36 | 37 | switch (filter_code) { 38 | case ARCHIVE_FILTER_NONE: 39 | return archive_read_support_filter_none(a); 40 | break; 41 | case ARCHIVE_FILTER_GZIP: 42 | return archive_read_support_filter_gzip(a); 43 | break; 44 | case ARCHIVE_FILTER_BZIP2: 45 | return archive_read_support_filter_bzip2(a); 46 | break; 47 | case ARCHIVE_FILTER_COMPRESS: 48 | return archive_read_support_filter_compress(a); 49 | break; 50 | case ARCHIVE_FILTER_LZMA: 51 | return archive_read_support_filter_lzma(a); 52 | break; 53 | case ARCHIVE_FILTER_XZ: 54 | return archive_read_support_filter_xz(a); 55 | break; 56 | case ARCHIVE_FILTER_UU: 57 | return archive_read_support_filter_uu(a); 58 | break; 59 | case ARCHIVE_FILTER_RPM: 60 | return archive_read_support_filter_rpm(a); 61 | break; 62 | case ARCHIVE_FILTER_LZIP: 63 | return archive_read_support_filter_lzip(a); 64 | break; 65 | case ARCHIVE_FILTER_LRZIP: 66 | return archive_read_support_filter_lrzip(a); 67 | break; 68 | case ARCHIVE_FILTER_LZOP: 69 | return archive_read_support_filter_lzop(a); 70 | break; 71 | case ARCHIVE_FILTER_GRZIP: 72 | return archive_read_support_filter_grzip(a); 73 | break; 74 | case ARCHIVE_FILTER_LZ4: 75 | return archive_read_support_filter_lz4(a); 76 | break; 77 | case ARCHIVE_FILTER_ZSTD: 78 | return archive_read_support_filter_zstd(a); 79 | break; 80 | } 81 | return (ARCHIVE_FATAL); 82 | } 83 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_support_filter_grzip.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2012 Michihiro NAKAJIMA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_ERRNO_H 29 | #include 30 | #endif 31 | #ifdef HAVE_STDLIB_H 32 | #include 33 | #endif 34 | #ifdef HAVE_STRING_H 35 | #include 36 | #endif 37 | #ifdef HAVE_UNISTD_H 38 | #include 39 | #endif 40 | 41 | #include "archive.h" 42 | #include "archive_private.h" 43 | #include "archive_read_private.h" 44 | 45 | static const unsigned char grzip_magic[] = { 46 | 0x47, 0x52, 0x5a, 0x69, 0x70, 0x49, 0x49, 0x00, 47 | 0x02, 0x04, 0x3a, 0x29 }; 48 | 49 | static int grzip_bidder_bid(struct archive_read_filter_bidder *, 50 | struct archive_read_filter *); 51 | static int grzip_bidder_init(struct archive_read_filter *); 52 | 53 | 54 | static const struct archive_read_filter_bidder_vtable 55 | grzip_bidder_vtable = { 56 | .bid = grzip_bidder_bid, 57 | .init = grzip_bidder_init, 58 | }; 59 | 60 | int 61 | archive_read_support_filter_grzip(struct archive *_a) 62 | { 63 | struct archive_read *a = (struct archive_read *)_a; 64 | 65 | if (__archive_read_register_bidder(a, NULL, NULL, 66 | &grzip_bidder_vtable) != ARCHIVE_OK) 67 | return (ARCHIVE_FATAL); 68 | 69 | /* This filter always uses an external program. */ 70 | archive_set_error(_a, ARCHIVE_ERRNO_MISC, 71 | "Using external grzip program for grzip decompression"); 72 | return (ARCHIVE_WARN); 73 | } 74 | 75 | /* 76 | * Bidder just verifies the header and returns the number of verified bits. 77 | */ 78 | static int 79 | grzip_bidder_bid(struct archive_read_filter_bidder *self, 80 | struct archive_read_filter *filter) 81 | { 82 | const unsigned char *p; 83 | ssize_t avail; 84 | 85 | (void)self; /* UNUSED */ 86 | 87 | p = __archive_read_filter_ahead(filter, sizeof(grzip_magic), &avail); 88 | if (p == NULL || avail == 0) 89 | return (0); 90 | 91 | if (memcmp(p, grzip_magic, sizeof(grzip_magic))) 92 | return (0); 93 | 94 | return (sizeof(grzip_magic) * 8); 95 | } 96 | 97 | static int 98 | grzip_bidder_init(struct archive_read_filter *self) 99 | { 100 | int r; 101 | 102 | r = __archive_read_program(self, "grzip -d"); 103 | /* Note: We set the format here even if __archive_read_program() 104 | * above fails. We do, after all, know what the format is 105 | * even if we weren't able to read it. */ 106 | self->code = ARCHIVE_FILTER_GRZIP; 107 | self->name = "grzip"; 108 | return (r); 109 | } 110 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_support_filter_lrzip.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_ERRNO_H 29 | #include 30 | #endif 31 | #ifdef HAVE_STDLIB_H 32 | #include 33 | #endif 34 | #ifdef HAVE_STRING_H 35 | #include 36 | #endif 37 | #ifdef HAVE_UNISTD_H 38 | #include 39 | #endif 40 | 41 | #include "archive.h" 42 | #include "archive_private.h" 43 | #include "archive_read_private.h" 44 | 45 | #define LRZIP_HEADER_MAGIC "LRZI" 46 | #define LRZIP_HEADER_MAGIC_LEN 4 47 | 48 | static int lrzip_bidder_bid(struct archive_read_filter_bidder *, 49 | struct archive_read_filter *); 50 | static int lrzip_bidder_init(struct archive_read_filter *); 51 | 52 | 53 | static const struct archive_read_filter_bidder_vtable 54 | lrzip_bidder_vtable = { 55 | .bid = lrzip_bidder_bid, 56 | .init = lrzip_bidder_init, 57 | }; 58 | 59 | int 60 | archive_read_support_filter_lrzip(struct archive *_a) 61 | { 62 | struct archive_read *a = (struct archive_read *)_a; 63 | 64 | if (__archive_read_register_bidder(a, NULL, "lrzip", 65 | &lrzip_bidder_vtable) != ARCHIVE_OK) 66 | return (ARCHIVE_FATAL); 67 | 68 | /* This filter always uses an external program. */ 69 | archive_set_error(_a, ARCHIVE_ERRNO_MISC, 70 | "Using external lrzip program for lrzip decompression"); 71 | return (ARCHIVE_WARN); 72 | } 73 | 74 | /* 75 | * Bidder just verifies the header and returns the number of verified bits. 76 | */ 77 | static int 78 | lrzip_bidder_bid(struct archive_read_filter_bidder *self, 79 | struct archive_read_filter *filter) 80 | { 81 | const unsigned char *p; 82 | ssize_t avail, len; 83 | int i; 84 | 85 | (void)self; /* UNUSED */ 86 | /* Start by looking at the first six bytes of the header, which 87 | * is all fixed layout. */ 88 | len = 6; 89 | p = __archive_read_filter_ahead(filter, len, &avail); 90 | if (p == NULL || avail == 0) 91 | return (0); 92 | 93 | if (memcmp(p, LRZIP_HEADER_MAGIC, LRZIP_HEADER_MAGIC_LEN)) 94 | return (0); 95 | 96 | /* current major version is always 0, verify this */ 97 | if (p[LRZIP_HEADER_MAGIC_LEN]) 98 | return 0; 99 | /* support only v0.6+ lrzip for sanity */ 100 | i = p[LRZIP_HEADER_MAGIC_LEN + 1]; 101 | if ((i < 6) || (i > 10)) 102 | return 0; 103 | 104 | return (int)len; 105 | } 106 | 107 | static int 108 | lrzip_bidder_init(struct archive_read_filter *self) 109 | { 110 | int r; 111 | 112 | r = __archive_read_program(self, "lrzip -d -q"); 113 | /* Note: We set the format here even if __archive_read_program() 114 | * above fails. We do, after all, know what the format is 115 | * even if we weren't able to read it. */ 116 | self->code = ARCHIVE_FILTER_LRZIP; 117 | self->name = "lrzip"; 118 | return (r); 119 | } 120 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_support_filter_none.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #include "archive.h" 29 | #include "archive_private.h" 30 | 31 | #if ARCHIVE_VERSION_NUMBER < 4000000 32 | /* Deprecated; remove in libarchive 4.0 */ 33 | int 34 | archive_read_support_compression_none(struct archive *a) 35 | { 36 | return archive_read_support_filter_none(a); 37 | } 38 | #endif 39 | 40 | /* 41 | * Uncompressed streams are handled implicitly by the read core, 42 | * so this is now a no-op. 43 | */ 44 | int 45 | archive_read_support_filter_none(struct archive *a) 46 | { 47 | archive_check_magic(a, ARCHIVE_READ_MAGIC, 48 | ARCHIVE_STATE_NEW, "archive_read_support_filter_none"); 49 | 50 | return (ARCHIVE_OK); 51 | } 52 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_support_format_all.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2011 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #include "archive.h" 29 | #include "archive_private.h" 30 | 31 | int 32 | archive_read_support_format_all(struct archive *a) 33 | { 34 | archive_check_magic(a, ARCHIVE_READ_MAGIC, 35 | ARCHIVE_STATE_NEW, "archive_read_support_format_all"); 36 | 37 | /* TODO: It would be nice to compute the ordering 38 | * here automatically so that people who enable just 39 | * a few formats can still get the benefits. That 40 | * may just require the format registration to include 41 | * a "maximum read-ahead" value (anything that uses seek 42 | * would be essentially infinite read-ahead). The core 43 | * bid management can then sort the bidders before calling 44 | * them. 45 | * 46 | * If you implement the above, please return the list below 47 | * to alphabetic order. 48 | */ 49 | 50 | /* 51 | * These bidders are all pretty cheap; they just examine a 52 | * small initial part of the archive. If one of these bids 53 | * high, we can maybe avoid running any of the more expensive 54 | * bidders below. 55 | */ 56 | archive_read_support_format_ar(a); 57 | archive_read_support_format_cpio(a); 58 | archive_read_support_format_empty(a); 59 | archive_read_support_format_lha(a); 60 | archive_read_support_format_mtree(a); 61 | archive_read_support_format_tar(a); 62 | archive_read_support_format_xar(a); 63 | archive_read_support_format_warc(a); 64 | 65 | /* 66 | * Install expensive bidders last. By doing them last, we 67 | * increase the chance that a high bid from someone else will 68 | * make it unnecessary for these to do anything at all. 69 | */ 70 | /* These have potentially large look-ahead. */ 71 | archive_read_support_format_7zip(a); 72 | archive_read_support_format_cab(a); 73 | archive_read_support_format_rar(a); 74 | archive_read_support_format_rar5(a); 75 | archive_read_support_format_iso9660(a); 76 | /* Seek is really bad, since it forces the read-ahead 77 | * logic to discard buffered data. */ 78 | archive_read_support_format_zip(a); 79 | 80 | /* Note: We always return ARCHIVE_OK here, even if some of the 81 | * above return ARCHIVE_WARN. The intent here is to enable 82 | * "as much as possible." Clients who need specific 83 | * compression should enable those individually so they can 84 | * verify the level of support. */ 85 | /* Clear any warning messages set by the above functions. */ 86 | archive_clear_error(a); 87 | return (ARCHIVE_OK); 88 | } 89 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_support_format_by_code.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2011 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #ifdef HAVE_ERRNO_H 29 | #include 30 | #endif 31 | 32 | #include "archive.h" 33 | #include "archive_private.h" 34 | 35 | int 36 | archive_read_support_format_by_code(struct archive *a, int format_code) 37 | { 38 | archive_check_magic(a, ARCHIVE_READ_MAGIC, 39 | ARCHIVE_STATE_NEW, "archive_read_support_format_by_code"); 40 | 41 | switch (format_code & ARCHIVE_FORMAT_BASE_MASK) { 42 | case ARCHIVE_FORMAT_7ZIP: 43 | return archive_read_support_format_7zip(a); 44 | break; 45 | case ARCHIVE_FORMAT_AR: 46 | return archive_read_support_format_ar(a); 47 | break; 48 | case ARCHIVE_FORMAT_CAB: 49 | return archive_read_support_format_cab(a); 50 | break; 51 | case ARCHIVE_FORMAT_CPIO: 52 | return archive_read_support_format_cpio(a); 53 | break; 54 | case ARCHIVE_FORMAT_EMPTY: 55 | return archive_read_support_format_empty(a); 56 | break; 57 | case ARCHIVE_FORMAT_ISO9660: 58 | return archive_read_support_format_iso9660(a); 59 | break; 60 | case ARCHIVE_FORMAT_LHA: 61 | return archive_read_support_format_lha(a); 62 | break; 63 | case ARCHIVE_FORMAT_MTREE: 64 | return archive_read_support_format_mtree(a); 65 | break; 66 | case ARCHIVE_FORMAT_RAR: 67 | return archive_read_support_format_rar(a); 68 | break; 69 | case ARCHIVE_FORMAT_RAR_V5: 70 | return archive_read_support_format_rar5(a); 71 | break; 72 | case ARCHIVE_FORMAT_RAW: 73 | return archive_read_support_format_raw(a); 74 | break; 75 | case ARCHIVE_FORMAT_TAR: 76 | return archive_read_support_format_tar(a); 77 | break; 78 | case ARCHIVE_FORMAT_WARC: 79 | return archive_read_support_format_warc(a); 80 | break; 81 | case ARCHIVE_FORMAT_XAR: 82 | return archive_read_support_format_xar(a); 83 | break; 84 | case ARCHIVE_FORMAT_ZIP: 85 | return archive_read_support_format_zip(a); 86 | break; 87 | } 88 | archive_set_error(a, ARCHIVE_ERRNO_PROGRAMMER, 89 | "Invalid format code specified"); 90 | return (ARCHIVE_FATAL); 91 | } 92 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_read_support_format_empty.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #include "archive.h" 29 | #include "archive_entry.h" 30 | #include "archive_private.h" 31 | #include "archive_read_private.h" 32 | 33 | static int archive_read_format_empty_bid(struct archive_read *, int); 34 | static int archive_read_format_empty_read_data(struct archive_read *, 35 | const void **, size_t *, int64_t *); 36 | static int archive_read_format_empty_read_header(struct archive_read *, 37 | struct archive_entry *); 38 | int 39 | archive_read_support_format_empty(struct archive *_a) 40 | { 41 | struct archive_read *a = (struct archive_read *)_a; 42 | int r; 43 | 44 | archive_check_magic(_a, ARCHIVE_READ_MAGIC, 45 | ARCHIVE_STATE_NEW, "archive_read_support_format_empty"); 46 | 47 | r = __archive_read_register_format(a, 48 | NULL, 49 | "empty", 50 | archive_read_format_empty_bid, 51 | NULL, 52 | archive_read_format_empty_read_header, 53 | archive_read_format_empty_read_data, 54 | NULL, 55 | NULL, 56 | NULL, 57 | NULL, 58 | NULL); 59 | 60 | return (r); 61 | } 62 | 63 | 64 | static int 65 | archive_read_format_empty_bid(struct archive_read *a, int best_bid) 66 | { 67 | if (best_bid < 1 && __archive_read_ahead(a, 1, NULL) == NULL) 68 | return (1); 69 | return (-1); 70 | } 71 | 72 | static int 73 | archive_read_format_empty_read_header(struct archive_read *a, 74 | struct archive_entry *entry) 75 | { 76 | (void)a; /* UNUSED */ 77 | (void)entry; /* UNUSED */ 78 | 79 | a->archive.archive_format = ARCHIVE_FORMAT_EMPTY; 80 | a->archive.archive_format_name = "Empty file"; 81 | 82 | return (ARCHIVE_EOF); 83 | } 84 | 85 | static int 86 | archive_read_format_empty_read_data(struct archive_read *a, 87 | const void **buff, size_t *size, int64_t *offset) 88 | { 89 | (void)a; /* UNUSED */ 90 | (void)buff; /* UNUSED */ 91 | (void)size; /* UNUSED */ 92 | (void)offset; /* UNUSED */ 93 | 94 | return (ARCHIVE_EOF); 95 | } 96 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_string_sprintf.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | /* 29 | * The use of printf()-family functions can be troublesome 30 | * for space-constrained applications. In addition, correctly 31 | * implementing this function in terms of vsnprintf() requires 32 | * two calls (one to determine the size, another to format the 33 | * result), which in turn requires duplicating the argument list 34 | * using va_copy, which isn't yet universally available. 35 | * 36 | * So, I've implemented a bare minimum of printf()-like capability 37 | * here. This is only used to format error messages, so doesn't 38 | * require any floating-point support or field-width handling. 39 | */ 40 | #ifdef HAVE_ERRNO_H 41 | #include 42 | #endif 43 | #include 44 | 45 | #include "archive_string.h" 46 | #include "archive_private.h" 47 | 48 | /* 49 | * Utility functions to format signed/unsigned integers and append 50 | * them to an archive_string. 51 | */ 52 | static void 53 | append_uint(struct archive_string *as, uintmax_t d, unsigned base) 54 | { 55 | static const char digits[] = "0123456789abcdef"; 56 | if (d >= base) 57 | append_uint(as, d/base, base); 58 | archive_strappend_char(as, digits[d % base]); 59 | } 60 | 61 | static void 62 | append_int(struct archive_string *as, intmax_t d, unsigned base) 63 | { 64 | uintmax_t ud; 65 | 66 | if (d < 0) { 67 | archive_strappend_char(as, '-'); 68 | ud = (d == INTMAX_MIN) ? (uintmax_t)(INTMAX_MAX) + 1 : (uintmax_t)(-d); 69 | } else 70 | ud = d; 71 | append_uint(as, ud, base); 72 | } 73 | 74 | 75 | void 76 | archive_string_sprintf(struct archive_string *as, const char *fmt, ...) 77 | { 78 | va_list ap; 79 | 80 | va_start(ap, fmt); 81 | archive_string_vsprintf(as, fmt, ap); 82 | va_end(ap); 83 | } 84 | 85 | /* 86 | * Like 'vsprintf', but ensures the target is big enough, resizing if 87 | * necessary. 88 | */ 89 | void 90 | archive_string_vsprintf(struct archive_string *as, const char *fmt, 91 | va_list ap) 92 | { 93 | char long_flag; 94 | intmax_t s; /* Signed integer temp. */ 95 | uintmax_t u; /* Unsigned integer temp. */ 96 | const char *p, *p2; 97 | const wchar_t *pw; 98 | 99 | if (archive_string_ensure(as, 64) == NULL) 100 | __archive_errx(1, "Out of memory"); 101 | 102 | if (fmt == NULL) { 103 | as->s[0] = 0; 104 | return; 105 | } 106 | 107 | for (p = fmt; *p != '\0'; p++) { 108 | const char *saved_p = p; 109 | 110 | if (*p != '%') { 111 | archive_strappend_char(as, *p); 112 | continue; 113 | } 114 | 115 | p++; 116 | 117 | long_flag = '\0'; 118 | switch(*p) { 119 | case 'j': 120 | case 'l': 121 | case 'z': 122 | long_flag = *p; 123 | p++; 124 | break; 125 | } 126 | 127 | switch (*p) { 128 | case '%': 129 | archive_strappend_char(as, '%'); 130 | break; 131 | case 'c': 132 | s = va_arg(ap, int); 133 | archive_strappend_char(as, (char)s); 134 | break; 135 | case 'd': 136 | switch(long_flag) { 137 | case 'j': s = va_arg(ap, intmax_t); break; 138 | case 'l': s = va_arg(ap, long); break; 139 | case 'z': s = va_arg(ap, ssize_t); break; 140 | default: s = va_arg(ap, int); break; 141 | } 142 | append_int(as, s, 10); 143 | break; 144 | case 's': 145 | switch(long_flag) { 146 | case 'l': 147 | pw = va_arg(ap, wchar_t *); 148 | if (pw == NULL) 149 | pw = L"(null)"; 150 | if (archive_string_append_from_wcs(as, pw, 151 | wcslen(pw)) != 0 && errno == ENOMEM) 152 | __archive_errx(1, "Out of memory"); 153 | break; 154 | default: 155 | p2 = va_arg(ap, char *); 156 | if (p2 == NULL) 157 | p2 = "(null)"; 158 | archive_strcat(as, p2); 159 | break; 160 | } 161 | break; 162 | case 'S': 163 | pw = va_arg(ap, wchar_t *); 164 | if (pw == NULL) 165 | pw = L"(null)"; 166 | if (archive_string_append_from_wcs(as, pw, 167 | wcslen(pw)) != 0 && errno == ENOMEM) 168 | __archive_errx(1, "Out of memory"); 169 | break; 170 | case 'o': case 'u': case 'x': case 'X': 171 | /* Common handling for unsigned integer formats. */ 172 | switch(long_flag) { 173 | case 'j': u = va_arg(ap, uintmax_t); break; 174 | case 'l': u = va_arg(ap, unsigned long); break; 175 | case 'z': u = va_arg(ap, size_t); break; 176 | default: u = va_arg(ap, unsigned int); break; 177 | } 178 | /* Format it in the correct base. */ 179 | switch (*p) { 180 | case 'o': append_uint(as, u, 8); break; 181 | case 'u': append_uint(as, u, 10); break; 182 | default: append_uint(as, u, 16); break; 183 | } 184 | break; 185 | default: 186 | /* Rewind and print the initial '%' literally. */ 187 | p = saved_p; 188 | archive_strappend_char(as, *p); 189 | } 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_version_details.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2009-2012,2014 Michihiro NAKAJIMA 3 | * Copyright (c) 2003-2007 Tim Kientzle 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #include "archive_platform.h" 28 | 29 | #ifdef HAVE_STDLIB_H 30 | #include 31 | #endif 32 | #ifdef HAVE_STRING_H 33 | #include 34 | #endif 35 | #ifdef HAVE_ZLIB_H 36 | #include 37 | #endif 38 | #ifdef HAVE_LZMA_H 39 | #include 40 | #endif 41 | #ifdef HAVE_BZLIB_H 42 | #include 43 | #endif 44 | #ifdef HAVE_LZ4_H 45 | #include 46 | #endif 47 | #ifdef HAVE_ZSTD_H 48 | #include 49 | #endif 50 | 51 | #include "archive.h" 52 | #include "archive_private.h" 53 | #include "archive_string.h" 54 | 55 | const char * 56 | archive_version_details(void) 57 | { 58 | static struct archive_string str; 59 | static int init = 0; 60 | const char *zlib = archive_zlib_version(); 61 | const char *liblzma = archive_liblzma_version(); 62 | const char *bzlib = archive_bzlib_version(); 63 | const char *liblz4 = archive_liblz4_version(); 64 | const char *libzstd = archive_libzstd_version(); 65 | 66 | if (!init) { 67 | archive_string_init(&str); 68 | 69 | archive_strcat(&str, ARCHIVE_VERSION_STRING); 70 | if (zlib != NULL) { 71 | archive_strcat(&str, " zlib/"); 72 | archive_strcat(&str, zlib); 73 | } 74 | if (liblzma) { 75 | archive_strcat(&str, " liblzma/"); 76 | archive_strcat(&str, liblzma); 77 | } 78 | if (bzlib) { 79 | const char *p = bzlib; 80 | const char *sep = strchr(p, ','); 81 | if (sep == NULL) 82 | sep = p + strlen(p); 83 | archive_strcat(&str, " bz2lib/"); 84 | archive_strncat(&str, p, sep - p); 85 | } 86 | if (liblz4) { 87 | archive_strcat(&str, " liblz4/"); 88 | archive_strcat(&str, liblz4); 89 | } 90 | if (libzstd) { 91 | archive_strcat(&str, " libzstd/"); 92 | archive_strcat(&str, libzstd); 93 | } 94 | } 95 | return str.s; 96 | } 97 | 98 | const char * 99 | archive_zlib_version(void) 100 | { 101 | #ifdef HAVE_ZLIB_H 102 | return ZLIB_VERSION; 103 | #else 104 | return NULL; 105 | #endif 106 | } 107 | 108 | const char * 109 | archive_liblzma_version(void) 110 | { 111 | #ifdef HAVE_LZMA_H 112 | return LZMA_VERSION_STRING; 113 | #else 114 | return NULL; 115 | #endif 116 | } 117 | 118 | const char * 119 | archive_bzlib_version(void) 120 | { 121 | #ifdef HAVE_BZLIB_H 122 | return BZ2_bzlibVersion(); 123 | #else 124 | return NULL; 125 | #endif 126 | } 127 | 128 | const char * 129 | archive_liblz4_version(void) 130 | { 131 | #if defined(HAVE_LZ4_H) && defined(HAVE_LIBLZ4) 132 | #define str(s) #s 133 | #define NUMBER(x) str(x) 134 | return NUMBER(LZ4_VERSION_MAJOR) "." NUMBER(LZ4_VERSION_MINOR) "." NUMBER(LZ4_VERSION_RELEASE); 135 | #undef NUMBER 136 | #undef str 137 | #else 138 | return NULL; 139 | #endif 140 | } 141 | 142 | const char * 143 | archive_libzstd_version(void) 144 | { 145 | #if HAVE_ZSTD_H && HAVE_LIBZSTD 146 | return ZSTD_VERSION_STRING; 147 | #else 148 | return NULL; 149 | #endif 150 | } 151 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_virtual.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "archive_platform.h" 27 | 28 | #include "archive.h" 29 | #include "archive_entry.h" 30 | #include "archive_private.h" 31 | 32 | int 33 | archive_filter_code(struct archive *a, int n) 34 | { 35 | return ((a->vtable->archive_filter_code)(a, n)); 36 | } 37 | 38 | int 39 | archive_filter_count(struct archive *a) 40 | { 41 | return ((a->vtable->archive_filter_count)(a)); 42 | } 43 | 44 | const char * 45 | archive_filter_name(struct archive *a, int n) 46 | { 47 | return ((a->vtable->archive_filter_name)(a, n)); 48 | } 49 | 50 | la_int64_t 51 | archive_filter_bytes(struct archive *a, int n) 52 | { 53 | return ((a->vtable->archive_filter_bytes)(a, n)); 54 | } 55 | 56 | int 57 | archive_free(struct archive *a) 58 | { 59 | if (a == NULL) 60 | return (ARCHIVE_OK); 61 | return ((a->vtable->archive_free)(a)); 62 | } 63 | 64 | int 65 | archive_write_close(struct archive *a) 66 | { 67 | return ((a->vtable->archive_close)(a)); 68 | } 69 | 70 | int 71 | archive_read_close(struct archive *a) 72 | { 73 | return ((a->vtable->archive_close)(a)); 74 | } 75 | 76 | int 77 | archive_write_fail(struct archive *a) 78 | { 79 | a->state = ARCHIVE_STATE_FATAL; 80 | return a->state; 81 | } 82 | 83 | int 84 | archive_write_free(struct archive *a) 85 | { 86 | return archive_free(a); 87 | } 88 | 89 | #if ARCHIVE_VERSION_NUMBER < 4000000 90 | /* For backwards compatibility; will be removed with libarchive 4.0. */ 91 | int 92 | archive_write_finish(struct archive *a) 93 | { 94 | return archive_write_free(a); 95 | } 96 | #endif 97 | 98 | int 99 | archive_read_free(struct archive *a) 100 | { 101 | return archive_free(a); 102 | } 103 | 104 | #if ARCHIVE_VERSION_NUMBER < 4000000 105 | /* For backwards compatibility; will be removed with libarchive 4.0. */ 106 | int 107 | archive_read_finish(struct archive *a) 108 | { 109 | return archive_read_free(a); 110 | } 111 | #endif 112 | 113 | int 114 | archive_write_header(struct archive *a, struct archive_entry *entry) 115 | { 116 | ++a->file_count; 117 | return ((a->vtable->archive_write_header)(a, entry)); 118 | } 119 | 120 | int 121 | archive_write_finish_entry(struct archive *a) 122 | { 123 | return ((a->vtable->archive_write_finish_entry)(a)); 124 | } 125 | 126 | la_ssize_t 127 | archive_write_data(struct archive *a, const void *buff, size_t s) 128 | { 129 | return ((a->vtable->archive_write_data)(a, buff, s)); 130 | } 131 | 132 | la_ssize_t 133 | archive_write_data_block(struct archive *a, const void *buff, size_t s, 134 | la_int64_t o) 135 | { 136 | if (a->vtable->archive_write_data_block == NULL) { 137 | archive_set_error(a, ARCHIVE_ERRNO_MISC, 138 | "archive_write_data_block not supported"); 139 | a->state = ARCHIVE_STATE_FATAL; 140 | return (ARCHIVE_FATAL); 141 | } 142 | return ((a->vtable->archive_write_data_block)(a, buff, s, o)); 143 | } 144 | 145 | int 146 | archive_read_next_header(struct archive *a, struct archive_entry **entry) 147 | { 148 | return ((a->vtable->archive_read_next_header)(a, entry)); 149 | } 150 | 151 | int 152 | archive_read_next_header2(struct archive *a, struct archive_entry *entry) 153 | { 154 | return ((a->vtable->archive_read_next_header2)(a, entry)); 155 | } 156 | 157 | int 158 | archive_read_data_block(struct archive *a, 159 | const void **buff, size_t *s, la_int64_t *o) 160 | { 161 | return ((a->vtable->archive_read_data_block)(a, buff, s, o)); 162 | } 163 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_write_disk_private.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2003-2007 Tim Kientzle 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer 10 | * in this position and unchanged. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED 28 | #define ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED 29 | 30 | #ifndef __LIBARCHIVE_BUILD 31 | #error This header is only to be used internally to libarchive. 32 | #endif 33 | 34 | #include "archive_platform_acl.h" 35 | #include "archive_acl_private.h" 36 | #include "archive_entry.h" 37 | 38 | struct archive_write_disk; 39 | 40 | int archive_write_disk_set_acls(struct archive *, int, const char *, 41 | struct archive_acl *, __LA_MODE_T); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/archive_xxhash.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2014 Michihiro NAKAJIMA 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | * 25 | */ 26 | 27 | #ifndef ARCHIVE_XXHASH_H_INCLUDED 28 | #define ARCHIVE_XXHASH_H_INCLUDED 29 | 30 | #ifndef __LIBARCHIVE_BUILD 31 | #error This header is only to be used internally to libarchive. 32 | #endif 33 | 34 | 35 | typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; 36 | 37 | struct archive_xxhash { 38 | unsigned int (*XXH32)(const void* input, unsigned int len, 39 | unsigned int seed); 40 | void* (*XXH32_init)(unsigned int seed); 41 | XXH_errorcode (*XXH32_update)(void* state, const void* input, 42 | unsigned int len); 43 | unsigned int (*XXH32_digest)(void* state); 44 | }; 45 | 46 | extern const struct archive_xxhash __archive_xxhash; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /qlZipInfo/libarchive/filter_fork.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2007 Joerg Sonnenberger 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 | * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef FILTER_FORK_H 27 | #define FILTER_FORK_H 28 | 29 | #ifndef __LIBARCHIVE_BUILD 30 | #error This header is only to be used internally to libarchive. 31 | #endif 32 | 33 | int 34 | __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout, 35 | #if defined(_WIN32) && !defined(__CYGWIN__) 36 | HANDLE *out_child); 37 | #else 38 | pid_t *out_child); 39 | #endif 40 | 41 | void 42 | __archive_check_child(int in, int out); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /qlZipInfo/lzma/lzma/bcj.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file lzma/bcj.h 3 | * \brief Branch/Call/Jump conversion filters 4 | * \note Never include this file directly. Use instead. 5 | */ 6 | 7 | /* 8 | * Author: Lasse Collin 9 | * 10 | * This file has been put into the public domain. 11 | * You can do whatever you want with this file. 12 | */ 13 | 14 | #ifndef LZMA_H_INTERNAL 15 | # error Never include this file directly. Use instead. 16 | #endif 17 | 18 | 19 | /* Filter IDs for lzma_filter.id */ 20 | 21 | /** 22 | * \brief Filter for x86 binaries 23 | */ 24 | #define LZMA_FILTER_X86 LZMA_VLI_C(0x04) 25 | 26 | /** 27 | * \brief Filter for Big endian PowerPC binaries 28 | */ 29 | #define LZMA_FILTER_POWERPC LZMA_VLI_C(0x05) 30 | 31 | /** 32 | * \brief Filter for IA-64 (Itanium) binaries 33 | */ 34 | #define LZMA_FILTER_IA64 LZMA_VLI_C(0x06) 35 | 36 | /** 37 | * \brief Filter for ARM binaries 38 | */ 39 | #define LZMA_FILTER_ARM LZMA_VLI_C(0x07) 40 | 41 | /** 42 | * \brief Filter for ARM-Thumb binaries 43 | */ 44 | #define LZMA_FILTER_ARMTHUMB LZMA_VLI_C(0x08) 45 | 46 | /** 47 | * \brief Filter for SPARC binaries 48 | */ 49 | #define LZMA_FILTER_SPARC LZMA_VLI_C(0x09) 50 | 51 | /** 52 | * \brief Filter for ARM64 binaries 53 | */ 54 | #define LZMA_FILTER_ARM64 LZMA_VLI_C(0x0A) 55 | 56 | 57 | /** 58 | * \brief Options for BCJ filters 59 | * 60 | * The BCJ filters never change the size of the data. Specifying options 61 | * for them is optional: if pointer to options is NULL, default value is 62 | * used. You probably never need to specify options to BCJ filters, so just 63 | * set the options pointer to NULL and be happy. 64 | * 65 | * If options with non-default values have been specified when encoding, 66 | * the same options must also be specified when decoding. 67 | * 68 | * \note At the moment, none of the BCJ filters support 69 | * LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified, 70 | * LZMA_OPTIONS_ERROR will be returned. If there is need, 71 | * partial support for LZMA_SYNC_FLUSH can be added in future. 72 | * Partial means that flushing would be possible only at 73 | * offsets that are multiple of 2, 4, or 16 depending on 74 | * the filter, except x86 which cannot be made to support 75 | * LZMA_SYNC_FLUSH predictably. 76 | */ 77 | typedef struct { 78 | /** 79 | * \brief Start offset for conversions 80 | * 81 | * This setting is useful only when the same filter is used 82 | * _separately_ for multiple sections of the same executable file, 83 | * and the sections contain cross-section branch/call/jump 84 | * instructions. In that case it is beneficial to set the start 85 | * offset of the non-first sections so that the relative addresses 86 | * of the cross-section branch/call/jump instructions will use the 87 | * same absolute addresses as in the first section. 88 | * 89 | * When the pointer to options is NULL, the default value (zero) 90 | * is used. 91 | */ 92 | uint32_t start_offset; 93 | 94 | } lzma_options_bcj; 95 | -------------------------------------------------------------------------------- /qlZipInfo/lzma/lzma/check.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file lzma/check.h 3 | * \brief Integrity checks 4 | * \note Never include this file directly. Use instead. 5 | */ 6 | 7 | /* 8 | * Author: Lasse Collin 9 | * 10 | * This file has been put into the public domain. 11 | * You can do whatever you want with this file. 12 | */ 13 | 14 | #ifndef LZMA_H_INTERNAL 15 | # error Never include this file directly. Use instead. 16 | #endif 17 | 18 | 19 | /** 20 | * \brief Type of the integrity check (Check ID) 21 | * 22 | * The .xz format supports multiple types of checks that are calculated 23 | * from the uncompressed data. They vary in both speed and ability to 24 | * detect errors. 25 | */ 26 | typedef enum { 27 | LZMA_CHECK_NONE = 0, 28 | /**< 29 | * No Check is calculated. 30 | * 31 | * Size of the Check field: 0 bytes 32 | */ 33 | 34 | LZMA_CHECK_CRC32 = 1, 35 | /**< 36 | * CRC32 using the polynomial from the IEEE 802.3 standard 37 | * 38 | * Size of the Check field: 4 bytes 39 | */ 40 | 41 | LZMA_CHECK_CRC64 = 4, 42 | /**< 43 | * CRC64 using the polynomial from the ECMA-182 standard 44 | * 45 | * Size of the Check field: 8 bytes 46 | */ 47 | 48 | LZMA_CHECK_SHA256 = 10 49 | /**< 50 | * SHA-256 51 | * 52 | * Size of the Check field: 32 bytes 53 | */ 54 | } lzma_check; 55 | 56 | 57 | /** 58 | * \brief Maximum valid Check ID 59 | * 60 | * The .xz file format specification specifies 16 Check IDs (0-15). Some 61 | * of them are only reserved, that is, no actual Check algorithm has been 62 | * assigned. When decoding, liblzma still accepts unknown Check IDs for 63 | * future compatibility. If a valid but unsupported Check ID is detected, 64 | * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK, 65 | * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h. 66 | */ 67 | #define LZMA_CHECK_ID_MAX 15 68 | 69 | 70 | /** 71 | * \brief Test if the given Check ID is supported 72 | * 73 | * LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always supported (even if 74 | * liblzma is built with limited features). 75 | * 76 | * \note It is safe to call this with a value that is not in the 77 | * range [0, 15]; in that case the return value is always false. 78 | * 79 | * \param check Check ID 80 | * 81 | * \return lzma_bool: 82 | * - true if Check ID is supported by this liblzma build. 83 | * - false otherwise. 84 | */ 85 | extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check check) 86 | lzma_nothrow lzma_attr_const; 87 | 88 | 89 | /** 90 | * \brief Get the size of the Check field with the given Check ID 91 | * 92 | * Although not all Check IDs have a check algorithm associated, the size of 93 | * every Check is already frozen. This function returns the size (in bytes) of 94 | * the Check field with the specified Check ID. The values are: 95 | * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 } 96 | * 97 | * \param check Check ID 98 | * 99 | * \return Size of the Check field in bytes. If the argument is not in 100 | * the range [0, 15], UINT32_MAX is returned. 101 | */ 102 | extern LZMA_API(uint32_t) lzma_check_size(lzma_check check) 103 | lzma_nothrow lzma_attr_const; 104 | 105 | 106 | /** 107 | * \brief Maximum size of a Check field 108 | */ 109 | #define LZMA_CHECK_SIZE_MAX 64 110 | 111 | 112 | /** 113 | * \brief Calculate CRC32 114 | * 115 | * Calculate CRC32 using the polynomial from the IEEE 802.3 standard. 116 | * 117 | * \param buf Pointer to the input buffer 118 | * \param size Size of the input buffer 119 | * \param crc Previously returned CRC value. This is used to 120 | * calculate the CRC of a big buffer in smaller chunks. 121 | * Set to zero when starting a new calculation. 122 | * 123 | * \return Updated CRC value, which can be passed to this function 124 | * again to continue CRC calculation. 125 | */ 126 | extern LZMA_API(uint32_t) lzma_crc32( 127 | const uint8_t *buf, size_t size, uint32_t crc) 128 | lzma_nothrow lzma_attr_pure; 129 | 130 | 131 | /** 132 | * \brief Calculate CRC64 133 | * 134 | * Calculate CRC64 using the polynomial from the ECMA-182 standard. 135 | * 136 | * This function is used similarly to lzma_crc32(). 137 | * 138 | * \param buf Pointer to the input buffer 139 | * \param size Size of the input buffer 140 | * \param crc Previously returned CRC value. This is used to 141 | * calculate the CRC of a big buffer in smaller chunks. 142 | * Set to zero when starting a new calculation. 143 | * 144 | * \return Updated CRC value, which can be passed to this function 145 | * again to continue CRC calculation. 146 | */ 147 | extern LZMA_API(uint64_t) lzma_crc64( 148 | const uint8_t *buf, size_t size, uint64_t crc) 149 | lzma_nothrow lzma_attr_pure; 150 | 151 | 152 | /** 153 | * \brief Get the type of the integrity check 154 | * 155 | * This function can be called only immediately after lzma_code() has 156 | * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK. 157 | * Calling this function in any other situation has undefined behavior. 158 | * 159 | * \param strm Pointer to lzma_stream meeting the above conditions. 160 | * 161 | * \return Check ID in the lzma_stream, or undefined if called improperly. 162 | */ 163 | extern LZMA_API(lzma_check) lzma_get_check(const lzma_stream *strm) 164 | lzma_nothrow; 165 | -------------------------------------------------------------------------------- /qlZipInfo/lzma/lzma/delta.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file lzma/delta.h 3 | * \brief Delta filter 4 | * \note Never include this file directly. Use instead. 5 | */ 6 | 7 | /* 8 | * Author: Lasse Collin 9 | * 10 | * This file has been put into the public domain. 11 | * You can do whatever you want with this file. 12 | */ 13 | 14 | #ifndef LZMA_H_INTERNAL 15 | # error Never include this file directly. Use instead. 16 | #endif 17 | 18 | 19 | /** 20 | * \brief Filter ID 21 | * 22 | * Filter ID of the Delta filter. This is used as lzma_filter.id. 23 | */ 24 | #define LZMA_FILTER_DELTA LZMA_VLI_C(0x03) 25 | 26 | 27 | /** 28 | * \brief Type of the delta calculation 29 | * 30 | * Currently only byte-wise delta is supported. Other possible types could 31 | * be, for example, delta of 16/32/64-bit little/big endian integers, but 32 | * these are not currently planned since byte-wise delta is almost as good. 33 | */ 34 | typedef enum { 35 | LZMA_DELTA_TYPE_BYTE 36 | } lzma_delta_type; 37 | 38 | 39 | /** 40 | * \brief Options for the Delta filter 41 | * 42 | * These options are needed by both encoder and decoder. 43 | */ 44 | typedef struct { 45 | /** For now, this must always be LZMA_DELTA_TYPE_BYTE. */ 46 | lzma_delta_type type; 47 | 48 | /** 49 | * \brief Delta distance 50 | * 51 | * With the only currently supported type, LZMA_DELTA_TYPE_BYTE, 52 | * the distance is as bytes. 53 | * 54 | * Examples: 55 | * - 16-bit stereo audio: distance = 4 bytes 56 | * - 24-bit RGB image data: distance = 3 bytes 57 | */ 58 | uint32_t dist; 59 | 60 | /** 61 | * \brief Minimum value for lzma_options_delta.dist. 62 | */ 63 | # define LZMA_DELTA_DIST_MIN 1 64 | 65 | /** 66 | * \brief Maximum value for lzma_options_delta.dist. 67 | */ 68 | # define LZMA_DELTA_DIST_MAX 256 69 | 70 | /* 71 | * Reserved space to allow possible future extensions without 72 | * breaking the ABI. You should not touch these, because the names 73 | * of these variables may change. These are and will never be used 74 | * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these 75 | * uninitialized. 76 | */ 77 | 78 | /** \private Reserved member. */ 79 | uint32_t reserved_int1; 80 | 81 | /** \private Reserved member. */ 82 | uint32_t reserved_int2; 83 | 84 | /** \private Reserved member. */ 85 | uint32_t reserved_int3; 86 | 87 | /** \private Reserved member. */ 88 | uint32_t reserved_int4; 89 | 90 | /** \private Reserved member. */ 91 | void *reserved_ptr1; 92 | 93 | /** \private Reserved member. */ 94 | void *reserved_ptr2; 95 | 96 | } lzma_options_delta; 97 | -------------------------------------------------------------------------------- /qlZipInfo/lzma/lzma/hardware.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file lzma/hardware.h 3 | * \brief Hardware information 4 | * \note Never include this file directly. Use instead. 5 | * 6 | * Since liblzma can consume a lot of system resources, it also provides 7 | * ways to limit the resource usage. Applications linking against liblzma 8 | * need to do the actual decisions how much resources to let liblzma to use. 9 | * To ease making these decisions, liblzma provides functions to find out 10 | * the relevant capabilities of the underlying hardware. Currently there 11 | * is only a function to find out the amount of RAM, but in the future there 12 | * will be also a function to detect how many concurrent threads the system 13 | * can run. 14 | * 15 | * \note On some operating systems, these function may temporarily 16 | * load a shared library or open file descriptor(s) to find out 17 | * the requested hardware information. Unless the application 18 | * assumes that specific file descriptors are not touched by 19 | * other threads, this should have no effect on thread safety. 20 | * Possible operations involving file descriptors will restart 21 | * the syscalls if they return EINTR. 22 | */ 23 | 24 | /* 25 | * Author: Lasse Collin 26 | * 27 | * This file has been put into the public domain. 28 | * You can do whatever you want with this file. 29 | */ 30 | 31 | #ifndef LZMA_H_INTERNAL 32 | # error Never include this file directly. Use instead. 33 | #endif 34 | 35 | 36 | /** 37 | * \brief Get the total amount of physical memory (RAM) in bytes 38 | * 39 | * This function may be useful when determining a reasonable memory 40 | * usage limit for decompressing or how much memory it is OK to use 41 | * for compressing. 42 | * 43 | * \return On success, the total amount of physical memory in bytes 44 | * is returned. If the amount of RAM cannot be determined, 45 | * zero is returned. This can happen if an error occurs 46 | * or if there is no code in liblzma to detect the amount 47 | * of RAM on the specific operating system. 48 | */ 49 | extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow; 50 | 51 | 52 | /** 53 | * \brief Get the number of processor cores or threads 54 | * 55 | * This function may be useful when determining how many threads to use. 56 | * If the hardware supports more than one thread per CPU core, the number 57 | * of hardware threads is returned if that information is available. 58 | * 59 | * \return On success, the number of available CPU threads or cores is 60 | * returned. If this information isn't available or an error 61 | * occurs, zero is returned. 62 | */ 63 | extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow; 64 | -------------------------------------------------------------------------------- /qlZipInfo/lzma/lzma/index_hash.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file lzma/index_hash.h 3 | * \brief Validate Index by using a hash function 4 | * \note Never include this file directly. Use instead. 5 | * 6 | * Hashing makes it possible to use constant amount of memory to validate 7 | * Index of arbitrary size. 8 | */ 9 | 10 | /* 11 | * Author: Lasse Collin 12 | * 13 | * This file has been put into the public domain. 14 | * You can do whatever you want with this file. 15 | */ 16 | 17 | #ifndef LZMA_H_INTERNAL 18 | # error Never include this file directly. Use instead. 19 | #endif 20 | 21 | /** 22 | * \brief Opaque data type to hold the Index hash 23 | */ 24 | typedef struct lzma_index_hash_s lzma_index_hash; 25 | 26 | 27 | /** 28 | * \brief Allocate and initialize a new lzma_index_hash structure 29 | * 30 | * If index_hash is NULL, this function allocates and initializes a new 31 | * lzma_index_hash structure and returns a pointer to it. If allocation 32 | * fails, NULL is returned. 33 | * 34 | * If index_hash is non-NULL, this function reinitializes the lzma_index_hash 35 | * structure and returns the same pointer. In this case, return value cannot 36 | * be NULL or a different pointer than the index_hash that was given as 37 | * an argument. 38 | * 39 | * \param index_hash Pointer to a lzma_index_hash structure or NULL. 40 | * \param allocator lzma_allocator for custom allocator functions. 41 | * Set to NULL to use malloc() and free(). 42 | * 43 | * \return Initialized lzma_index_hash structure on success or 44 | * NULL on failure. 45 | */ 46 | extern LZMA_API(lzma_index_hash *) lzma_index_hash_init( 47 | lzma_index_hash *index_hash, const lzma_allocator *allocator) 48 | lzma_nothrow lzma_attr_warn_unused_result; 49 | 50 | 51 | /** 52 | * \brief Deallocate lzma_index_hash structure 53 | * 54 | * \param index_hash Pointer to a lzma_index_hash structure to free. 55 | * \param allocator lzma_allocator for custom allocator functions. 56 | * Set to NULL to use malloc() and free(). 57 | */ 58 | extern LZMA_API(void) lzma_index_hash_end( 59 | lzma_index_hash *index_hash, const lzma_allocator *allocator) 60 | lzma_nothrow; 61 | 62 | 63 | /** 64 | * \brief Add a new Record to an Index hash 65 | * 66 | * \param index_hash Pointer to a lzma_index_hash structure 67 | * \param unpadded_size Unpadded Size of a Block 68 | * \param uncompressed_size Uncompressed Size of a Block 69 | * 70 | * \return Possible lzma_ret values: 71 | * - LZMA_OK 72 | * - LZMA_DATA_ERROR: Compressed or uncompressed size of the 73 | * Stream or size of the Index field would grow too big. 74 | * - LZMA_PROG_ERROR: Invalid arguments or this function is being 75 | * used when lzma_index_hash_decode() has already been used. 76 | */ 77 | extern LZMA_API(lzma_ret) lzma_index_hash_append(lzma_index_hash *index_hash, 78 | lzma_vli unpadded_size, lzma_vli uncompressed_size) 79 | lzma_nothrow lzma_attr_warn_unused_result; 80 | 81 | 82 | /** 83 | * \brief Decode and validate the Index field 84 | * 85 | * After telling the sizes of all Blocks with lzma_index_hash_append(), 86 | * the actual Index field is decoded with this function. Specifically, 87 | * once decoding of the Index field has been started, no more Records 88 | * can be added using lzma_index_hash_append(). 89 | * 90 | * This function doesn't use lzma_stream structure to pass the input data. 91 | * Instead, the input buffer is specified using three arguments. This is 92 | * because it matches better the internal APIs of liblzma. 93 | * 94 | * \param index_hash Pointer to a lzma_index_hash structure 95 | * \param in Pointer to the beginning of the input buffer 96 | * \param[out] in_pos in[*in_pos] is the next byte to process 97 | * \param in_size in[in_size] is the first byte not to process 98 | * 99 | * \return Possible lzma_ret values: 100 | * - LZMA_OK: So far good, but more input is needed. 101 | * - LZMA_STREAM_END: Index decoded successfully and it matches 102 | * the Records given with lzma_index_hash_append(). 103 | * - LZMA_DATA_ERROR: Index is corrupt or doesn't match the 104 | * information given with lzma_index_hash_append(). 105 | * - LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size. 106 | * - LZMA_PROG_ERROR 107 | */ 108 | extern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash, 109 | const uint8_t *in, size_t *in_pos, size_t in_size) 110 | lzma_nothrow lzma_attr_warn_unused_result; 111 | 112 | 113 | /** 114 | * \brief Get the size of the Index field as bytes 115 | * 116 | * This is needed to verify the Backward Size field in the Stream Footer. 117 | * 118 | * \param index_hash Pointer to a lzma_index_hash structure 119 | * 120 | * \return Size of the Index field in bytes. 121 | */ 122 | extern LZMA_API(lzma_vli) lzma_index_hash_size( 123 | const lzma_index_hash *index_hash) 124 | lzma_nothrow lzma_attr_pure; 125 | -------------------------------------------------------------------------------- /qlZipInfo/lzma/lzma/version.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file lzma/version.h 3 | * \brief Version number 4 | * \note Never include this file directly. Use instead. 5 | */ 6 | 7 | /* 8 | * Author: Lasse Collin 9 | * 10 | * This file has been put into the public domain. 11 | * You can do whatever you want with this file. 12 | */ 13 | 14 | #ifndef LZMA_H_INTERNAL 15 | # error Never include this file directly. Use instead. 16 | #endif 17 | 18 | 19 | /** \brief Major version number of the liblzma release. */ 20 | #define LZMA_VERSION_MAJOR 5 21 | 22 | /** \brief Minor version number of the liblzma release. */ 23 | #define LZMA_VERSION_MINOR 4 24 | 25 | /** \brief Patch version number of the liblzma release. */ 26 | #define LZMA_VERSION_PATCH 4 27 | 28 | /** 29 | * \brief Version stability marker 30 | * 31 | * This will always be one of three values: 32 | * - LZMA_VERSION_STABILITY_ALPHA 33 | * - LZMA_VERSION_STABILITY_BETA 34 | * - LZMA_VERSION_STABILITY_STABLE 35 | */ 36 | #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE 37 | 38 | /** \brief Commit version number of the liblzma release */ 39 | #ifndef LZMA_VERSION_COMMIT 40 | # define LZMA_VERSION_COMMIT "" 41 | #endif 42 | 43 | 44 | /* 45 | * Map symbolic stability levels to integers. 46 | */ 47 | #define LZMA_VERSION_STABILITY_ALPHA 0 48 | #define LZMA_VERSION_STABILITY_BETA 1 49 | #define LZMA_VERSION_STABILITY_STABLE 2 50 | 51 | 52 | /** 53 | * \brief Compile-time version number 54 | * 55 | * The version number is of format xyyyzzzs where 56 | * - x = major 57 | * - yyy = minor 58 | * - zzz = revision 59 | * - s indicates stability: 0 = alpha, 1 = beta, 2 = stable 60 | * 61 | * The same xyyyzzz triplet is never reused with different stability levels. 62 | * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta 63 | * or 5.1.0 stable. 64 | * 65 | * \note The version number of liblzma has nothing to with 66 | * the version number of Igor Pavlov's LZMA SDK. 67 | */ 68 | #define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \ 69 | + LZMA_VERSION_MINOR * UINT32_C(10000) \ 70 | + LZMA_VERSION_PATCH * UINT32_C(10) \ 71 | + LZMA_VERSION_STABILITY) 72 | 73 | 74 | /* 75 | * Macros to construct the compile-time version string 76 | */ 77 | #if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA 78 | # define LZMA_VERSION_STABILITY_STRING "alpha" 79 | #elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA 80 | # define LZMA_VERSION_STABILITY_STRING "beta" 81 | #elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE 82 | # define LZMA_VERSION_STABILITY_STRING "" 83 | #else 84 | # error Incorrect LZMA_VERSION_STABILITY 85 | #endif 86 | 87 | #define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \ 88 | #major "." #minor "." #patch stability commit 89 | 90 | #define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \ 91 | LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) 92 | 93 | 94 | /** 95 | * \brief Compile-time version as a string 96 | * 97 | * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable 98 | * versions don't have any "stable" suffix). In future, a snapshot built 99 | * from source code repository may include an additional suffix, for example 100 | * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form 101 | * in LZMA_VERSION macro. 102 | */ 103 | #define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \ 104 | LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \ 105 | LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \ 106 | LZMA_VERSION_COMMIT) 107 | 108 | 109 | /* #ifndef is needed for use with windres (MinGW or Cygwin). */ 110 | #ifndef LZMA_H_INTERNAL_RC 111 | 112 | /** 113 | * \brief Run-time version number as an integer 114 | * 115 | * This allows an application to compare if it was built against the same, 116 | * older, or newer version of liblzma that is currently running. 117 | * 118 | * \return The value of LZMA_VERSION macro at the compile time of liblzma 119 | */ 120 | extern LZMA_API(uint32_t) lzma_version_number(void) 121 | lzma_nothrow lzma_attr_const; 122 | 123 | 124 | /** 125 | * \brief Run-time version as a string 126 | * 127 | * This function may be useful to display which version of liblzma an 128 | * application is currently using. 129 | * 130 | * \return Run-time version of liblzma 131 | */ 132 | extern LZMA_API(const char *) lzma_version_string(void) 133 | lzma_nothrow lzma_attr_const; 134 | 135 | #endif 136 | -------------------------------------------------------------------------------- /qlZipInfo/macosroman2ascii.h: -------------------------------------------------------------------------------- 1 | /* 2 | macosroman2ascii.h - convert MacOS Roman encoded strings 3 | to ascii 4 | 5 | History: 6 | 7 | v. 0.1.0 (08/01/2022) - initial release 8 | 9 | Based on: 10 | 11 | https://en.m.wikipedia.org/wiki/Mac_OS_Roman 12 | 13 | Copyright (c) 2022 Sriranga R. Veeraraghavan 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining 16 | a copy of this software and associated documentation files (the 17 | "Software") to deal in the Software without restriction, including 18 | without limitation the rights to use, copy, modify, merge, publish, 19 | distribute, sublicense, and/or sell copies of the Software, and to 20 | permit persons to whom the Software is furnished to do so, subject 21 | to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be 24 | included in all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 29 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 30 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 31 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 32 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 | */ 34 | 35 | #ifndef qlZipInfo_macosroman2ascii_h 36 | #define qlZipInfo_macosroman2ascii_h 37 | 38 | int macosroman2ascii(const char *macosromanStr, 39 | int macosromanStrLen, 40 | char *asciiStr, 41 | int asciiStrLen); 42 | 43 | #endif /* qlZipInfo_macosroman2ascii_h */ 44 | -------------------------------------------------------------------------------- /qlZipInfo/minizip/minishared.h: -------------------------------------------------------------------------------- 1 | /* minishared.h 2 | Version 1.2.0, September 16th, 2017 3 | part of the MiniZip project 4 | 5 | Copyright (C) 2012-2017 Nathan Moinvaziri 6 | https://github.com/nmoinvaz/minizip 7 | Copyright (C) 2009-2010 Mathias Svensson 8 | Modifications for Zip64 support on both zip and unzip 9 | http://result42.com 10 | Copyright (C) 2007-2008 Even Rouault 11 | Modifications of Unzip for Zip64 12 | Copyright (C) 1998-2010 Gilles Vollant 13 | http://www.winimage.com/zLibDll/minizip.html 14 | 15 | This program is distributed under the terms of the same license as zlib. 16 | See the accompanying LICENSE file for the full text of the license. 17 | */ 18 | 19 | #ifndef _MINISHARED_H 20 | #define _MINISHARED_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #ifdef _WIN32 27 | # define MKDIR(d) _mkdir(d) 28 | # define CHDIR(d) _chdir(d) 29 | #else 30 | # define MKDIR(d) mkdir(d, 0775) 31 | # define CHDIR(d) chdir(d) 32 | #endif 33 | 34 | /***************************************************************************/ 35 | 36 | /* Get a file's date and time in dos format */ 37 | uint32_t get_file_date(const char *path, uint32_t *dos_date); 38 | 39 | /* Sets a file's date and time in dos format */ 40 | void change_file_date(const char *path, uint32_t dos_date); 41 | 42 | /* Convert dos date/time format to struct tm */ 43 | int dosdate_to_tm(uint64_t dos_date, struct tm *ptm); 44 | 45 | /* Convert dos date/time format to time_t */ 46 | time_t dosdate_to_time_t(uint64_t dos_date); 47 | 48 | /* Convert struct tm to dos date/time format */ 49 | uint32_t tm_to_dosdate(const struct tm *ptm); 50 | 51 | /* Create a directory and all subdirectories */ 52 | int makedir(const char *newdir); 53 | 54 | /* Check to see if a file exists */ 55 | int check_file_exists(const char *path); 56 | 57 | /* Check to see if a file is over 4GB and needs ZIP64 extension */ 58 | int is_large_file(const char *path); 59 | 60 | /* Print a 64-bit number for compatibility */ 61 | void display_zpos64(uint64_t n, int size_char); 62 | 63 | /***************************************************************************/ 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* _MINISHARED_H */ 70 | --------------------------------------------------------------------------------