]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/random.c
remap: Change remapping function argument type from void to int16_t / float as approp...
[pulseaudio] / src / pulsecore / random.c
index 1bd69c2d09a654fddf9f7de9cd72e7e24aa8ffc3..acfbc3123cf9b6469802a601985eac2baf2324db 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "random.h"
 
-static pa_bool_t has_whined = FALSE;
+static bool has_whined = false;
 
 static const char * const devices[] = { "/dev/urandom", "/dev/random", NULL };
 
@@ -49,13 +49,13 @@ static int random_proper(void *ret_data, size_t length) {
 #ifdef OS_IS_WIN32
     int ret = -1;
 
+    HCRYPTPROV hCryptProv = 0;
+
     pa_assert(ret_data);
     pa_assert(length > 0);
 
-    HCRYPTPROV hCryptProv = NULL;
-
     if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
-        if(CryptGenRandom(hCryptProv, length, ret_data))
+        if (CryptGenRandom(hCryptProv, length, ret_data))
             ret = 0;
         CryptReleaseContext(hCryptProv, 0);
     }
@@ -102,7 +102,7 @@ void pa_random_seed(void) {
 
         if (!has_whined) {
             pa_log_warn("Failed to get proper entropy. Falling back to seeding with current time.");
-            has_whined = TRUE;
+            has_whined = true;
         }
 
         seed = (unsigned int) time(NULL);
@@ -123,7 +123,7 @@ void pa_random(void *ret_data, size_t length) {
 
     if (!has_whined) {
         pa_log_warn("Failed to get proper entropy. Falling back to unsecure pseudo RNG.");
-        has_whined = TRUE;
+        has_whined = true;
     }
 
     for (p = ret_data, l = length; l > 0; p++, l--)