osl_get_system_random_data should return bool
Change-Id: I29535d3562fe1b8d05b8df1d6c9ab83e4ead0f74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163227 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
parent
7d59468721
commit
d248a7131f
3 changed files with 7 additions and 7 deletions
|
@ -16,7 +16,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
int osl_get_system_random_data(char* buffer, size_t desired_len);
|
||||
bool osl_get_system_random_data(char* buffer, size_t desired_len);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int osl_get_system_random_data(char* buffer, size_t desired_len)
|
||||
bool osl_get_system_random_data(char* buffer, size_t desired_len)
|
||||
{
|
||||
int fd;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include <oslrandom.h>
|
||||
|
||||
int osl_get_system_random_data(char* buffer, size_t desired_len)
|
||||
bool osl_get_system_random_data(char* buffer, size_t desired_len)
|
||||
{
|
||||
unsigned int val;
|
||||
|
||||
|
@ -29,7 +29,7 @@ int osl_get_system_random_data(char* buffer, size_t desired_len)
|
|||
}
|
||||
if (rand_s(&val))
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
memcpy(buffer, &val, len);
|
||||
buffer += len;
|
||||
|
@ -40,7 +40,7 @@ int osl_get_system_random_data(char* buffer, size_t desired_len)
|
|||
{
|
||||
if (rand_s(reinterpret_cast<unsigned int*>(buffer)))
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -53,11 +53,11 @@ int osl_get_system_random_data(char* buffer, size_t desired_len)
|
|||
{
|
||||
if (rand_s(&val))
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
memcpy(buffer, &val, desired_len);
|
||||
}
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
Loading…
Reference in a new issue