VirtualBox

Changeset 58539 in vbox


Ignore:
Timestamp:
Oct 31, 2015 9:59:32 AM (9 years ago)
Author:
vboxsync
Message:

DevVGA_VBVA: postpone data offset update, use uintptr_t, cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp

    r58170 r58539  
    315315            *ppHdr = (VBVACMDHDR *)pu8Src;
    316316
    317             /* Advance data offset and sync with guest. */
    318             pVBVAData->off32Data = (pVBVAData->off32Data + cbRecord) % pVBVAData->cbData;
    319             pVBVAData->guest.pVBVA->off32Data = pVBVAData->off32Data;
     317            /* The data offset will be updated in vbvaReleaseCmd. */
    320318        }
    321319        else
     
    353351{
    354352    VBVAPARTIALRECORD *pPartialRecord = &pVBVAData->partialRecord;
    355     uint8_t *au8RingBuffer = pVBVAData->guest.pu8Data;
    356 
    357     if (   (uint8_t *)pHdr >= au8RingBuffer
    358         && (uint8_t *)pHdr < &au8RingBuffer[pVBVAData->cbData])
     353    const uint8_t *au8RingBuffer = pVBVAData->guest.pu8Data;
     354
     355    if (   (uintptr_t)pHdr >= (uintptr_t)au8RingBuffer
     356        && (uintptr_t)pHdr < (uintptr_t)&au8RingBuffer[pVBVAData->cbData])
    359357    {
    360358        /* The pointer is inside ring buffer. Must be continuous chunk. */
    361         Assert(pVBVAData->cbData - ((uint8_t *)pHdr - au8RingBuffer) >= cbCmd);
    362 
    363         /* Do nothing. */
    364 
    365         Assert (!pPartialRecord->pu8 && pPartialRecord->cb == 0);
     359        Assert(pVBVAData->cbData - (uint32_t)((uint8_t *)pHdr - au8RingBuffer) >= cbCmd);
     360
     361        /* Advance data offset and sync with guest. */
     362        pVBVAData->off32Data = (pVBVAData->off32Data + cbCmd) % pVBVAData->cbData;
     363        pVBVAData->guest.pVBVA->off32Data = pVBVAData->off32Data;
     364
     365        Assert(!pPartialRecord->pu8 && pPartialRecord->cb == 0);
    366366    }
    367367    else
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