VirtualBox

Changeset 51697 in vbox


Ignore:
Timestamp:
Jun 23, 2014 4:46:13 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
94481
Message:

uint64_t / RTFOFF mess

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp

    r51696 r51697  
    314314    RTZIPPKZIPBASEOBJ       BaseObj;
    315315    /** The number of (uncompressed) bytes in the file. */
    316     RTFOFF                  cbFile;
     316    uint64_t                cbFile;
    317317    /** The current file position at uncompressed file data. */
    318     RTFOFF                  offFile;
     318    uint64_t                offFile;
    319319    /** The start position of the compressed data in the hVfsIos. */
    320     RTFOFF                  offCompStart;
     320    uint64_t                offCompStart;
    321321    /** The current position for decompressing bytes in the hVfsIos. */
    322     RTFOFF                  offComp;
     322    uint64_t                offComp;
    323323    /** The number of compressed bytes starting at offCompStart. */
    324     RTFOFF                  cbComp;
     324    uint64_t                cbComp;
    325325    /** Set if we have to pass the type function the next time the input
    326326     * function is called. */
     
    355355
    356356    /** The offset of the first Central Directory header. */
    357     RTFOFF                  offFirstCdh;
     357    uint64_t                offFirstCdh;
    358358    /** The offset of the next Central Directory header. */
    359     RTFOFF                  offNextCdh;
     359    uint64_t                offNextCdh;
    360360
    361361    /** Size of the central directory. */
     
    436436 * Return the offset of the Local File Header.
    437437 */
    438 static RTFOFF rtZipPkzipReaderOffLocalHeader(PRTZIPPKZIPREADER pThis)
     438static uint64_t rtZipPkzipReaderOffLocalHeader(PRTZIPPKZIPREADER pThis)
    439439{
    440440    if (pThis->fZip64Ex && pThis->cdh.offLocalFileHeader == -1U)
     
    448448 * Return the uncompressed object size.
    449449 */
    450 static RTFOFF rtZipPkzipReaderUncompressed(PRTZIPPKZIPREADER pThis)
     450static uint64_t rtZipPkzipReaderUncompressed(PRTZIPPKZIPREADER pThis)
    451451{
    452452    if (pThis->fZip64Ex && pThis->cdh.cbUncompressed == -1U)
     
    460460 * Return the compressed object size.
    461461 */
    462 static RTFOFF rtZipPkzipReaderCompressed(PRTZIPPKZIPREADER pThis)
     462static uint64_t rtZipPkzipReaderCompressed(PRTZIPPKZIPREADER pThis)
    463463{
    464464    if (pThis->fZip64Ex && pThis->cdh.cbCompressed == -1U)
     
    473473 */
    474474static int rtZipPkzipParseCentrDirHeaderExtra(PRTZIPPKZIPREADER pThis, uint8_t *pu8Buf, size_t cb,
    475                                               RTZIPPKZIP_COMP_METHOD *penmCompMethod, PRTFOFF pcbCompressed)
     475                                              RTZIPPKZIP_COMP_METHOD *penmCompMethod, uint64_t *pcbCompressed)
    476476{
    477477    int rc = RTStrCopyEx(pThis->szName, sizeof(pThis->szName), (const char*)pu8Buf, pThis->cdh.cbFilename);
     
    582582 * Directory.
    583583 */
    584 static int rtZipPkzipFssIosReadLfh(PRTZIPPKZIPFSSTREAM pThis, RTFOFF *poffStartData)
     584static int rtZipPkzipFssIosReadLfh(PRTZIPPKZIPFSSTREAM pThis, uint64_t *poffStartData)
    585585{
    586586    RTZIPPKZIPLOCALFILEHDR lfh;
    587     RTFOFF offLocalFileHeader = rtZipPkzipReaderOffLocalHeader(&pThis->PkzipReader);
     587    uint64_t offLocalFileHeader = rtZipPkzipReaderOffLocalHeader(&pThis->PkzipReader);
    588588    int rc = RTVfsIoStrmReadAt(pThis->hVfsIos, offLocalFileHeader,
    589589                               &lfh, sizeof(lfh) - 1, true /*fBlocking*/, NULL);
     
    614614 * Scan the current Central Directory Header.
    615615 */
    616 static int rtZipPkzipFssIosReadCdh(PRTZIPPKZIPFSSTREAM pThis, RTFOFF *poffStartData,
    617                                     RTZIPPKZIP_COMP_METHOD *penmCompMethod, PRTFOFF pcbCompressed)
     616static int rtZipPkzipFssIosReadCdh(PRTZIPPKZIPFSSTREAM pThis, uint64_t *poffStartData,
     617                                    RTZIPPKZIP_COMP_METHOD *penmCompMethod, uint64_t *pcbCompressed)
    618618{
    619619    int rc;
    620620
    621     RTFOFF offCd = pThis->offNextCdh - pThis->offFirstCdh;
     621    uint64_t offCd = pThis->offNextCdh - pThis->offFirstCdh;
    622622    if (   pThis->iCentrDirEntry < pThis->cCentrDirEntries
    623623        || offCd + sizeof(RTZIPPKZIPCENTRDIRHDR) - 1 <= pThis->cbCentrDir)
     
    688688    /* maximum size of EOCD comment 2^16-1 */
    689689    const size_t cbHdrMax = 0xffff + sizeof(RTZIPPKZIPENDOFCENTRDIRREC) - 1;
    690     RTFOFF offMin = cbFile >= cbHdrMax ? cbFile - cbHdrMax : 0;
    691 
    692     RTFOFF off = cbFile - cbBuf;
     690    uint64_t offMin = cbFile >= cbHdrMax ? cbFile - cbHdrMax : 0;
     691
     692    uint64_t off = cbFile - cbBuf;
    693693    while (off >= offMin)
    694694    {
     
    709709                {
    710710                    /* sanity check */
    711                     if (off + RT_UOFFSETOF(RTZIPPKZIPENDOFCENTRDIRREC, u8Comment) + eocd.cbComment == cbFile)
     711                    if (off + RT_OFFSETOF(RTZIPPKZIPENDOFCENTRDIRREC, u8Comment) + eocd.cbComment == cbFile)
    712712                    {
    713713                        pThis->offFirstCdh = eocd.offCentrDir;
     
    896896    if (off < 0)
    897897        off = pThis->offFile;
    898     if (off >= pThis->cbFile)
     898    if (off >= (RTFOFF)pThis->cbFile)
    899899        return pcbRead ? VINF_EOF : VERR_EOF;
    900900
     
    914914    if (   !pThis->pZip
    915915        || !off
    916         || off < pThis->offFile)
     916        || off < (RTFOFF)pThis->offFile)
    917917    {
    918918        switch (pThis->enmCompMethod)
     
    944944     * Skip bytes if necessary.
    945945     */
    946     if (off > pThis->offFile)
     946    if (off > (RTFOFF)pThis->offFile)
    947947    {
    948948        uint8_t u8Buf[_1K];
    949         while (off > pThis->offFile)
     949        while (off > (RTFOFF)pThis->offFile)
    950950        {
    951951            size_t cbSkip = off - pThis->offFile;
     
    11051105    if (!pThis->PkzipReader.fHaveEocd)
    11061106        rc = rtZipPkzipFssIosReadEocb(pThis);
    1107     RTFOFF offData = 0;
     1107    uint64_t offData = 0;
    11081108
    11091109    /*
     
    11111111     */
    11121112    RTZIPPKZIP_COMP_METHOD enmCompMethod = RTZIPPKZIP_COMP_METHOD_STORED;
    1113     RTFOFF cbCompressed = 0;
     1113    uint64_t cbCompressed = 0;
    11141114    if (RT_SUCCESS(rc))
    11151115        rc = rtZipPkzipFssIosReadCdh(pThis, &offData, &enmCompMethod, &cbCompressed);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette