# HG changeset patch # User Matti Hamalainen # Date 1510722407 -7200 # Node ID f08c4ace528d58aa0ba31e4360741c29ee82c03e # Parent b09a9457ffe34b59220480d80a4daa230e679d25 Simplify dmC64GetImageTypeString(). diff -r b09a9457ffe3 -r f08c4ace528d tools/lib64gfx.c --- a/tools/lib64gfx.c Wed Nov 08 02:38:44 2017 +0200 +++ b/tools/lib64gfx.c Wed Nov 15 07:06:47 2017 +0200 @@ -129,18 +129,13 @@ char * dmC64GetImageTypeString(char *buf, const size_t len, const int type) { - *buf = 0; - - if (type & D64_FMT_FLI) - strncat(buf, "FLI ", len - strlen(buf)); - - strncat(buf, (type & D64_FMT_MC) ? "MCol " : "HiRes ", len - strlen(buf)); - - if (type & D64_FMT_ILACE) - strncat(buf, "Ilace ", len - strlen(buf)); - - if (type & D64_FMT_CHAR) - strncat(buf, "CharMap", len - strlen(buf)); + snprintf(buf, len, + "%s%s%s%s", + (type & D64_FMT_FLI) ? "FLI " : "", + (type & D64_FMT_MC) ? "MCol " : "HiRes ", + (type & D64_FMT_ILACE) ? "Ilace " : "", + (type & D64_FMT_CHAR) ? "CharMap" : "" + ); return buf; }