Changeset 40329 in vbox for trunk/src/VBox/Runtime/common/checksum
- Timestamp:
- Mar 2, 2012 4:13:50 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/checksum/manifest.cpp
r33289 r40329 196 196 } 197 197 198 RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, 198 RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, RTDIGESTTYPE enmDigestType, 199 const char * const *papszFiles, size_t cFiles, 199 200 PFNRTPROGRESS pfnProgressCallback, void *pvUser) 200 201 { … … 239 240 { 240 241 size_t cbSize = 0; 241 rc = RTManifestWriteFilesBuf(&pvBuf, &cbSize, paFiles, cFiles);242 rc = RTManifestWriteFilesBuf(&pvBuf, &cbSize, enmDigestType, paFiles, cFiles); 242 243 if (RT_FAILURE(rc)) 243 244 break; … … 442 443 } 443 444 444 RTR3DECL(int) RTManifestWriteFilesBuf(void **ppvBuf, size_t *pcbSize, PRTMANIFESTTEST paFiles, size_t cFiles)445 RTR3DECL(int) RTManifestWriteFilesBuf(void **ppvBuf, size_t *pcbSize, RTDIGESTTYPE enmDigestType, PRTMANIFESTTEST paFiles, size_t cFiles) 445 446 { 446 447 /* Validate input */ … … 468 469 char * pszTmp = RTStrAlloc(cbMaxSize + 1); 469 470 size_t cbPos = 0; 471 const char *pcszDigestType; 472 switch (enmDigestType) 473 { 474 case RTDIGESTTYPE_CRC32: pcszDigestType = "CRC32:"; break; 475 case RTDIGESTTYPE_CRC64: pcszDigestType = "CRC64:"; break; 476 case RTDIGESTTYPE_MD5: pcszDigestType = "MD5:"; break; 477 case RTDIGESTTYPE_SHA1: pcszDigestType = "SHA1:"; break; 478 case RTDIGESTTYPE_SHA256: pcszDigestType = "SHA256"; break; 479 default: return VERR_INVALID_PARAMETER; 480 } 470 481 for (size_t i = 0; i < cFiles; ++i) 471 482 { 472 size_t cch = RTStrPrintf(pszTmp, cbMaxSize + 1, " SHA1 (%s)= %s\n", RTPathFilename(paFiles[i].pszTestFile), paFiles[i].pszTestDigest);483 size_t cch = RTStrPrintf(pszTmp, cbMaxSize + 1, "%s (%s)= %s\n", pcszDigestType, RTPathFilename(paFiles[i].pszTestFile), paFiles[i].pszTestDigest); 473 484 memcpy(&((char*)pvBuf)[cbPos], pszTmp, cch); 474 485 cbPos += cch;
Note:
See TracChangeset
for help on using the changeset viewer.