Changeset 100908 in vbox for trunk/src/VBox/Runtime/common/zip
- Timestamp:
- Aug 19, 2023 2:57:05 AM (18 months ago)
- Location:
- trunk/src/VBox/Runtime/common/zip
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/zip/cpiovfs.cpp
r98103 r100908 484 484 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 485 485 */ 486 static DECLCALLBACK(int) rtZipCpioFssIos_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)486 static DECLCALLBACK(int) rtZipCpioFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 487 487 { 488 488 PRTZIPCPIOIOSTREAM pThis = (PRTZIPCPIOIOSTREAM)pvThis; … … 518 518 int rc = RTVfsIoStrmReadAt(pThis->hVfsIos, pThis->offStart + off, pSgBuf->paSegs[0].pvSeg, cbToRead, fBlocking, pcbRead); 519 519 pThis->offFile = off + *pcbRead; 520 RTSgBufAdvance(pSgBuf, *pcbRead); 521 520 522 if (pThis->offFile >= pThis->cbFile) 521 523 { … … 532 534 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 533 535 */ 534 static DECLCALLBACK(int) rtZipCpioFssIos_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)536 static DECLCALLBACK(int) rtZipCpioFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 535 537 { 536 538 /* Cannot write to a read-only I/O stream. */ -
trunk/src/VBox/Runtime/common/zip/gzipvfs.cpp
r98103 r100908 289 289 * @param fBlocking Whether to block or not. 290 290 * @param pcbRead Where to store the number of bytes actually read. 291 */ 292 static int rtZipGzip_ReadOneSeg(PRTZIPGZIPSTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead) 291 * @param pSgBuf The segment buffer descriptor, for advancing. 292 */ 293 static int rtZipGzip_ReadOneSeg(PRTZIPGZIPSTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking, 294 size_t *pcbRead, PRTSGBUF pSgBuf) 293 295 { 294 296 /* … … 324 326 { 325 327 size_t cbReadIn = ~(size_t)0; 328 RTSgBufReset(&pThis->SgBuf); 326 329 rc = RTVfsIoStrmSgRead(pThis->hVfsIos, -1 /*off*/, &pThis->SgBuf, fBlocking, &cbReadIn); 327 330 if (rc != VINF_SUCCESS) … … 375 378 if (pcbRead) 376 379 *pcbRead = cbRead; 380 RTSgBufAdvance(pSgBuf, cbRead); 377 381 378 382 return rc; … … 383 387 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 384 388 */ 385 static DECLCALLBACK(int) rtZipGzip_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)389 static DECLCALLBACK(int) rtZipGzip_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 386 390 { 387 391 PRTZIPGZIPSTREAM pThis = (PRTZIPGZIPSTREAM)pvThis; … … 392 396 AssertReturn(off == -1 || off == pThis->offStream , VERR_INVALID_PARAMETER); 393 397 394 return rtZipGzip_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead );398 return rtZipGzip_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead, pSgBuf); 395 399 } 396 400 … … 517 521 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 518 522 */ 519 static DECLCALLBACK(int) rtZipGzip_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)523 static DECLCALLBACK(int) rtZipGzip_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 520 524 { 521 525 PRTZIPGZIPSTREAM pThis = (PRTZIPGZIPSTREAM)pvThis; … … 554 558 if (pcbWritten) 555 559 *pcbWritten = cbWritten; 560 RTSgBufAdvance(pSgBuf, cbWritten); 556 561 return rc; 557 562 } -
trunk/src/VBox/Runtime/common/zip/lzmavfs.cpp
r98766 r100908 215 215 * @param fBlocking Whether to block or not. 216 216 * @param pcbRead Where to store the number of bytes actually read. 217 */ 218 static int rtZipLzma_ReadOneSeg(PRTZIPLZMASTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead) 217 * @param pSgBuf The S/G buffer descriptor, for advancing. 218 */ 219 static int rtZipLzma_ReadOneSeg(PRTZIPLZMASTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking, 220 size_t *pcbRead, PRTSGBUF pSgBuf) 219 221 { 220 222 /* … … 243 245 { 244 246 size_t cbReadIn = ~(size_t)0; 247 RTSgBufReset(&pThis->SgBuf); 245 248 rc = RTVfsIoStrmSgRead(pThis->hVfsIos, -1 /*off*/, &pThis->SgBuf, fBlocking, &cbReadIn); 246 249 if (rc != VINF_SUCCESS) … … 298 301 if (pcbRead) 299 302 *pcbRead = cbRead; 303 RTSgBufAdvance(pSgBuf, cbRead); 300 304 301 305 return rc; … … 306 310 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 307 311 */ 308 static DECLCALLBACK(int) rtZipLzma_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)312 static DECLCALLBACK(int) rtZipLzma_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 309 313 { 310 314 PRTZIPLZMASTREAM pThis = (PRTZIPLZMASTREAM)pvThis; … … 315 319 AssertReturn(off == -1 || off == pThis->offStream , VERR_INVALID_PARAMETER); 316 320 317 return rtZipLzma_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead );321 return rtZipLzma_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead, pSgBuf); 318 322 } 319 323 … … 440 444 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 441 445 */ 442 static DECLCALLBACK(int) rtZipLzma_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)446 static DECLCALLBACK(int) rtZipLzma_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 443 447 { 444 448 PRTZIPLZMASTREAM pThis = (PRTZIPLZMASTREAM)pvThis; … … 477 481 if (pcbWritten) 478 482 *pcbWritten = cbWritten; 483 RTSgBufAdvance(pSgBuf, cbWritten); 484 479 485 return rc; 480 486 } -
trunk/src/VBox/Runtime/common/zip/pkzip.cpp
r98103 r100908 99 99 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 100 100 */ 101 static DECLCALLBACK(int) memFssIos_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)101 static DECLCALLBACK(int) memFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 102 102 { 103 103 PMEMIOSTREAM pThis = (PMEMIOSTREAM)pvThis; … … 123 123 if (pcbRead) 124 124 *pcbRead = cbToRead; 125 RTSgBufAdvance(pSgBuf, cbToRead); 125 126 126 127 return VINF_SUCCESS; … … 130 131 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 131 132 */ 132 static DECLCALLBACK(int) memFssIos_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)133 static DECLCALLBACK(int) memFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 133 134 { 134 135 RT_NOREF_PV(pvThis); RT_NOREF_PV(off); RT_NOREF_PV(pSgBuf); RT_NOREF_PV(fBlocking); RT_NOREF_PV(pcbWritten); -
trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp
r98103 r100908 907 907 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 908 908 */ 909 static DECLCALLBACK(int) rtZipPkzipFssIos_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)909 static DECLCALLBACK(int) rtZipPkzipFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 910 910 { 911 911 PRTZIPPKZIPIOSTREAM pThis = (PRTZIPPKZIPIOSTREAM)pvThis; … … 986 986 int rc = RTZipDecompress(pThis->pZip, pSgBuf->paSegs[0].pvSeg, cbToRead, pcbRead); 987 987 pThis->offFile = off + *pcbRead; 988 RTSgBufAdvance(pSgBuf, *pcbRead); 989 988 990 if (pThis->offFile >= pThis->cbFile) 989 991 { … … 995 997 } 996 998 997 static DECLCALLBACK(int) rtZipPkzipFssIos_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)999 static DECLCALLBACK(int) rtZipPkzipFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 998 1000 { 999 1001 RT_NOREF_PV(pvThis); RT_NOREF_PV(off); RT_NOREF_PV(pSgBuf); RT_NOREF_PV(fBlocking); RT_NOREF_PV(pcbWritten); -
trunk/src/VBox/Runtime/common/zip/tarvfs.cpp
r98325 r100908 872 872 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 873 873 */ 874 static DECLCALLBACK(int) rtZipTarFssIos_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)874 static DECLCALLBACK(int) rtZipTarFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 875 875 { 876 876 PRTZIPTARIOSTREAM pThis = (PRTZIPTARIOSTREAM)pvThis; … … 906 906 int rc = RTVfsIoStrmReadAt(pThis->hVfsIos, pThis->offStart + off, pSgBuf->paSegs[0].pvSeg, cbToRead, fBlocking, pcbRead); 907 907 pThis->offFile = off + *pcbRead; 908 RTSgBufAdvance(pSgBuf, *pcbRead); 909 908 910 if (pThis->offFile >= pThis->cbFile) 909 911 { … … 920 922 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 921 923 */ 922 static DECLCALLBACK(int) rtZipTarFssIos_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)924 static DECLCALLBACK(int) rtZipTarFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 923 925 { 924 926 /* Cannot write to a read-only I/O stream. */ -
trunk/src/VBox/Runtime/common/zip/tarvfswriter.cpp
r99739 r100908 753 753 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 754 754 */ 755 static DECLCALLBACK(int) rtZipTarWriterPush_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)755 static DECLCALLBACK(int) rtZipTarWriterPush_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 756 756 { 757 757 /* No read support, sorry. */ … … 765 765 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 766 766 */ 767 static DECLCALLBACK(int) rtZipTarWriterPush_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)767 static DECLCALLBACK(int) rtZipTarWriterPush_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 768 768 { 769 769 PRTZIPTARFSSTREAMWRITERPUSH pPush = (PRTZIPTARFSSTREAMWRITERPUSH)pvThis; … … 810 810 if (pcbWritten) 811 811 *pcbWritten = cbWritten; 812 RTSgBufAdvance(pSgBuf, cbWritten); 812 813 } 813 814 } -
trunk/src/VBox/Runtime/common/zip/xarvfs.cpp
r98103 r100908 854 854 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 855 855 */ 856 static DECLCALLBACK(int) rtZipXarFssIos_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)856 static DECLCALLBACK(int) rtZipXarFssIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 857 857 { 858 858 PRTZIPXARIOSTREAM pThis = (PRTZIPXARIOSTREAM)pvThis; … … 918 918 /* Update the file position. */ 919 919 pThis->offCurPos += cbActuallyRead; 920 RTSgBufAdvance(pSgBuf, cbActuallyRead); 920 921 921 922 /* … … 963 964 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 964 965 */ 965 static DECLCALLBACK(int) rtZipXarFssIos_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)966 static DECLCALLBACK(int) rtZipXarFssIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 966 967 { 967 968 /* Cannot write to a read-only I/O stream. */ … … 1226 1227 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead} 1227 1228 */ 1228 static DECLCALLBACK(int) rtZipXarFssDecompIos_Read(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)1229 static DECLCALLBACK(int) rtZipXarFssDecompIos_Read(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead) 1229 1230 { 1230 1231 PRTZIPXARDECOMPIOS pThis = (PRTZIPXARDECOMPIOS)pvThis; … … 1243 1244 * validate off wrt data digest updating. 1244 1245 */ 1245 int rc = RTVfsIoStrmReadAt(pThis->hVfsIosDecompressor, off, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, 1246 fBlocking, pcbRead); 1246 size_t cbSeg = 0; 1247 void * const pvSeg = RTSgBufGetCurrentSegment(pSgBuf, ~(size_t)0, &cbSeg); 1248 int rc = RTVfsIoStrmReadAt(pThis->hVfsIosDecompressor, off, pvSeg, cbSeg, fBlocking, pcbRead); 1247 1249 if (RT_FAILURE(rc)) 1248 1250 return rc; … … 1251 1253 * Hash the data. When reaching the end match against the expected digest. 1252 1254 */ 1253 size_t c bActuallyRead = pcbRead ? *pcbRead : pSgBuf->paSegs[0].cbSeg;1255 size_t const cbActuallyRead = pcbRead ? *pcbRead : cbSeg; 1254 1256 pThis->offCurPos += cbActuallyRead; 1257 RTSgBufAdvance(pSgBuf, cbActuallyRead); 1255 1258 rtZipXarHashUpdate(&pThis->CtxExtracted, pThis->uHashFunExtracted, pSgBuf->paSegs[0].pvSeg, cbActuallyRead); 1259 1256 1260 if (rc == VINF_EOF) 1257 1261 { … … 1295 1299 * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite} 1296 1300 */ 1297 static DECLCALLBACK(int) rtZipXarFssDecompIos_Write(void *pvThis, RTFOFF off, P CRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)1301 static DECLCALLBACK(int) rtZipXarFssDecompIos_Write(void *pvThis, RTFOFF off, PRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten) 1298 1302 { 1299 1303 /* Cannot write to a read-only I/O stream. */
Note:
See TracChangeset
for help on using the changeset viewer.