diff options
-rw-r--r-- | draw.c | 4 | ||||
-rw-r--r-- | main.c | 10 |
2 files changed, 7 insertions, 7 deletions
@@ -35,8 +35,8 @@ drawtext(const char *text, unsigned long col[ColLast]) { | |||
35 | return; | 35 | return; |
36 | w = 0; | 36 | w = 0; |
37 | olen = len = strlen(text); | 37 | olen = len = strlen(text); |
38 | if(len >= sizeof(buf)) | 38 | if(len >= sizeof buf) |
39 | len = sizeof(buf) - 1; | 39 | len = sizeof buf - 1; |
40 | memcpy(buf, text, len); | 40 | memcpy(buf, text, len); |
41 | buf[len] = 0; | 41 | buf[len] = 0; |
42 | h = dc.font.ascent + dc.font.descent; | 42 | h = dc.font.ascent + dc.font.descent; |
@@ -144,7 +144,7 @@ kpress(XKeyEvent * e) { | |||
144 | 144 | ||
145 | len = strlen(text); | 145 | len = strlen(text); |
146 | buf[0] = 0; | 146 | buf[0] = 0; |
147 | num = XLookupString(e, buf, sizeof(buf), &ksym, 0); | 147 | num = XLookupString(e, buf, sizeof buf, &ksym, 0); |
148 | if(IsFunctionKey(ksym) || IsKeypadKey(ksym) | 148 | if(IsFunctionKey(ksym) || IsKeypadKey(ksym) |
149 | || IsMiscFunctionKey(ksym) || IsPFKey(ksym) | 149 | || IsMiscFunctionKey(ksym) || IsPFKey(ksym) |
150 | || IsPrivateKeypadKey(ksym)) | 150 | || IsPrivateKeypadKey(ksym)) |
@@ -181,7 +181,7 @@ kpress(XKeyEvent * e) { | |||
181 | case XK_Tab: | 181 | case XK_Tab: |
182 | if(!sel) | 182 | if(!sel) |
183 | return; | 183 | return; |
184 | strncpy(text, sel->text, sizeof(text)); | 184 | strncpy(text, sel->text, sizeof text); |
185 | match(text); | 185 | match(text); |
186 | break; | 186 | break; |
187 | case XK_Right: | 187 | case XK_Right: |
@@ -221,9 +221,9 @@ kpress(XKeyEvent * e) { | |||
221 | if(num && !iscntrl((int) buf[0])) { | 221 | if(num && !iscntrl((int) buf[0])) { |
222 | buf[num] = 0; | 222 | buf[num] = 0; |
223 | if(len > 0) | 223 | if(len > 0) |
224 | strncat(text, buf, sizeof(text)); | 224 | strncat(text, buf, sizeof text); |
225 | else | 225 | else |
226 | strncpy(text, buf, sizeof(text)); | 226 | strncpy(text, buf, sizeof text); |
227 | match(text); | 227 | match(text); |
228 | } | 228 | } |
229 | } | 229 | } |
@@ -238,7 +238,7 @@ readstdin(void) { | |||
238 | Item *i, *new; | 238 | Item *i, *new; |
239 | 239 | ||
240 | i = 0; | 240 | i = 0; |
241 | while(fgets(buf, sizeof(buf), stdin)) { | 241 | while(fgets(buf, sizeof buf, stdin)) { |
242 | len = strlen(buf); | 242 | len = strlen(buf); |
243 | if (buf[len - 1] == '\n') | 243 | if (buf[len - 1] == '\n') |
244 | buf[len - 1] = 0; | 244 | buf[len - 1] = 0; |