summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-02-11 11:12:57 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-02-11 13:16:07 +0100
commitd248a7131ff495fb817cc4963298363b9e1b2008 (patch)
tree21e410405d02a7b660bf15a0977bf6a1d64045b7 /sal
parent7d594687216f183a681ecfe7e1d424d8a55422c2 (diff)
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>
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/oslrandom.h2
-rw-r--r--sal/osl/unx/random.cxx2
-rw-r--r--sal/osl/w32/random.cxx10
3 files changed, 7 insertions, 7 deletions
diff --git a/sal/inc/oslrandom.h b/sal/inc/oslrandom.h
index b65878433225..891277bba675 100644
--- a/sal/inc/oslrandom.h
+++ b/sal/inc/oslrandom.h
@@ -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
}
diff --git a/sal/osl/unx/random.cxx b/sal/osl/unx/random.cxx
index e8379f8f0bf7..fbb2d7dedb90 100644
--- a/sal/osl/unx/random.cxx
+++ b/sal/osl/unx/random.cxx
@@ -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;
diff --git a/sal/osl/w32/random.cxx b/sal/osl/w32/random.cxx
index a2c364da2ebb..27ee14fdd6d4 100644
--- a/sal/osl/w32/random.cxx
+++ b/sal/osl/w32/random.cxx
@@ -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: */