Skip to content

Commit

Permalink
ui/vnc-enc-tight: remove switch and have single return
Browse files Browse the repository at this point in the history
When enabling the sanitizer build it will complain about control
reaching a non-void function. Normally the compiler should detect that
there is only one possible exit given a static VNC_SERVER_FB_BYTES.

As we always expect a static VNC_SERVER_FB_BYTES I've added a compile
time assert and just called the sub-function directly.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
stsquad authored and kraxel committed Sep 28, 2016
1 parent 4423184 commit d9d2663
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ui/vnc-enc-tight.c
Expand Up @@ -707,10 +707,8 @@ check_solid_tile32(VncState *vs, int x, int y, int w, int h,
static bool check_solid_tile(VncState *vs, int x, int y, int w, int h,
uint32_t* color, bool samecolor)
{
switch (VNC_SERVER_FB_BYTES) {
case 4:
return check_solid_tile32(vs, x, y, w, h, color, samecolor);
}
QEMU_BUILD_BUG_ON(VNC_SERVER_FB_BYTES != 4);
return check_solid_tile32(vs, x, y, w, h, color, samecolor);
}

static void find_best_solid_area(VncState *vs, int x, int y, int w, int h,
Expand Down

0 comments on commit d9d2663

Please sign in to comment.