Index: /trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp
===================================================================
--- /trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp	(revision 54948)
+++ /trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp	(revision 54949)
@@ -48,6 +48,6 @@
 typedef struct DSOUNDHOSTCFG
 {
-    int     cbBufferIn;
-    int     cbBufferOut;
+    DWORD   cbBufferIn;
+    DWORD   cbBufferOut;
     RTUUID  uuidPlay;
     LPCGUID pGuidPlay;
@@ -115,7 +115,7 @@
 static void dsoundDevRemove(PDSOUNDDEV pDev);
 
-static size_t dsoundRingDistance(size_t offEnd, size_t offBegin, size_t cSize)
-{
-    return offEnd >= offBegin ? offEnd - offBegin: cSize - offBegin + offEnd;
+static DWORD dsoundRingDistance(DWORD offEnd, DWORD offBegin, DWORD cSize)
+{
+    return offEnd >= offBegin ? offEnd - offBegin : cSize - offBegin + offEnd;
 }
 
@@ -367,5 +367,5 @@
 static int dsoundPlayOpen(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMOUT pDSoundStrmOut)
 {
-    DSLOG(("DSound: playback open %p size %d bytes, freq %d, chan %d, bits %d, sign %d\n",
+    DSLOG(("DSound: playback open %p size %u bytes, freq %u, chan %u, bits %u, sign %d\n",
            pDSoundStrmOut,
            pThis->cfg.cbBufferOut,
@@ -696,5 +696,5 @@
 static int dsoundCaptureOpen(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMIN pDSoundStrmIn)
 {
-    DSLOG(("DSound: capture open %p size %d bytes freq %d, chan %d, bits %d, sign %d\n",
+    DSLOG(("DSound: capture open %p size %u bytes freq %u, chan %u, bits %u, sign %d\n",
            pDSoundStrmIn,
            pThis->cfg.cbBufferIn,
@@ -792,5 +792,5 @@
         if (bc.dwBufferBytes != pThis->cfg.cbBufferIn)
         {
-            DSLOGREL(("DSound: buffer size mismatch dsound %d, requested %d bytes\n",
+            DSLOGREL(("DSound: buffer size mismatch dsound %u, requested %u bytes\n",
                       bc.dwBufferBytes, pThis->cfg.cbBufferIn));
         }
@@ -1075,5 +1075,5 @@
 
     int cShift = pHstStrmOut->Props.cShift;
-    int cbBuffer = pDSoundStrmOut->csPlaybackBufferSize << cShift;
+    DWORD cbBuffer = pDSoundStrmOut->csPlaybackBufferSize << cShift;
 
     DWORD cbPlayPos, cbWritePos;
@@ -1106,5 +1106,5 @@
     }
 
-    int cbFree;
+    DWORD cbFree;
     DWORD cbPlayWritePos;
     if (pDSoundStrmOut->fReinitPlayPos)
@@ -1115,5 +1115,5 @@
 
         cbPlayWritePos = pDSoundStrmOut->cbPlayWritePos;
-        cbFree = cbBuffer - (int)dsoundRingDistance(cbWritePos, cbPlayPos, cbBuffer);
+        cbFree = cbBuffer - dsoundRingDistance(cbWritePos, cbPlayPos, cbBuffer);
     }
     else
@@ -1128,9 +1128,9 @@
 
         cbPlayWritePos = pDSoundStrmOut->cbPlayWritePos;
-        cbFree = (int)dsoundRingDistance(cbPlayPos, cbPlayWritePos, cbBuffer);
+        cbFree = dsoundRingDistance(cbPlayPos, cbPlayWritePos, cbBuffer);
     }
 
     uint32_t csLive = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
-    int cbLive = csLive << cShift;
+    uint32_t cbLive = csLive << cShift;
 
     /* Do not write more than available space in the DirectSound playback buffer. */
@@ -1138,5 +1138,5 @@
 
     cbLive &= ~pHstStrmOut->Props.uAlign;
-    if (cbLive <= 0 || cbLive > cbBuffer)
+    if (cbLive == 0 || cbLive > cbBuffer)
     {
         DSLOG(("DSound: cbLive=%d cbBuffer=%d cbPlayWritePos=%d cbPlayPos=%d\n",
@@ -1354,5 +1354,5 @@
 
     /* Get number of free samples in the mix buffer and check that is has free space */
-    size_t csMixFree = audioMixBufFree(&pHstStrmIn->MixBuf);
+    uint32_t csMixFree = audioMixBufFree(&pHstStrmIn->MixBuf);
     if (csMixFree == 0)
     {
@@ -1363,5 +1363,5 @@
     }
 
-    LogFlow(("DSound: CaptureIn csMixFree = %d, csReadPos = %d, csCaptureReadPos = %d, csCaptured = %d\n",
+    LogFlow(("DSound: CaptureIn csMixFree = %u, csReadPos = %d, csCaptureReadPos = %d, csCaptured = %u\n",
              csMixFree, csReadPos, pDSoundStrmIn->csCaptureReadPos, csCaptured));
 
@@ -1568,6 +1568,10 @@
 static void dSoundConfigInit(PDRVHOSTDSOUND pThis, PCFGMNODE pCfg)
 {
-    CFGMR3QuerySIntDef(pCfg, "BufsizeOut",       &pThis->cfg.cbBufferOut,       _16K);
-    CFGMR3QuerySIntDef(pCfg, "BufsizeIn",        &pThis->cfg.cbBufferIn,        _16K);
+    uint32_t    uBufsizeOut, uBufsizeIn;
+
+    CFGMR3QueryUIntDef(pCfg, "BufsizeOut",       &uBufsizeOut,      _16K);
+    CFGMR3QueryUIntDef(pCfg, "BufsizeIn",        &uBufsizeIn,       _16K);
+    pThis->cfg.cbBufferOut = uBufsizeOut;
+    pThis->cfg.cbBufferIn  = uBufsizeIn;
 
     pThis->cfg.pGuidPlay    = dsoundConfigQueryGUID(pCfg, "DeviceGuidOut", &pThis->cfg.uuidPlay);
