[vlc-commits] rand: simplify
Marvin Scholz
git at videolan.org
Thu Apr 16 12:11:40 CEST 2020
vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Apr 1 16:12:26 2020 +0200| [733039f95195ecb2b1c9da0b479a9070d6b9c96b] | committer: Marvin Scholz
rand: simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=733039f95195ecb2b1c9da0b479a9070d6b9c96b
---
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..bd0cdc4475 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, (len < sizeof(mdo_buf)) ? 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;
}
More information about the vlc-commits
mailing list