From dcec9694998ad640260dcb8107668f44133deac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 16 Jun 2003 22:17:09 +0000 Subject: [PATCH] get_driver_settings_string() now returns the new B_BUFFER_OVERFLOW code if the buffer is too small for the settings string. Added/changed some comments. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3548 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/os/driver_settings.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/kernel/libroot/os/driver_settings.c b/src/kernel/libroot/os/driver_settings.c index 8a2c565a0d..b5a2412522 100644 --- a/src/kernel/libroot/os/driver_settings.c +++ b/src/kernel/libroot/os/driver_settings.c @@ -657,12 +657,18 @@ get_driver_settings_string(void *_handle, char *buffer, size_t *_bufferSize, boo } *_bufferSize -= bufferSize; - return bufferSize >= 0 ? B_OK : B_DEVICE_FULL; - // ToDo: ?? don't we have a B_BUFFER_OVERFLOW kind of error? - // find a better error code for this. + return bufferSize >= 0 ? B_OK : B_BUFFER_OVERFLOW; } +/** Matches the first value of the parameter matching "keyName" with a set + * of boolean values like 1/true/yes/on/enabled/... + * Returns "unknownValue" if the parameter could not be found or doesn't + * have any valid boolean setting, and "noArgValue" if the parameter + * doesn't have any values. + * Also returns "unknownValue" if the handle passed in was not valid. + */ + bool get_driver_boolean_parameter(void *handle, const char *keyName, bool unknownValue, bool noArgValue) { @@ -676,10 +682,6 @@ get_driver_boolean_parameter(void *handle, const char *keyName, bool unknownValu if ((parameter = get_parameter(handle, keyName)) == NULL) return unknownValue; - // ToDo: This takes just the first argument/value, and checks that one; - // I don't know if they are used to work that way in BeOS, though. - // bonefish: Yep, exactly like that. - // check for the argument if (parameter->value_count <= 0) return noArgValue;