[Spice-devel] [PATCH 03/18] worker: improve some pre-conditions
Frediano Ziglio
fziglio at redhat.com
Fri Nov 20 03:17:27 PST 2015
From: Marc-André Lureau <marcandre.lureau at gmail.com>
---
server/red_worker.c | 35 ++---------------------------------
1 file changed, 2 insertions(+), 33 deletions(-)
diff --git a/server/red_worker.c b/server/red_worker.c
index 6e859fe..f6dfe28 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -223,8 +223,8 @@ void drawable_pipe_item_unref(DrawablePipeItem *dpi)
return;
}
- spice_warn_if_fail(!ring_item_is_linked(&dpi->dpi_pipe_item.link));
- spice_warn_if_fail(!ring_item_is_linked(&dpi->base));
+ spice_return_if_fail(!ring_item_is_linked(&dpi->dpi_pipe_item.link));
+ spice_return_if_fail(!ring_item_is_linked(&dpi->base));
display_channel_drawable_unref(display, dpi->drawable);
free(dpi);
}
@@ -236,33 +236,6 @@ QXLInstance* red_worker_get_qxl(RedWorker *worker)
return worker->qxl;
}
-static int validate_drawable_bbox(RedWorker *worker, RedDrawable *drawable)
-{
- DrawContext *context;
- uint32_t surface_id = drawable->surface_id;
-
- /* surface_id must be validated before calling into
- * validate_drawable_bbox
- */
- VALIDATE_SURFACE_RETVAL(worker->display_channel, surface_id, FALSE);
- context = &worker->display_channel->surfaces[surface_id].context;
-
- if (drawable->bbox.top < 0)
- return FALSE;
- if (drawable->bbox.left < 0)
- return FALSE;
- if (drawable->bbox.bottom < 0)
- return FALSE;
- if (drawable->bbox.right < 0)
- return FALSE;
- if (drawable->bbox.bottom > context->height)
- return FALSE;
- if (drawable->bbox.right > context->width)
- return FALSE;
-
- return TRUE;
-}
-
static inline int validate_surface(DisplayChannel *display, uint32_t surface_id)
{
if SPICE_UNLIKELY(surface_id >= display->n_surfaces) {
@@ -1098,10 +1071,6 @@ static Drawable *get_drawable(RedWorker *worker, uint8_t effect, RedDrawable *re
int x;
VALIDATE_SURFACE_RETVAL(display, red_drawable->surface_id, NULL)
- if (!validate_drawable_bbox(worker, red_drawable)) {
- rendering_incorrect(__func__);
- return NULL;
- }
for (x = 0; x < 3; ++x) {
if (red_drawable->surface_deps[x] != -1) {
VALIDATE_SURFACE_RETVAL(display, red_drawable->surface_deps[x], NULL)
--
2.4.3
More information about the Spice-devel
mailing list