Mercurial > hg > dmlib
changeset 1425:f08c4ace528d
Simplify dmC64GetImageTypeString().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 15 Nov 2017 07:06:47 +0200 |
parents | b09a9457ffe3 |
children | 4c7b456d7f0b |
files | tools/lib64gfx.c |
diffstat | 1 files changed, 7 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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; }