Changeset 21746 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jul 21, 2009 12:58:49 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/checksum/manifest.cpp
r21742 r21746 57 57 *******************************************************************************/ 58 58 59 RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST p TestList, size_t cTests, size_t *pcFileIndexOnFailure)59 RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed) 60 60 { 61 61 /* Validate input */ 62 if (!pszManifestFile || !p TestList)63 { 64 AssertMsgFailed(("Must supply pszManifestFile and p TestList!\n"));62 if (!pszManifestFile || !paTests) 63 { 64 AssertMsgFailed(("Must supply pszManifestFile and paTests!\n")); 65 65 return VERR_INVALID_PARAMETER; 66 66 } … … 77 77 /* Fill our compare list */ 78 78 for (size_t i=0; i < cTests; ++i) 79 pFileList[i].pTestPattern = &p TestList[i];79 pFileList[i].pTestPattern = &paTests[i]; 80 80 81 81 /* Parse the manifest file line by line */ … … 173 173 if (RTStrICmp(pFileList[i].pszManifestDigest, pFileList[i].pTestPattern->pszTestDigest)) 174 174 { 175 if (p cFileIndexOnFailure)176 *p cFileIndexOnFailure= i;175 if (piFailed) 176 *piFailed = i; 177 177 rc = VERR_MANIFEST_DIGEST_MISMATCH; 178 178 break; … … 194 194 } 195 195 196 RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * *ppszFiles, size_t cFiles, size_t *pcFileIndexOnFailure)196 RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed) 197 197 { 198 198 /* Validate input */ 199 if (!pszManifestFile || !p pszFiles)200 { 201 AssertMsgFailed(("Must supply pszManifestFile and p pszFiles!\n"));199 if (!pszManifestFile || !papszFiles) 200 { 201 AssertMsgFailed(("Must supply pszManifestFile and papszFiles!\n")); 202 202 return VERR_INVALID_PARAMETER; 203 203 } … … 213 213 { 214 214 char *pszDigest; 215 rc = RTSHA1Digest(p pszFiles[i], &pszDigest);215 rc = RTSHA1Digest(papszFiles[i], &pszDigest); 216 216 if (RT_FAILURE(rc)) 217 217 break; 218 pFileList[i].pszTestFile = (char*)p pszFiles[i];218 pFileList[i].pszTestFile = (char*)papszFiles[i]; 219 219 pFileList[i].pszTestDigest = pszDigest; 220 220 } 221 221 /* Do the verify */ 222 222 if (RT_SUCCESS(rc)) 223 rc = RTManifestVerify(pszManifestFile, pFileList, cFiles, p cFileIndexOnFailure);223 rc = RTManifestVerify(pszManifestFile, pFileList, cFiles, piFailed); 224 224 225 225 /* Cleanup */ … … 234 234 } 235 235 236 RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * *ppszFiles, size_t cFiles)236 RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles) 237 237 { 238 238 /* Validate input */ 239 if (!pszManifestFile || !p pszFiles)240 { 241 AssertMsgFailed(("Must supply pszManifestFile and p pszFiles!\n"));239 if (!pszManifestFile || !papszFiles) 240 { 241 AssertMsgFailed(("Must supply pszManifestFile and papszFiles!\n")); 242 242 return VERR_INVALID_PARAMETER; 243 243 } … … 253 253 /* Calculate the SHA1 digest of every file */ 254 254 char *pszDigest; 255 rc = RTSHA1Digest(p pszFiles[i], &pszDigest);255 rc = RTSHA1Digest(papszFiles[i], &pszDigest); 256 256 if (RT_FAILURE(rc)) 257 257 break; 258 258 /* Add the entry to the manifest file */ 259 int cbRet = RTStrmPrintf(pStream, "SHA1 (%s)= %s\n", RTPathFilename(p pszFiles[i]), pszDigest);259 int cbRet = RTStrmPrintf(pStream, "SHA1 (%s)= %s\n", RTPathFilename(papszFiles[i]), pszDigest); 260 260 RTStrFree(pszDigest); 261 261 if (cbRet < 0)
Note:
See TracChangeset
for help on using the changeset viewer.