Changeset 49039 in vbox for trunk/src/VBox/Storage
- Timestamp:
- Oct 10, 2013 6:27:32 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 89816
- Location:
- trunk/src/VBox/Storage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/Parallels.cpp
r48743 r49039 205 205 { 206 206 /* Check if the file has hdd as extension. It is a fixed size raw image then. */ 207 char *psz Extension = RTPathExt(pImage->pszFilename);208 if (strcmp(psz Extension, ".hdd"))207 char *pszSuffix = RTPathSuffix(pImage->pszFilename); 208 if (strcmp(pszSuffix, ".hdd")) 209 209 { 210 210 rc = VERR_VD_PARALLELS_INVALID_HEADER; … … 391 391 */ 392 392 uint64_t cbFile; 393 char *psz Extension;393 char *pszSuffix; 394 394 395 395 rc = vdIfIoIntFileGetSize(pIfIo, pStorage, &cbFile); … … 400 400 } 401 401 402 psz Extension = RTPathExt(pszFilename);403 if (!psz Extension || strcmp(pszExtension, ".hdd"))402 pszSuffix = RTPathSuffix(pszFilename); 403 if (!pszSuffix || strcmp(pszSuffix, ".hdd")) 404 404 rc = VERR_VD_PARALLELS_INVALID_HEADER; 405 405 else -
trunk/src/VBox/Storage/RAW.cpp
r48743 r49039 349 349 uint64_t cbFile; 350 350 int rc = VINF_SUCCESS; 351 char *psz Extension= NULL;351 char *pszSuffix = NULL; 352 352 353 353 PVDINTERFACEIOINT pIfIo = VDIfIoIntGet(pVDIfsImage); … … 361 361 } 362 362 363 psz Extension = RTPathExt(pszFilename);363 pszSuffix = RTPathSuffix(pszFilename); 364 364 365 365 /* … … 375 375 /* Try to guess the image type based on the extension. */ 376 376 if ( RT_SUCCESS(rc) 377 && psz Extension)378 { 379 if ( !RTStrICmp(psz Extension, ".iso")380 || !RTStrICmp(psz Extension, ".cdr")) /* DVD images. */377 && pszSuffix) 378 { 379 if ( !RTStrICmp(pszSuffix, ".iso") 380 || !RTStrICmp(pszSuffix, ".cdr")) /* DVD images. */ 381 381 { 382 382 /* Note that there are ISO images smaller than 1 MB; it is impossible to distinguish … … 392 392 rc = VERR_VD_RAW_INVALID_HEADER; 393 393 } 394 else if ( !RTStrICmp(psz Extension, ".img")395 || !RTStrICmp(psz Extension, ".ima")396 || !RTStrICmp(psz Extension, ".dsk")397 || !RTStrICmp(psz Extension, ".flp")398 || !RTStrICmp(psz Extension, ".vfd")) /* Floppy images */394 else if ( !RTStrICmp(pszSuffix, ".img") 395 || !RTStrICmp(pszSuffix, ".ima") 396 || !RTStrICmp(pszSuffix, ".dsk") 397 || !RTStrICmp(pszSuffix, ".flp") 398 || !RTStrICmp(pszSuffix, ".vfd")) /* Floppy images */ 399 399 { 400 400 if (!(cbFile % 512) && cbFile <= RAW_MAX_FLOPPY_IMG_SIZE) -
trunk/src/VBox/Storage/VMDK.cpp
r48860 r49039 3429 3429 char pszPartition[1024]; 3430 3430 const char *pszBase = RTPathFilename(pImage->pszFilename); 3431 const char *psz Ext = RTPathExt(pszBase);3432 if (psz Ext== NULL)3431 const char *pszSuff = RTPathSuffix(pszBase); 3432 if (pszSuff == NULL) 3433 3433 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: invalid filename '%s'"), pImage->pszFilename); 3434 3434 char *pszBaseBase = RTStrDup(pszBase); 3435 3435 if (!pszBaseBase) 3436 3436 return VERR_NO_MEMORY; 3437 RTPathStrip Ext(pszBaseBase);3437 RTPathStripSuffix(pszBaseBase); 3438 3438 RTStrPrintf(pszPartition, sizeof(pszPartition), "%s-pt%s", 3439 pszBaseBase, psz Ext);3439 pszBaseBase, pszSuff); 3440 3440 RTStrFree(pszBaseBase); 3441 3441 … … 3627 3627 else 3628 3628 { 3629 char *pszBasename Ext = RTPathExt(pszBasenameSubstr);3629 char *pszBasenameSuff = RTPathSuffix(pszBasenameSubstr); 3630 3630 char *pszBasenameBase = RTStrDup(pszBasenameSubstr); 3631 RTPathStrip Ext(pszBasenameBase);3631 RTPathStripSuffix(pszBasenameBase); 3632 3632 char *pszTmp; 3633 3633 size_t cbTmp; … … 3636 3636 if (cExtents == 1) 3637 3637 RTStrAPrintf(&pszTmp, "%s-flat%s", pszBasenameBase, 3638 pszBasename Ext);3638 pszBasenameSuff); 3639 3639 else 3640 3640 RTStrAPrintf(&pszTmp, "%s-f%03d%s", pszBasenameBase, 3641 i+1, pszBasename Ext);3641 i+1, pszBasenameSuff); 3642 3642 } 3643 3643 else 3644 3644 RTStrAPrintf(&pszTmp, "%s-s%03d%s", pszBasenameBase, i+1, 3645 pszBasename Ext);3645 pszBasenameSuff); 3646 3646 RTStrFree(pszBasenameBase); 3647 3647 if (!pszTmp) … … 5491 5491 /* Prepare both old and new base names used for string replacement. */ 5492 5492 pszNewBaseName = RTStrDup(RTPathFilename(pszFilename)); 5493 RTPathStrip Ext(pszNewBaseName);5493 RTPathStripSuffix(pszNewBaseName); 5494 5494 pszOldBaseName = RTStrDup(RTPathFilename(pImage->pszFilename)); 5495 RTPathStrip Ext(pszOldBaseName);5495 RTPathStripSuffix(pszOldBaseName); 5496 5496 /* Prepare both old and new full names used for string replacement. */ 5497 5497 pszNewFullName = RTStrDup(pszFilename); 5498 RTPathStrip Ext(pszNewFullName);5498 RTPathStripSuffix(pszNewFullName); 5499 5499 pszOldFullName = RTStrDup(pImage->pszFilename); 5500 RTPathStrip Ext(pszOldFullName);5500 RTPathStripSuffix(pszOldFullName); 5501 5501 5502 5502 /* --- Up to this point we have not done any damage yet. --- */
Note:
See TracChangeset
for help on using the changeset viewer.