--- a/ZipArchive.st Tue Nov 19 15:23:27 2019 +0100
+++ b/ZipArchive.st Tue Nov 19 15:31:59 2019 +0100
@@ -49,8 +49,9 @@
compressionMethod lastModFileTime lastModFileDate crc32
compressedSize uncompressedSize fileNameLength extraFieldLength
fileCommentLength diskNumberStart internalFileAttributes
- externalFileAttributes relativeLocalHeaderOffset fileName
- extraField fileComment dataStart data'
+ externalFileAttributes relativeLocalHeaderOffset
+ absoluteLocalHeaderOffset fileName extraField fileComment
+ dataStart data'
classVariableNames:''
poolDictionaries:'ZipArchiveConstants'
privateIn:ZipArchive
@@ -3440,6 +3441,8 @@
mode := #read.
aPositionableStream binary.
stream := aPositionableStream.
+ startOfArchive := aPositionableStream position.
+
aPositionableStream isFileStream ifTrue:[
archiveName := aPositionableStream pathName.
aPositionableStream isDirectory ifTrue:[
@@ -3455,6 +3458,7 @@
"Modified: / 21-11-2010 / 11:45:53 / cg"
"Modified: / 22-05-2019 / 12:19:06 / Claus Gittinger"
+ "Modified: / 19-11-2019 / 14:25:09 / Stefan Vogel"
!
reopenForReading
@@ -4412,7 +4416,7 @@
"/ ensure that the file position is at the end
stream setToEnd.
- zipEntry writeTo:stream position:stream position - startOfArchive.
+ zipEntry writeTo:stream position:stream position startOfArchive:startOfArchive.
streamBufferSize := self class streamBufferSize.
buffer := ByteArray new:streamBufferSize.
@@ -4457,7 +4461,7 @@
stream setToEnd.
"Modified: / 19-11-2010 / 15:39:32 / cg"
- "Modified: / 15-11-2019 / 19:44:42 / Stefan Vogel"
+ "Modified: / 19-11-2019 / 14:53:35 / Stefan Vogel"
!
addFile: aFileName withContents: data
@@ -4552,7 +4556,7 @@
"/ ensure that the file position is at the end
stream setToEnd.
- zipEntry writeTo:stream position:stream position - startOfArchive.
+ zipEntry writeTo:stream position:stream position startOfArchive:startOfArchive.
theCompressedData notNil ifTrue:[
stream
nextPutAll:theCompressedData
@@ -4564,7 +4568,7 @@
"Created: / 18-11-2010 / 19:31:10 / cg"
"Modified: / 19-11-2010 / 17:47:01 / cg"
"Modified: / 19-11-2012 / 12:04:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 15-11-2019 / 19:50:43 / Stefan Vogel"
+ "Modified: / 19-11-2019 / 14:53:29 / Stefan Vogel"
! !
!ZipArchive methodsFor:'writing - stream'!
@@ -4611,13 +4615,13 @@
"/ ensure that the file position is at the end
stream setToEnd.
- zipEntry writeTo:stream position:stream position - startOfArchive.
+ zipEntry writeTo:stream position:stream position startOfArchive:startOfArchive.
self addMember:zipEntry.
^ (ZipWriteStream zipFileStream:stream zipEntry:zipEntry) zipArchive:self.
"Modified: / 19-11-2010 / 15:38:54 / cg"
- "Modified: / 15-11-2019 / 19:45:48 / Stefan Vogel"
+ "Modified: / 19-11-2019 / 14:53:10 / Stefan Vogel"
! !
!ZipArchive::AbstractZipStream class methodsFor:'instance creation'!
@@ -5161,18 +5165,21 @@
rewriteCrcAndSizeTo:aStream
"Header has already been written - now rewrite CRC and sizes"
- aStream position:relativeLocalHeaderOffset+14.
+ aStream position:absoluteLocalHeaderOffset+14.
aStream
- nextPutInt32:crc32 MSB:false;
- nextPutInt32:compressedSize MSB:false;
- nextPutInt32:uncompressedSize MSB:false.
+ nextPutInt32:crc32 MSB:false;
+ nextPutInt32:compressedSize MSB:false;
+ nextPutInt32:uncompressedSize MSB:false.
+
+ "Modified: / 19-11-2019 / 14:54:21 / Stefan Vogel"
!
-writeTo:aStream position:position
+writeTo:aStream position:absolutePosition startOfArchive:startOfArchive
"represent myself on aStream"
- relativeLocalHeaderOffset := position.
+ absoluteLocalHeaderOffset := absolutePosition.
+ relativeLocalHeaderOffset := absolutePosition - startOfArchive.
aStream
nextPutInt32:C_LOCAL_HEADER_SIGNATURE MSB:false;
@@ -5193,7 +5200,7 @@
aStream nextPutAll:extraField.
].
- "Created: / 15-11-2019 / 19:44:10 / Stefan Vogel"
+ "Created: / 19-11-2019 / 14:52:22 / Stefan Vogel"
! !
!ZipArchive::ZipReadStream methodsFor:'accessing'!