Attachment "tclZipfs.patch" to
ticket [ad7bafd5e1]
added by
juliannoble2
2024-10-09 14:03:37.
0000: 2d 2d 2d 20 74 63 6c 5a 69 70 66 73 5f 6f 72 69 --- tclZipfs_ori
0010: 67 2e 63 09 53 61 74 20 4f 63 74 20 30 35 20 30 g.c.Sat Oct 05 0
0020: 36 3a 30 39 3a 35 33 20 32 30 32 34 0d 0a 2b 2b 6:09:53 2024..++
0030: 2b 20 74 63 6c 5a 69 70 66 73 2e 63 09 57 65 64 + tclZipfs.c.Wed
0040: 20 4f 63 74 20 30 39 20 32 31 3a 35 37 3a 32 38 Oct 09 21:57:28
0050: 20 32 30 32 34 0d 0a 40 40 20 2d 33 33 37 2c 31 2024..@@ -337,1
0060: 31 20 2b 33 33 37 2c 31 32 20 40 40 0d 0a 20 73 1 +337,12 @@.. s
0070: 74 61 74 69 63 20 76 6f 69 64 09 09 53 65 72 69 tatic void..Seri
0080: 61 6c 69 7a 65 43 65 6e 74 72 61 6c 44 69 72 65 alizeCentralDire
0090: 63 74 6f 72 79 45 6e 74 72 79 28 0d 0a 20 09 09 ctoryEntry(.. ..
00a0: 09 20 20 20 20 63 6f 6e 73 74 20 75 6e 73 69 67 . const unsig
00b0: 6e 65 64 20 63 68 61 72 20 2a 73 74 61 72 74 2c ned char *start,
00c0: 0d 0a 20 09 09 09 20 20 20 20 63 6f 6e 73 74 20 .. ... const
00d0: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 65 unsigned char *e
00e0: 6e 64 2c 20 75 6e 73 69 67 6e 65 64 20 63 68 61 nd, unsigned cha
00f0: 72 20 2a 62 75 66 2c 0d 0a 2d 09 09 09 20 20 20 r *buf,..-...
0100: 20 5a 69 70 45 6e 74 72 79 20 2a 7a 2c 20 73 69 ZipEntry *z, si
0110: 7a 65 5f 74 20 6e 61 6d 65 4c 65 6e 67 74 68 29 ze_t nameLength)
0120: 3b 0d 0a 2b 09 09 09 20 20 20 20 5a 69 70 45 6e ;..+... ZipEn
0130: 74 72 79 20 2a 7a 2c 20 73 69 7a 65 5f 74 20 6e try *z, size_t n
0140: 61 6d 65 4c 65 6e 67 74 68 2c 20 6c 6f 6e 67 20 ameLength, long
0150: 6c 6f 6e 67 20 64 61 74 61 53 74 61 72 74 4f 66 long dataStartOf
0160: 66 73 65 74 29 3b 0d 0a 20 73 74 61 74 69 63 20 fset);.. static
0170: 76 6f 69 64 09 09 53 65 72 69 61 6c 69 7a 65 43 void..SerializeC
0180: 65 6e 74 72 61 6c 44 69 72 65 63 74 6f 72 79 53 entralDirectoryS
0190: 75 66 66 69 78 28 0d 0a 20 09 09 09 20 20 20 20 uffix(.. ...
01a0: 63 6f 6e 73 74 20 75 6e 73 69 67 6e 65 64 20 63 const unsigned c
01b0: 68 61 72 20 2a 73 74 61 72 74 2c 0d 0a 20 09 09 har *start,.. ..
01c0: 09 20 20 20 20 63 6f 6e 73 74 20 75 6e 73 69 67 . const unsig
01d0: 6e 65 64 20 63 68 61 72 20 2a 65 6e 64 2c 20 75 ned char *end, u
01e0: 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 62 75 nsigned char *bu
01f0: 66 2c 0d 0a 2d 09 09 09 20 20 20 20 69 6e 74 20 f,..-... int
0200: 65 6e 74 72 79 43 6f 75 6e 74 2c 20 6c 6f 6e 67 entryCount, long
0210: 20 6c 6f 6e 67 20 64 69 72 65 63 74 6f 72 79 53 long directoryS
0220: 74 61 72 74 4f 66 66 73 65 74 2c 0d 0a 2b 09 09 tartOffset,..+..
0230: 09 20 20 20 20 69 6e 74 20 65 6e 74 72 79 43 6f . int entryCo
0240: 75 6e 74 2c 20 6c 6f 6e 67 20 6c 6f 6e 67 20 64 unt, long long d
0250: 61 74 61 53 74 61 72 74 4f 66 66 73 65 74 2c 0d ataStartOffset,.
0260: 0a 2b 09 09 09 20 20 20 20 6c 6f 6e 67 20 6c 6f .+... long lo
0270: 6e 67 20 64 69 72 65 63 74 6f 72 79 53 74 61 72 ng directoryStar
0280: 74 4f 66 66 73 65 74 2c 0d 0a 20 09 09 09 20 20 tOffset,.. ...
0290: 20 20 6c 6f 6e 67 20 6c 6f 6e 67 20 73 75 66 66 long long suff
02a0: 69 78 53 74 61 72 74 4f 66 66 73 65 74 29 3b 0d ixStartOffset);.
02b0: 0a 20 73 74 61 74 69 63 20 76 6f 69 64 09 09 53 . static void..S
02c0: 65 72 69 61 6c 69 7a 65 4c 6f 63 61 6c 45 6e 74 erializeLocalEnt
02d0: 72 79 48 65 61 64 65 72 28 0d 0a 20 09 09 09 20 ryHeader(.. ...
02e0: 20 20 20 63 6f 6e 73 74 20 75 6e 73 69 67 6e 65 const unsigne
02f0: 64 20 63 68 61 72 20 2a 73 74 61 72 74 2c 0d 0a d char *start,..
0300: 40 40 20 2d 33 33 35 36 2c 36 20 2b 33 33 35 37 @@ -3356,6 +3357
0310: 2c 38 20 40 40 0d 0a 20 20 20 20 20 69 6e 74 20 ,8 @@.. int
0320: 63 6f 75 6e 74 2c 20 72 65 74 20 3d 20 54 43 4c count, ret = TCL
0330: 5f 45 52 52 4f 52 3b 0d 0a 20 20 20 20 20 54 63 _ERROR;.. Tc
0340: 6c 5f 53 69 7a 65 20 70 77 6c 65 6e 20 3d 20 30 l_Size pwlen = 0
0350: 2c 20 73 6c 65 6e 20 3d 20 30 2c 20 6c 65 6e 2c , slen = 0, len,
0360: 20 69 20 3d 20 30 3b 0d 0a 20 20 20 20 20 54 63 i = 0;.. Tc
0370: 6c 5f 53 69 7a 65 20 6c 6f 62 6a 63 3b 0d 0a 2b l_Size lobjc;..+
0380: 20 20 20 20 6c 6f 6e 67 20 6c 6f 6e 67 20 64 61 long long da
0390: 74 61 53 74 61 72 74 4f 66 66 73 65 74 3b 2f 2a taStartOffset;/*
03a0: 20 54 68 65 20 6f 76 65 72 61 6c 6c 20 66 69 6c The overall fil
03b0: 65 20 6f 66 66 73 65 74 20 6f 66 20 74 68 65 20 e offset of the
03c0: 73 74 61 72 74 20 6f 66 20 74 68 65 0d 0a 2b 20 start of the..+
03d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
03e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 20 *
03f0: 64 61 74 61 20 73 65 63 74 69 6f 6e 20 6f 66 20 data section of
0400: 74 68 65 20 66 69 6c 65 2e 20 2a 2f 0d 0a 20 20 the file. */..
0410: 20 20 20 6c 6f 6e 67 20 6c 6f 6e 67 20 64 69 72 long long dir
0420: 65 63 74 6f 72 79 53 74 61 72 74 4f 66 66 73 65 ectoryStartOffse
0430: 74 3b 0d 0a 20 20 20 20 20 2f 2a 20 54 68 65 20 t;.. /* The
0440: 6f 76 65 72 61 6c 6c 20 66 69 6c 65 20 6f 66 66 overall file off
0450: 73 65 74 20 6f 66 20 74 68 65 20 73 74 61 72 74 set of the start
0460: 20 6f 66 20 74 68 65 0d 0a 20 20 20 20 20 20 2a of the.. *
0470: 20 63 65 6e 74 72 61 6c 20 64 69 72 65 63 74 6f central directo
0480: 72 79 2e 20 2a 2f 0d 0a 40 40 20 2d 33 35 32 38 ry. */..@@ -3528
0490: 2c 36 20 2b 33 35 33 31 2c 31 30 20 40 40 0d 0a ,6 +3531,10 @@..
04a0: 20 09 7d 0d 0a 20 09 6d 65 6d 73 65 74 28 70 61 .}.. .memset(pa
04b0: 73 73 42 75 66 2c 20 30 2c 20 73 69 7a 65 6f 66 ssBuf, 0, sizeof
04c0: 28 70 61 73 73 42 75 66 29 29 3b 0d 0a 20 09 54 (passBuf));.. .T
04d0: 63 6c 5f 46 6c 75 73 68 28 6f 75 74 29 3b 0d 0a cl_Flush(out);..
04e0: 2b 09 2f 2f 64 61 74 61 53 74 61 72 74 4f 66 66 +.//dataStartOff
04f0: 73 65 74 20 3d 20 7a 66 2d 3e 62 61 73 65 4f 66 set = zf->baseOf
0500: 66 73 65 74 3b 20 2f 2f 20 52 45 56 49 45 57 0d fset; // REVIEW.
0510: 0a 2b 09 64 61 74 61 53 74 61 72 74 4f 66 66 73 .+.dataStartOffs
0520: 65 74 20 3d 20 54 63 6c 5f 54 65 6c 6c 28 6f 75 et = Tcl_Tell(ou
0530: 74 29 3b 0d 0a 2b 09 7d 20 65 6c 73 65 20 7b 0d t);..+.} else {.
0540: 0a 2b 09 64 61 74 61 53 74 61 72 74 4f 66 66 73 .+.dataStartOffs
0550: 65 74 20 3d 20 30 3b 0d 0a 20 20 20 20 20 7d 0d et = 0;.. }.
0560: 0a 20 0d 0a 20 20 20 20 20 2f 2a 0d 0a 40 40 20 . .. /*..@@
0570: 2d 33 35 37 39 2c 37 20 2b 33 35 38 36 2c 37 20 -3579,7 +3586,7
0580: 40 40 0d 0a 20 09 6e 61 6d 65 20 3d 20 54 63 6c @@.. .name = Tcl
0590: 5f 44 53 74 72 69 6e 67 56 61 6c 75 65 28 26 64 _DStringValue(&d
05a0: 73 29 3b 0d 0a 20 09 6c 65 6e 20 3d 20 54 63 6c s);.. .len = Tcl
05b0: 5f 44 53 74 72 69 6e 67 4c 65 6e 67 74 68 28 26 _DStringLength(&
05c0: 64 73 29 3b 0d 0a 20 09 53 65 72 69 61 6c 69 7a ds);.. .Serializ
05d0: 65 43 65 6e 74 72 61 6c 44 69 72 65 63 74 6f 72 eCentralDirector
05e0: 79 45 6e 74 72 79 28 73 74 61 72 74 2c 20 65 6e yEntry(start, en
05f0: 64 2c 20 28 75 6e 73 69 67 6e 65 64 20 63 68 61 d, (unsigned cha
0600: 72 20 2a 29 20 62 75 66 2c 0d 0a 2d 09 09 7a 2c r *) buf,..-..z,
0610: 20 6c 65 6e 29 3b 0d 0a 2b 09 09 7a 2c 20 6c 65 len);..+..z, le
0620: 6e 2c 20 64 61 74 61 53 74 61 72 74 4f 66 66 73 n, dataStartOffs
0630: 65 74 29 3b 0d 0a 20 09 69 66 20 28 28 54 63 6c et);.. .if ((Tcl
0640: 5f 57 72 69 74 65 28 6f 75 74 2c 20 62 75 66 2c _Write(out, buf,
0650: 20 5a 49 50 5f 43 45 4e 54 52 41 4c 5f 48 45 41 ZIP_CENTRAL_HEA
0660: 44 45 52 5f 4c 45 4e 29 0d 0a 20 09 09 21 3d 20 DER_LEN).. ..!=
0670: 5a 49 50 5f 43 45 4e 54 52 41 4c 5f 48 45 41 44 ZIP_CENTRAL_HEAD
0680: 45 52 5f 4c 45 4e 29 0d 0a 20 09 09 7c 7c 20 28 ER_LEN).. ..|| (
0690: 54 63 6c 5f 57 72 69 74 65 28 6f 75 74 2c 20 6e Tcl_Write(out, n
06a0: 61 6d 65 2c 20 6c 65 6e 29 20 21 3d 20 6c 65 6e ame, len) != len
06b0: 29 29 20 7b 0d 0a 40 40 20 2d 33 35 39 39 2c 37 )) {..@@ -3599,7
06c0: 20 2b 33 36 30 36 2c 37 20 40 40 0d 0a 20 20 20 +3606,7 @@..
06d0: 20 20 54 63 6c 5f 46 6c 75 73 68 28 6f 75 74 29 Tcl_Flush(out)
06e0: 3b 0d 0a 20 20 20 20 20 73 75 66 66 69 78 53 74 ;.. suffixSt
06f0: 61 72 74 4f 66 66 73 65 74 20 3d 20 54 63 6c 5f artOffset = Tcl_
0700: 54 65 6c 6c 28 6f 75 74 29 3b 0d 0a 20 20 20 20 Tell(out);..
0710: 20 53 65 72 69 61 6c 69 7a 65 43 65 6e 74 72 61 SerializeCentra
0720: 6c 44 69 72 65 63 74 6f 72 79 53 75 66 66 69 78 lDirectorySuffix
0730: 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 28 75 6e (start, end, (un
0740: 73 69 67 6e 65 64 20 63 68 61 72 20 2a 29 20 62 signed char *) b
0750: 75 66 2c 0d 0a 2d 09 20 20 20 20 63 6f 75 6e 74 uf,..-. count
0760: 2c 20 64 69 72 65 63 74 6f 72 79 53 74 61 72 74 , directoryStart
0770: 4f 66 66 73 65 74 2c 20 73 75 66 66 69 78 53 74 Offset, suffixSt
0780: 61 72 74 4f 66 66 73 65 74 29 3b 0d 0a 2b 09 20 artOffset);..+.
0790: 20 20 20 63 6f 75 6e 74 2c 20 64 61 74 61 53 74 count, dataSt
07a0: 61 72 74 4f 66 66 73 65 74 2c 20 64 69 72 65 63 artOffset, direc
07b0: 74 6f 72 79 53 74 61 72 74 4f 66 66 73 65 74 2c toryStartOffset,
07c0: 20 73 75 66 66 69 78 53 74 61 72 74 4f 66 66 73 suffixStartOffs
07d0: 65 74 29 3b 0d 0a 20 20 20 20 20 69 66 20 28 54 et);.. if (T
07e0: 63 6c 5f 57 72 69 74 65 28 6f 75 74 2c 20 62 75 cl_Write(out, bu
07f0: 66 2c 20 5a 49 50 5f 43 45 4e 54 52 41 4c 5f 45 f, ZIP_CENTRAL_E
0800: 4e 44 5f 4c 45 4e 29 20 21 3d 20 5a 49 50 5f 43 ND_LEN) != ZIP_C
0810: 45 4e 54 52 41 4c 5f 45 4e 44 5f 4c 45 4e 29 20 ENTRAL_END_LEN)
0820: 7b 0d 0a 20 09 54 63 6c 5f 53 65 74 4f 62 6a 52 {.. .Tcl_SetObjR
0830: 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20 54 63 esult(interp, Tc
0840: 6c 5f 4f 62 6a 50 72 69 6e 74 66 28 0d 0a 20 09 l_ObjPrintf(.. .
0850: 09 22 77 72 69 74 65 20 65 72 72 6f 72 3a 20 25 ."write error: %
0860: 73 22 2c 20 54 63 6c 5f 50 6f 73 69 78 45 72 72 s", Tcl_PosixErr
0870: 6f 72 28 69 6e 74 65 72 70 29 29 29 3b 0d 0a 40 or(interp)));..@
0880: 40 20 2d 33 37 35 36 2c 37 20 2b 33 37 36 33 2c @ -3756,7 +3763,
0890: 39 20 40 40 0d 0a 20 20 20 20 20 63 6f 6e 73 74 9 @@.. const
08a0: 20 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a unsigned char *
08b0: 65 6e 64 2c 09 2f 2a 20 54 68 65 20 65 6e 64 20 end,./* The end
08c0: 6f 66 20 77 72 69 74 61 62 6c 65 20 6d 65 6d 6f of writable memo
08d0: 72 79 2e 20 2a 2f 0d 0a 20 20 20 20 20 75 6e 73 ry. */.. uns
08e0: 69 67 6e 65 64 20 63 68 61 72 20 2a 62 75 66 2c igned char *buf,
08f0: 09 09 2f 2a 20 57 68 65 72 65 20 74 6f 20 73 65 ../* Where to se
0900: 72 69 61 6c 69 7a 65 20 74 6f 20 2a 2f 0d 0a 20 rialize to */..
0910: 20 20 20 20 5a 69 70 45 6e 74 72 79 20 2a 7a 2c ZipEntry *z,
0920: 09 09 2f 2a 20 54 68 65 20 64 65 73 63 72 69 70 ../* The descrip
0930: 74 69 6f 6e 20 6f 66 20 77 68 61 74 20 74 6f 20 tion of what to
0940: 73 65 72 69 61 6c 69 7a 65 2e 20 2a 2f 0d 0a 2d serialize. */..-
0950: 20 20 20 20 73 69 7a 65 5f 74 20 6e 61 6d 65 4c size_t nameL
0960: 65 6e 67 74 68 29 09 09 2f 2a 20 54 68 65 20 6c ength)../* The l
0970: 65 6e 67 74 68 20 6f 66 20 74 68 65 20 6e 61 6d ength of the nam
0980: 65 2e 20 2a 2f 0d 0a 2b 20 20 20 20 73 69 7a 65 e. */..+ size
0990: 5f 74 20 6e 61 6d 65 4c 65 6e 67 74 68 2c 09 2f _t nameLength,./
09a0: 2a 20 54 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 * The length of
09b0: 74 68 65 20 6e 61 6d 65 2e 20 2a 2f 0d 0a 2b 20 the name. */..+
09c0: 20 20 20 6c 6f 6e 67 20 6c 6f 6e 67 20 64 61 74 long long dat
09d0: 61 53 74 61 72 74 4f 66 66 73 65 74 29 09 2f 2a aStartOffset)./*
09e0: 54 68 65 20 6f 76 65 72 61 6c 6c 20 66 69 6c 65 The overall file
09f0: 20 6f 66 66 73 65 74 20 6f 66 20 74 68 65 20 73 offset of the s
0a00: 74 61 72 74 20 6f 66 20 74 68 65 0d 0a 2b 20 20 tart of the..+
0a10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0a20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a *
0a30: 20 44 61 74 61 20 73 65 63 74 69 6f 6e 20 6f 66 Data section of
0a40: 20 74 68 65 20 66 69 6c 65 2e 20 2a 2f 0d 0a 20 the file. */..
0a50: 7b 0d 0a 20 20 20 20 20 5a 69 70 57 72 69 74 65 {.. ZipWrite
0a60: 49 6e 74 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 Int(start, end,
0a70: 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e 54 52 41 buf + ZIP_CENTRA
0a80: 4c 5f 53 49 47 5f 4f 46 46 53 2c 0d 0a 20 09 20 L_SIG_OFFS,.. .
0a90: 20 20 20 5a 49 50 5f 43 45 4e 54 52 41 4c 5f 48 ZIP_CENTRAL_H
0aa0: 45 41 44 45 52 5f 53 49 47 29 3b 0d 0a 40 40 20 EADER_SIG);..@@
0ab0: 2d 33 37 38 31 2c 37 20 2b 33 37 39 30 2c 37 20 -3781,7 +3790,7
0ac0: 40 40 0d 0a 20 20 20 20 20 5a 69 70 57 72 69 74 @@.. ZipWrit
0ad0: 65 53 68 6f 72 74 28 73 74 61 72 74 2c 20 65 6e eShort(start, en
0ae0: 64 2c 20 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e d, buf + ZIP_CEN
0af0: 54 52 41 4c 5f 49 41 54 54 52 5f 4f 46 46 53 2c TRAL_IATTR_OFFS,
0b00: 20 30 29 3b 0d 0a 20 20 20 20 20 5a 69 70 57 72 0);.. ZipWr
0b10: 69 74 65 49 6e 74 28 73 74 61 72 74 2c 20 65 6e iteInt(start, en
0b20: 64 2c 20 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e d, buf + ZIP_CEN
0b30: 54 52 41 4c 5f 45 41 54 54 52 5f 4f 46 46 53 2c TRAL_EATTR_OFFS,
0b40: 20 30 29 3b 0d 0a 20 20 20 20 20 5a 69 70 57 72 0);.. ZipWr
0b50: 69 74 65 49 6e 74 28 73 74 61 72 74 2c 20 65 6e iteInt(start, en
0b60: 64 2c 20 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e d, buf + ZIP_CEN
0b70: 54 52 41 4c 5f 4c 4f 43 41 4c 48 44 52 5f 4f 46 TRAL_LOCALHDR_OF
0b80: 46 53 2c 0d 0a 2d 09 20 20 20 20 7a 2d 3e 6f 66 FS,..-. z->of
0b90: 66 73 65 74 29 3b 0d 0a 2b 09 20 20 20 20 7a 2d fset);..+. z-
0ba0: 3e 6f 66 66 73 65 74 20 2d 20 64 61 74 61 53 74 >offset - dataSt
0bb0: 61 72 74 4f 66 66 73 65 74 29 3b 0d 0a 20 7d 0d artOffset);.. }.
0bc0: 0a 20 0d 0a 20 73 74 61 74 69 63 20 76 6f 69 64 . .. static void
0bd0: 0d 0a 40 40 20 2d 33 37 39 30 2c 36 20 2b 33 37 ..@@ -3790,6 +37
0be0: 39 39 2c 38 20 40 40 0d 0a 20 20 20 20 20 63 6f 99,8 @@.. co
0bf0: 6e 73 74 20 75 6e 73 69 67 6e 65 64 20 63 68 61 nst unsigned cha
0c00: 72 20 2a 65 6e 64 2c 09 2f 2a 20 54 68 65 20 65 r *end,./* The e
0c10: 6e 64 20 6f 66 20 77 72 69 74 61 62 6c 65 20 6d nd of writable m
0c20: 65 6d 6f 72 79 2e 20 2a 2f 0d 0a 20 20 20 20 20 emory. */..
0c30: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 62 unsigned char *b
0c40: 75 66 2c 09 09 2f 2a 20 57 68 65 72 65 20 74 6f uf,../* Where to
0c50: 20 73 65 72 69 61 6c 69 7a 65 20 74 6f 20 2a 2f serialize to */
0c60: 0d 0a 20 20 20 20 20 69 6e 74 20 65 6e 74 72 79 .. int entry
0c70: 43 6f 75 6e 74 2c 09 09 2f 2a 20 54 68 65 20 6e Count,../* The n
0c80: 75 6d 62 65 72 20 6f 66 20 65 6e 74 72 69 65 73 umber of entries
0c90: 20 69 6e 20 74 68 65 20 64 69 72 65 63 74 6f 72 in the director
0ca0: 79 20 2a 2f 0d 0a 2b 20 20 20 20 6c 6f 6e 67 20 y */..+ long
0cb0: 6c 6f 6e 67 20 64 61 74 61 53 74 61 72 74 4f 66 long dataStartOf
0cc0: 66 73 65 74 2c 20 20 2f 2a 20 54 68 65 20 6f 76 fset, /* The ov
0cd0: 65 72 61 6c 6c 20 66 69 6c 65 20 6f 66 66 73 65 erall file offse
0ce0: 74 20 6f 66 20 74 68 65 20 73 74 61 72 74 20 6f t of the start o
0cf0: 66 20 74 68 65 0d 0a 2b 20 20 20 20 20 20 20 20 f the..+
0d00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0d10: 20 20 20 20 20 20 20 20 20 2a 20 63 65 6e 74 72 * centr
0d20: 61 6c 20 64 69 72 65 63 74 6f 72 79 2e 20 2a 2f al directory. */
0d30: 0d 0a 20 20 20 20 20 6c 6f 6e 67 20 6c 6f 6e 67 .. long long
0d40: 20 64 69 72 65 63 74 6f 72 79 53 74 61 72 74 4f directoryStartO
0d50: 66 66 73 65 74 2c 0d 0a 20 09 09 09 09 2f 2a 20 ffset,.. ..../*
0d60: 54 68 65 20 6f 76 65 72 61 6c 6c 20 66 69 6c 65 The overall file
0d70: 20 6f 66 66 73 65 74 20 6f 66 20 74 68 65 20 73 offset of the s
0d80: 74 61 72 74 20 6f 66 20 74 68 65 0d 0a 20 09 09 tart of the.. ..
0d90: 09 09 20 2a 20 63 65 6e 74 72 61 6c 20 64 69 72 .. * central dir
0da0: 65 63 74 6f 72 79 2e 20 2a 2f 0d 0a 40 40 20 2d ectory. */..@@ -
0db0: 33 38 30 36 2c 37 20 2b 33 38 31 37 2c 37 20 40 3806,7 +3817,7 @
0dc0: 40 0d 0a 20 20 20 20 20 5a 69 70 57 72 69 74 65 @.. ZipWrite
0dd0: 49 6e 74 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 Int(start, end,
0de0: 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e 54 52 41 buf + ZIP_CENTRA
0df0: 4c 5f 44 49 52 53 49 5a 45 5f 4f 46 46 53 2c 0d L_DIRSIZE_OFFS,.
0e00: 0a 20 09 20 20 20 20 73 75 66 66 69 78 53 74 61 . . suffixSta
0e10: 72 74 4f 66 66 73 65 74 20 2d 20 64 69 72 65 63 rtOffset - direc
0e20: 74 6f 72 79 53 74 61 72 74 4f 66 66 73 65 74 29 toryStartOffset)
0e30: 3b 0d 0a 20 20 20 20 20 5a 69 70 57 72 69 74 65 ;.. ZipWrite
0e40: 49 6e 74 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 Int(start, end,
0e50: 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e 54 52 41 buf + ZIP_CENTRA
0e60: 4c 5f 44 49 52 53 54 41 52 54 5f 4f 46 46 53 2c L_DIRSTART_OFFS,
0e70: 0d 0a 2d 09 20 20 20 20 64 69 72 65 63 74 6f 72 ..-. director
0e80: 79 53 74 61 72 74 4f 66 66 73 65 74 29 3b 0d 0a yStartOffset);..
0e90: 2b 09 20 20 20 20 64 69 72 65 63 74 6f 72 79 53 +. directoryS
0ea0: 74 61 72 74 4f 66 66 73 65 74 20 2d 20 64 61 74 tartOffset - dat
0eb0: 61 53 74 61 72 74 4f 66 66 73 65 74 29 3b 0d 0a aStartOffset);..
0ec0: 20 20 20 20 20 5a 69 70 57 72 69 74 65 53 68 6f ZipWriteSho
0ed0: 72 74 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 62 rt(start, end, b
0ee0: 75 66 20 2b 20 5a 49 50 5f 43 45 4e 54 52 41 4c uf + ZIP_CENTRAL
0ef0: 5f 43 4f 4d 4d 45 4e 54 4c 45 4e 5f 4f 46 46 53 _COMMENTLEN_OFFS
0f00: 2c 20 30 29 3b 0d 0a 20 7d 0d 0a 20 0c 0d 0a , 0);.. }.. ...