mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
archive/zip: write data descriptor signature for OS X; fix bugs reading it
We now always write the "optional" streaming data descriptor signature, which turns out to be required for OS X. Also, handle reading the data descriptor with or without the signature, per the spec's recommendation. Fix data descriptor reading bugs found in the process. Fixes #3252 R=golang-dev, alex.brainman, nigeltao, rsc CC=golang-dev https://golang.org/cl/5787062
This commit is contained in:
parent
ece0d0e7d2
commit
3cea4131df
7 changed files with 146 additions and 57 deletions
|
|
@ -27,10 +27,11 @@ const (
|
|||
fileHeaderSignature = 0x04034b50
|
||||
directoryHeaderSignature = 0x02014b50
|
||||
directoryEndSignature = 0x06054b50
|
||||
fileHeaderLen = 30 // + filename + extra
|
||||
directoryHeaderLen = 46 // + filename + extra + comment
|
||||
directoryEndLen = 22 // + comment
|
||||
dataDescriptorLen = 12
|
||||
dataDescriptorSignature = 0x08074b50 // de-facto standard; required by OS X Finder
|
||||
fileHeaderLen = 30 // + filename + extra
|
||||
directoryHeaderLen = 46 // + filename + extra + comment
|
||||
directoryEndLen = 22 // + comment
|
||||
dataDescriptorLen = 16 // four uint32: descriptor signature, crc32, compressed size, size
|
||||
|
||||
// Constants for the first byte in CreatorVersion
|
||||
creatorFAT = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue