Changeset 51696 in vbox
- Timestamp:
- Jun 23, 2014 4:30:29 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
- 1 copied
-
include/iprt/err.h (modified) (1 diff)
-
include/iprt/mangling.h (modified) (1 diff)
-
include/iprt/zip.h (modified) (4 diffs)
-
src/VBox/Runtime/Makefile.kmk (modified) (1 diff)
-
src/VBox/Runtime/common/zip/pkzipvfs.cpp (added)
-
src/VBox/Runtime/common/zip/unzipcmd.cpp (added)
-
src/VBox/Runtime/common/zip/zip.cpp (modified) (7 diffs)
-
src/VBox/Runtime/tools/Makefile.kmk (modified) (1 diff)
-
src/VBox/Runtime/tools/RTUnzip.cpp (copied) (copied from trunk/src/VBox/Runtime/tools/RTTar.cpp ) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/err.h
r50956 r51696 1712 1712 /** @} */ 1713 1713 1714 /** @name Pkzip status codes 1715 * @{ */ 1716 /** No end of central directory record found. */ 1717 #define VERR_PKZIP_NO_EOCB (-960) 1718 /** Too long name string. */ 1719 #define VERR_PKZIP_NAME_TOO_LONG (-961) 1720 /** Local file header corrupt. */ 1721 #define VERR_PKZIP_BAD_LF_HEADER (-962) 1722 /** Central directory file header corrupt. */ 1723 #define VERR_PKZIP_BAD_CDF_HEADER (-963) 1724 /** Encountered an unknown type flag. */ 1725 #define VERR_PKZIP_UNKNOWN_TYPE_FLAG (-964) 1726 /** Found a ZIP64 Extra Information Field in a ZIP32 file. */ 1727 #define VERR_PKZIP_ZIP64EX_IN_ZIP32 (-965) 1728 1729 1714 1730 /** @name RTZip status codes 1715 1731 * @{ */ -
trunk/include/iprt/mangling.h
r51087 r51696 1903 1903 # define RTZipGzipDecompressIoStream RT_MANGLER(RTZipGzipDecompressIoStream) 1904 1904 # define RTZipTarCmd RT_MANGLER(RTZipTarCmd) 1905 # define RTZipUnzipCmd RT_MANGLER(RTZipUnzipCmd) 1905 1906 # define RTZipTarFsStreamFromIoStream RT_MANGLER(RTZipTarFsStreamFromIoStream) 1906 1907 # define RTZipXarFsStreamFromIoStream RT_MANGLER(RTZipXarFsStreamFromIoStream) 1908 # define RTZipPkzipFsStreamFromIoStream RT_MANGLER(RTZipPkzipFsStreamFromIoStream) 1907 1909 /* 1908 1910 * Stable variables (alphabetical order): -
trunk/include/iprt/zip.h
r48836 r51696 86 86 /** Lempel-Ziv-Oberhumer compression. */ 87 87 RTZIPTYPE_LZO, 88 /* Zlib compression the data without zlib header. */ 89 RTZIPTYPE_ZLIB_NO_HEADER, 88 90 /** End of valid the valid compression types. */ 89 91 RTZIPTYPE_END … … 217 219 218 220 /** 221 * Opens a zip decompression I/O stream. 222 * 223 * @returns IPRT status code. 224 * 225 * @param hVfsIosIn The compressed input stream (must be readable). 226 * The reference is not consumed, instead another 227 * one is retained. 228 * @param fFlags Flags, MBZ. 229 * @param phVfsIosUnzip Where to return the handle to the gunzipped I/O 230 * stream (read). 231 */ 232 RTDECL(int) RTZipDecompressIoStream(RTVFSIOSTREAM hVfsIosIn, uint32_t fFlags, PRTVFSIOSTREAM phVfsIosUnzip); 233 234 235 /** 219 236 * Opens a gzip decompression I/O stream. 220 237 * … … 279 296 280 297 /** 281 * Opens a XARfilesystem stream.282 * 283 * This is used to extract, list or check a XARarchive.298 * Opens a ZIP filesystem stream. 299 * 300 * This is used to extract, list or check a ZIP archive. 284 301 * 285 302 * @returns IPRT status code. … … 288 305 * not consumed, instead another one is retained. 289 306 * @param fFlags Flags, MBZ. 307 * @param phVfsFss Where to return the handle to the TAR 308 * filesystem stream. 309 */ 310 RTDECL(int) RTZipPkzipFsStreamFromIoStream(RTVFSIOSTREAM hVfsIosIn, uint32_t fFlags, PRTVFSFSSTREAM phVfsFss); 311 312 /** 313 * A mini UNZIP program. 314 * 315 * @returns Program exit code. 316 * @ 317 * @param cArgs The number of arguments. 318 * @param papszArgs The argument vector. (Note that this may be 319 * reordered, so the memory must be writable.) 320 */ 321 RTDECL(RTEXITCODE) RTZipUnzipCmd(unsigned cArgs, char **papszArgs); 322 323 /** 324 * Opens a XAR filesystem stream. 325 * 326 * This is used to extract, list or check a XAR archive. 327 * 328 * @returns IPRT status code. 329 * 330 * @param hVfsIosIn The compressed input stream. The reference is 331 * not consumed, instead another one is retained. 332 * @param fFlags Flags, MBZ. 290 333 * @param phVfsFss Where to return the handle to the XAR filesystem 291 334 * stream. -
trunk/src/VBox/Runtime/Makefile.kmk
r51346 r51696 464 464 common/zip/tar.cpp \ 465 465 common/zip/tarcmd.cpp \ 466 common/zip/unzipcmd.cpp \ 466 467 common/zip/tarvfs.cpp \ 467 468 common/zip/gzipvfs.cpp \ 469 common/zip/pkzipvfs.cpp \ 468 470 common/zip/zip.cpp \ 469 471 generic/createtemp-generic.cpp \ -
trunk/src/VBox/Runtime/common/zip/zip.cpp
r49233 r51696 420 420 421 421 #ifdef RTZIP_USE_ZLIB 422 423 /* 424 * Missing definitions from zutil.h. We need these constants for calling 425 * inflateInit2() / deflateInit2(). 426 */ 427 # ifndef Z_DEF_WBITS 428 # define Z_DEF_WBITS MAX_WBITS 429 # endif 430 # ifndef Z_DEF_MEM_LEVEL 431 # define Z_DEF_MEM_LEVEL 8 432 # endif 433 422 434 /** 423 435 * Convert from zlib errno to iprt status code. … … 543 555 * @param pZip The compressor instance. 544 556 * @param enmLevel The desired compression level. 545 */ 546 static DECLCALLBACK(int) rtZipZlibCompInit(PRTZIPCOMP pZip, RTZIPLEVEL enmLevel) 557 * @param fZlibHeader If true, write the Zlib header. 558 */ 559 static DECLCALLBACK(int) rtZipZlibCompInit(PRTZIPCOMP pZip, RTZIPLEVEL enmLevel, bool fZlibHeader) 547 560 { 548 561 pZip->pfnCompress = rtZipZlibCompress; … … 564 577 pZip->u.Zlib.opaque = pZip; 565 578 566 int rc = deflateInit(&pZip->u.Zlib, iLevel); 579 int rc = deflateInit2(&pZip->u.Zlib, iLevel, Z_DEFLATED, fZlibHeader ? Z_DEF_WBITS : -Z_DEF_WBITS, 580 Z_DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); 567 581 return rc >= 0 ? rc = VINF_SUCCESS : zipErrConvertFromZlib(rc, true /*fCompressing*/); 568 582 } … … 636 650 * @returns iprt status code. 637 651 * @param pZip The decompressor instance. 638 */ 639 static DECLCALLBACK(int) rtZipZlibDecompInit(PRTZIPDECOMP pZip) 652 * @param fZlibHeader If true, expect the Zlib header. 653 */ 654 static DECLCALLBACK(int) rtZipZlibDecompInit(PRTZIPDECOMP pZip, bool fZlibHeader) 640 655 { 641 656 pZip->pfnDecompress = rtZipZlibDecompress; … … 645 660 pZip->u.Zlib.opaque = pZip; 646 661 647 int rc = inflateInit (&pZip->u.Zlib);662 int rc = inflateInit2(&pZip->u.Zlib, fZlibHeader ? Z_DEF_WBITS : -Z_DEF_WBITS); 648 663 return rc >= 0 ? VINF_SUCCESS : zipErrConvertFromZlib(rc, false /*fCompressing*/); 649 664 } … … 1406 1421 1407 1422 case RTZIPTYPE_ZLIB: 1423 case RTZIPTYPE_ZLIB_NO_HEADER: 1408 1424 #ifdef RTZIP_USE_ZLIB 1409 rc = rtZipZlibCompInit(pZip, enmLevel );1425 rc = rtZipZlibCompInit(pZip, enmLevel, enmType == RTZIPTYPE_ZLIB /*fZlibHeader*/); 1410 1426 #endif 1411 1427 break; … … 1584 1600 1585 1601 case RTZIPTYPE_ZLIB: 1602 case RTZIPTYPE_ZLIB_NO_HEADER: 1586 1603 #ifdef RTZIP_USE_ZLIB 1587 rc = rtZipZlibDecompInit(pZip );1604 rc = rtZipZlibDecompInit(pZip, pZip->enmType == RTZIPTYPE_ZLIB /*fHeader*/); 1588 1605 #else 1589 1606 AssertMsgFailed(("Zlib is not include in this build!\n")); -
trunk/src/VBox/Runtime/tools/Makefile.kmk
r49116 r51696 66 66 RTTar_SOURCES = RTTar.cpp 67 67 68 # RTUnzip - our unzip clone (for testing the unzip streaming code) 69 PROGRAMS += RTUnzip 70 RTUnzip_TEMPLATE = VBoxR3Tool 71 RTUnzip_SOURCES = RTUnzip.cpp 72 68 73 # RTNtDbgHelp - our tar clone (for testing the tar/gzip/gunzip streaming code) 69 74 PROGRAMS.win += RTNtDbgHelp -
trunk/src/VBox/Runtime/tools/RTUnzip.cpp
r51634 r51696 40 40 if (RT_FAILURE(rc)) 41 41 return RTMsgInitFailure(rc); 42 return RTZip TarCmd(argc, argv);42 return RTZipUnzipCmd(argc, argv); 43 43 } 44 44
Note:
See TracChangeset
for help on using the changeset viewer.

