VirtualBox

Changeset 54783 in vbox


Ignore:
Timestamp:
Mar 16, 2015 1:18:12 PM (10 years ago)
Author:
vboxsync
Message:

VMSVGA3D: Corrected realloc calls.

Location:
trunk/src/VBox/Devices/Graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r54772 r54783  
    26272627    if (sid >= pState->cSurfaces)
    26282628    {
    2629         pState->paSurface = (PVMSVGA3DSURFACE )RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
    2630         AssertReturn(pState->paSurface, VERR_NO_MEMORY);
     2629        void *pvNew = RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
     2630        AssertReturn(pvNew, VERR_NO_MEMORY);
     2631        pState->paSurface = (PVMSVGA3DSURFACE)pvNew;
    26312632        memset(&pState->paSurface[pState->cSurfaces], 0, sizeof(VMSVGA3DSURFACE) * (sid + 1 - pState->cSurfaces));
    26322633        for (uint32_t i = pState->cSurfaces; i < sid + 1; i++)
     
    42384239        if (cid >= pState->cContexts)
    42394240        {
    4240             pState->paContext = (PVMSVGA3DCONTEXT)RTMemRealloc(pState->paContext, sizeof(VMSVGA3DCONTEXT) * (cid + 1));
    4241             AssertReturn(pState->paContext, VERR_NO_MEMORY);
     4241            void *pvNew = RTMemRealloc(pState->paContext, sizeof(VMSVGA3DCONTEXT) * (cid + 1));
     4242            AssertReturn(pvNew, VERR_NO_MEMORY);
     4243            pState->paContext = (PVMSVGA3DCONTEXT)pvNew;
    42424244            memset(&pState->paContext[pState->cContexts], 0, sizeof(VMSVGA3DCONTEXT) * (cid + 1 - pState->cContexts));
    42434245            for (uint32_t i = pState->cContexts; i < cid + 1; i++)
     
    74297431        if (shid >= pContext->cVertexShaders)
    74307432        {
    7431             pContext->paVertexShader = (PVMSVGA3DSHADER)RTMemRealloc(pContext->paVertexShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
    7432             AssertReturn(pContext->paVertexShader, VERR_NO_MEMORY);
     7433            void *pvNew = RTMemRealloc(pContext->paVertexShader, sizeof(VMSVGA3DSHADER) * (shid + 1))
     7434            AssertReturn(pvNew, VERR_NO_MEMORY);
     7435            pContext->paVertexShader = (PVMSVGA3DSHADER)pvNew;
    74337436            memset(&pContext->paVertexShader[pContext->cVertexShaders], 0, sizeof(VMSVGA3DSHADER) * (shid + 1 - pContext->cVertexShaders));
    74347437            for (uint32_t i = pContext->cVertexShaders; i < shid + 1; i++)
     
    74477450        if (shid >= pContext->cPixelShaders)
    74487451        {
    7449             pContext->paPixelShader = (PVMSVGA3DSHADER)RTMemRealloc(pContext->paPixelShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
    7450             AssertReturn(pContext->paPixelShader, VERR_NO_MEMORY);
     7452            void *pvNew = RTMemRealloc(pContext->paPixelShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
     7453            AssertReturn(pvNew, VERR_NO_MEMORY);
     7454            pContext->paPixelShader = (PVMSVGA3DSHADER)pvNew;
    74517455            memset(&pContext->paPixelShader[pContext->cPixelShaders], 0, sizeof(VMSVGA3DSHADER) * (shid + 1 - pContext->cPixelShaders));
    74527456            for (uint32_t i = pContext->cPixelShaders; i < shid + 1; i++)
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp

    r54766 r54783  
    13981398    if (sid >= pState->cSurfaces)
    13991399    {
    1400         pState->paSurface = (PVMSVGA3DSURFACE )RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
    1401         AssertReturn(pState->paSurface, VERR_NO_MEMORY);
     1400        void *pvNew = RTMemRealloc(pState->paSurface, sizeof(VMSVGA3DSURFACE) * (sid + 1));
     1401        AssertReturn(pvNew, VERR_NO_MEMORY);
     1402        pState->paSurface = (PVMSVGA3DSURFACE)pvNew;
    14021403        memset(&pState->paSurface[pState->cSurfaces], 0, sizeof(VMSVGA3DSURFACE) * (sid + 1 - pState->cSurfaces));
    14031404        for (uint32_t i = pState->cSurfaces; i < sid + 1; i++)
     
    16331634        Assert(pSurface->pSharedObjectTree == NULL);
    16341635
    1635         switch (pSurface->flags & (SVGA3D_SURFACE_HINT_INDEXBUFFER | SVGA3D_SURFACE_HINT_VERTEXBUFFER | SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET | SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_CUBEMAP))
     1636        switch (pSurface->flags & (  SVGA3D_SURFACE_HINT_INDEXBUFFER  | SVGA3D_SURFACE_HINT_VERTEXBUFFER
     1637                                   | SVGA3D_SURFACE_HINT_TEXTURE      | SVGA3D_SURFACE_HINT_RENDERTARGET
     1638                                   | SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_CUBEMAP))
    16361639        {
    16371640        case SVGA3D_SURFACE_CUBEMAP:
     
    29212924    if (cid >= pState->cContexts)
    29222925    {
    2923         pState->paContext = (PVMSVGA3DCONTEXT)RTMemRealloc(pState->paContext, sizeof(VMSVGA3DCONTEXT) * (cid + 1));
    2924         AssertReturn(pState->paContext, VERR_NO_MEMORY);
     2926        void *pvNew = RTMemRealloc(pState->paContext, sizeof(VMSVGA3DCONTEXT) * (cid + 1));
     2927        AssertReturn(pvNew, VERR_NO_MEMORY);
     2928        pState->paContext = (PVMSVGA3DCONTEXT)pvNew;
    29252929        memset(&pState->paContext[pState->cContexts], 0, sizeof(VMSVGA3DCONTEXT) * (cid + 1 - pState->cContexts));
    29262930        for (uint32_t i = pState->cContexts; i < cid + 1; i++)
     
    57205724        if (shid >= pContext->cVertexShaders)
    57215725        {
    5722             pContext->paVertexShader = (PVMSVGA3DSHADER)RTMemRealloc(pContext->paVertexShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
    5723             AssertReturn(pContext->paVertexShader, VERR_NO_MEMORY);
     5726            void *pvNew = RTMemRealloc(pContext->paVertexShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
     5727            AssertReturn(pvNew, VERR_NO_MEMORY);
     5728            pContext->paVertexShader = (PVMSVGA3DSHADER)pvNew;
    57245729            memset(&pContext->paVertexShader[pContext->cVertexShaders], 0, sizeof(VMSVGA3DSHADER) * (shid + 1 - pContext->cVertexShaders));
    57255730            for (uint32_t i = pContext->cVertexShaders; i < shid + 1; i++)
     
    57385743        if (shid >= pContext->cPixelShaders)
    57395744        {
    5740             pContext->paPixelShader = (PVMSVGA3DSHADER)RTMemRealloc(pContext->paPixelShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
    5741             AssertReturn(pContext->paPixelShader, VERR_NO_MEMORY);
     5745            void *pvNew = RTMemRealloc(pContext->paPixelShader, sizeof(VMSVGA3DSHADER) * (shid + 1));
     5746            AssertReturn(pvNew, VERR_NO_MEMORY);
     5747            pContext->paPixelShader = (PVMSVGA3DSHADER)pvNew;
    57425748            memset(&pContext->paPixelShader[pContext->cPixelShaders], 0, sizeof(VMSVGA3DSHADER) * (shid + 1 - pContext->cPixelShaders));
    57435749            for (uint32_t i = pContext->cPixelShaders; i < shid + 1; i++)
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