File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -62,19 +62,19 @@ void swift_stdlib_random(void *buf, __swift_size_t nbytes) {
62
62
}
63
63
64
64
#elif defined(_WIN32) && !defined(__CYGWIN__)
65
- #warning TODO: Test swift_stdlib_random on Windows
66
65
67
66
SWIFT_RUNTIME_STDLIB_API
68
67
void swift_stdlib_random (void *buf, __swift_size_t nbytes) {
69
68
while (nbytes > 0 ) {
70
- auto actual_nbytes = std::min (nbytes, (__swift_size_t )ULONG_MAX);
69
+ __swift_size_t actual_nbytes =
70
+ std::min (nbytes, static_cast <__swift_size_t >(ULONG_MAX));
71
71
NTSTATUS status = BCryptGenRandom (nullptr ,
72
72
static_cast <PUCHAR>(buf),
73
73
static_cast <ULONG>(actual_nbytes),
74
74
BCRYPT_USE_SYSTEM_PREFERRED_RNG);
75
- if (!BCRYPT_SUCCESS (status)) {
76
- fatalError (0 , " Fatal error: 0x%lX in '%s'\n " , status, __func__);
77
- }
75
+ if (!BCRYPT_SUCCESS (status))
76
+ fatalError (0 , " Fatal error: BCryptGenRandom returned 0x%lX in '%s'\n " ,
77
+ status, __func__);
78
78
79
79
buf = static_cast <uint8_t *>(buf) + actual_nbytes;
80
80
nbytes -= actual_nbytes;
You can’t perform that action at this time.
0 commit comments