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) {
6262}
6363
6464#elif defined(_WIN32) && !defined(__CYGWIN__)
65- #warning TODO: Test swift_stdlib_random on Windows
6665
6766SWIFT_RUNTIME_STDLIB_API
6867void swift_stdlib_random (void *buf, __swift_size_t nbytes) {
6968 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));
7171 NTSTATUS status = BCryptGenRandom (nullptr ,
7272 static_cast <PUCHAR>(buf),
7373 static_cast <ULONG>(actual_nbytes),
7474 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__);
7878
7979 buf = static_cast <uint8_t *>(buf) + actual_nbytes;
8080 nbytes -= actual_nbytes;
You can’t perform that action at this time.
0 commit comments