From: Dan Nicholson Date: Sat, 24 Jan 2009 02:05:12 +0000 (-0800) Subject: makekeys: No need for strncat X-Git-Tag: accepted/2.0alpha-wayland/20121109.204519~510 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d60166b507096ade932d0881555e99f4dc8836bb;p=profile%2Fivi%2Flibxkbcommon.git makekeys: No need for strncat --- diff --git a/src/makekeys/makekeys.c b/src/makekeys/makekeys.c index 07ba3ce..8fa6dda 100644 --- a/src/makekeys/makekeys.c +++ b/src/makekeys/makekeys.c @@ -132,8 +132,7 @@ get_xf86_keysym(const char *buf, char *key, size_t len, int index) return 0; /* Prepend XF86 or XF86_ to the key */ - snprintf(key, len, "XF86%s", is_xf86_special(tmp) ? "_" : ""); - strncat(key, tmp, len - strlen(key) - 1); + snprintf(key, len, "XF86%s%s", is_xf86_special(tmp) ? "_" : "", tmp); return 1; } @@ -147,17 +146,16 @@ get_xf86_keysym_alias(const char *buf, char *key, size_t len, int index) /* Try to handle both XF86XK and XK aliases */ if (sscanf(buf, "#define XF86XK_%127s XF86XK_%127s", ktmp, atmp) == 2) { /* Prepend XF86 to the key and alias */ - snprintf(key, len, "XF86%s", is_xf86_special(ktmp) ? "_" : ""); - strncat(key, ktmp, len - strlen(key) - 1); - snprintf(alias, sizeof(alias), "XF86%s", - is_xf86_special(atmp) ? "_" : ""); - strncat(alias, atmp, sizeof(alias) - strlen(alias) - 1); + snprintf(key, len, "XF86%s%s", is_xf86_special(ktmp) ? "_" : "", + ktmp); + snprintf(alias, sizeof(alias), "XF86%s%s", + is_xf86_special(atmp) ? "_" : "", atmp); } else { if (sscanf(buf, "#define XF86XK_%127s XK_%127s", ktmp, alias) != 2) return 0; /* Prepend XF86 to the key */ - snprintf(key, len, "XF86%s", is_xf86_special(ktmp) ? "_" : ""); - strncat(key, ktmp, len - strlen(key) - 1); + snprintf(key, len, "XF86%s%s", is_xf86_special(ktmp) ? "_" : "", + ktmp); } for (i = index - 1; i >= 0; i--) {