From b8b9bf4f2944e7f6bc76e98aea1249915943e612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 28 Feb 2011 01:05:02 +0100 Subject: check SetCurrentDevice --- libk8055/libk8055.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c index 7489759..ad34212 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -266,18 +266,11 @@ int CloseDevice() { } /* New function in version 2 of Velleman DLL, should return deviceno if OK */ -long SetCurrentDevice(long deviceno) -{ - if (deviceno >= 0 && deviceno < K8055_MAX_DEV) - { - if (k8055d[deviceno].dev_no != 0) - { - curr_dev = &k8055d[deviceno]; - return deviceno; - } - } - return K8055_ERROR; - +long SetCurrentDevice(long deviceno) { + if (deviceno < 0 || deviceno >= K8055_MAX_DEV) return K8055_ERROR; + if (k8055d[deviceno].dev_no == 0) return K8055_ERROR; + curr_dev = &k8055d[deviceno]; + return deviceno; } /* New function in version 2 of Velleman DLL, should return devices-found bitmask or 0*/ -- cgit v1.1-2-g2b99