Changeset 21848 in vbox
- Timestamp:
- Jul 28, 2009 2:45:02 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/zip.cpp
r21844 r21848 61 61 #endif 62 62 #ifdef RTZIP_USE_LZO 63 # include <lzo/lzo1x.h>63 # include <lzo/lzo1x.h> 64 64 #endif 65 65 … … 259 259 260 260 #ifdef RTZIP_USE_STORE 261 #include <stdio.h>262 261 263 262 /** … … 417 416 } 418 417 419 #endif 418 #endif /* RTZIP_USE_STORE */ 420 419 421 420 … … 635 634 } 636 635 637 #endif 636 #endif /* RTZIP_USE_ZLIB */ 638 637 639 638 … … 858 857 } 859 858 860 #endif 859 #endif /* RTZIP_USE_BZLIB */ 861 860 862 861 … … 1336 1335 * Validate input. 1337 1336 */ 1338 if ( enmType < RTZIPTYPE_AUTO 1339 || enmType > RTZIPTYPE_LZF) 1340 { 1341 AssertMsgFailed(("Invalid enmType=%d\n", enmType)); 1342 return VERR_INVALID_PARAMETER; 1343 } 1344 if ( enmLevel < RTZIPLEVEL_STORE 1345 || enmLevel > RTZIPLEVEL_MAX) 1346 { 1347 AssertMsgFailed(("Invalid enmLevel=%d\n", enmLevel)); 1348 return VERR_INVALID_PARAMETER; 1349 } 1350 if (!pfnOut || !ppZip) 1351 { 1352 AssertMsgFailed(("Must supply pfnOut and ppZip!\n")); 1353 return VERR_INVALID_PARAMETER; 1354 } 1337 AssertReturn(enmType >= RTZIPTYPE_INVALID && enmType < RTZIPTYPE_END, VERR_INVALID_PARAMETER); 1338 AssertReturn(enmLevel >= RTZIPLEVEL_STORE && enmLevel <= RTZIPLEVEL_MAX, VERR_INVALID_PARAMETER); 1339 AssertPtrReturn(pfnOut, VERR_INVALID_POINTER); 1340 AssertPtrReturn(ppZip, VERR_INVALID_POINTER); 1355 1341 1356 1342 /* … … 1392 1378 pZip->pvUser = pvUser; 1393 1379 pZip->abBuffer[0] = enmType; /* first byte is the compression type. */ 1394 int rc = V INF_SUCCESS;1380 int rc = VERR_NOT_IMPLEMENTED; 1395 1381 switch (enmType) 1396 1382 { 1383 case RTZIPTYPE_STORE: 1397 1384 #ifdef RTZIP_USE_STORE 1398 case RTZIPTYPE_STORE:1399 1385 rc = rtZipStoreCompInit(pZip, enmLevel); 1400 break; 1401 #endif 1402 1386 #endif 1387 break; 1388 1389 case RTZIPTYPE_ZLIB: 1403 1390 #ifdef RTZIP_USE_ZLIB 1404 case RTZIPTYPE_ZLIB:1405 1391 rc = rtZipZlibCompInit(pZip, enmLevel); 1406 break; 1407 #endif 1408 1392 #endif 1393 break; 1394 1395 case RTZIPTYPE_BZLIB: 1409 1396 #ifdef RTZIP_USE_BZLIB 1410 case RTZIPTYPE_BZLIB:1411 1397 rc = rtZipBZlibCompInit(pZip, enmLevel); 1412 break; 1413 #endif 1414 1398 #endif 1399 break; 1400 1401 case RTZIPTYPE_LZF: 1415 1402 #ifdef RTZIP_USE_LZF 1416 case RTZIPTYPE_LZF:1417 1403 rc = rtZipLZFCompInit(pZip, enmLevel); 1418 break; 1419 #endif 1404 #endif 1405 break; 1406 1407 case RTZIPTYPE_LZJB: 1408 case RTZIPTYPE_LZO: 1409 break; 1420 1410 1421 1411 default: 1422 AssertMsgFailed(("Not implemented!\n")); 1423 rc = VERR_NOT_IMPLEMENTED; 1424 break; 1412 AssertFailedBreak(); 1425 1413 } 1426 1414 … … 1520 1508 * Validate input. 1521 1509 */ 1522 if (!pfnIn || !ppZip) 1523 { 1524 AssertMsgFailed(("Must supply pfnIn and ppZip!\n")); 1525 return VERR_INVALID_PARAMETER; 1526 } 1510 AssertPtrReturn(pfnIn, VERR_INVALID_POINTER); 1511 AssertPtrReturn(ppZip, VERR_INVALID_POINTER); 1527 1512 1528 1513 /* … … 1567 1552 */ 1568 1553 pZip->enmType = (RTZIPTYPE)u8Type; 1554 rc = VERR_NOT_SUPPORTED; 1569 1555 switch (pZip->enmType) 1570 1556 { 1557 case RTZIPTYPE_STORE: 1571 1558 #ifdef RTZIP_USE_STORE 1572 case RTZIPTYPE_STORE:1573 1559 rc = rtZipStoreDecompInit(pZip); 1574 break; 1575 #endif 1560 #else 1561 AssertMsgFailed(("Store is not include in this build!\n")); 1562 #endif 1563 break; 1576 1564 1577 1565 case RTZIPTYPE_ZLIB: … … 1579 1567 rc = rtZipZlibDecompInit(pZip); 1580 1568 #else 1581 AssertMsgFailed Return(("Zlib is not include in this build!\n"), VERR_NOT_IMPLEMENTED);1569 AssertMsgFailed(("Zlib is not include in this build!\n")); 1582 1570 #endif 1583 1571 break; … … 1587 1575 rc = rtZipBZlibDecompInit(pZip); 1588 1576 #else 1589 AssertMsgFailed Return(("BZlib is not include in this build!\n"), VERR_NOT_IMPLEMENTED);1577 AssertMsgFailed(("BZlib is not include in this build!\n")); 1590 1578 #endif 1591 1579 break; … … 1595 1583 rc = rtZipLZFDecompInit(pZip); 1596 1584 #else 1597 AssertMsgFailedReturn(("LZF is not include in this build!\n"), VERR_NOT_IMPLEMENTED); 1598 #endif 1599 break; 1600 1601 case RTZIPTYPE_INVALID: 1602 AssertMsgFailed(("Invalid compression type RTZIPTYPE_INVALID!\n")); 1603 rc = VERR_NOT_IMPLEMENTED; 1604 break; 1605 1606 case RTZIPTYPE_AUTO: 1607 AssertMsgFailed(("Invalid compression type RTZIPTYPE_AUTO!\n")); 1608 rc = VERR_INVALID_MAGIC; 1585 AssertMsgFailed(("LZF is not include in this build!\n")); 1586 #endif 1587 break; 1588 1589 case RTZIPTYPE_LZJB: 1590 #ifdef RTZIP_USE_LZJB 1591 AssertMsgFailed(("LZJB streaming support is not implemented yet!\n")); 1592 #else 1593 AssertMsgFailed(("LZJB is not include in this build!\n")); 1594 #endif 1595 break; 1596 1597 case RTZIPTYPE_LZO: 1598 #ifdef RTZIP_USE_LZJB 1599 AssertMsgFailed(("LZO streaming support is not implemented yet!\n")); 1600 #else 1601 AssertMsgFailed(("LZO is not include in this build!\n")); 1602 #endif 1609 1603 break; 1610 1604 1611 1605 default: 1612 AssertMsgFailed((" Unknown compression type %d\n\n", pZip->enmType));1606 AssertMsgFailed(("Invalid compression type %d (%#x)!\n", pZip->enmType, pZip->enmType)); 1613 1607 rc = VERR_INVALID_MAGIC; 1614 1608 break; … … 1622 1616 return rc; 1623 1617 } 1618 1624 1619 1625 1620 /**
Note:
See TracChangeset
for help on using the changeset viewer.