VirtualBox

Changeset 62747 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 30, 2016 4:01:43 PM (8 years ago)
Author:
vboxsync
Message:

Storage: warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/RAW.cpp

    r62482 r62747  
    234234                          unsigned uPercentStart, unsigned uPercentSpan)
    235235{
     236    RT_NOREF1(pszComment);
    236237    int rc;
    237238    RTFOFF cbFree = 0;
     
    307308                                         PVDINTERFACE pVDIfsImage, VDTYPE *penmType)
    308309{
     310    RT_NOREF1(pVDIfsDisk);
    309311    LogFlowFunc(("pszFilename=\"%s\" pVDIfsDisk=%#p pVDIfsImage=%#p\n", pszFilename, pVDIfsDisk, pVDIfsImage));
    310312    PVDIOSTORAGE pStorage = NULL;
     
    333335                           &pStorage);
    334336    if (RT_SUCCESS(rc))
     337    {
    335338        rc = vdIfIoIntFileGetSize(pIfIo, pStorage, &cbFile);
    336339
    337     /* Try to guess the image type based on the extension. */
    338     if (   RT_SUCCESS(rc)
    339         && pszSuffix)
    340     {
    341         if (   !RTStrICmp(pszSuffix, ".iso")
    342             || !RTStrICmp(pszSuffix, ".cdr")) /* DVD images. */
     340        /* Try to guess the image type based on the extension. */
     341        if (   RT_SUCCESS(rc)
     342            && pszSuffix)
    343343        {
    344             /* Note that there are ISO images smaller than 1 MB; it is impossible to distinguish
    345              * between raw floppy and CD images based on their size (and cannot be reliably done
    346              * based on contents, either).
    347              */
    348             if (cbFile % 2048)
    349                 rc = VERR_VD_RAW_SIZE_MODULO_2048;
    350             else if (cbFile <= 32768)
    351                 rc = VERR_VD_RAW_SIZE_OPTICAL_TOO_SMALL;
     344            if (   !RTStrICmp(pszSuffix, ".iso")
     345                || !RTStrICmp(pszSuffix, ".cdr")) /* DVD images. */
     346            {
     347                /* Note that there are ISO images smaller than 1 MB; it is impossible to distinguish
     348                 * between raw floppy and CD images based on their size (and cannot be reliably done
     349                 * based on contents, either).
     350                 */
     351                if (cbFile % 2048)
     352                    rc = VERR_VD_RAW_SIZE_MODULO_2048;
     353                else if (cbFile <= 32768)
     354                    rc = VERR_VD_RAW_SIZE_OPTICAL_TOO_SMALL;
     355                else
     356                {
     357                    *penmType = VDTYPE_DVD;
     358                    rc = VINF_SUCCESS;
     359                }
     360            }
     361            else if (   !RTStrICmp(pszSuffix, ".img")
     362                     || !RTStrICmp(pszSuffix, ".ima")
     363                     || !RTStrICmp(pszSuffix, ".dsk")
     364                     || !RTStrICmp(pszSuffix, ".flp")
     365                     || !RTStrICmp(pszSuffix, ".vfd")) /* Floppy images */
     366            {
     367                if (cbFile % 512)
     368                    rc = VERR_VD_RAW_SIZE_MODULO_512;
     369                else if (cbFile > RAW_MAX_FLOPPY_IMG_SIZE)
     370                    rc = VERR_VD_RAW_SIZE_FLOPPY_TOO_BIG;
     371                else
     372                {
     373                    *penmType = VDTYPE_FLOPPY;
     374                    rc = VINF_SUCCESS;
     375                }
     376            }
    352377            else
    353             {
    354                 *penmType = VDTYPE_DVD;
    355                 rc = VINF_SUCCESS;
    356             }
    357         }
    358         else if (   !RTStrICmp(pszSuffix, ".img")
    359                  || !RTStrICmp(pszSuffix, ".ima")
    360                  || !RTStrICmp(pszSuffix, ".dsk")
    361                  || !RTStrICmp(pszSuffix, ".flp")
    362                  || !RTStrICmp(pszSuffix, ".vfd")) /* Floppy images */
    363         {
    364             if (cbFile % 512)
    365                 rc = VERR_VD_RAW_SIZE_MODULO_512;
    366             else if (cbFile > RAW_MAX_FLOPPY_IMG_SIZE)
    367                 rc = VERR_VD_RAW_SIZE_FLOPPY_TOO_BIG;
    368             else
    369             {
    370                 *penmType = VDTYPE_FLOPPY;
    371                 rc = VINF_SUCCESS;
    372             }
     378                rc = VERR_VD_RAW_INVALID_HEADER;
    373379        }
    374380        else
    375381            rc = VERR_VD_RAW_INVALID_HEADER;
    376382    }
    377     else
    378         rc = VERR_VD_RAW_INVALID_HEADER;
    379383
    380384    if (pStorage)
     
    451455                                   void **ppBackendData)
    452456{
     457    RT_NOREF1(pUuid);
    453458    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
    454459                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     
    619624                                  size_t *pcbPostRead, unsigned fWrite)
    620625{
     626    RT_NOREF1(fWrite);
    621627    int rc = VINF_SUCCESS;
    622628    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    907913                                       size_t cbComment)
    908914{
     915    RT_NOREF2(pszComment, cbComment);
    909916    LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment));
    910917    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    925932static DECLCALLBACK(int) rawSetComment(void *pBackendData, const char *pszComment)
    926933{
     934    RT_NOREF1(pszComment);
    927935    LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment));
    928936    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    948956static DECLCALLBACK(int) rawGetUuid(void *pBackendData, PRTUUID pUuid)
    949957{
     958    RT_NOREF1(pUuid);
    950959    LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    951960    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    966975static DECLCALLBACK(int) rawSetUuid(void *pBackendData, PCRTUUID pUuid)
    967976{
     977    RT_NOREF1(pUuid);
    968978    LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    969979    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    9901000static DECLCALLBACK(int) rawGetModificationUuid(void *pBackendData, PRTUUID pUuid)
    9911001{
     1002    RT_NOREF1(pUuid);
    9921003    LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    9931004    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    10081019static DECLCALLBACK(int) rawSetModificationUuid(void *pBackendData, PCRTUUID pUuid)
    10091020{
     1021    RT_NOREF1(pUuid);
    10101022    LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    10111023    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    10311043static DECLCALLBACK(int) rawGetParentUuid(void *pBackendData, PRTUUID pUuid)
    10321044{
     1045    RT_NOREF1(pUuid);
    10331046    LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    10341047    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    10491062static DECLCALLBACK(int) rawSetParentUuid(void *pBackendData, PCRTUUID pUuid)
    10501063{
     1064    RT_NOREF1(pUuid);
    10511065    LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    10521066    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    10721086static DECLCALLBACK(int) rawGetParentModificationUuid(void *pBackendData, PRTUUID pUuid)
    10731087{
     1088    RT_NOREF1(pUuid);
    10741089    LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid));
    10751090    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
     
    10901105static DECLCALLBACK(int) rawSetParentModificationUuid(void *pBackendData, PCRTUUID pUuid)
    10911106{
     1107    RT_NOREF1(pUuid);
    10921108    LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid));
    10931109    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
Note: See TracChangeset for help on using the changeset viewer.

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