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:
Stephan Bergmann 2024-02-11 11:12:57 +01:00
parent 7d59468721
commit d248a7131f
3 changed files with 7 additions and 7 deletions

View file

@ -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
}

View file

@ -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;

View file

@ -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: */