[vlc-devel] [PATCH 09/14] rand: simplify
Marvin Scholz
epirat07 at gmail.com
Wed Apr 1 21:47:37 CEST 2020
---
src/posix/rand.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/posix/rand.c b/src/posix/rand.c
index 1c258055b7..a1c8ac9602 100644
--- a/src/posix/rand.c
+++ b/src/posix/rand.c
@@ -105,13 +105,11 @@ void vlc_rand_bytes (void *buf, size_t len)
vlc_hash_md5_Update (&mdo, mdi_buf, sizeof(mdi_buf));
vlc_hash_md5_Finish (&mdo, mdo_buf, sizeof(mdo_buf));
+ memcpy (buf, mdo_buf, __MIN(len, sizeof(mdo_buf)));
+
if (len < sizeof(mdo_buf))
- {
- memcpy (buf, mdo_buf, len);
break;
- }
- memcpy (buf, mdo_buf, sizeof(mdo_buf));
len -= 16;
buf = ((uint8_t *)buf) + 16;
}
--
2.24.1 (Apple Git-126)
More information about the vlc-devel
mailing list