Changeset 38455 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 15, 2011 9:57:51 AM (13 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ApplianceImpl.h
r37862 r38455 150 150 HRESULT readFSOVF(TaskOVF *pTask); 151 151 HRESULT readFSOVA(TaskOVF *pTask); 152 HRESULT readFSImpl(TaskOVF *pTask, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage);152 HRESULT readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage); 153 153 HRESULT readS3(TaskOVF *pTask); 154 154 -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r37862 r38455 841 841 break; 842 842 } 843 rc = readFSImpl(pTask, pSha1Callbacks, &storage); 843 844 rc = readFSImpl(pTask, pTask->locInfo.strPath, pSha1Callbacks, &storage); 844 845 }while(0); 845 846 … … 871 872 PVDINTERFACEIO pSha1Callbacks = 0; 872 873 PVDINTERFACEIO pTarCallbacks = 0; 874 char *pszFilename = 0; 873 875 do 874 876 { 877 vrc = RTTarCurrentFile(tar, &pszFilename); 878 if (RT_FAILURE(vrc)) 879 { 880 rc = VBOX_E_FILE_ERROR; 881 break; 882 } 875 883 pSha1Callbacks = Sha1CreateInterface(); 876 884 if (!pSha1Callbacks) … … 896 904 break; 897 905 } 898 rc = readFSImpl(pTask, p Sha1Callbacks, &storage);906 rc = readFSImpl(pTask, pszFilename, pSha1Callbacks, &storage); 899 907 }while(0); 900 908 … … 902 910 903 911 /* Cleanup */ 912 if (pszFilename) 913 RTMemFree(pszFilename); 904 914 if (pSha1Callbacks) 905 915 RTMemFree(pSha1Callbacks); … … 913 923 } 914 924 915 HRESULT Appliance::readFSImpl(TaskOVF *pTask, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage)925 HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage) 916 926 { 917 927 LogFlowFuncEnter(); … … 924 934 try 925 935 { 926 Utf8Str strOvfFile = Utf8Str(pTask->locInfo.strPath).stripExt().append(".ovf");927 936 /* Read the OVF into a memory buffer */ 928 937 size_t cbSize = 0; 929 int vrc = Sha1ReadBuf(str OvfFile.c_str(), &pvTmpBuf, &cbSize, pCallbacks, pStorage);938 int vrc = Sha1ReadBuf(strFilename.c_str(), &pvTmpBuf, &cbSize, pCallbacks, pStorage); 930 939 if ( RT_FAILURE(vrc) 931 940 || !pvTmpBuf) 932 941 throw setError(VBOX_E_FILE_ERROR, 933 942 tr("Could not read OVF file '%s' (%Rrc)"), 934 RTPathFilename(str OvfFile.c_str()), vrc);943 RTPathFilename(strFilename.c_str()), vrc); 935 944 /* Copy the SHA1 sum of the OVF file for later validation */ 936 945 m->strOVFSHA1Digest = pStorage->strDigest; … … 1300 1309 PVDINTERFACEIO pSha1Callbacks = 0; 1301 1310 PVDINTERFACEIO pTarCallbacks = 0; 1311 char *pszFilename = 0; 1302 1312 void *pvMfBuf = 0; 1303 1313 writeLock.release(); … … 1322 1332 tr("Internal error (%Rrc)"), vrc); 1323 1333 1334 /* Read the file name of the first file (need to be the ovf file). This 1335 * is how all internal files are named. */ 1336 vrc = RTTarCurrentFile(tar, &pszFilename); 1337 if (RT_FAILURE(vrc)) 1338 throw setError(E_FAIL, 1339 tr("Internal error (%Rrc)"), vrc); 1324 1340 /* Skip the OVF file, cause this was read in IAppliance::Read already. */ 1325 1341 vrc = RTTarSeekNextFile(tar); … … 1337 1353 1338 1354 size_t cbMfSize = 0; 1339 Utf8Str strMfFile = Utf8Str(p Task->locInfo.strPath).stripExt().append(".mf");1355 Utf8Str strMfFile = Utf8Str(pszFilename).stripExt().append(".mf"); 1340 1356 /* Create the import stack for the rollback on errors. */ 1341 1357 ImportStack stack(pTask->locInfo, m->pReader->m_mapDisks, pTask->pProgress); … … 1366 1382 { 1367 1383 /* Add the ovf file to the digest list. */ 1368 stack.llSrcDisksDigest.push_front(STRPAIR(Utf8Str(p Task->locInfo.strPath).stripExt().append(".ovf"), m->strOVFSHA1Digest));1384 stack.llSrcDisksDigest.push_front(STRPAIR(Utf8Str(pszFilename).stripExt().append(".ovf"), m->strOVFSHA1Digest)); 1369 1385 rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize); 1370 1386 if (FAILED(rc)) throw rc; … … 1380 1396 1381 1397 /* Cleanup */ 1398 if (pszFilename) 1399 RTMemFree(pszFilename); 1382 1400 if (pvMfBuf) 1383 1401 RTMemFree(pvMfBuf);
Note:
See TracChangeset
for help on using the changeset viewer.