Tcl Source Code

Hex Artifact Content
Login

Artifact 78ad2f7dc457b8ec8f545cf4843f357a4df6b11ff6e4cd8d44ef16ca66aa6cd6:

Attachment "tclZipfs.patch" to ticket [aaa84fbbc5] added by juliannoble2 2024-11-24 10:52:38.
0000: 2d 2d 2d 20 74 63 6c 5a 69 70 66 73 5f 6f 72 69  --- tclZipfs_ori
0010: 67 69 6e 61 6c 2e 63 09 53 75 6e 20 4e 6f 76 20  ginal.c.Sun Nov 
0020: 32 34 20 31 35 3a 34 31 3a 35 33 20 32 30 32 34  24 15:41:53 2024
0030: 0a 2b 2b 2b 20 74 63 6c 5a 69 70 66 73 2e 63 09  .+++ tclZipfs.c.
0040: 53 75 6e 20 4e 6f 76 20 32 34 20 32 30 3a 30 34  Sun Nov 24 20:04
0050: 3a 34 36 20 32 30 32 34 0a 40 40 20 2d 33 33 36  :46 2024.@@ -336
0060: 2c 31 31 20 2b 33 33 36 2c 31 32 20 40 40 0a 20  ,11 +336,12 @@. 
0070: 73 74 61 74 69 63 20 76 6f 69 64 09 09 53 65 72  static void..Ser
0080: 69 61 6c 69 7a 65 43 65 6e 74 72 61 6c 44 69 72  ializeCentralDir
0090: 65 63 74 6f 72 79 45 6e 74 72 79 28 0a 20 09 09  ectoryEntry(. ..
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: 0a 20 09 09 09 20 20 20 20 63 6f 6e 73 74 20 75  . ...    const u
00d0: 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 65 6e  nsigned char *en
00e0: 64 2c 20 75 6e 73 69 67 6e 65 64 20 63 68 61 72  d, unsigned char
00f0: 20 2a 62 75 66 2c 0a 2d 09 09 09 20 20 20 20 5a   *buf,.-...    Z
0100: 69 70 45 6e 74 72 79 20 2a 7a 2c 20 73 69 7a 65  ipEntry *z, size
0110: 5f 74 20 6e 61 6d 65 4c 65 6e 67 74 68 29 3b 0a  _t nameLength);.
0120: 2b 09 09 09 20 20 20 20 5a 69 70 45 6e 74 72 79  +...    ZipEntry
0130: 20 2a 7a 2c 20 73 69 7a 65 5f 74 20 6e 61 6d 65   *z, size_t name
0140: 4c 65 6e 67 74 68 2c 20 6c 6f 6e 67 20 6c 6f 6e  Length, long lon
0150: 67 20 64 61 74 61 53 74 61 72 74 4f 66 66 73 65  g dataStartOffse
0160: 74 29 3b 0a 20 73 74 61 74 69 63 20 76 6f 69 64  t);. static void
0170: 09 09 53 65 72 69 61 6c 69 7a 65 43 65 6e 74 72  ..SerializeCentr
0180: 61 6c 44 69 72 65 63 74 6f 72 79 53 75 66 66 69  alDirectorySuffi
0190: 78 28 0a 20 09 09 09 20 20 20 20 63 6f 6e 73 74  x(. ...    const
01a0: 20 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a   unsigned char *
01b0: 73 74 61 72 74 2c 0a 20 09 09 09 20 20 20 20 63  start,. ...    c
01c0: 6f 6e 73 74 20 75 6e 73 69 67 6e 65 64 20 63 68  onst unsigned ch
01d0: 61 72 20 2a 65 6e 64 2c 20 75 6e 73 69 67 6e 65  ar *end, unsigne
01e0: 64 20 63 68 61 72 20 2a 62 75 66 2c 0a 2d 09 09  d char *buf,.-..
01f0: 09 20 20 20 20 69 6e 74 20 65 6e 74 72 79 43 6f  .    int entryCo
0200: 75 6e 74 2c 20 6c 6f 6e 67 20 6c 6f 6e 67 20 64  unt, long long d
0210: 69 72 65 63 74 6f 72 79 53 74 61 72 74 4f 66 66  irectoryStartOff
0220: 73 65 74 2c 0a 2b 09 09 09 20 20 20 20 69 6e 74  set,.+...    int
0230: 20 65 6e 74 72 79 43 6f 75 6e 74 2c 20 6c 6f 6e   entryCount, lon
0240: 67 20 6c 6f 6e 67 20 64 61 74 61 53 74 61 72 74  g long dataStart
0250: 4f 66 66 73 65 74 2c 0a 2b 20 20 20 20 20 20 20  Offset,.+       
0260: 20 20 20 20 20 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 0a 20 09 09 09 20 20 20  tOffset,. ...   
0290: 20 6c 6f 6e 67 20 6c 6f 6e 67 20 73 75 66 66 69   long long suffi
02a0: 78 53 74 61 72 74 4f 66 66 73 65 74 29 3b 0a 20  xStartOffset);. 
02b0: 73 74 61 74 69 63 20 76 6f 69 64 09 09 53 65 72  static void..Ser
02c0: 69 61 6c 69 7a 65 4c 6f 63 61 6c 45 6e 74 72 79  ializeLocalEntry
02d0: 48 65 61 64 65 72 28 0a 20 09 09 09 20 20 20 20  Header(. ...    
02e0: 63 6f 6e 73 74 20 75 6e 73 69 67 6e 65 64 20 63  const unsigned c
02f0: 68 61 72 20 2a 73 74 61 72 74 2c 0a 40 40 20 2d  har *start,.@@ -
0300: 33 33 35 35 2c 36 20 2b 33 33 35 36 2c 38 20 40  3355,6 +3356,8 @
0310: 40 0a 20 20 20 20 20 69 6e 74 20 63 6f 75 6e 74  @.     int count
0320: 2c 20 72 65 74 20 3d 20 54 43 4c 5f 45 52 52 4f  , ret = TCL_ERRO
0330: 52 3b 0a 20 20 20 20 20 54 63 6c 5f 53 69 7a 65  R;.     Tcl_Size
0340: 20 70 77 6c 65 6e 20 3d 20 30 2c 20 73 6c 65 6e   pwlen = 0, slen
0350: 20 3d 20 30 2c 20 6c 65 6e 2c 20 69 20 3d 20 30   = 0, len, i = 0
0360: 3b 0a 20 20 20 20 20 54 63 6c 5f 53 69 7a 65 20  ;.     Tcl_Size 
0370: 6c 6f 62 6a 63 3b 0a 2b 20 20 20 20 6c 6f 6e 67  lobjc;.+    long
0380: 20 6c 6f 6e 67 20 64 61 74 61 53 74 61 72 74 4f   long dataStartO
0390: 66 66 73 65 74 3b 20 2f 2a 20 54 68 65 20 6f 76  ffset; /* The ov
03a0: 65 72 61 6c 6c 20 66 69 6c 65 20 6f 66 66 73 65  erall file offse
03b0: 74 20 6f 66 20 74 68 65 20 73 74 61 72 74 20 6f  t of the start o
03c0: 66 20 74 68 65 0a 2b 09 09 09 09 20 2a 20 64 61  f the.+.... * da
03d0: 74 61 20 73 65 63 74 69 6f 6e 20 6f 66 20 74 68  ta section of th
03e0: 65 20 66 69 6c 65 2e 20 2a 2f 0a 20 20 20 20 20  e file. */.     
03f0: 6c 6f 6e 67 20 6c 6f 6e 67 20 64 69 72 65 63 74  long long direct
0400: 6f 72 79 53 74 61 72 74 4f 66 66 73 65 74 3b 0a  oryStartOffset;.
0410: 20 20 20 20 20 2f 2a 20 54 68 65 20 6f 76 65 72       /* The over
0420: 61 6c 6c 20 66 69 6c 65 20 6f 66 66 73 65 74 20  all file offset 
0430: 6f 66 20 74 68 65 20 73 74 61 72 74 20 6f 66 20  of the start of 
0440: 74 68 65 0a 20 20 20 20 20 20 2a 20 63 65 6e 74  the.      * cent
0450: 72 61 6c 20 64 69 72 65 63 74 6f 72 79 2e 20 2a  ral directory. *
0460: 2f 0a 40 40 20 2d 33 35 32 37 2c 36 20 2b 33 35  /.@@ -3527,6 +35
0470: 33 30 2c 39 20 40 40 0a 20 09 7d 0a 20 09 6d 65  30,9 @@. .}. .me
0480: 6d 73 65 74 28 70 61 73 73 42 75 66 2c 20 30 2c  mset(passBuf, 0,
0490: 20 73 69 7a 65 6f 66 28 70 61 73 73 42 75 66 29   sizeof(passBuf)
04a0: 29 3b 0a 20 09 54 63 6c 5f 46 6c 75 73 68 28 6f  );. .Tcl_Flush(o
04b0: 75 74 29 3b 0a 2b 09 64 61 74 61 53 74 61 72 74  ut);.+.dataStart
04c0: 4f 66 66 73 65 74 20 3d 20 54 63 6c 5f 54 65 6c  Offset = Tcl_Tel
04d0: 6c 28 6f 75 74 29 3b 0a 2b 20 20 20 20 7d 20 65  l(out);.+    } e
04e0: 6c 73 65 20 7b 0a 2b 09 64 61 74 61 53 74 61 72  lse {.+.dataStar
04f0: 74 4f 66 66 73 65 74 20 3d 20 30 3b 0a 20 20 20  tOffset = 0;.   
0500: 20 20 7d 0a 20 0a 20 20 20 20 20 2f 2a 0a 40 40    }. .     /*.@@
0510: 20 2d 33 35 37 38 2c 37 20 2b 33 35 38 34 2c 37   -3578,7 +3584,7
0520: 20 40 40 0a 20 09 6e 61 6d 65 20 3d 20 54 63 6c   @@. .name = Tcl
0530: 5f 44 53 74 72 69 6e 67 56 61 6c 75 65 28 26 64  _DStringValue(&d
0540: 73 29 3b 0a 20 09 6c 65 6e 20 3d 20 54 63 6c 5f  s);. .len = Tcl_
0550: 44 53 74 72 69 6e 67 4c 65 6e 67 74 68 28 26 64  DStringLength(&d
0560: 73 29 3b 0a 20 09 53 65 72 69 61 6c 69 7a 65 43  s);. .SerializeC
0570: 65 6e 74 72 61 6c 44 69 72 65 63 74 6f 72 79 45  entralDirectoryE
0580: 6e 74 72 79 28 73 74 61 72 74 2c 20 65 6e 64 2c  ntry(start, end,
0590: 20 28 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20   (unsigned char 
05a0: 2a 29 20 62 75 66 2c 0a 2d 09 09 7a 2c 20 6c 65  *) buf,.-..z, le
05b0: 6e 29 3b 0a 2b 09 09 7a 2c 20 6c 65 6e 2c 20 64  n);.+..z, len, d
05c0: 61 74 61 53 74 61 72 74 4f 66 66 73 65 74 29 3b  ataStartOffset);
05d0: 0a 20 09 69 66 20 28 28 54 63 6c 5f 57 72 69 74  . .if ((Tcl_Writ
05e0: 65 28 6f 75 74 2c 20 62 75 66 2c 20 5a 49 50 5f  e(out, buf, ZIP_
05f0: 43 45 4e 54 52 41 4c 5f 48 45 41 44 45 52 5f 4c  CENTRAL_HEADER_L
0600: 45 4e 29 0a 20 09 09 21 3d 20 5a 49 50 5f 43 45  EN). ..!= ZIP_CE
0610: 4e 54 52 41 4c 5f 48 45 41 44 45 52 5f 4c 45 4e  NTRAL_HEADER_LEN
0620: 29 0a 20 09 09 7c 7c 20 28 54 63 6c 5f 57 72 69  ). ..|| (Tcl_Wri
0630: 74 65 28 6f 75 74 2c 20 6e 61 6d 65 2c 20 6c 65  te(out, name, le
0640: 6e 29 20 21 3d 20 6c 65 6e 29 29 20 7b 0a 40 40  n) != len)) {.@@
0650: 20 2d 33 35 39 38 2c 37 20 2b 33 36 30 34 2c 37   -3598,7 +3604,7
0660: 20 40 40 0a 20 20 20 20 20 54 63 6c 5f 46 6c 75   @@.     Tcl_Flu
0670: 73 68 28 6f 75 74 29 3b 0a 20 20 20 20 20 73 75  sh(out);.     su
0680: 66 66 69 78 53 74 61 72 74 4f 66 66 73 65 74 20  ffixStartOffset 
0690: 3d 20 54 63 6c 5f 54 65 6c 6c 28 6f 75 74 29 3b  = Tcl_Tell(out);
06a0: 0a 20 20 20 20 20 53 65 72 69 61 6c 69 7a 65 43  .     SerializeC
06b0: 65 6e 74 72 61 6c 44 69 72 65 63 74 6f 72 79 53  entralDirectoryS
06c0: 75 66 66 69 78 28 73 74 61 72 74 2c 20 65 6e 64  uffix(start, end
06d0: 2c 20 28 75 6e 73 69 67 6e 65 64 20 63 68 61 72  , (unsigned char
06e0: 20 2a 29 20 62 75 66 2c 0a 2d 09 20 20 20 20 63   *) buf,.-.    c
06f0: 6f 75 6e 74 2c 20 64 69 72 65 63 74 6f 72 79 53  ount, directoryS
0700: 74 61 72 74 4f 66 66 73 65 74 2c 20 73 75 66 66  tartOffset, suff
0710: 69 78 53 74 61 72 74 4f 66 66 73 65 74 29 3b 0a  ixStartOffset);.
0720: 2b 09 20 20 20 20 63 6f 75 6e 74 2c 20 64 61 74  +.    count, dat
0730: 61 53 74 61 72 74 4f 66 66 73 65 74 2c 20 64 69  aStartOffset, di
0740: 72 65 63 74 6f 72 79 53 74 61 72 74 4f 66 66 73  rectoryStartOffs
0750: 65 74 2c 20 73 75 66 66 69 78 53 74 61 72 74 4f  et, suffixStartO
0760: 66 66 73 65 74 29 3b 0a 20 20 20 20 20 69 66 20  ffset);.     if 
0770: 28 54 63 6c 5f 57 72 69 74 65 28 6f 75 74 2c 20  (Tcl_Write(out, 
0780: 62 75 66 2c 20 5a 49 50 5f 43 45 4e 54 52 41 4c  buf, ZIP_CENTRAL
0790: 5f 45 4e 44 5f 4c 45 4e 29 20 21 3d 20 5a 49 50  _END_LEN) != ZIP
07a0: 5f 43 45 4e 54 52 41 4c 5f 45 4e 44 5f 4c 45 4e  _CENTRAL_END_LEN
07b0: 29 20 7b 0a 20 09 54 63 6c 5f 53 65 74 4f 62 6a  ) {. .Tcl_SetObj
07c0: 52 65 73 75 6c 74 28 69 6e 74 65 72 70 2c 20 54  Result(interp, T
07d0: 63 6c 5f 4f 62 6a 50 72 69 6e 74 66 28 0a 20 09  cl_ObjPrintf(. .
07e0: 09 22 77 72 69 74 65 20 65 72 72 6f 72 3a 20 25  ."write error: %
07f0: 73 22 2c 20 54 63 6c 5f 50 6f 73 69 78 45 72 72  s", Tcl_PosixErr
0800: 6f 72 28 69 6e 74 65 72 70 29 29 29 3b 0a 40 40  or(interp)));.@@
0810: 20 2d 33 37 35 35 2c 37 20 2b 33 37 36 31 2c 39   -3755,7 +3761,9
0820: 20 40 40 0a 20 20 20 20 20 63 6f 6e 73 74 20 75   @@.     const u
0830: 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 65 6e  nsigned char *en
0840: 64 2c 09 2f 2a 20 54 68 65 20 65 6e 64 20 6f 66  d,./* The end of
0850: 20 77 72 69 74 61 62 6c 65 20 6d 65 6d 6f 72 79   writable memory
0860: 2e 20 2a 2f 0a 20 20 20 20 20 75 6e 73 69 67 6e  . */.     unsign
0870: 65 64 20 63 68 61 72 20 2a 62 75 66 2c 09 09 2f  ed char *buf,../
0880: 2a 20 57 68 65 72 65 20 74 6f 20 73 65 72 69 61  * Where to seria
0890: 6c 69 7a 65 20 74 6f 20 2a 2f 0a 20 20 20 20 20  lize to */.     
08a0: 5a 69 70 45 6e 74 72 79 20 2a 7a 2c 09 09 2f 2a  ZipEntry *z,../*
08b0: 20 54 68 65 20 64 65 73 63 72 69 70 74 69 6f 6e   The description
08c0: 20 6f 66 20 77 68 61 74 20 74 6f 20 73 65 72 69   of what to seri
08d0: 61 6c 69 7a 65 2e 20 2a 2f 0a 2d 20 20 20 20 73  alize. */.-    s
08e0: 69 7a 65 5f 74 20 6e 61 6d 65 4c 65 6e 67 74 68  ize_t nameLength
08f0: 29 09 09 2f 2a 20 54 68 65 20 6c 65 6e 67 74 68  )../* The length
0900: 20 6f 66 20 74 68 65 20 6e 61 6d 65 2e 20 2a 2f   of the name. */
0910: 0a 2b 20 20 20 20 73 69 7a 65 5f 74 20 6e 61 6d  .+    size_t nam
0920: 65 4c 65 6e 67 74 68 2c 09 09 2f 2a 20 54 68 65  eLength,../* The
0930: 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 6e   length of the n
0940: 61 6d 65 2e 20 2a 2f 0a 2b 20 20 20 20 6c 6f 6e  ame. */.+    lon
0950: 67 20 6c 6f 6e 67 20 64 61 74 61 53 74 61 72 74  g long dataStart
0960: 4f 66 66 73 65 74 29 09 2f 2a 20 54 68 65 20 6f  Offset)./* The o
0970: 76 65 72 61 6c 6c 20 66 69 6c 65 20 6f 66 66 73  verall file offs
0980: 65 74 20 6f 66 20 74 68 65 20 73 74 61 72 74 20  et of the start 
0990: 6f 66 20 74 68 65 20 0a 2b 20 20 20 20 09 09 09  of the .+    ...
09a0: 09 20 2a 20 64 61 74 61 20 73 65 63 74 69 6f 6e  . * data section
09b0: 20 6f 66 20 74 68 65 20 66 69 6c 65 2e 20 2a 2f   of the file. */
09c0: 0a 20 7b 0a 20 20 20 20 20 5a 69 70 57 72 69 74  . {.     ZipWrit
09d0: 65 49 6e 74 28 73 74 61 72 74 2c 20 65 6e 64 2c  eInt(start, end,
09e0: 20 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e 54 52   buf + ZIP_CENTR
09f0: 41 4c 5f 53 49 47 5f 4f 46 46 53 2c 0a 20 09 20  AL_SIG_OFFS,. . 
0a00: 20 20 20 5a 49 50 5f 43 45 4e 54 52 41 4c 5f 48     ZIP_CENTRAL_H
0a10: 45 41 44 45 52 5f 53 49 47 29 3b 0a 40 40 20 2d  EADER_SIG);.@@ -
0a20: 33 37 38 30 2c 37 20 2b 33 37 38 38 2c 37 20 40  3780,7 +3788,7 @
0a30: 40 0a 20 20 20 20 20 5a 69 70 57 72 69 74 65 53  @.     ZipWriteS
0a40: 68 6f 72 74 28 73 74 61 72 74 2c 20 65 6e 64 2c  hort(start, end,
0a50: 20 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e 54 52   buf + ZIP_CENTR
0a60: 41 4c 5f 49 41 54 54 52 5f 4f 46 46 53 2c 20 30  AL_IATTR_OFFS, 0
0a70: 29 3b 0a 20 20 20 20 20 5a 69 70 57 72 69 74 65  );.     ZipWrite
0a80: 49 6e 74 28 73 74 61 72 74 2c 20 65 6e 64 2c 20  Int(start, end, 
0a90: 62 75 66 20 2b 20 5a 49 50 5f 43 45 4e 54 52 41  buf + ZIP_CENTRA
0aa0: 4c 5f 45 41 54 54 52 5f 4f 46 46 53 2c 20 30 29  L_EATTR_OFFS, 0)
0ab0: 3b 0a 20 20 20 20 20 5a 69 70 57 72 69 74 65 49  ;.     ZipWriteI
0ac0: 6e 74 28 73 74 61 72 74 2c 20 65 6e 64 2c 20 62  nt(start, end, b
0ad0: 75 66 20 2b 20 5a 49 50 5f 43 45 4e 54 52 41 4c  uf + ZIP_CENTRAL
0ae0: 5f 4c 4f 43 41 4c 48 44 52 5f 4f 46 46 53 2c 0a  _LOCALHDR_OFFS,.
0af0: 2d 09 20 20 20 20 7a 2d 3e 6f 66 66 73 65 74 29  -.    z->offset)
0b00: 3b 0a 2b 09 20 20 20 20 7a 2d 3e 6f 66 66 73 65  ;.+.    z->offse
0b10: 74 20 2d 20 64 61 74 61 53 74 61 72 74 4f 66 66  t - dataStartOff
0b20: 73 65 74 29 3b 0a 20 7d 0a 20 0a 20 73 74 61 74  set);. }. . stat
0b30: 69 63 20 76 6f 69 64 0a 40 40 20 2d 33 37 38 39  ic void.@@ -3789
0b40: 2c 36 20 2b 33 37 39 37 2c 39 20 40 40 0a 20 20  ,6 +3797,9 @@.  
0b50: 20 20 20 63 6f 6e 73 74 20 75 6e 73 69 67 6e 65     const unsigne
0b60: 64 20 63 68 61 72 20 2a 65 6e 64 2c 09 2f 2a 20  d char *end,./* 
0b70: 54 68 65 20 65 6e 64 20 6f 66 20 77 72 69 74 61  The end of writa
0b80: 62 6c 65 20 6d 65 6d 6f 72 79 2e 20 2a 2f 0a 20  ble memory. */. 
0b90: 20 20 20 20 75 6e 73 69 67 6e 65 64 20 63 68 61      unsigned cha
0ba0: 72 20 2a 62 75 66 2c 09 09 2f 2a 20 57 68 65 72  r *buf,../* Wher
0bb0: 65 20 74 6f 20 73 65 72 69 61 6c 69 7a 65 20 74  e to serialize t
0bc0: 6f 20 2a 2f 0a 20 20 20 20 20 69 6e 74 20 65 6e  o */.     int en
0bd0: 74 72 79 43 6f 75 6e 74 2c 09 09 2f 2a 20 54 68  tryCount,../* Th
0be0: 65 20 6e 75 6d 62 65 72 20 6f 66 20 65 6e 74 72  e number of entr
0bf0: 69 65 73 20 69 6e 20 74 68 65 20 64 69 72 65 63  ies in the direc
0c00: 74 6f 72 79 20 2a 2f 0a 2b 20 20 20 20 6c 6f 6e  tory */.+    lon
0c10: 67 20 6c 6f 6e 67 20 64 61 74 61 53 74 61 72 74  g long dataStart
0c20: 4f 66 66 73 65 74 2c 0a 2b 09 09 09 09 2f 2a 20  Offset,.+..../* 
0c30: 54 68 65 20 6f 76 65 72 61 6c 6c 20 66 69 6c 65  The overall file
0c40: 20 6f 66 66 73 65 74 20 6f 66 20 74 68 65 20 73   offset of the s
0c50: 74 61 72 74 20 6f 66 20 74 68 65 0a 2b 09 09 09  tart of the.+...
0c60: 09 20 2a 20 64 61 74 61 20 66 69 6c 65 2e 20 2a  . * data file. *
0c70: 2f 0a 20 20 20 20 20 6c 6f 6e 67 20 6c 6f 6e 67  /.     long long
0c80: 20 64 69 72 65 63 74 6f 72 79 53 74 61 72 74 4f   directoryStartO
0c90: 66 66 73 65 74 2c 0a 20 09 09 09 09 2f 2a 20 54  ffset,. ..../* T
0ca0: 68 65 20 6f 76 65 72 61 6c 6c 20 66 69 6c 65 20  he overall file 
0cb0: 6f 66 66 73 65 74 20 6f 66 20 74 68 65 20 73 74  offset of the st
0cc0: 61 72 74 20 6f 66 20 74 68 65 0a 20 09 09 09 09  art of the. ....
0cd0: 20 2a 20 63 65 6e 74 72 61 6c 20 64 69 72 65 63   * central direc
0ce0: 74 6f 72 79 2e 20 2a 2f 0a 40 40 20 2d 33 38 30  tory. */.@@ -380
0cf0: 35 2c 37 20 2b 33 38 31 36 2c 37 20 40 40 0a 20  5,7 +3816,7 @@. 
0d00: 20 20 20 20 5a 69 70 57 72 69 74 65 49 6e 74 28      ZipWriteInt(
0d10: 73 74 61 72 74 2c 20 65 6e 64 2c 20 62 75 66 20  start, end, buf 
0d20: 2b 20 5a 49 50 5f 43 45 4e 54 52 41 4c 5f 44 49  + ZIP_CENTRAL_DI
0d30: 52 53 49 5a 45 5f 4f 46 46 53 2c 0a 20 09 20 20  RSIZE_OFFS,. .  
0d40: 20 20 73 75 66 66 69 78 53 74 61 72 74 4f 66 66    suffixStartOff
0d50: 73 65 74 20 2d 20 64 69 72 65 63 74 6f 72 79 53  set - directoryS
0d60: 74 61 72 74 4f 66 66 73 65 74 29 3b 0a 20 20 20  tartOffset);.   
0d70: 20 20 5a 69 70 57 72 69 74 65 49 6e 74 28 73 74    ZipWriteInt(st
0d80: 61 72 74 2c 20 65 6e 64 2c 20 62 75 66 20 2b 20  art, end, buf + 
0d90: 5a 49 50 5f 43 45 4e 54 52 41 4c 5f 44 49 52 53  ZIP_CENTRAL_DIRS
0da0: 54 41 52 54 5f 4f 46 46 53 2c 0a 2d 09 20 20 20  TART_OFFS,.-.   
0db0: 20 64 69 72 65 63 74 6f 72 79 53 74 61 72 74 4f   directoryStartO
0dc0: 66 66 73 65 74 29 3b 0a 2b 09 20 20 20 20 64 69  ffset);.+.    di
0dd0: 72 65 63 74 6f 72 79 53 74 61 72 74 4f 66 66 73  rectoryStartOffs
0de0: 65 74 20 2d 20 64 61 74 61 53 74 61 72 74 4f 66  et - dataStartOf
0df0: 66 73 65 74 29 3b 0a 20 20 20 20 20 5a 69 70 57  fset);.     ZipW
0e00: 72 69 74 65 53 68 6f 72 74 28 73 74 61 72 74 2c  riteShort(start,
0e10: 20 65 6e 64 2c 20 62 75 66 20 2b 20 5a 49 50 5f   end, buf + ZIP_
0e20: 43 45 4e 54 52 41 4c 5f 43 4f 4d 4d 45 4e 54 4c  CENTRAL_COMMENTL
0e30: 45 4e 5f 4f 46 46 53 2c 20 30 29 3b 0a 20 7d 0a  EN_OFFS, 0);. }.
0e40: 20 0c 0a                                          ..