Changeset 51697 in vbox
- Timestamp:
- Jun 23, 2014 4:46:13 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94481
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp
r51696 r51697 314 314 RTZIPPKZIPBASEOBJ BaseObj; 315 315 /** The number of (uncompressed) bytes in the file. */ 316 RTFOFFcbFile;316 uint64_t cbFile; 317 317 /** The current file position at uncompressed file data. */ 318 RTFOFFoffFile;318 uint64_t offFile; 319 319 /** The start position of the compressed data in the hVfsIos. */ 320 RTFOFFoffCompStart;320 uint64_t offCompStart; 321 321 /** The current position for decompressing bytes in the hVfsIos. */ 322 RTFOFFoffComp;322 uint64_t offComp; 323 323 /** The number of compressed bytes starting at offCompStart. */ 324 RTFOFFcbComp;324 uint64_t cbComp; 325 325 /** Set if we have to pass the type function the next time the input 326 326 * function is called. */ … … 355 355 356 356 /** The offset of the first Central Directory header. */ 357 RTFOFFoffFirstCdh;357 uint64_t offFirstCdh; 358 358 /** The offset of the next Central Directory header. */ 359 RTFOFFoffNextCdh;359 uint64_t offNextCdh; 360 360 361 361 /** Size of the central directory. */ … … 436 436 * Return the offset of the Local File Header. 437 437 */ 438 static RTFOFFrtZipPkzipReaderOffLocalHeader(PRTZIPPKZIPREADER pThis)438 static uint64_t rtZipPkzipReaderOffLocalHeader(PRTZIPPKZIPREADER pThis) 439 439 { 440 440 if (pThis->fZip64Ex && pThis->cdh.offLocalFileHeader == -1U) … … 448 448 * Return the uncompressed object size. 449 449 */ 450 static RTFOFFrtZipPkzipReaderUncompressed(PRTZIPPKZIPREADER pThis)450 static uint64_t rtZipPkzipReaderUncompressed(PRTZIPPKZIPREADER pThis) 451 451 { 452 452 if (pThis->fZip64Ex && pThis->cdh.cbUncompressed == -1U) … … 460 460 * Return the compressed object size. 461 461 */ 462 static RTFOFFrtZipPkzipReaderCompressed(PRTZIPPKZIPREADER pThis)462 static uint64_t rtZipPkzipReaderCompressed(PRTZIPPKZIPREADER pThis) 463 463 { 464 464 if (pThis->fZip64Ex && pThis->cdh.cbCompressed == -1U) … … 473 473 */ 474 474 static int rtZipPkzipParseCentrDirHeaderExtra(PRTZIPPKZIPREADER pThis, uint8_t *pu8Buf, size_t cb, 475 RTZIPPKZIP_COMP_METHOD *penmCompMethod, PRTFOFFpcbCompressed)475 RTZIPPKZIP_COMP_METHOD *penmCompMethod, uint64_t *pcbCompressed) 476 476 { 477 477 int rc = RTStrCopyEx(pThis->szName, sizeof(pThis->szName), (const char*)pu8Buf, pThis->cdh.cbFilename); … … 582 582 * Directory. 583 583 */ 584 static int rtZipPkzipFssIosReadLfh(PRTZIPPKZIPFSSTREAM pThis, RTFOFF*poffStartData)584 static int rtZipPkzipFssIosReadLfh(PRTZIPPKZIPFSSTREAM pThis, uint64_t *poffStartData) 585 585 { 586 586 RTZIPPKZIPLOCALFILEHDR lfh; 587 RTFOFFoffLocalFileHeader = rtZipPkzipReaderOffLocalHeader(&pThis->PkzipReader);587 uint64_t offLocalFileHeader = rtZipPkzipReaderOffLocalHeader(&pThis->PkzipReader); 588 588 int rc = RTVfsIoStrmReadAt(pThis->hVfsIos, offLocalFileHeader, 589 589 &lfh, sizeof(lfh) - 1, true /*fBlocking*/, NULL); … … 614 614 * Scan the current Central Directory Header. 615 615 */ 616 static int rtZipPkzipFssIosReadCdh(PRTZIPPKZIPFSSTREAM pThis, RTFOFF*poffStartData,617 RTZIPPKZIP_COMP_METHOD *penmCompMethod, PRTFOFFpcbCompressed)616 static int rtZipPkzipFssIosReadCdh(PRTZIPPKZIPFSSTREAM pThis, uint64_t *poffStartData, 617 RTZIPPKZIP_COMP_METHOD *penmCompMethod, uint64_t *pcbCompressed) 618 618 { 619 619 int rc; 620 620 621 RTFOFFoffCd = pThis->offNextCdh - pThis->offFirstCdh;621 uint64_t offCd = pThis->offNextCdh - pThis->offFirstCdh; 622 622 if ( pThis->iCentrDirEntry < pThis->cCentrDirEntries 623 623 || offCd + sizeof(RTZIPPKZIPCENTRDIRHDR) - 1 <= pThis->cbCentrDir) … … 688 688 /* maximum size of EOCD comment 2^16-1 */ 689 689 const size_t cbHdrMax = 0xffff + sizeof(RTZIPPKZIPENDOFCENTRDIRREC) - 1; 690 RTFOFFoffMin = cbFile >= cbHdrMax ? cbFile - cbHdrMax : 0;691 692 RTFOFFoff = cbFile - cbBuf;690 uint64_t offMin = cbFile >= cbHdrMax ? cbFile - cbHdrMax : 0; 691 692 uint64_t off = cbFile - cbBuf; 693 693 while (off >= offMin) 694 694 { … … 709 709 { 710 710 /* sanity check */ 711 if (off + RT_ UOFFSETOF(RTZIPPKZIPENDOFCENTRDIRREC, u8Comment) + eocd.cbComment == cbFile)711 if (off + RT_OFFSETOF(RTZIPPKZIPENDOFCENTRDIRREC, u8Comment) + eocd.cbComment == cbFile) 712 712 { 713 713 pThis->offFirstCdh = eocd.offCentrDir; … … 896 896 if (off < 0) 897 897 off = pThis->offFile; 898 if (off >= pThis->cbFile)898 if (off >= (RTFOFF)pThis->cbFile) 899 899 return pcbRead ? VINF_EOF : VERR_EOF; 900 900 … … 914 914 if ( !pThis->pZip 915 915 || !off 916 || off < pThis->offFile)916 || off < (RTFOFF)pThis->offFile) 917 917 { 918 918 switch (pThis->enmCompMethod) … … 944 944 * Skip bytes if necessary. 945 945 */ 946 if (off > pThis->offFile)946 if (off > (RTFOFF)pThis->offFile) 947 947 { 948 948 uint8_t u8Buf[_1K]; 949 while (off > pThis->offFile)949 while (off > (RTFOFF)pThis->offFile) 950 950 { 951 951 size_t cbSkip = off - pThis->offFile; … … 1105 1105 if (!pThis->PkzipReader.fHaveEocd) 1106 1106 rc = rtZipPkzipFssIosReadEocb(pThis); 1107 RTFOFFoffData = 0;1107 uint64_t offData = 0; 1108 1108 1109 1109 /* … … 1111 1111 */ 1112 1112 RTZIPPKZIP_COMP_METHOD enmCompMethod = RTZIPPKZIP_COMP_METHOD_STORED; 1113 RTFOFFcbCompressed = 0;1113 uint64_t cbCompressed = 0; 1114 1114 if (RT_SUCCESS(rc)) 1115 1115 rc = rtZipPkzipFssIosReadCdh(pThis, &offData, &enmCompMethod, &cbCompressed);
Note:
See TracChangeset
for help on using the changeset viewer.