Added bool_to_string() and check_size_error().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5548 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -128,4 +128,26 @@ Udf::get_block_shift(uint32 blockSize, uint32 &blockShift)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/*! \brief Returns "true" if \a value is true, "false" otherwise.
|
||||
*/
|
||||
const char*
|
||||
Udf::bool_to_string(bool value)
|
||||
{
|
||||
return value ? "true" : "false";
|
||||
}
|
||||
|
||||
/*! \brief Takes an overloaded ssize_t return value like those returned
|
||||
by BFile::Read() and friends, as well as an expected number of bytes,
|
||||
and returns B_OK if the byte counts match, or the appropriate error
|
||||
code otherwise.
|
||||
*/
|
||||
status_t
|
||||
Udf::check_size_error(ssize_t bytesReturned, ssize_t bytesExpected)
|
||||
{
|
||||
return bytesReturned == bytesExpected
|
||||
? B_OK
|
||||
: (bytesReturned >= 0 ? B_ERROR : status_t(bytesReturned));
|
||||
}
|
||||
|
||||
} // namespace Udf
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@ time_t make_time(timestamp ×tamp);
|
||||
|
||||
status_t get_block_shift(uint32 blockSize, uint32 &blockShift);
|
||||
|
||||
const char* bool_to_string(bool value);
|
||||
|
||||
status_t check_size_error(ssize_t bytesReturned, ssize_t bytesExpected);
|
||||
|
||||
} // namespace Udf
|
||||
|
||||
#endif // _UDF_UTILS_H
|
||||
|
||||
Reference in New Issue
Block a user