Changeset 49039 in vbox for trunk/src/VBox
- Timestamp:
- Oct 10, 2013 6:27:32 PM (11 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r48775 r49039 1742 1742 if (pszLogFile) 1743 1743 { 1744 char *pszLog Ext= NULL;1745 if (RTPathHas Ext(pszLogFile))1746 pszLog Ext = RTStrDup(RTPathExt(pszLogFile));1747 RTPathStrip Ext(pszLogFile);1748 char *pszLog Suffix;1744 char *pszLogSuff = NULL; 1745 if (RTPathHasSuffix(pszLogFile)) 1746 pszLogSuff = RTStrDup(RTPathSuffix(pszLogFile)); 1747 RTPathStripSuffix(pszLogFile); 1748 char *pszLogNewSuffix; 1749 1749 #ifndef DEBUG 1750 if (RTStrAPrintf(&pszLog Suffix, "-%RU32-%s",1750 if (RTStrAPrintf(&pszLogNewSuffix, "-%RU32-%s", 1751 1751 pSessionStartupInfo->uSessionID, 1752 1752 pSessionStartupInfo->szUser) < 0) … … 1755 1755 } 1756 1756 #else 1757 if (RTStrAPrintf(&pszLog Suffix, "-%RU32-%RU32-%s",1757 if (RTStrAPrintf(&pszLogNewSuffix, "-%RU32-%RU32-%s", 1758 1758 pSessionStartupInfo->uSessionID, 1759 1759 s_uCtrlSessionThread, … … 1765 1765 else 1766 1766 { 1767 rc2 = RTStrAAppend(&pszLogFile, pszLog Suffix);1768 if (RT_SUCCESS(rc2) && pszLog Ext)1769 rc2 = RTStrAAppend(&pszLogFile, pszLog Ext);1767 rc2 = RTStrAAppend(&pszLogFile, pszLogNewSuffix); 1768 if (RT_SUCCESS(rc2) && pszLogSuff) 1769 rc2 = RTStrAAppend(&pszLogFile, pszLogSuff); 1770 1770 if (RT_SUCCESS(rc2)) 1771 1771 { … … 1776 1776 } 1777 1777 } 1778 RTStrFree(pszLog Suffix);1778 RTStrFree(pszLogNewSuffix); 1779 1779 } 1780 1780 if (RT_FAILURE(rc2)) 1781 1781 VBoxServiceError("Error building session logfile string for session %RU32 (user %s), rc=%Rrc\n", 1782 1782 pSessionStartupInfo->uSessionID, pSessionStartupInfo->szUser, rc2); 1783 if (pszLog Ext)1784 RTStrFree(pszLog Ext);1783 if (pszLogSuff) 1784 RTStrFree(pszLogSuff); 1785 1785 RTStrFree(pszLogFile); 1786 1786 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r47906 r49039 323 323 if (!format || !*format) 324 324 { 325 const char *pszExt = RTPath Ext(filename);325 const char *pszExt = RTPathSuffix(filename); 326 326 /* Skip over . if there is an extension. */ 327 327 if (pszExt) … … 356 356 /** @todo use IMediumFormat to cover all extensions generically */ 357 357 Utf8Str strName(filename); 358 if (!RTPathHa veExt(strName.c_str()))358 if (!RTPathHasSuffix(strName.c_str())) 359 359 { 360 360 Utf8Str strFormat(format); -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r46326 r49039 2199 2199 * Add the default extension if it's missing. 2200 2200 */ 2201 if (!RTPathHa veExt(pszFilename))2201 if (!RTPathHasSuffix(pszFilename)) 2202 2202 { 2203 2203 const char *pszSuff = RTLdrGetSuff(); … … 2239 2239 const char *pszExt = ""; 2240 2240 size_t cchExt = 0; 2241 if (!RTPathHa veExt(pszFilename))2241 if (!RTPathHasSuffix(pszFilename)) 2242 2242 { 2243 2243 pszExt = RTLdrGetSuff(); … … 2659 2659 2660 2660 memcpy(Req.u.In.szName, pszModule, cchModule + 1); 2661 if (!RTPathHas Ext(Req.u.In.szName))2661 if (!RTPathHasSuffix(Req.u.In.szName)) 2662 2662 { 2663 2663 /* Add the default suffix if none is given. */ -
trunk/src/VBox/Installer/linux/install_service/generate_service_file.cpp
r44529 r49039 585 585 else 586 586 { 587 const char *pcszFileName = 588 RTPathFilename(pParameters->pcszCommand); 589 const char *pcszExtension = 590 RTPathExt(pParameters->pcszCommand); 587 const char *pcszFileName = RTPathFilename(pParameters->pcszCommand); 588 const char *pcszSuffix = RTPathSuffix(pParameters->pcszCommand); 591 589 char *pszName = RTStrDupN(pcszFileName, 592 pcsz Extension593 ? pcsz Extension- pcszFileName590 pcszSuffix 591 ? pcszSuffix - pcszFileName 594 592 : RTPATH_MAX); 595 593 bool fRc; -
trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp
r45332 r49039 626 626 627 627 RTEXITCODE rcExit; 628 const char *psz Ext = RTPathExt(szPkgFile);629 if (RTStrICmp(psz Ext, ".msi") == 0)628 const char *pszSuff = RTPathSuffix(szPkgFile); 629 if (RTStrICmp(pszSuff, ".msi") == 0) 630 630 rcExit = ProcessMsiPackage(szPkgFile, pszMsiArgs, fLogging); 631 else if (RTStrICmp(psz Ext, ".cab") == 0)631 else if (RTStrICmp(pszSuff, ".cab") == 0) 632 632 rcExit = RTEXITCODE_SUCCESS; /* Ignore .cab files, they're generally referenced by other files. */ 633 633 else -
trunk/src/VBox/Main/glue/string.cpp
r45927 r49039 135 135 } 136 136 137 Utf8Str& Utf8Str::strip Ext()138 { 139 if (length()) 140 { 141 RTPathStrip Ext(m_psz);137 Utf8Str& Utf8Str::stripSuffix() 138 { 139 if (length()) 140 { 141 RTPathStripSuffix(m_psz); 142 142 jolt(); 143 143 } -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r47905 r49039 2739 2739 { 2740 2740 char *pszAbsPath = RTPathAbsDup(com::Utf8Str(strFile).c_str()); 2741 char *psz Ext = RTPathExt(pszAbsPath);2742 if (psz Ext)2743 psz Ext = RTStrDup(pszExt);2744 RTPathStrip Ext(pszAbsPath);2741 char *pszSuff = RTPathSuffix(pszAbsPath); 2742 if (pszSuff) 2743 pszSuff = RTStrDup(pszSuff); 2744 RTPathStripSuffix(pszAbsPath); 2745 2745 if (!pszAbsPath) 2746 2746 rc = VERR_INVALID_PARAMETER; 2747 if (!psz Ext)2748 psz Ext= RTStrDup(".webm");2747 if (!pszSuff) 2748 pszSuff = RTStrDup(".webm"); 2749 2749 char *pszName = NULL; 2750 2750 if (RT_SUCCESS(rc)) 2751 2751 { 2752 2752 if (mcMonitors > 1) 2753 rc = RTStrAPrintf(&pszName, "%s-%u%s", pszAbsPath, uScreen+1, psz Ext);2753 rc = RTStrAPrintf(&pszName, "%s-%u%s", pszAbsPath, uScreen+1, pszSuff); 2754 2754 else 2755 rc = RTStrAPrintf(&pszName, "%s%s", pszAbsPath, psz Ext);2755 rc = RTStrAPrintf(&pszName, "%s%s", pszAbsPath, pszSuff); 2756 2756 } 2757 2757 if (RT_SUCCESS(rc)) … … 2768 2768 pszAbsPath, time.i32Year, time.u8Month, time.u8MonthDay, 2769 2769 time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond, 2770 uScreen+1, psz Ext);2770 uScreen+1, pszSuff); 2771 2771 else 2772 2772 rc = RTStrAPrintf(&pszName, "%s-%04d-%02u-%02uT%02u-%02u-%02u-%09uZ%s", 2773 2773 pszAbsPath, time.i32Year, time.u8Month, time.u8MonthDay, 2774 2774 time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond, 2775 psz Ext);2775 pszSuff); 2776 2776 if (RT_SUCCESS(rc)) 2777 2777 rc = VideoRecStrmInit(mpVideoRecCtx, uScreen, … … 2786 2786 LogRel(("Failed to initialize video recording context #%u (%Rrc)!\n", uScreen, rc)); 2787 2787 RTStrFree(pszName); 2788 RTStrFree(psz Ext);2788 RTStrFree(pszSuff); 2789 2789 RTStrFree(pszAbsPath); 2790 2790 } -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r48685 r49039 788 788 RTPathStripFilename(tmpDir);; 789 789 char *tmpFile = RTStrDup(RTPathFilename(aName.c_str())); 790 RTPathStrip Ext(tmpFile);791 const char * tmpExt = RTPathExt(aName.c_str());792 RTStrAPrintf(&tmpName, "%s%c%s_%d%s", tmpDir, RTPATH_DELIMITER, tmpFile, i, tmpExt);790 RTPathStripSuffix(tmpFile); 791 const char *pszTmpSuff = RTPathSuffix(aName.c_str()); 792 RTStrAPrintf(&tmpName, "%s%c%s_%d%s", tmpDir, RTPATH_DELIMITER, tmpFile, i, pszTmpSuff); 793 793 RTStrFree(tmpFile); 794 794 RTStrFree(tmpDir); -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r49038 r49039 352 352 if (FAILED(rc)) throw rc; 353 353 354 Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().strip Ext();354 Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().stripSuffix(); 355 355 strTargetVmdkName = Utf8StrFmt("%s-disk%d.vmdk", strTargetName.c_str(), ++pAppliance->m->cDisks); 356 356 if (strTargetVmdkName.length() > RTTAR_NAME_MAX) … … 388 388 if (FAILED(rc)) throw rc; 389 389 390 Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().strip Ext();390 Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().stripSuffix(); 391 391 strTargetVmdkName = Utf8StrFmt("%s-disk%d.iso", strTargetName.c_str(), ++pAppliance->m->cDisks); 392 392 if (strTargetVmdkName.length() > RTTAR_NAME_MAX) … … 2015 2015 Utf8Str strOvaFile = pTask->locInfo.strPath; 2016 2016 /* Extract the path */ 2017 Utf8Str strOvfFile = strOvaFile.strip Ext().append(".ovf");2017 Utf8Str strOvfFile = strOvaFile.stripSuffix().append(".ovf"); 2018 2018 // Create a memory buffer containing the XML. */ 2019 2019 void *pvBuf = 0; … … 2235 2235 { 2236 2236 // Create & write the manifest file 2237 Utf8Str strMfFilePath = Utf8Str(pTask->locInfo.strPath).strip Ext().append(".mf");2237 Utf8Str strMfFilePath = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf"); 2238 2238 Utf8Str strMfFileName = Utf8Str(strMfFilePath).stripPath(); 2239 2239 pTask->pProgress->SetNextOperation(BstrFmt(tr("Creating manifest file '%s'"), strMfFileName.c_str()).raw(), … … 2371 2371 if (m->fManifest) 2372 2372 { 2373 Utf8Str strMfFile = Utf8Str(strTmpOvf).strip Ext().append(".mf");2373 Utf8Str strMfFile = Utf8Str(strTmpOvf).stripSuffix().append(".mf"); 2374 2374 filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total for the manifest file upload */ 2375 2375 } -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r49038 r49039 641 641 /* Figure out from extension which format the image of disk has. */ 642 642 { 643 char *pszExt = RTPathExt(di.strHref.c_str()); 643 char *pszExt = RTPathSuffix(di.strHref.c_str()); 644 if (pszExt) 645 pszExt++; 644 646 /* Get the system properties. */ 645 647 SystemProperties *pSysProps = mVirtualBox->getSystemProperties(); 646 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension( &pszExt[1]);648 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(pszExt); 647 649 if (trgFormat.isNull()) 648 650 { … … 955 957 } 956 958 957 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).strip Ext().append(".mf");959 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf"); 958 960 959 961 SHASTORAGE storage; … … 1101 1103 } 1102 1104 1103 Utf8Str extension(RTPathExt(pszFilename));1104 1105 if (! extension.endsWith(".ovf",Utf8Str::CaseInsensitive))1105 Utf8Str suffix(RTPathSuffix(pszFilename)); 1106 1107 if (!suffix.endsWith(".ovf",Utf8Str::CaseInsensitive)) 1106 1108 { 1107 1109 vrc = VERR_FILE_NOT_FOUND; … … 1523 1525 throw setError(E_OUTOFMEMORY); 1524 1526 1525 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).strip Ext().append(".mf");1527 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf"); 1526 1528 1527 1529 SHASTORAGE storage; … … 1573 1575 Utf8Str manifestShaDigest = storage.strDigest; 1574 1576 1575 Utf8Str strCertFile = Utf8Str(pTask->locInfo.strPath).strip Ext().append(".cert");1577 Utf8Str strCertFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".cert"); 1576 1578 if (RTFileExists(strCertFile.c_str())) 1577 1579 { … … 1685 1687 size_t cbMfSize = 0; 1686 1688 size_t cbCertSize = 0; 1687 Utf8Str strMfFile = (Utf8Str(pszFilename)).strip Ext().append(".mf");1688 Utf8Str strCertFile = (Utf8Str(pszFilename)).strip Ext().append(".cert");1689 Utf8Str strMfFile = (Utf8Str(pszFilename)).stripSuffix().append(".mf"); 1690 Utf8Str strCertFile = (Utf8Str(pszFilename)).stripSuffix().append(".cert"); 1689 1691 1690 1692 /* Skip the OVF file, cause this was read in IAppliance::Read already. */ … … 2299 2301 Utf8Str strTempTargetFilename(*strTargetPath); 2300 2302 strTempTargetFilename = strTempTargetFilename.stripPath(); 2301 strTempTargetFilename = strTempTargetFilename.strip Ext();2303 strTempTargetFilename = strTempTargetFilename.stripSuffix(); 2302 2304 Utf8Str vdf = typeOfVirtualDiskFormatFromURI(di.strFormat); 2303 2305 … … 2337 2339 Utf8Str strTrgFormat = "VMDK"; 2338 2340 ULONG lCabs = 0; 2339 char *pszExt = NULL; 2340 2341 if (RTPathHaveExt(strTargetPath->c_str())) 2342 { 2343 pszExt = RTPathExt(strTargetPath->c_str()); 2341 2342 if (RTPathHasSuffix(strTargetPath->c_str())) 2343 { 2344 const char *pszSuff = RTPathSuffix(strTargetPath->c_str()); 2344 2345 /* Figure out which format the user like to have. Default is VMDK. */ 2345 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&psz Ext[1]);2346 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&pszSuff[1]); 2346 2347 if (trgFormat.isNull()) 2347 2348 throw setError(VBOX_E_NOT_SUPPORTED, -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r48983 r49039 7911 7911 7912 7912 strFile = mData->m_strConfigFileFull; // path/to/machinesfolder/vmname/vmname.vbox 7913 strFile.strip Ext();// path/to/machinesfolder/vmname/vmname7913 strFile.stripSuffix(); // path/to/machinesfolder/vmname/vmname 7914 7914 strFile.append(".webm"); // path/to/machinesfolder/vmname/vmname.webm 7915 7915 } … … 11974 11974 Utf8Str strConfigFileOnly(mData->m_strConfigFileFull); // path/to/machinesfolder/vmname/vmname.vbox 11975 11975 strConfigFileOnly.stripPath() // vmname.vbox 11976 .strip Ext();// vmname11976 .stripSuffix(); // vmname 11977 11977 /** @todo hack, make somehow use of ComposeMachineFilename */ 11978 11978 if (mUserData->s.fDirectoryIncludesUUID) -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r48955 r49039 1134 1134 if (!mt.strBaseName.isEmpty()) 1135 1135 strSrcTest = mt.strBaseName; 1136 strSrcTest.strip Ext();1136 strSrcTest.stripSuffix(); 1137 1137 /* If the old disk name was in {uuid} format we also 1138 1138 * want the new name in this format, but with the … … 1142 1142 * template: "new name-disk1.vdi". */ 1143 1143 if (strSrcTest == strOldVMName) 1144 strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(), RTPath Ext(Utf8Str(bstrSrcName).c_str()));1144 strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(), RTPathSuffix(Utf8Str(bstrSrcName).c_str())); 1145 1145 else if ( strSrcTest.startsWith("{") 1146 1146 && strSrcTest.endsWith("}")) … … 1150 1150 Guid temp_guid(strSrcTest); 1151 1151 if (temp_guid.isValid() && !temp_guid.isZero()) 1152 strNewName = Utf8StrFmt("%s%s", newId.toStringCurly().c_str(), RTPath Ext(strNewName.c_str()));1152 strNewName = Utf8StrFmt("%s%s", newId.toStringCurly().c_str(), RTPathSuffix(strNewName.c_str())); 1153 1153 } 1154 1154 else 1155 strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks, RTPathExt(Utf8Str(bstrSrcName).c_str())); 1155 strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks, 1156 RTPathSuffix(Utf8Str(bstrSrcName).c_str())); 1156 1157 } 1157 1158 -
trunk/src/VBox/Runtime/VBox/VBoxRTImp.def
r48484 r49039 795 795 RTPathExists 796 796 RTPathExistsEx 797 RTPathExt798 797 RTPathFilename 799 798 RTPathGetCurrent 800 799 RTPathGetMode 801 RTPathHaveExt802 800 RTPathHavePath 801 RTPathHaveSuffix 803 802 RTPathJoin 804 803 RTPathJoinA … … 819 818 RTPathStartsWith 820 819 RTPathStartsWithRoot 821 RTPathStripExt822 820 RTPathStripFilename 821 RTPathStripSuffix 823 822 RTPathStripTrailingSlash 823 RTPathSuffix 824 824 RTPathTemp 825 825 RTPathTraverseList -
trunk/src/VBox/Runtime/common/path/RTPathExt.cpp
r48935 r49039 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 33 33 34 34 35 /** 36 * Finds the extension part of in a path. 37 * 38 * @returns Pointer to extension within pszPath. 39 * @returns NULL if no extension. 40 * @param pszPath Path to find extension in. 41 */ 42 RTDECL(char *) RTPathExt(const char *pszPath) 35 RTDECL(char *) RTPathSuffix(const char *pszPath) 43 36 { 44 37 const char *psz = pszPath; … … 66 59 /* the end */ 67 60 case '\0': 68 if (pszExt )61 if (pszExt && pszExt != pszPath && pszExt[1]) 69 62 return (char *)(void *)pszExt; 70 63 return NULL; -
trunk/src/VBox/Runtime/common/path/RTPathHasExt.cpp
r48935 r49039 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 34 34 35 35 36 /** 37 * Checks if a path has an extension. 38 * 39 * @returns true if extension present. 40 * @returns false if no extension present. 41 * @param pszPath Path to check. 42 */ 43 RTDECL(bool) RTPathHasExt(const char *pszPath) 36 RTDECL(bool) RTPathHasSuffix(const char *pszPath) 44 37 { 45 return RTPath Ext(pszPath) != NULL;38 return RTPathSuffix(pszPath) != NULL; 46 39 } 47 40 -
trunk/src/VBox/Runtime/common/path/RTPathStripExt.cpp
r48935 r49039 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 35 35 36 36 37 /** 38 * Strips the extension from a path. 39 * 40 * @param pszPath Path which extension should be stripped. 41 */ 42 RTDECL(void) RTPathStripExt(char *pszPath) 37 RTDECL(void) RTPathStripSuffix(char *pszPath) 43 38 { 44 char *pszDot = NULL; 45 for (;; pszPath++) 46 { 47 switch (*pszPath) 48 { 49 /* handle separators. */ 50 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 51 case ':': 52 case '\\': 53 #endif 54 case '/': 55 pszDot = NULL; 56 break; 57 case '.': 58 pszDot = pszPath; 59 break; 60 61 /* the end */ 62 case '\0': 63 if (pszDot) 64 *pszDot = '\0'; 65 return; 66 } 67 } 68 /* will never get here */ 39 char *pszSuffix = RTPathSuffix(pszPath); 40 if (pszSuffix) 41 *pszSuffix = '\0'; 69 42 } 70 43 -
trunk/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
r48935 r49039 46 46 * Do we need to add an extension? 47 47 */ 48 if (!RTPathHa veExt(pszFilename))48 if (!RTPathHasSuffix(pszFilename)) 49 49 { 50 50 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) -
trunk/src/VBox/Runtime/r3/win/ldrNative-win.cpp
r48935 r49039 58 58 * Do we need to add an extension? 59 59 */ 60 if (!RTPathHa veExt(pszFilename))60 if (!RTPathHasSuffix(pszFilename)) 61 61 { 62 62 size_t cch = strlen(pszFilename); -
trunk/src/VBox/Runtime/testcase/tstRTPath.cpp
r45400 r49039 705 705 706 706 /* 707 * RTPathStrip Ext708 */ 709 RTTestSub(hTest, "RTPathStrip Ext");707 * RTPathStripSuffix 708 */ 709 RTTestSub(hTest, "RTPathStripSuffix"); 710 710 struct 711 711 { … … 725 725 726 726 strcpy(szPath, pszInput); 727 RTPathStrip Ext(szPath);727 RTPathStripSuffix(szPath); 728 728 if (strcmp(szPath, pszResult)) 729 729 RTTestIFailed("Unexpected result\n" -
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. --- */ -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
r47986 r49039 1221 1221 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0); 1222 1222 IEMOP_HLP_DECODED_NL_2(fIsLar ? OP_LAR : OP_LSL, IEMOPFORM_RM_MEM, OP_PARM_Gv, OP_PARM_Ew, DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP); 1223 /** @todo testcase: make sure it's a 16-bit read. */ 1223 1224 1224 1225 IEM_MC_FETCH_MEM_U16(u16Sel, pIemCpu->iEffSeg, GCPtrEffSrc); -
trunk/src/VBox/VMM/VMMR3/PDMLdr.cpp
r46915 r49039 282 282 */ 283 283 const char *pszSuff = RTLdrGetSuff(); 284 size_t cchSuff = RTPathHa veExt(pszFilename) ? 0 : strlen(pszSuff);284 size_t cchSuff = RTPathHasSuffix(pszFilename) ? 0 : strlen(pszSuff); 285 285 PPDMMOD pModule = (PPDMMOD)RTMemAllocZ(RT_OFFSETOF(PDMMOD, szFilename[cchFilename + cchSuff + 1])); 286 286 if (pModule)
Note:
See TracChangeset
for help on using the changeset viewer.