summaryrefslogtreecommitdiff
path: root/src/getstring.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-06-07 09:42:39 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2011-07-02 10:09:13 +0200
commite85501e5ef0d990539090f4d12dbb3eae487c971 (patch)
treef3acd91b9e7d076150e6efd3e181fb6ca0b38838 /src/getstring.c
parentc8029a5a1356ee7e684dc6dfe4001bcc739bc2a6 (diff)
downloadcalcurse-e85501e5ef0d990539090f4d12dbb3eae487c971.zip
Use constant for maximum UTF-8 character size
Introduce a UTF8_MAXLEN constant instead of using the literal value "6" at various places. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/getstring.c')
-rw-r--r--src/getstring.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/getstring.c b/src/getstring.c
index 9dd7b8a..3b9e865 100644
--- a/src/getstring.c
+++ b/src/getstring.c
@@ -186,7 +186,7 @@ getstring (WINDOW *win, char *str, int l, int x, int y)
struct getstr_charinfo ci[l + 1];
int ch, k;
- char c[6];
+ char c[UTF8_MAXLEN];
getstr_init (&st, str, ci);
custom_apply_attr (win, ATTR_HIGHEST);
@@ -255,7 +255,8 @@ getstring (WINDOW *win, char *str, int l, int x, int y)
return (GETSTRING_ESC);
break;
default: /* insert one character */
- for (c[0] = ch, k = 1; k < MIN (UTF8_LENGTH (c[0]), 6); k++)
+ c[0] = ch;
+ for (k = 1; k < MIN (UTF8_LENGTH (c[0]), UTF8_MAXLEN); k++)
c[k] = (unsigned char)wgetch (win);
if (st.ci[st.len].offset + k < l)
{