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
This commit is contained in:
Axel Dörfler 2003-06-16 22:17:09 +00:00
parent 68145d0df8
commit dcec969499
1 changed files with 9 additions and 7 deletions

View File

@ -657,12 +657,18 @@ get_driver_settings_string(void *_handle, char *buffer, size_t *_bufferSize, boo
} }
*_bufferSize -= bufferSize; *_bufferSize -= bufferSize;
return bufferSize >= 0 ? B_OK : B_DEVICE_FULL; return bufferSize >= 0 ? B_OK : B_BUFFER_OVERFLOW;
// ToDo: ?? don't we have a B_BUFFER_OVERFLOW kind of error?
// find a better error code for this.
} }
/** 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 bool
get_driver_boolean_parameter(void *handle, const char *keyName, bool unknownValue, bool noArgValue) 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) if ((parameter = get_parameter(handle, keyName)) == NULL)
return unknownValue; 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 // check for the argument
if (parameter->value_count <= 0) if (parameter->value_count <= 0)
return noArgValue; return noArgValue;