diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-07-26 13:33:31 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-07-26 13:33:31 +0000 |
commit | b972436577589cbf5796f477c17c357efe73dc81 (patch) | |
tree | b364bd1423444d694514d70a2f15c04ffd12bc27 /lib | |
parent | ecf01f4c902d6b9198249122d769af3f757c4034 (diff) |
use ``sizeof(string) - 1'' rather than ``strlen(string)'' on static
strings. suggested by Thomas Pfaff
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libsndio/mio.c | 6 | ||||
-rw-r--r-- | lib/libsndio/mio_priv.h | 4 | ||||
-rw-r--r-- | lib/libsndio/sndio.c | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/libsndio/mio.c b/lib/libsndio/mio.c index 6064981eb6f..4e423bebd17 100644 --- a/lib/libsndio/mio.c +++ b/lib/libsndio/mio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mio.c,v 1.4 2009/07/26 13:10:05 ratchov Exp $ */ +/* $OpenBSD: mio.c,v 1.5 2009/07/26 13:33:30 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -79,10 +79,10 @@ mio_open(const char *str, unsigned mode, int nbio) } len = sep - str; - if (len == strlen(prefix_midithru) && + if (len == (sizeof(prefix_midithru) - 1) && memcmp(str, prefix_midithru, len) == 0) return mio_open_thru(sep + 1, mode, nbio); - if (len == strlen(prefix_rmidi) && + if (len == (sizeof(prefix_rmidi) - 1) && memcmp(str, prefix_rmidi, len) == 0) return mio_open_rmidi(sep + 1, mode, nbio); DPRINTF("mio_open: %s: unknown device type\n", str); diff --git a/lib/libsndio/mio_priv.h b/lib/libsndio/mio_priv.h index e5c76553888..ec217394cc4 100644 --- a/lib/libsndio/mio_priv.h +++ b/lib/libsndio/mio_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mio_priv.h,v 1.2 2009/07/25 11:15:56 ratchov Exp $ */ +/* $OpenBSD: mio_priv.h,v 1.3 2009/07/26 13:33:30 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -41,7 +41,7 @@ */ struct mio_hdl { struct mio_ops *ops; - unsigned mode; /* MIO_PLAY | MIO_REC */ + unsigned mode; /* MIO_IN | MIO_OUT */ int nbio; /* true if non-blocking io */ int eof; /* true if error occured */ }; diff --git a/lib/libsndio/sndio.c b/lib/libsndio/sndio.c index dcb770d45d0..f50d871b793 100644 --- a/lib/libsndio/sndio.c +++ b/lib/libsndio/sndio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sndio.c,v 1.18 2009/07/26 12:38:20 ratchov Exp $ */ +/* $OpenBSD: sndio.c,v 1.19 2009/07/26 13:33:30 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -212,10 +212,10 @@ sio_open(const char *str, unsigned mode, int nbio) return sio_open_sun(buf, mode, nbio); } len = sep - str; - if (len == strlen(prefix_aucat) && + if (len == (sizeof(prefix_aucat) - 1) && memcmp(str, prefix_aucat, len) == 0) return sio_open_aucat(sep + 1, mode, nbio); - if (len == strlen(prefix_sun) && + if (len == (sizeof(prefix_sun) - 1) && memcmp(str, prefix_sun, len) == 0) return sio_open_sun(sep + 1, mode, nbio); DPRINTF("sio_open: %s: unknown device type\n", str); |