VirtualBox

Ignore:
Timestamp:
Apr 9, 2010 8:15:38 AM (15 years ago)
Author:
vboxsync
Message:

DrvChar.cpp: cosmetics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvChar.cpp

    r28103 r28125  
    2222 * additional information or have any questions.
    2323 */
    24 
    2524
    2625
     
    114113{
    115114    PDRVCHAR pThis = PDMICHAR_2_DRVCHAR(pInterface);
    116     const char *pBuffer = (const char *)pvBuf;
     115    const char *pbBuffer = (const char *)pvBuf;
    117116
    118117    LogFlow(("%s: pvBuf=%#p cbWrite=%d\n", __FUNCTION__, pvBuf, cbWrite));
    119118
    120     for (uint32_t i=0; i<cbWrite; i++)
     119    for (uint32_t i = 0; i < cbWrite; i++)
    121120    {
    122121        uint32_t iOld = pThis->iSendQueueHead;
    123122        uint32_t iNew = (iOld + 1) & CHAR_MAX_SEND_QUEUE_MASK;
    124123
    125         pThis->aSendQueue[iOld] = pBuffer[i];
     124        pThis->aSendQueue[iOld] = pbBuffer[i];
    126125
    127126        STAM_COUNTER_INC(&pThis->StatBytesWritten);
     
    129128        ASMAtomicIncU32(&pThis->cEntries);
    130129        if (pThis->cEntries > CHAR_MAX_SEND_QUEUE_MASK / 2)
    131             pThis->pDrvCharPort->pfnNotifyBufferFull(pThis->pDrvCharPort, true);
     130            pThis->pDrvCharPort->pfnNotifyBufferFull(pThis->pDrvCharPort, true /*fFull*/);
    132131    }
    133132    RTSemEventSignal(pThis->SendSem);
     
    177176
    178177            rc = pThis->pDrvStream->pfnWrite(pThis->pDrvStream, &pThis->aSendQueue[pThis->iSendQueueTail], &cbProcessed);
    179             pThis->pDrvCharPort->pfnNotifyBufferFull(pThis->pDrvCharPort, false);
     178            pThis->pDrvCharPort->pfnNotifyBufferFull(pThis->pDrvCharPort, false /*fFull*/);
    180179            if (RT_SUCCESS(rc))
    181180            {
     
    213212static DECLCALLBACK(int) drvCharReceiveLoop(RTTHREAD ThreadSelf, void *pvUser)
    214213{
    215     PDRVCHAR pThis = (PDRVCHAR)pvUser;
    216     char aBuffer[256], *pBuffer;
    217     size_t cbRemaining, cbProcessed;
    218     int rc;
    219 
    220     cbRemaining = 0;
    221     pBuffer = aBuffer;
     214    PDRVCHAR    pThis = (PDRVCHAR)pvUser;
     215    char        abBuffer[256];
     216    char       *pbRemaining = abBuffer;
     217    size_t      cbRemaining = 0;
     218    int         rc;
     219
    222220    while (!pThis->fShutdown)
    223221    {
     
    227225            if (pThis->pDrvStream)
    228226            {
    229                 cbRemaining = sizeof(aBuffer);
    230                 rc = pThis->pDrvStream->pfnRead(pThis->pDrvStream, aBuffer, &cbRemaining);
     227                pbRemaining = abBuffer;
     228                cbRemaining = sizeof(abBuffer);
     229                rc = pThis->pDrvStream->pfnRead(pThis->pDrvStream, abBuffer, &cbRemaining);
    231230                if (RT_FAILURE(rc))
    232231                {
     
    236235            }
    237236            else
    238             {
    239                 cbRemaining = 0;
    240237                RTThreadSleep(100);
    241             }
    242             pBuffer = aBuffer;
    243238        }
    244239        else
    245240        {
    246241            /* Send data to guest. */
    247             cbProcessed = cbRemaining;
    248             rc = pThis->pDrvCharPort->pfnNotifyRead(pThis->pDrvCharPort, pBuffer, &cbProcessed);
     242            size_t cbProcessed = cbRemaining;
     243            rc = pThis->pDrvCharPort->pfnNotifyRead(pThis->pDrvCharPort, pbRemaining, &cbProcessed);
    249244            if (RT_SUCCESS(rc))
    250245            {
    251246                Assert(cbProcessed);
    252                 pBuffer += cbProcessed;
     247                pbRemaining += cbProcessed;
    253248                cbRemaining -= cbProcessed;
    254249                STAM_COUNTER_ADD(&pThis->StatBytesRead, cbProcessed);
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