Changeset 36527 in vbox for trunk/src/VBox/Main/src-all
- Timestamp:
- Apr 4, 2011 1:16:09 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 70949
- Location:
- trunk/src/VBox/Main/src-all
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
r35934 r36527 242 242 m->pVirtualBox = a_pVirtualBox; 243 243 244 iprt::MiniString *pstrTarName = VBoxExtPackExtractNameFromTarballPath(a_pszFile);244 RTCString *pstrTarName = VBoxExtPackExtractNameFromTarballPath(a_pszFile); 245 245 if (pstrTarName) 246 246 { … … 284 284 * Parse the XML. 285 285 */ 286 iprt::MiniString strSavedName(m->Desc.strName);287 iprt::MiniString *pStrLoadErr = VBoxExtPackLoadDescFromVfsFile(hXmlFile, &m->Desc, &m->ObjInfoDesc);286 RTCString strSavedName(m->Desc.strName); 287 RTCString *pStrLoadErr = VBoxExtPackLoadDescFromVfsFile(hXmlFile, &m->Desc, &m->ObjInfoDesc); 288 288 RTVfsFileRelease(hXmlFile); 289 289 if (pStrLoadErr != NULL) … … 1225 1225 * Read the description file. 1226 1226 */ 1227 iprt::MiniString strSavedName(m->Desc.strName);1228 iprt::MiniString *pStrLoadErr = VBoxExtPackLoadDesc(m->strExtPackPath.c_str(), &m->Desc, &m->ObjInfoDesc);1227 RTCString strSavedName(m->Desc.strName); 1228 RTCString *pStrLoadErr = VBoxExtPackLoadDesc(m->strExtPackPath.c_str(), &m->Desc, &m->ObjInfoDesc); 1229 1229 if (pStrLoadErr != NULL) 1230 1230 { … … 1903 1903 if (RT_SUCCESS(vrc)) 1904 1904 { 1905 iprt::MiniString *pstrName = VBoxExtPackUnmangleName(Entry.szName, RTSTR_MAX);1905 RTCString *pstrName = VBoxExtPackUnmangleName(Entry.szName, RTSTR_MAX); 1906 1906 AssertLogRel(pstrName); 1907 1907 if (pstrName) … … 2563 2563 { 2564 2564 AssertReturn(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON, E_UNEXPECTED); 2565 iprt::MiniString const * const pStrName = &a_pExtPackFile->m->Desc.strName;2566 iprt::MiniString const * const pStrTarball = &a_pExtPackFile->m->strExtPackFile;2565 RTCString const * const pStrName = &a_pExtPackFile->m->Desc.strName; 2566 RTCString const * const pStrTarball = &a_pExtPackFile->m->strExtPackFile; 2567 2567 2568 2568 AutoCaller autoCaller(this); -
trunk/src/VBox/Main/src-all/ExtPackUtil.cpp
r35523 r36527 47 47 * (RTMemFree it even on failure) 48 48 */ 49 static iprt::MiniString *49 static RTCString * 50 50 vboxExtPackLoadPlugInDescs(const xml::ElementNode *pVBoxExtPackElm, 51 51 uint32_t *pcPlugIns, PVBOXEXTPACKPLUGINDESC *paPlugIns) … … 98 98 * @param a_pExtPackDesc Where to store the extension pack descriptor. 99 99 */ 100 static iprt::MiniString *vboxExtPackLoadDescFromDoc(xml::Document *a_pDoc, PVBOXEXTPACKDESC a_pExtPackDesc)100 static RTCString *vboxExtPackLoadDescFromDoc(xml::Document *a_pDoc, PVBOXEXTPACKDESC a_pExtPackDesc) 101 101 { 102 102 /* … … 106 106 if ( !pVBoxExtPackElm 107 107 || strcmp(pVBoxExtPackElm->getName(), "VirtualBoxExtensionPack") != 0) 108 return new iprt::MiniString("No VirtualBoxExtensionPack element");109 110 iprt::MiniString strFormatVersion;108 return new RTCString("No VirtualBoxExtensionPack element"); 109 110 RTCString strFormatVersion; 111 111 if (!pVBoxExtPackElm->getAttributeValue("version", strFormatVersion)) 112 return new iprt::MiniString("Missing format version");112 return new RTCString("Missing format version"); 113 113 if (!strFormatVersion.equals("1.0")) 114 return &(new iprt::MiniString("Unsupported format version: "))->append(strFormatVersion);114 return &(new RTCString("Unsupported format version: "))->append(strFormatVersion); 115 115 116 116 /* … … 119 119 const xml::ElementNode *pNameElm = pVBoxExtPackElm->findChildElement("Name"); 120 120 if (!pNameElm) 121 return new iprt::MiniString("The 'Name' element is missing");121 return new RTCString("The 'Name' element is missing"); 122 122 const char *pszName = pNameElm->getValue(); 123 123 if (!VBoxExtPackIsValidName(pszName)) 124 return &(new iprt::MiniString("Invalid name: "))->append(pszName);124 return &(new RTCString("Invalid name: "))->append(pszName); 125 125 126 126 const xml::ElementNode *pDescElm = pVBoxExtPackElm->findChildElement("Description"); 127 127 if (!pDescElm) 128 return new iprt::MiniString("The 'Description' element is missing");128 return new RTCString("The 'Description' element is missing"); 129 129 const char *pszDesc = pDescElm->getValue(); 130 130 if (!pszDesc || *pszDesc == '\0') 131 return new iprt::MiniString("The 'Description' element is empty");131 return new RTCString("The 'Description' element is empty"); 132 132 if (strpbrk(pszDesc, "\n\r\t\v\b") != NULL) 133 return new iprt::MiniString("The 'Description' must not contain control characters");133 return new RTCString("The 'Description' must not contain control characters"); 134 134 135 135 const xml::ElementNode *pVersionElm = pVBoxExtPackElm->findChildElement("Version"); 136 136 if (!pVersionElm) 137 return new iprt::MiniString("The 'Version' element is missing");137 return new RTCString("The 'Version' element is missing"); 138 138 const char *pszVersion = pVersionElm->getValue(); 139 139 if (!pszVersion || *pszVersion == '\0') 140 return new iprt::MiniString("The 'Version' element is empty");140 return new RTCString("The 'Version' element is empty"); 141 141 if (!VBoxExtPackIsValidVersionString(pszVersion)) 142 return &(new iprt::MiniString("Invalid version string: "))->append(pszVersion);142 return &(new RTCString("Invalid version string: "))->append(pszVersion); 143 143 144 144 uint32_t uRevision; … … 148 148 const xml::ElementNode *pMainModuleElm = pVBoxExtPackElm->findChildElement("MainModule"); 149 149 if (!pMainModuleElm) 150 return new iprt::MiniString("The 'MainModule' element is missing");150 return new RTCString("The 'MainModule' element is missing"); 151 151 const char *pszMainModule = pMainModuleElm->getValue(); 152 152 if (!pszMainModule || *pszMainModule == '\0') 153 return new iprt::MiniString("The 'MainModule' element is empty");153 return new RTCString("The 'MainModule' element is empty"); 154 154 if (!VBoxExtPackIsValidModuleString(pszMainModule)) 155 return &(new iprt::MiniString("Invalid main module string: "))->append(pszMainModule);155 return &(new RTCString("Invalid main module string: "))->append(pszMainModule); 156 156 157 157 /* … … 167 167 pszVrdeModule = NULL; 168 168 else if (!VBoxExtPackIsValidModuleString(pszVrdeModule)) 169 return &(new iprt::MiniString("Invalid VRDE module string: "))->append(pszVrdeModule);169 return &(new RTCString("Invalid VRDE module string: "))->append(pszVrdeModule); 170 170 } 171 171 … … 181 181 uint32_t cPlugIns = 0; 182 182 PVBOXEXTPACKPLUGINDESC paPlugIns = NULL; 183 iprt::MiniString *pstrRet = vboxExtPackLoadPlugInDescs(pVBoxExtPackElm, &cPlugIns, &paPlugIns);183 RTCString *pstrRet = vboxExtPackLoadPlugInDescs(pVBoxExtPackElm, &cPlugIns, &paPlugIns); 184 184 if (pstrRet) 185 185 { … … 214 214 * attribs). Optional. 215 215 */ 216 iprt::MiniString *VBoxExtPackLoadDesc(const char *a_pszDir, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo)216 RTCString *VBoxExtPackLoadDesc(const char *a_pszDir, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo) 217 217 { 218 218 vboxExtPackClearDesc(a_pExtPackDesc); … … 224 224 int vrc = RTPathJoin(szFilePath, sizeof(szFilePath), a_pszDir, VBOX_EXTPACK_DESCRIPTION_NAME); 225 225 if (RT_FAILURE(vrc)) 226 return new iprt::MiniString("RTPathJoin failed with %Rrc", vrc);226 return new RTCString("RTPathJoin failed with %Rrc", vrc); 227 227 228 228 RTFSOBJINFO ObjInfo; 229 229 vrc = RTPathQueryInfoEx(szFilePath, &ObjInfo, RTFSOBJATTRADD_UNIX, RTPATH_F_ON_LINK); 230 230 if (RT_FAILURE(vrc)) 231 return &(new iprt::MiniString())->printf("RTPathQueryInfoEx failed with %Rrc", vrc);231 return &(new RTCString())->printf("RTPathQueryInfoEx failed with %Rrc", vrc); 232 232 if (a_pObjInfo) 233 233 *a_pObjInfo = ObjInfo; … … 235 235 { 236 236 if (RTFS_IS_SYMLINK(ObjInfo.Attr.fMode)) 237 return new iprt::MiniString("The XML file is symlinked, that is not allowed");238 return &(new iprt::MiniString)->printf("The XML file is not a file (fMode=%#x)", ObjInfo.Attr.fMode);237 return new RTCString("The XML file is symlinked, that is not allowed"); 238 return &(new RTCString)->printf("The XML file is not a file (fMode=%#x)", ObjInfo.Attr.fMode); 239 239 } 240 240 … … 248 248 catch (xml::XmlError Err) 249 249 { 250 return new iprt::MiniString(Err.what());250 return new RTCString(Err.what()); 251 251 } 252 252 } … … 268 268 * attribs). Optional. 269 269 */ 270 iprt::MiniString *VBoxExtPackLoadDescFromVfsFile(RTVFSFILE hVfsFile, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo)270 RTCString *VBoxExtPackLoadDescFromVfsFile(RTVFSFILE hVfsFile, PVBOXEXTPACKDESC a_pExtPackDesc, PRTFSOBJINFO a_pObjInfo) 271 271 { 272 272 vboxExtPackClearDesc(a_pExtPackDesc); … … 278 278 int rc = RTVfsFileQueryInfo(hVfsFile, &ObjInfo, RTFSOBJATTRADD_UNIX); 279 279 if (RT_FAILURE(rc)) 280 return &(new iprt::MiniString)->printf("RTVfsFileQueryInfo failed: %Rrc", rc);280 return &(new RTCString)->printf("RTVfsFileQueryInfo failed: %Rrc", rc); 281 281 if (a_pObjInfo) 282 282 *a_pObjInfo = ObjInfo; … … 289 289 /* Check the file size. */ 290 290 if (ObjInfo.cbObject > _1M || ObjInfo.cbObject < 0) 291 return &(new iprt::MiniString)->printf("The XML file is too large (%'RU64 bytes)", ObjInfo.cbObject);291 return &(new RTCString)->printf("The XML file is too large (%'RU64 bytes)", ObjInfo.cbObject); 292 292 size_t const cbFile = (size_t)ObjInfo.cbObject; 293 293 … … 295 295 rc = RTVfsFileSeek(hVfsFile, 0, RTFILE_SEEK_BEGIN, NULL); 296 296 if (RT_FAILURE(rc)) 297 return &(new iprt::MiniString)->printf("RTVfsFileSeek(,0,BEGIN) failed: %Rrc", rc);297 return &(new RTCString)->printf("RTVfsFileSeek(,0,BEGIN) failed: %Rrc", rc); 298 298 299 299 /* Allocate memory and read the file content into it. */ 300 300 void *pvFile = RTMemTmpAlloc(cbFile); 301 301 if (!pvFile) 302 return &(new iprt::MiniString)->printf("RTMemTmpAlloc(%zu) failed", cbFile);303 304 iprt::MiniString *pstrErr = NULL;302 return &(new RTCString)->printf("RTMemTmpAlloc(%zu) failed", cbFile); 303 304 RTCString *pstrErr = NULL; 305 305 rc = RTVfsFileRead(hVfsFile, pvFile, cbFile, NULL); 306 306 if (RT_FAILURE(rc)) 307 pstrErr = &(new iprt::MiniString)->printf("RTVfsFileRead failed: %Rrc", rc);307 pstrErr = &(new RTCString)->printf("RTVfsFileRead failed: %Rrc", rc); 308 308 309 309 /* … … 314 314 { 315 315 xml::XmlMemParser Parser; 316 iprt::MiniString strFileName = VBOX_EXTPACK_DESCRIPTION_NAME;316 RTCString strFileName = VBOX_EXTPACK_DESCRIPTION_NAME; 317 317 try 318 318 { … … 321 321 catch (xml::XmlError Err) 322 322 { 323 pstrErr = new iprt::MiniString(Err.what());323 pstrErr = new RTCString(Err.what()); 324 324 rc = VERR_PARSE_ERROR; 325 325 } … … 366 366 * @param pszTarball The path to the tarball. 367 367 */ 368 iprt::MiniString *VBoxExtPackExtractNameFromTarballPath(const char *pszTarball)368 RTCString *VBoxExtPackExtractNameFromTarballPath(const char *pszTarball) 369 369 { 370 370 /* … … 470 470 * @sa VBoxExtPackUnmangleName, VBoxExtPackIsValidMangledName 471 471 */ 472 iprt::MiniString *VBoxExtPackMangleName(const char *pszName)472 RTCString *VBoxExtPackMangleName(const char *pszName) 473 473 { 474 474 AssertReturn(VBoxExtPackIsValidName(pszName), NULL); … … 486 486 Assert(VBoxExtPackIsValidMangledName(szTmp)); 487 487 488 return new iprt::MiniString(szTmp, off);488 return new RTCString(szTmp, off); 489 489 } 490 490 … … 498 498 * @sa VBoxExtPackMangleName, VBoxExtPackIsValidMangledName 499 499 */ 500 iprt::MiniString *VBoxExtPackUnmangleName(const char *pszMangledName, size_t cchMax)500 RTCString *VBoxExtPackUnmangleName(const char *pszMangledName, size_t cchMax) 501 501 { 502 502 AssertReturn(VBoxExtPackIsValidMangledName(pszMangledName, cchMax), NULL); … … 517 517 AssertReturn(VBoxExtPackIsValidName(szTmp), NULL); 518 518 519 return new iprt::MiniString(szTmp, off);519 return new RTCString(szTmp, off); 520 520 } 521 521 … … 535 535 AssertReturn(VBoxExtPackIsValidName(pszName), VERR_INTERNAL_ERROR_5); 536 536 537 iprt::MiniString *pstrMangledName = VBoxExtPackMangleName(pszName);537 RTCString *pstrMangledName = VBoxExtPackMangleName(pszName); 538 538 if (!pstrMangledName) 539 539 return VERR_INTERNAL_ERROR_4; … … 665 665 */ 666 666 VBOXEXTPACKDESC ExtPackDesc; 667 iprt::MiniString *pstrErr = VBoxExtPackLoadDescFromVfsFile(hXmlFile, &ExtPackDesc, NULL);667 RTCString *pstrErr = VBoxExtPackLoadDescFromVfsFile(hXmlFile, &ExtPackDesc, NULL); 668 668 if (pstrErr) 669 669 {
Note:
See TracChangeset
for help on using the changeset viewer.