Clears gcc warnings: x2jet.c: In function `validate_visual': x2jet.c:1053: warning: format not a string literal, argument types not checked x2jet.c:1055: warning: format not a string literal, argument types not checked x2jet.c:1057: warning: format not a string literal, argument types not checked x2jet.c:1059: warning: format not a string literal, argument types not checked x2jet.c:1064: warning: format not a string literal, argument types not checked
Signed-off-by: Alan Coopersmith <[email protected]> --- x2jet.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/x2jet.c b/x2jet.c index b5eabcc..2811f0f 100644 --- a/x2jet.c +++ b/x2jet.c @@ -1041,27 +1041,35 @@ void download_colors ( } +static _X_INLINE _X_NORETURN +void invalid_depth_for_visual(int depth, const char *name) +{ + fatal_err(catgets(nlmsg_fd,NL_SETN,25, + "%d bit deep %s bitmap not supported.\n"), + depth, name); +} + static void validate_visual(void) { int depth = xwd_header.pixmap_depth; - char *errmsg = catgets(nlmsg_fd,NL_SETN,25, - "%d bit deep %s bitmap not supported.\n"); switch (xwd_header.visual_class) { case GrayScale: - if (depth > 8) fatal_err(errmsg, depth, "GrayScale"); break; + if (depth > 8) invalid_depth_for_visual(depth, "GrayScale"); break; case StaticGray: - if (depth > 8) fatal_err(errmsg, depth, "StaticGray"); break; + if (depth > 8) invalid_depth_for_visual(depth, "StaticGray"); break; case PseudoColor: - if (depth > 8) fatal_err(errmsg, depth, "PseudoColor"); break; + if (depth > 8) invalid_depth_for_visual(depth, "PseudoColor"); break; case StaticColor: - if (depth > 8) fatal_err(errmsg, depth, "StaticColor"); break; + if (depth > 8) invalid_depth_for_visual(depth, "StaticColor"); break; case DirectColor: + if (depth != 12 && depth != 24) + invalid_depth_for_visual(depth, "DirectColor"); + break; case TrueColor: if (depth != 12 && depth != 24) - fatal_err(errmsg, depth, (xwd_header.visual_class == DirectColor) - ? "DirectColor" : "TrueColor"); + invalid_depth_for_visual(depth, "TrueColor"); break; default: fatal_err((catgets(nlmsg_fd,NL_SETN,26, -- 1.7.3.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
