[Spice-devel] [PATCH qxl-wddm-dod 06/20] fixup! qxl-wddm-dod: Use rendering offload thread

Frediano Ziglio fziglio at redhat.com
Tue Mar 28 13:27:01 UTC 2017


Do not use reinterpret_cast for allocations if not needed
---
 qxldod/QxlDod.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 8b384a7..6dc50fc 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -3790,7 +3790,7 @@ QxlDevice::ExecutePresentDisplayOnly(
     SIZE_T sizeRects = NumDirtyRects*sizeof(RECT);
     SIZE_T size = sizeof(DoPresentMemory) + sizeMoves + sizeRects;
 
-    QXLDrawable **pDrawables = reinterpret_cast<QXLDrawable **>(new (NonPagedPoolNx) BYTE[sizeof(QXLDrawable *)*(NumDirtyRects + NumMoves + 1)]);
+    QXLDrawable **pDrawables = new (NonPagedPoolNx) QXLDrawable *[NumDirtyRects + NumMoves + 1];
     UINT nIndex = 0;
 
     if (!pDrawables)
@@ -3803,7 +3803,7 @@ QxlDevice::ExecutePresentDisplayOnly(
 
     if (!ctx)
     {
-        delete[] reinterpret_cast<BYTE*>(pDrawables);
+        delete[] pDrawables;
         return STATUS_NO_MEMORY;
     }
 
@@ -3834,7 +3834,7 @@ QxlDevice::ExecutePresentDisplayOnly(
         if(!mdl)
         {
             delete[] reinterpret_cast<BYTE*>(ctx);
-            delete[] reinterpret_cast<BYTE*>(pDrawables);
+            delete[] pDrawables;
             return STATUS_INSUFFICIENT_RESOURCES;
         }
 
@@ -3852,7 +3852,7 @@ QxlDevice::ExecutePresentDisplayOnly(
             Status = GetExceptionCode();
             IoFreeMdl(mdl);
             delete[] reinterpret_cast<BYTE*>(ctx);
-            delete[] reinterpret_cast<BYTE*>(pDrawables);
+            delete[] pDrawables;
             return Status;
         }
 
@@ -3867,7 +3867,7 @@ QxlDevice::ExecutePresentDisplayOnly(
             MmUnlockPages(mdl);
             IoFreeMdl(mdl);
             delete[] reinterpret_cast<BYTE*>(ctx);
-            delete[] reinterpret_cast<BYTE*>(pDrawables);
+            delete[] pDrawables;
             return Status;
         }
 
-- 
2.9.3



More information about the Spice-devel mailing list