Changeset 34045 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Nov 12, 2010 7:16:09 PM (14 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r34027 r34045 372 372 common/vfs/vfsstdfile.cpp \ 373 373 common/zip/tar.cpp \ 374 common/zip/tarcmd.cpp \ 374 375 common/zip/tarvfs.cpp \ 375 376 common/zip/gzipvfs.cpp \ -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r34032 r34045 1597 1597 RTVFSFSSTREAMINTERNAL *pThis = hVfsFss; 1598 1598 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1599 AssertReturn(pThis->uMagic == RTVFS DIR_MAGIC, VERR_INVALID_HANDLE);1599 AssertReturn(pThis->uMagic == RTVFSFSSTREAM_MAGIC, VERR_INVALID_HANDLE); 1600 1600 AssertPtrNullReturn(ppszName, VERR_INVALID_POINTER); 1601 1601 if (ppszName) -
trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
r34029 r34045 284 284 { 285 285 PRTVFSSTDFILE pThis = (PRTVFSSTDFILE)pvThis; 286 return RTFileTell(pThis->hFile); 286 uint64_t offActual; 287 int rc = RTFileSeek(pThis->hFile, 0, RTFILE_SEEK_CURRENT, &offActual); 288 if (RT_SUCCESS(rc)) 289 *poffActual = (RTFOFF)offActual; 290 return rc; 287 291 } 288 292 -
trunk/src/VBox/Runtime/common/zip/tarvfs.cpp
r34029 r34045 32 32 #include <iprt/zip.h> 33 33 34 #include <iprt/asm.h> 34 35 #include <iprt/assert.h> 35 36 #include <iprt/err.h> … … 144 145 DECLINLINE(bool) rtZipTarHdrHasPrefix(PCRTZIPTARHDR pTar) 145 146 { 146 return true;147 return pTar->Posix.prefix[0] != '\0'; 147 148 } 148 149 … … 157 158 { 158 159 return VINF_SUCCESS; 160 } 161 162 163 /** 164 * Converts a numeric header field to the C native type. 165 * 166 * @returns IPRT status code. 167 * 168 * @param pszField The TAR header field. 169 * @param cchField The length of the field. 170 * @param fOctalOnly Must be octal. 171 * @param pi64 Where to store the value. 172 */ 173 static int rtZipTarHdrFieldToNum(const char *pszField, size_t cchField, bool fOctalOnly, int64_t *pi64) 174 { 175 /** @todo check for base256 and more */ 176 return RTStrToInt64Full(pszField, 8, pi64); 159 177 } 160 178 … … 171 189 { 172 190 RT_ZERO(*pObjInfo); 191 int rc; 192 193 int64_t i64; 194 rc = rtZipTarHdrFieldToNum(pTar->Posix.size, sizeof(pTar->Posix.size), false, &i64); 195 AssertRCSuccessReturn(rc, rc); 196 pObjInfo->cbObject = i64; 197 198 pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_UNIX; 173 199 174 200 return VINF_SUCCESS; … … 267 293 { 268 294 PRTZIPTARIOSTREAM pThis = (PRTZIPTARIOSTREAM)pvThis; 295 296 RTVfsIoStrmRelease(pThis->hVfsIos); 297 pThis->hVfsIos = NIL_RTVFSIOSTREAM; 298 269 299 return rtZipTarFssBaseObj_Close(&pThis->BaseObj); 270 300 } … … 602 632 && off < pThis->offNextHdr) 603 633 { 604 int rc = RTVfsIoStrmSkip(pThis->hVfsIos, off - pThis->offNextHdr);634 int rc = RTVfsIoStrmSkip(pThis->hVfsIos, pThis->offNextHdr - off); 605 635 if (RT_FAILURE(rc)) 606 636 { … … 637 667 /* 638 668 * Validate the header and convert to binary object info. 639 * /640 /** @todo look for the two all zero headers terminating the stream...*/669 * We pick up the two zero headers in the failure path here. 670 */ 641 671 rc = rtZipTarHdrValidate(&Hdr); 642 if (RT_FAILURE(rc)) 672 if (RT_FAILURE_NP(rc)) 673 { 674 if (ASMMemIsAllU32(&Hdr, sizeof(Hdr), 0) == NULL) 675 { 676 int rc2 = RTVfsIoStrmRead(pThis->hVfsIos, &Hdr, sizeof(Hdr), true /*fBlocking*/, &cbRead); 677 if (RT_FAILURE(rc2)) 678 return pThis->rcFatal = rc2; 679 if (ASMMemIsAllU32(&Hdr, sizeof(Hdr), 0) == NULL) 680 { 681 pThis->fEndOfStream = true; 682 if (RTVfsIoStrmIsAtEnd(pThis->hVfsIos)) 683 return VERR_EOF; 684 return VERR_TAR_EOS_MORE_INPUT; 685 } 686 } 687 643 688 return pThis->rcFatal = rc; 689 } 644 690 645 691 RTFSOBJINFO Info; … … 764 810 { 765 811 *ppszName = NULL; 766 rc = RTStrAAppendExN(ppszName, 2, Hdr.Posix.prefix, Hdr.Posix.name); 812 rc = RTStrAAppendExN(ppszName, 3, 813 Hdr.Posix.prefix, sizeof(Hdr.Posix.prefix), 814 "/", 1, 815 Hdr.Posix.name, sizeof(Hdr.Posix.name)); 767 816 } 768 817 else 769 rc = RTStrDupEx(ppszName, Hdr.Posix.name); 818 { 819 *ppszName = RTStrDupN(Hdr.Posix.name, sizeof(Hdr.Posix.name)); 820 rc = *ppszName ? VINF_SUCCESS : VERR_NO_STR_MEMORY; 821 } 770 822 if (RT_FAILURE(rc)) 771 823 return rc; … … 806 858 807 859 808 RTDECL(int) RTZipTarFsStreamFromIoStream(RTVFSIOSTREAM hVfsIosIn, PRTVFSFSSTREAM phVfsFss)860 RTDECL(int) RTZipTarFsStreamFromIoStream(RTVFSIOSTREAM hVfsIosIn, uint32_t fFlags, PRTVFSFSSTREAM phVfsFss) 809 861 { 810 862 /* … … 814 866 *phVfsFss = NIL_RTVFSFSSTREAM; 815 867 AssertPtrReturn(hVfsIosIn, VERR_INVALID_HANDLE); 868 AssertReturn(!fFlags, VERR_INVALID_PARAMETER); 816 869 817 870 RTFOFF const offStart = RTVfsIoStrmTell(hVfsIosIn); -
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r33973 r34045 577 577 RTGzip_SOURCES = RTGzip.cpp 578 578 579 # RTTar - our tar clone (for testing the tar/gzip/gunzip streaming code) 580 PROGRAMS += RTTar 581 RTTar_TEMPLATE = VBOXR3TSTEXE 582 RTTar_SOURCES = RTTar.cpp 579 583 580 584
Note:
See TracChangeset
for help on using the changeset viewer.