consistently use () with sizeof
This commit is contained in:
parent
b1289f30b7
commit
10d4e479c5
1 changed files with 2 additions and 2 deletions
4
slock.c
4
slock.c
|
@ -133,7 +133,7 @@ readpw(Display *dpy, const char *pws)
|
||||||
while (running && !XNextEvent(dpy, &ev)) {
|
while (running && !XNextEvent(dpy, &ev)) {
|
||||||
if (ev.type == KeyPress) {
|
if (ev.type == KeyPress) {
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
num = XLookupString(&ev.xkey, buf, sizeof buf, &ksym, 0);
|
num = XLookupString(&ev.xkey, buf, sizeof(buf), &ksym, 0);
|
||||||
if (IsKeypadKey(ksym)) {
|
if (IsKeypadKey(ksym)) {
|
||||||
if (ksym == XK_KP_Enter)
|
if (ksym == XK_KP_Enter)
|
||||||
ksym = XK_Return;
|
ksym = XK_Return;
|
||||||
|
@ -168,7 +168,7 @@ readpw(Display *dpy, const char *pws)
|
||||||
--len;
|
--len;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (num && !iscntrl((int) buf[0]) && (len + num < sizeof passwd)) {
|
if (num && !iscntrl((int) buf[0]) && (len + num < sizeof(passwd))) {
|
||||||
memcpy(passwd + len, buf, num);
|
memcpy(passwd + len, buf, num);
|
||||||
len += num;
|
len += num;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue