Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitae9d019

Browse files
committed
iui: draw: use mem::MaybeUninit in identity()
The `mem::uninitialized()` function is considered undefined behavior,and is therefore heavily deprecated. Instead, `mem::MaybeUninit` ispreferred.Convert the usage of `mem::uninitialized()` into `mem::MaybeUninit` inthe `Transform::identity()` function to remove this UB.Signed-off-by: Sean Cross <sean@xobs.io>
1 parent50e68f9 commitae9d019

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎iui/src/draw/transform.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ impl Transform {
1919
/// Create a new Transform that does nothing.
2020
pubfnidentity() ->Transform{
2121
unsafe{
22-
letmut matrix = mem::uninitialized();
23-
ui_sys::uiDrawMatrixSetIdentity(&mutmatrix);
24-
Transform::from_ui_matrix(&matrix)
22+
letmut matrix = mem::MaybeUninit::uninit();
23+
ui_sys::uiDrawMatrixSetIdentity(matrix.as_mut_ptr());
24+
Transform::from_ui_matrix(&matrix.assume_init())
2525
}
2626
}
2727

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp