Index: /trunk/include/iprt/manifest.h
===================================================================
--- /trunk/include/iprt/manifest.h	(revision 30078)
+++ /trunk/include/iprt/manifest.h	(revision 30079)
@@ -51,15 +51,4 @@
 typedef RTMANIFESTTEST* PRTMANIFESTTEST;
 
-/**
- * Manifest progress callback.
- *
- * @returns IPRT status code.
- *
- * @param   uPercent    The progress completion percentage.
- * @param   pvUser      The user defined parameter.
- */
-typedef DECLCALLBACK(int) FNRTMANIFESTPROGRESS(unsigned uPercent, void *pvUser);
-/** Pointer to a manifest progress callback. */
-typedef FNRTMANIFESTPROGRESS *PFNRTMANIFESTPROGRESS;
 
 /**
@@ -97,5 +86,6 @@
  * @param   pvUser               user defined pointer for the callback
  */
-RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed, PFNRTMANIFESTPROGRESS pfnProgressCallback, void *pvUser);
+RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed,
+                                    PFNRTPROGRESS pfnProgressCallback, void *pvUser);
 
 /**
@@ -112,5 +102,6 @@
  * @param   pvUser               user defined pointer for the callback
  */
-RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, PFNRTMANIFESTPROGRESS pfnProgressCallback, void *pvUser);
+RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles,
+                                   PFNRTPROGRESS pfnProgressCallback, void *pvUser);
 
 /** @} */
@@ -118,4 +109,4 @@
 RT_C_DECLS_END
 
-#endif /* ___iprt_manifest_h */
+#endif
 
