From 8b66ebd3faeedb645f33ce9db2ae2626e274aa53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 20 Nov 2013 13:54:00 -0800 Subject: [PATCH] weston-info: Handle shm formats better Use a switch for this and don't fall back to XRGB8888 if we don't recognize the format. --- clients/weston-info.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/clients/weston-info.c b/clients/weston-info.c index 5d928f54..4cc05723 100644 --- a/clients/weston-info.c +++ b/clients/weston-info.c @@ -234,8 +234,20 @@ print_shm_info(void *data) printf("\tformats:"); wl_list_for_each(format, &shm->formats, link) - printf(" %s", (format->format == WL_SHM_FORMAT_ARGB8888) ? - "ARGB8888" : "XRGB8888"); + switch (format->format) { + case WL_SHM_FORMAT_ARGB8888: + printf(" ARGB8888"); + break; + case WL_SHM_FORMAT_XRGB8888: + printf(" XRGB8888"); + break; + case WL_SHM_FORMAT_RGB565: + printf(" RGB565"); + break; + default: + printf(" unknown(%08x)", format->format); + break; + } printf("\n"); }