aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarg@mig29 <unknown>2006-11-26 15:49:33 +0100
committerarg@mig29 <unknown>2006-11-26 15:49:33 +0100
commit8c20e5dbd3aac1aa45902c6bce3bc32d57c2d598 (patch)
treee885d2563b2353f017cc2409d8258f1600cfc4aa
parent26fbf124fa337502136e8465516bb376e9ca8a20 (diff)
downloaddmenu-8c20e5dbd3aac1aa45902c6bce3bc32d57c2d598.tar.gz
dmenu-8c20e5dbd3aac1aa45902c6bce3bc32d57c2d598.tar.bz2
dmenu-8c20e5dbd3aac1aa45902c6bce3bc32d57c2d598.zip
fixing sizeof stuff
-rw-r--r--draw.c4
-rw-r--r--main.c10
2 files changed, 7 insertions, 7 deletions
diff --git a/draw.c b/draw.c
index 14bb801..74a47a6 100644
--- a/draw.c
+++ b/draw.c
@@ -35,8 +35,8 @@ drawtext(const char *text, unsigned long col[ColLast]) {
return;
w = 0;
olen = len = strlen(text);
- if(len >= sizeof(buf))
- len = sizeof(buf) - 1;
+ if(len >= sizeof buf)
+ len = sizeof buf - 1;
memcpy(buf, text, len);
buf[len] = 0;
h = dc.font.ascent + dc.font.descent;
diff --git a/main.c b/main.c
index 7228cb6..ce13a80 100644
--- a/main.c
+++ b/main.c
@@ -144,7 +144,7 @@ kpress(XKeyEvent * e) {
len = strlen(text);
buf[0] = 0;
- num = XLookupString(e, buf, sizeof(buf), &ksym, 0);
+ num = XLookupString(e, buf, sizeof buf, &ksym, 0);
if(IsFunctionKey(ksym) || IsKeypadKey(ksym)
|| IsMiscFunctionKey(ksym) || IsPFKey(ksym)
|| IsPrivateKeypadKey(ksym))
@@ -181,7 +181,7 @@ kpress(XKeyEvent * e) {
case XK_Tab:
if(!sel)
return;
- strncpy(text, sel->text, sizeof(text));
+ strncpy(text, sel->text, sizeof text);
match(text);
break;
case XK_Right:
@@ -221,9 +221,9 @@ kpress(XKeyEvent * e) {
if(num && !iscntrl((int) buf[0])) {
buf[num] = 0;
if(len > 0)
- strncat(text, buf, sizeof(text));
+ strncat(text, buf, sizeof text);
else
- strncpy(text, buf, sizeof(text));
+ strncpy(text, buf, sizeof text);
match(text);
}
}
@@ -238,7 +238,7 @@ readstdin(void) {
Item *i, *new;
i = 0;
- while(fgets(buf, sizeof(buf), stdin)) {
+ while(fgets(buf, sizeof buf, stdin)) {
len = strlen(buf);
if (buf[len - 1] == '\n')
buf[len - 1] = 0;