Index: /trunk/include/iprt/sha.h
===================================================================
--- /trunk/include/iprt/sha.h	(revision 30078)
+++ /trunk/include/iprt/sha.h	(revision 30079)
@@ -35,16 +35,4 @@
  * @{
  */
-
-/**
- * SHA progress callback.
- *
- * @returns IPRT status code.
- *
- * @param   uPercent    The progress completion percentage.
- * @param   pvUser      The user defined parameter.
- */
-typedef DECLCALLBACK(int) FNRTSHAPROGRESS(unsigned uPercent, void *pvUser);
-/** Pointer to a SHA progress callback. */
-typedef FNRTSHAPROGRESS *PFNRTSHAPROGRESS;
 
 /** The size of a SHA-1 hash. */
@@ -135,5 +123,5 @@
  * @param   pvUser                user defined pointer for the callback
  */
-RTR3DECL(int) RTSha1Digest(const char *pszFile, char **ppszDigest, PFNRTSHAPROGRESS pfnProgressCallback, void *pvUser);
+RTR3DECL(int) RTSha1Digest(const char *pszFile, char **ppszDigest, FNRTPROGRESS pfnProgressCallback, void *pvUser);
 
 
Index: /trunk/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp	(revision 30078)
+++ /trunk/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp	(revision 30079)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2009 Oracle Corporation
+ * Copyright (C) 2009-2010 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -32,4 +32,5 @@
 #include <iprt/sha.h>
 
+#include <iprt/alloca.h>
 #include <iprt/assert.h>
 #include <iprt/mem.h>
@@ -39,5 +40,6 @@
 #include <openssl/sha.h>
 
-RTR3DECL(int) RTSha1Digest(const char *pszFile, char **ppszDigest, PFNRTSHAPROGRESS pfnProgressCallback, void *pvUser)
+
+RTR3DECL(int) RTSha1Digest(const char *pszFile, char **ppszDigest, FNRTPROGRESS pfnProgressCallback, void *pvUser)
 {
     /* Validate input */
@@ -47,41 +49,46 @@
 
     *ppszDigest = NULL;
-    int rc = VINF_SUCCESS;
 
-    /* Initialize OpenSSL */
+    /* Initialize OpenSSL. */
     SHA_CTX ctx;
     if (!SHA1_Init(&ctx))
         return VERR_INTERNAL_ERROR;
 
+    /* Open the file to calculate a SHA1 sum of */
+    RTFILE hFile;
+    int rc = RTFileOpen(&hFile, pszFile, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
+    if (RT_FAILURE(rc))
+        return rc;
+
     /* Fetch the file size. Only needed if there is a progress callback. */
-    float multi = 0;
+    double rdMulti = 0;
     if (pfnProgressCallback)
     {
         uint64_t cbFile;
-        rc = RTFileQuerySize(pszFile, &cbFile);
+        rc = RTFileGetSize(hFile, &cbFile);
         if (RT_FAILURE(rc))
+        {
+            RTFileClose(hFile);
             return rc;
-        multi = 100.0 / cbFile;
+        }
+        rdMulti = 100.0 / cbFile;
     }
 
-    /* Open the file to calculate a SHA1 sum of */
-    RTFILE file;
-    rc = RTFileOpen(&file, pszFile, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
-    if (RT_FAILURE(rc))
-        return rc;
+    /* Allocate a reasonably large buffer, fall back on a tiny one. */
+    void  *pvBufFree;
+    size_t cbBuf = _1M;
+    void  *pvBuf = pvBufFree = RTMemTmpAlloc(cbBuf);
+    if (!pvBuf)
+    {
+        cbBuf = 0x1000;
+        pvBuf = alloca(cbBuf);
+    }
 
     /* Read that file in blocks */
-    void *pvBuf = RTMemTmpAlloc(_1M);
-    if (!pvBuf)
-    {
-        RTFileClose(file);
-        rc = VERR_NO_MEMORY;
-    }
     size_t cbRead;
-    size_t cbReadFull = 0;
+    size_t cbReadTotal = 0;
     for (;;)
     {
-        cbRead = 0;
-        rc = RTFileRead(file, pvBuf, _1M, &cbRead);
+        rc = RTFileRead(hFile, pvBuf, cbBuf, &cbRead);
         if (RT_FAILURE(rc) || !cbRead)
             break;
@@ -91,16 +98,16 @@
             break;
         }
-        cbReadFull += cbRead;
-        /* Call progress callback if some is defined */
-        if (   pfnProgressCallback
-            && RT_FAILURE(pfnProgressCallback((unsigned)(cbReadFull * multi), pvUser)))
+        cbReadTotal += cbRead;
+
+        /* Call the progress callback if one is defined */
+        if (pfnProgressCallback)
         {
-            /* Cancel support */
-            rc = VERR_CANCELLED;
-            break;
+            rc = pfnProgressCallback((unsigned)(cbReadTotal * rdMulti), pvUser);
+            if (RT_FAILURE(rc))
+                break; /* canceled */
         }
     }
-    RTMemTmpFree(pvBuf);
-    RTFileClose(file);
+    RTMemTmpFree(pvBufFree);
+    RTFileClose(hFile);
 
     if (RT_FAILURE(rc))
Index: /trunk/src/VBox/Runtime/common/checksum/manifest.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/checksum/manifest.cpp	(revision 30078)
+++ /trunk/src/VBox/Runtime/common/checksum/manifest.cpp	(revision 30079)
@@ -60,5 +60,5 @@
 typedef struct RTMANIFESTCALLBACKDATA
 {
-    PFNRTMANIFESTPROGRESS pfnProgressCallback;
+    PFNRTPROGRESS pfnProgressCallback;
     void *pvUser;
     size_t cMaxFiles;
@@ -67,8 +67,11 @@
 typedef RTMANIFESTCALLBACKDATA* PRTMANIFESTCALLBACKDATA;
 
+
 int rtSHAProgressCallback(unsigned uPercent, void *pvUser)
 {
     PRTMANIFESTCALLBACKDATA pData = (PRTMANIFESTCALLBACKDATA)pvUser;
-    return pData->pfnProgressCallback((unsigned)((uPercent + (float)pData->cCurrentFile * 100.0) / (float)pData->cMaxFiles), pData->pvUser);
+    return pData->pfnProgressCallback((unsigned)(  (uPercent + (float)pData->cCurrentFile * 100.0)
+                                                 / (float)pData->cMaxFiles),
+                                      pData->pvUser);
 }
 
@@ -227,5 +230,6 @@
 
 
-RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed, PFNRTMANIFESTPROGRESS pfnProgressCallback, void *pvUser)
+RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed,
+                                    PFNRTPROGRESS pfnProgressCallback, void *pvUser)
 {
     /* Validate input */
@@ -275,5 +279,6 @@
 
 
-RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, PFNRTMANIFESTPROGRESS pfnProgressCallback, void *pvUser)
+RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles,
+                                   PFNRTPROGRESS pfnProgressCallback, void *pvUser)
 {
     /* Validate input */
