VirtualBox

Changeset 21746 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Jul 21, 2009 12:58:49 PM (16 years ago)
Author:
vboxsync
Message:

Runtime: little corrections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/checksum/manifest.cpp

    r21742 r21746  
    5757*******************************************************************************/
    5858
    59 RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST pTestList, size_t cTests, size_t *pcFileIndexOnFailure)
     59RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed)
    6060{
    6161    /* Validate input */
    62     if (!pszManifestFile || !pTestList)
    63     {
    64         AssertMsgFailed(("Must supply pszManifestFile and pTestList!\n"));
     62    if (!pszManifestFile || !paTests)
     63    {
     64        AssertMsgFailed(("Must supply pszManifestFile and paTests!\n"));
    6565        return VERR_INVALID_PARAMETER;
    6666    }
     
    7777    /* Fill our compare list */
    7878    for (size_t i=0; i < cTests; ++i)
    79         pFileList[i].pTestPattern = &pTestList[i];
     79        pFileList[i].pTestPattern = &paTests[i];
    8080
    8181    /* Parse the manifest file line by line */
     
    173173            if (RTStrICmp(pFileList[i].pszManifestDigest, pFileList[i].pTestPattern->pszTestDigest))
    174174            {
    175                 if (pcFileIndexOnFailure)
    176                     *pcFileIndexOnFailure = i;
     175                if (piFailed)
     176                    *piFailed = i;
    177177                rc = VERR_MANIFEST_DIGEST_MISMATCH;
    178178                break;
     
    194194}
    195195
    196 RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char **ppszFiles, size_t cFiles, size_t *pcFileIndexOnFailure)
     196RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed)
    197197{
    198198    /* Validate input */
    199     if (!pszManifestFile || !ppszFiles)
    200     {
    201         AssertMsgFailed(("Must supply pszManifestFile and ppszFiles!\n"));
     199    if (!pszManifestFile || !papszFiles)
     200    {
     201        AssertMsgFailed(("Must supply pszManifestFile and papszFiles!\n"));
    202202        return VERR_INVALID_PARAMETER;
    203203    }
     
    213213    {
    214214        char *pszDigest;
    215         rc = RTSHA1Digest(ppszFiles[i], &pszDigest);
     215        rc = RTSHA1Digest(papszFiles[i], &pszDigest);
    216216        if (RT_FAILURE(rc))
    217217            break;
    218         pFileList[i].pszTestFile = (char*)ppszFiles[i];
     218        pFileList[i].pszTestFile = (char*)papszFiles[i];
    219219        pFileList[i].pszTestDigest = pszDigest;
    220220    }
    221221    /* Do the verify */
    222222    if (RT_SUCCESS(rc))
    223         rc = RTManifestVerify(pszManifestFile, pFileList, cFiles, pcFileIndexOnFailure);
     223        rc = RTManifestVerify(pszManifestFile, pFileList, cFiles, piFailed);
    224224
    225225    /* Cleanup */
     
    234234}
    235235
    236 RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char **ppszFiles, size_t cFiles)
     236RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles)
    237237{
    238238    /* Validate input */
    239     if (!pszManifestFile || !ppszFiles)
    240     {
    241         AssertMsgFailed(("Must supply pszManifestFile and ppszFiles!\n"));
     239    if (!pszManifestFile || !papszFiles)
     240    {
     241        AssertMsgFailed(("Must supply pszManifestFile and papszFiles!\n"));
    242242        return VERR_INVALID_PARAMETER;
    243243    }
     
    253253        /* Calculate the SHA1 digest of every file */
    254254        char *pszDigest;
    255         rc = RTSHA1Digest(ppszFiles[i], &pszDigest);
     255        rc = RTSHA1Digest(papszFiles[i], &pszDigest);
    256256        if (RT_FAILURE(rc))
    257257            break;
    258258        /* Add the entry to the manifest file */
    259         int cbRet = RTStrmPrintf(pStream, "SHA1 (%s)= %s\n", RTPathFilename(ppszFiles[i]), pszDigest);
     259        int cbRet = RTStrmPrintf(pStream, "SHA1 (%s)= %s\n", RTPathFilename(papszFiles[i]), pszDigest);
    260260        RTStrFree(pszDigest);
    261261        if (cbRet < 0)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette