Skip to content

Commit 0d68a06

Browse files
committed
chore: Bump getrandom to 0.3, rand to 0.9, etc.
Also: ahash, arboard, ashpd, async-io, base64, hermit-abi, polling, ppv-lite86, quinn, quinn-proto, rand_chacha, rand_core, reqwest, rfd, ring, tempfile, toml_edit, webbrowser, webpki-roots, zbus, zerocopy, zopfli, zvariant
1 parent dbb6ef1 commit 0d68a06

File tree

17 files changed

+697
-358
lines changed

17 files changed

+697
-358
lines changed

Cargo.lock

Lines changed: 664 additions & 330 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ wasm-bindgen = "=0.2.100"
7676
walkdir = "2.5.0"
7777
tokio = "1.45.0"
7878
# Switching from the `async-std` to the `tokio` runtime, which we depend on anyway.
79-
rfd = { version = "0.15.2", default-features = false, features = ["tokio", "xdg-portal"] }
79+
rfd = { version = "0.15.3", default-features = false, features = ["tokio", "xdg-portal"] }
8080

8181
[workspace.lints.rust]
8282
# Clippy nightly often adds new/buggy lints that we want to ignore.

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ thiserror = { workspace = true }
3737
chrono = { workspace = true, features = ["clock"] }
3838
web-time = "1.1.0"
3939
encoding_rs = "0.8.35"
40-
rand = { version = "0.8.5", features = ["std", "small_rng"], default-features = false }
40+
rand = { version = "0.9.1", features = ["std", "small_rng", "os_rng"], default-features = false }
4141
serde = { workspace = true }
4242
serde_json = { version = "1.0", features = ["preserve_order"] }
4343
nellymoser-rs = { git = "https://github.com/ruffle-rs/nellymoser", rev = "073eb48d907201f46dea0c8feb4e8d9a1d92208c", optional = true }

core/src/avm1/activation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
18581858
// The max value is clamped to the range [0, 2^31 - 1).
18591859
let max = self.context.avm1.pop().coerce_to_f64(self)? as i32;
18601860
let result = if max > 0 {
1861-
self.context.rng.gen_range(0..max)
1861+
self.context.rng.random_range(0..max)
18621862
} else {
18631863
0
18641864
};

core/src/avm1/globals/math.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub fn random<'gc>(
156156
// See https://github.com/adobe/avmplus/blob/858d034a3bd3a54d9b70909386435cf4aec81d21/core/MathUtils.cpp#L1731C24-L1731C44
157157
// This generated a restricted set of 'f64' values, which some SWFs implicitly rely on.
158158
const MAX_VAL: u32 = 0x7FFFFFFF;
159-
let rand = activation.context.rng.gen_range(0..MAX_VAL);
159+
let rand = activation.context.rng.random_range(0..MAX_VAL);
160160
Ok(((rand as f64) / (MAX_VAL as f64 + 1f64)).into())
161161
}
162162

core/src/avm2/globals/flash/crypto.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use crate::avm2::error::{make_error_2004, Error2004Type};
44
use crate::avm2::object::TObject;
55
use crate::avm2::{Activation, Error, Value};
6-
use rand::{rngs::OsRng, RngCore};
6+
use rand::{rngs::OsRng, TryRngCore};
77

88
/// Implements `flash.crypto.generateRandomBytes`
99
pub fn generate_random_bytes<'gc>(
@@ -32,7 +32,7 @@ pub fn generate_random_bytes<'gc>(
3232

3333
let mut rng = OsRng {};
3434

35-
rng.fill_bytes(ba_write.bytes_mut());
35+
rng.try_fill_bytes(ba_write.bytes_mut()).unwrap();
3636

3737
Ok(ba.into())
3838
}

core/src/avm2/globals/math.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,6 @@ pub fn random<'gc>(
148148
// See https://github.com/adobe/avmplus/blob/858d034a3bd3a54d9b70909386435cf4aec81d21/core/MathUtils.cpp#L1731C24-L1731C44
149149
// This generated a restricted set of 'f64' values, which some SWFs implicitly rely on.
150150
const MAX_VAL: u32 = 0x7FFFFFFF;
151-
let rand = activation.context.rng.gen_range(0..MAX_VAL);
151+
let rand = activation.context.rng.random_range(0..MAX_VAL);
152152
Ok(((rand as f64) / (MAX_VAL as f64 + 1f64)).into())
153153
}

core/src/bitmap/bitmap_data.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ impl LehmerRng {
2323

2424
/// Generate the next value in the sequence via the following formula
2525
/// X_(k+1) = a * X_k mod m
26-
pub fn gen(&mut self) -> u32 {
26+
pub fn random(&mut self) -> u32 {
2727
self.x = ((self.x as u64).overflowing_mul(16_807).0 % 2_147_483_647) as u32;
2828
self.x
2929
}
3030

31-
pub fn gen_range(&mut self, rng: Range<u8>) -> u8 {
32-
rng.start + (self.gen() % ((rng.end - rng.start) as u32 + 1)) as u8
31+
pub fn random_range(&mut self, rng: Range<u8>) -> u8 {
32+
rng.start + (self.random() % ((rng.end - rng.start) as u32 + 1)) as u8
3333
}
3434
}
3535

core/src/bitmap/operations.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,35 +211,35 @@ pub fn noise<'gc>(
211211
for y in 0..write.height() {
212212
for x in 0..write.width() {
213213
let pixel_color = if gray_scale {
214-
let gray = rng.gen_range(low..high);
214+
let gray = rng.random_range(low..high);
215215
let alpha = if channel_options.contains(ChannelOptions::ALPHA) {
216-
rng.gen_range(low..high)
216+
rng.random_range(low..high)
217217
} else {
218218
255
219219
};
220220

221221
Color::argb(alpha, gray, gray, gray)
222222
} else {
223223
let r = if channel_options.contains(ChannelOptions::RED) {
224-
rng.gen_range(low..high)
224+
rng.random_range(low..high)
225225
} else {
226226
0
227227
};
228228

229229
let g = if channel_options.contains(ChannelOptions::GREEN) {
230-
rng.gen_range(low..high)
230+
rng.random_range(low..high)
231231
} else {
232232
0
233233
};
234234

235235
let b = if channel_options.contains(ChannelOptions::BLUE) {
236-
rng.gen_range(low..high)
236+
rng.random_range(low..high)
237237
} else {
238238
0
239239
};
240240

241241
let a = if channel_options.contains(ChannelOptions::ALPHA) {
242-
rng.gen_range(low..high)
242+
rng.random_range(low..high)
243243
} else {
244244
255
245245
};

deny.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ allow = [
1414
"BSD-2-Clause",
1515
"BSD-3-Clause",
1616
"ISC",
17-
"Unicode-DFS-2016",
1817
"Unicode-3.0",
1918
"MPL-2.0",
2019
"BSL-1.0",
2120
"CC0-1.0",
2221
"OFL-1.1",
23-
"LicenseRef-UFL-1.0",
2422
"Ubuntu-font-1.0",
25-
"OpenSSL"
23+
"CDLA-Permissive-2.0",
2624
]
2725

2826
# Some crates don't have (easily) machine readable licensing information,

0 commit comments

Comments
 (0)