VirtualBox

Changeset 49039 in vbox for trunk/src/VBox/Storage/VMDK.cpp


Ignore:
Timestamp:
Oct 10, 2013 6:27:32 PM (11 years ago)
Author:
vboxsync
Message:

IPRT: Filename extension versus suffix cleanup, long overdue.

File:
1 edited

Legend:

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

    r48860 r49039  
    34293429        char pszPartition[1024];
    34303430        const char *pszBase = RTPathFilename(pImage->pszFilename);
    3431         const char *pszExt = RTPathExt(pszBase);
    3432         if (pszExt == NULL)
     3431        const char *pszSuff = RTPathSuffix(pszBase);
     3432        if (pszSuff == NULL)
    34333433            return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: invalid filename '%s'"), pImage->pszFilename);
    34343434        char *pszBaseBase = RTStrDup(pszBase);
    34353435        if (!pszBaseBase)
    34363436            return VERR_NO_MEMORY;
    3437         RTPathStripExt(pszBaseBase);
     3437        RTPathStripSuffix(pszBaseBase);
    34383438        RTStrPrintf(pszPartition, sizeof(pszPartition), "%s-pt%s",
    3439                     pszBaseBase, pszExt);
     3439                    pszBaseBase, pszSuff);
    34403440        RTStrFree(pszBaseBase);
    34413441
     
    36273627        else
    36283628        {
    3629             char *pszBasenameExt = RTPathExt(pszBasenameSubstr);
     3629            char *pszBasenameSuff = RTPathSuffix(pszBasenameSubstr);
    36303630            char *pszBasenameBase = RTStrDup(pszBasenameSubstr);
    3631             RTPathStripExt(pszBasenameBase);
     3631            RTPathStripSuffix(pszBasenameBase);
    36323632            char *pszTmp;
    36333633            size_t cbTmp;
     
    36363636                if (cExtents == 1)
    36373637                    RTStrAPrintf(&pszTmp, "%s-flat%s", pszBasenameBase,
    3638                                  pszBasenameExt);
     3638                                 pszBasenameSuff);
    36393639                else
    36403640                    RTStrAPrintf(&pszTmp, "%s-f%03d%s", pszBasenameBase,
    3641                                  i+1, pszBasenameExt);
     3641                                 i+1, pszBasenameSuff);
    36423642            }
    36433643            else
    36443644                RTStrAPrintf(&pszTmp, "%s-s%03d%s", pszBasenameBase, i+1,
    3645                              pszBasenameExt);
     3645                             pszBasenameSuff);
    36463646            RTStrFree(pszBasenameBase);
    36473647            if (!pszTmp)
     
    54915491    /* Prepare both old and new base names used for string replacement. */
    54925492    pszNewBaseName = RTStrDup(RTPathFilename(pszFilename));
    5493     RTPathStripExt(pszNewBaseName);
     5493    RTPathStripSuffix(pszNewBaseName);
    54945494    pszOldBaseName = RTStrDup(RTPathFilename(pImage->pszFilename));
    5495     RTPathStripExt(pszOldBaseName);
     5495    RTPathStripSuffix(pszOldBaseName);
    54965496    /* Prepare both old and new full names used for string replacement. */
    54975497    pszNewFullName = RTStrDup(pszFilename);
    5498     RTPathStripExt(pszNewFullName);
     5498    RTPathStripSuffix(pszNewFullName);
    54995499    pszOldFullName = RTStrDup(pImage->pszFilename);
    5500     RTPathStripExt(pszOldFullName);
     5500    RTPathStripSuffix(pszOldFullName);
    55015501
    55025502    /* --- Up to this point we have not done any damage yet. --- */
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