From f07727ee6d04c46661113395d4db1345e2a61f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 6 Jan 2023 14:11:45 +0200 Subject: [PATCH] Use uninitialized stack memory for out parameters instead of zeroed memory if applicable Part-of: --- gstreamer-audio/src/audio_decoder.rs | 6 +++--- gstreamer-audio/src/audio_encoder.rs | 6 +++--- gstreamer-base/src/aggregator.rs | 6 +++--- gstreamer-base/src/base_src.rs | 6 +++--- gstreamer-base/src/base_transform.rs | 6 +++--- gstreamer-gl/src/gl_video_frame.rs | 4 ++-- gstreamer-sdp/src/sdp_attribute.rs | 2 +- gstreamer-sdp/src/sdp_bandwidth.rs | 4 ++-- gstreamer-sdp/src/sdp_connection.rs | 4 ++-- gstreamer-sdp/src/sdp_time.rs | 4 ++-- gstreamer-sdp/src/sdp_zone.rs | 4 ++-- gstreamer-video/src/subclass/video_aggregator.rs | 2 +- gstreamer-video/src/video_buffer_pool.rs | 2 +- gstreamer-video/src/video_decoder.rs | 6 +++--- gstreamer-video/src/video_encoder.rs | 6 +++--- gstreamer-video/src/video_frame.rs | 16 ++++++++-------- gstreamer-video/src/video_hdr.rs | 8 ++++---- gstreamer-video/src/video_info.rs | 2 +- gstreamer-video/src/video_time_code.rs | 2 +- gstreamer-video/src/video_time_code_interval.rs | 2 +- gstreamer/src/buffer.rs | 8 ++++---- gstreamer/src/buffer_pool.rs | 2 +- gstreamer/src/bus_unix.rs | 2 +- gstreamer/src/bus_windows.rs | 2 +- gstreamer/src/memory.rs | 8 ++++---- gstreamer/src/segment.rs | 2 +- 26 files changed, 61 insertions(+), 61 deletions(-) diff --git a/gstreamer-audio/src/audio_decoder.rs b/gstreamer-audio/src/audio_decoder.rs index 003f34a93..e557f2536 100644 --- a/gstreamer-audio/src/audio_decoder.rs +++ b/gstreamer-audio/src/audio_decoder.rs @@ -100,13 +100,13 @@ impl> AudioDecoderExtManual for O { fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); - let mut params = mem::zeroed(); + let mut params = mem::MaybeUninit::uninit(); ffi::gst_audio_decoder_get_allocator( self.as_ref().to_glib_none().0, &mut allocator, - &mut params, + params.as_mut_ptr(), ); - (from_glib_full(allocator), params.into()) + (from_glib_full(allocator), params.assume_init().into()) } } diff --git a/gstreamer-audio/src/audio_encoder.rs b/gstreamer-audio/src/audio_encoder.rs index db2e53705..9281761c5 100644 --- a/gstreamer-audio/src/audio_encoder.rs +++ b/gstreamer-audio/src/audio_encoder.rs @@ -56,13 +56,13 @@ impl> AudioEncoderExtManual for O { fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); - let mut params = mem::zeroed(); + let mut params = mem::MaybeUninit::uninit(); ffi::gst_audio_encoder_get_allocator( self.as_ref().to_glib_none().0, &mut allocator, - &mut params, + params.as_mut_ptr(), ); - (from_glib_full(allocator), params.into()) + (from_glib_full(allocator), params.assume_init().into()) } } diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index e0cc13c9e..b75ad1db3 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -84,13 +84,13 @@ impl> AggregatorExtManual for O { fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); - let mut params = mem::zeroed(); + let mut params = mem::MaybeUninit::uninit(); ffi::gst_aggregator_get_allocator( self.as_ref().to_glib_none().0, &mut allocator, - &mut params, + params.as_mut_ptr(), ); - (from_glib_full(allocator), params.into()) + (from_glib_full(allocator), params.assume_init().into()) } } diff --git a/gstreamer-base/src/base_src.rs b/gstreamer-base/src/base_src.rs index eeffdafee..6139bf0db 100644 --- a/gstreamer-base/src/base_src.rs +++ b/gstreamer-base/src/base_src.rs @@ -31,13 +31,13 @@ impl> BaseSrcExtManual for O { fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); - let mut params = mem::zeroed(); + let mut params = mem::MaybeUninit::uninit(); ffi::gst_base_src_get_allocator( self.as_ref().to_glib_none().0, &mut allocator, - &mut params, + params.as_mut_ptr(), ); - (from_glib_full(allocator), params.into()) + (from_glib_full(allocator), params.assume_init().into()) } } diff --git a/gstreamer-base/src/base_transform.rs b/gstreamer-base/src/base_transform.rs index 704394cba..e438bdbcc 100644 --- a/gstreamer-base/src/base_transform.rs +++ b/gstreamer-base/src/base_transform.rs @@ -23,13 +23,13 @@ impl> BaseTransformExtManual for O { fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); - let mut params = mem::zeroed(); + let mut params = mem::MaybeUninit::uninit(); ffi::gst_base_transform_get_allocator( self.as_ref().to_glib_none().0, &mut allocator, - &mut params, + params.as_mut_ptr(), ); - (from_glib_full(allocator), params.into()) + (from_glib_full(allocator), params.assume_init().into()) } } diff --git a/gstreamer-gl/src/gl_video_frame.rs b/gstreamer-gl/src/gl_video_frame.rs index 761d62f5e..68b8313db 100644 --- a/gstreamer-gl/src/gl_video_frame.rs +++ b/gstreamer-gl/src/gl_video_frame.rs @@ -62,7 +62,7 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> { } unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(gst_video::ffi::gst_video_frame_map( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, @@ -108,7 +108,7 @@ impl<'a> VideoFrameGLExt for gst_video::VideoFrameRef<&'a gst::BufferRef> { } unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(gst_video::ffi::gst_video_frame_map( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, diff --git a/gstreamer-sdp/src/sdp_attribute.rs b/gstreamer-sdp/src/sdp_attribute.rs index d48285b16..fa8db01fa 100644 --- a/gstreamer-sdp/src/sdp_attribute.rs +++ b/gstreamer-sdp/src/sdp_attribute.rs @@ -15,7 +15,7 @@ impl SDPAttribute { pub fn new(key: &str, value: Option<&str>) -> Self { assert_initialized_main_thread!(); unsafe { - let mut attr = mem::MaybeUninit::zeroed(); + let mut attr = mem::MaybeUninit::uninit(); ffi::gst_sdp_attribute_set( attr.as_mut_ptr(), key.to_glib_none().0, diff --git a/gstreamer-sdp/src/sdp_bandwidth.rs b/gstreamer-sdp/src/sdp_bandwidth.rs index 95af12f7e..54ecab984 100644 --- a/gstreamer-sdp/src/sdp_bandwidth.rs +++ b/gstreamer-sdp/src/sdp_bandwidth.rs @@ -15,7 +15,7 @@ impl SDPBandwidth { pub fn new(bwtype: &str, bandwidth: u32) -> Self { assert_initialized_main_thread!(); unsafe { - let mut bw = mem::MaybeUninit::zeroed(); + let mut bw = mem::MaybeUninit::uninit(); ffi::gst_sdp_bandwidth_set(bw.as_mut_ptr(), bwtype.to_glib_none().0, bandwidth); SDPBandwidth(bw.assume_init()) } @@ -40,7 +40,7 @@ impl Clone for SDPBandwidth { fn clone(&self) -> Self { assert_initialized_main_thread!(); unsafe { - let mut bw = mem::MaybeUninit::zeroed(); + let mut bw = mem::MaybeUninit::uninit(); ffi::gst_sdp_bandwidth_set(bw.as_mut_ptr(), self.0.bwtype, self.0.bandwidth); SDPBandwidth(bw.assume_init()) } diff --git a/gstreamer-sdp/src/sdp_connection.rs b/gstreamer-sdp/src/sdp_connection.rs index 8b0423f35..ec4132660 100644 --- a/gstreamer-sdp/src/sdp_connection.rs +++ b/gstreamer-sdp/src/sdp_connection.rs @@ -15,7 +15,7 @@ impl SDPConnection { pub fn new(nettype: &str, addrtype: &str, address: &str, ttl: u32, addr_number: u32) -> Self { assert_initialized_main_thread!(); unsafe { - let mut conn = mem::MaybeUninit::zeroed(); + let mut conn = mem::MaybeUninit::uninit(); ffi::gst_sdp_connection_set( conn.as_mut_ptr(), nettype.to_glib_none().0, @@ -71,7 +71,7 @@ impl Clone for SDPConnection { fn clone(&self) -> Self { assert_initialized_main_thread!(); unsafe { - let mut conn = mem::MaybeUninit::zeroed(); + let mut conn = mem::MaybeUninit::uninit(); ffi::gst_sdp_connection_set( conn.as_mut_ptr(), self.0.nettype, diff --git a/gstreamer-sdp/src/sdp_time.rs b/gstreamer-sdp/src/sdp_time.rs index cc3ee4c78..c85bae480 100644 --- a/gstreamer-sdp/src/sdp_time.rs +++ b/gstreamer-sdp/src/sdp_time.rs @@ -15,7 +15,7 @@ impl SDPTime { pub fn new(start: &str, stop: &str, repeat: &[&str]) -> Self { assert_initialized_main_thread!(); unsafe { - let mut time = mem::MaybeUninit::zeroed(); + let mut time = mem::MaybeUninit::uninit(); ffi::gst_sdp_time_set( time.as_mut_ptr(), start.to_glib_none().0, @@ -69,7 +69,7 @@ impl Clone for SDPTime { assert_initialized_main_thread!(); #[allow(clippy::cast_ptr_alignment)] unsafe { - let mut time = mem::MaybeUninit::zeroed(); + let mut time = mem::MaybeUninit::uninit(); ffi::gst_sdp_time_set( time.as_mut_ptr(), self.0.start, diff --git a/gstreamer-sdp/src/sdp_zone.rs b/gstreamer-sdp/src/sdp_zone.rs index 3aff1fd64..d6f85d9a0 100644 --- a/gstreamer-sdp/src/sdp_zone.rs +++ b/gstreamer-sdp/src/sdp_zone.rs @@ -15,7 +15,7 @@ impl SDPZone { pub fn new(time: &str, typed_time: &str) -> Self { assert_initialized_main_thread!(); unsafe { - let mut zone = mem::MaybeUninit::zeroed(); + let mut zone = mem::MaybeUninit::uninit(); ffi::gst_sdp_zone_set( zone.as_mut_ptr(), time.to_glib_none().0, @@ -50,7 +50,7 @@ impl Clone for SDPZone { fn clone(&self) -> Self { assert_initialized_main_thread!(); unsafe { - let mut zone = mem::MaybeUninit::zeroed(); + let mut zone = mem::MaybeUninit::uninit(); ffi::gst_sdp_zone_set(zone.as_mut_ptr(), self.0.time, self.0.typed_time); SDPZone(zone.assume_init()) } diff --git a/gstreamer-video/src/subclass/video_aggregator.rs b/gstreamer-video/src/subclass/video_aggregator.rs index f587bbc60..6c16c79f0 100644 --- a/gstreamer-video/src/subclass/video_aggregator.rs +++ b/gstreamer-video/src/subclass/video_aggregator.rs @@ -126,7 +126,7 @@ impl VideoAggregatorImplExt for T { let data = Self::type_data(); let parent_class = data.as_ref().parent_class() as *mut ffi::GstVideoAggregatorClass; (*parent_class).find_best_format.and_then(|f| { - let mut info = mem::MaybeUninit::zeroed(); + let mut info = mem::MaybeUninit::uninit(); ffi::gst_video_info_init(info.as_mut_ptr()); let mut info = info.assume_init(); diff --git a/gstreamer-video/src/video_buffer_pool.rs b/gstreamer-video/src/video_buffer_pool.rs index d9db66ec8..bce9b0aea 100644 --- a/gstreamer-video/src/video_buffer_pool.rs +++ b/gstreamer-video/src/video_buffer_pool.rs @@ -107,7 +107,7 @@ impl VideoBufferPoolConfig for gst::BufferPoolConfigRef { #[doc(alias = "gst_buffer_pool_config_get_video_alignment")] fn video_alignment(&self) -> Option { unsafe { - let mut alignment = mem::MaybeUninit::zeroed(); + let mut alignment = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_buffer_pool_config_get_video_alignment( self.as_ref().as_mut_ptr(), alignment.as_mut_ptr(), diff --git a/gstreamer-video/src/video_decoder.rs b/gstreamer-video/src/video_decoder.rs index 155cc2b38..0336f0ba6 100644 --- a/gstreamer-video/src/video_decoder.rs +++ b/gstreamer-video/src/video_decoder.rs @@ -116,13 +116,13 @@ impl> VideoDecoderExtManual for O { fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); - let mut params = mem::zeroed(); + let mut params = mem::MaybeUninit::uninit(); ffi::gst_video_decoder_get_allocator( self.as_ref().to_glib_none().0, &mut allocator, - &mut params, + params.as_mut_ptr(), ); - (from_glib_full(allocator), params.into()) + (from_glib_full(allocator), params.assume_init().into()) } } diff --git a/gstreamer-video/src/video_encoder.rs b/gstreamer-video/src/video_encoder.rs index 72469a005..40e6c3b0e 100644 --- a/gstreamer-video/src/video_encoder.rs +++ b/gstreamer-video/src/video_encoder.rs @@ -89,13 +89,13 @@ impl> VideoEncoderExtManual for O { fn allocator(&self) -> (Option, gst::AllocationParams) { unsafe { let mut allocator = ptr::null_mut(); - let mut params = mem::zeroed(); + let mut params = mem::MaybeUninit::uninit(); ffi::gst_video_encoder_get_allocator( self.as_ref().to_glib_none().0, &mut allocator, - &mut params, + params.as_mut_ptr(), ); - (from_glib_full(allocator), params.into()) + (from_glib_full(allocator), params.assume_init().into()) } } diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 2f380a8e8..0999bf23b 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -268,7 +268,7 @@ impl VideoFrame { assert!(info.is_valid()); unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_frame_map( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, @@ -301,7 +301,7 @@ impl VideoFrame { assert!(info.is_valid()); unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_frame_map_id( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, @@ -340,7 +340,7 @@ impl VideoFrame { assert!(info.is_valid()); unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_frame_map( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, @@ -375,7 +375,7 @@ impl VideoFrame { assert!(info.is_valid()); unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_frame_map_id( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, @@ -693,7 +693,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { assert!(info.is_valid()); unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_frame_map( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, @@ -726,7 +726,7 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { assert!(info.is_valid()); unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_frame_map_id( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, @@ -788,7 +788,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { assert!(info.is_valid()); unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_frame_map( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, @@ -823,7 +823,7 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { assert!(info.is_valid()); unsafe { - let mut frame = mem::MaybeUninit::zeroed(); + let mut frame = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_frame_map_id( frame.as_mut_ptr(), info.to_glib_none().0 as *mut _, diff --git a/gstreamer-video/src/video_hdr.rs b/gstreamer-video/src/video_hdr.rs index afc4d6efc..ae99629b9 100644 --- a/gstreamer-video/src/video_hdr.rs +++ b/gstreamer-video/src/video_hdr.rs @@ -47,7 +47,7 @@ impl VideoContentLightLevel { skip_assert_initialized!(); unsafe { - let mut info = mem::MaybeUninit::zeroed(); + let mut info = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_content_light_level_from_caps( info.as_mut_ptr(), caps.as_ptr(), @@ -101,7 +101,7 @@ impl str::FromStr for VideoContentLightLevel { assert_initialized_main_thread!(); unsafe { - let mut colorimetry = mem::MaybeUninit::zeroed(); + let mut colorimetry = mem::MaybeUninit::uninit(); let valid: bool = from_glib(ffi::gst_video_content_light_level_from_string( colorimetry.as_mut_ptr(), s.to_glib_none().0, @@ -206,7 +206,7 @@ impl VideoMasteringDisplayInfo { skip_assert_initialized!(); unsafe { - let mut info = mem::MaybeUninit::zeroed(); + let mut info = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_video_mastering_display_info_from_caps( info.as_mut_ptr(), caps.as_ptr(), @@ -254,7 +254,7 @@ impl str::FromStr for VideoMasteringDisplayInfo { assert_initialized_main_thread!(); unsafe { - let mut colorimetry = mem::MaybeUninit::zeroed(); + let mut colorimetry = mem::MaybeUninit::uninit(); let valid: bool = from_glib(ffi::gst_video_mastering_display_info_from_string( colorimetry.as_mut_ptr(), s.to_glib_none().0, diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 521a10ab3..44fd70dc8 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -158,7 +158,7 @@ impl str::FromStr for crate::VideoColorimetry { assert_initialized_main_thread!(); unsafe { - let mut colorimetry = mem::MaybeUninit::zeroed(); + let mut colorimetry = mem::MaybeUninit::uninit(); let valid: bool = from_glib(ffi::gst_video_colorimetry_from_string( colorimetry.as_mut_ptr(), s.to_glib_none().0, diff --git a/gstreamer-video/src/video_time_code.rs b/gstreamer-video/src/video_time_code.rs index 0b18c0527..5a35d8ed1 100644 --- a/gstreamer-video/src/video_time_code.rs +++ b/gstreamer-video/src/video_time_code.rs @@ -77,7 +77,7 @@ impl VideoTimeCode { ) -> Self { assert_initialized_main_thread!(); unsafe { - let mut v = mem::MaybeUninit::zeroed(); + let mut v = mem::MaybeUninit::uninit(); ffi::gst_video_time_code_init( v.as_mut_ptr(), fps.numer() as u32, diff --git a/gstreamer-video/src/video_time_code_interval.rs b/gstreamer-video/src/video_time_code_interval.rs index 2c6f6cf03..a54983c6d 100644 --- a/gstreamer-video/src/video_time_code_interval.rs +++ b/gstreamer-video/src/video_time_code_interval.rs @@ -17,7 +17,7 @@ impl VideoTimeCodeInterval { pub fn new(hours: u32, minutes: u32, seconds: u32, frames: u32) -> Self { assert_initialized_main_thread!(); unsafe { - let mut v = mem::MaybeUninit::zeroed(); + let mut v = mem::MaybeUninit::uninit(); ffi::gst_video_time_code_interval_init(v.as_mut_ptr(), hours, minutes, seconds, frames); Self { inner: v.assume_init(), diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index f06094c88..8626e9d0f 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -110,7 +110,7 @@ impl Buffer { #[doc(alias = "gst_buffer_map")] pub fn into_mapped_buffer_readable(self) -> Result, Self> { unsafe { - let mut map_info = mem::MaybeUninit::zeroed(); + let mut map_info = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_buffer_map( self.as_mut_ptr(), map_info.as_mut_ptr(), @@ -131,7 +131,7 @@ impl Buffer { #[doc(alias = "gst_buffer_map")] pub fn into_mapped_buffer_writable(self) -> Result, Self> { unsafe { - let mut map_info = mem::MaybeUninit::zeroed(); + let mut map_info = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_buffer_map( self.as_mut_ptr(), map_info.as_mut_ptr(), @@ -177,7 +177,7 @@ impl BufferRef { #[doc(alias = "gst_buffer_map")] pub fn map_readable(&self) -> Result, glib::BoolError> { unsafe { - let mut map_info = mem::MaybeUninit::zeroed(); + let mut map_info = mem::MaybeUninit::uninit(); let res = ffi::gst_buffer_map(self.as_mut_ptr(), map_info.as_mut_ptr(), ffi::GST_MAP_READ); if res == glib::ffi::GTRUE { @@ -195,7 +195,7 @@ impl BufferRef { #[doc(alias = "gst_buffer_map")] pub fn map_writable(&mut self) -> Result, glib::BoolError> { unsafe { - let mut map_info = mem::MaybeUninit::zeroed(); + let mut map_info = mem::MaybeUninit::uninit(); let res = ffi::gst_buffer_map( self.as_mut_ptr(), map_info.as_mut_ptr(), diff --git a/gstreamer/src/buffer_pool.rs b/gstreamer/src/buffer_pool.rs index 04f34b11e..0e2264422 100644 --- a/gstreamer/src/buffer_pool.rs +++ b/gstreamer/src/buffer_pool.rs @@ -207,7 +207,7 @@ impl BufferPoolConfigRef { pub fn allocator(&self) -> Option<(Option, AllocationParams)> { unsafe { let mut allocator = ptr::null_mut(); - let mut params = mem::MaybeUninit::zeroed(); + let mut params = mem::MaybeUninit::uninit(); let ret = from_glib(ffi::gst_buffer_pool_config_get_allocator( self.0.as_mut_ptr(), &mut allocator, diff --git a/gstreamer/src/bus_unix.rs b/gstreamer/src/bus_unix.rs index 767dbe721..4c95a81df 100644 --- a/gstreamer/src/bus_unix.rs +++ b/gstreamer/src/bus_unix.rs @@ -28,7 +28,7 @@ impl UnixBusExtManual for Bus { fn pollfd(&self) -> unix::io::RawFd { #[cfg(unix)] unsafe { - let mut pollfd = mem::MaybeUninit::zeroed(); + let mut pollfd = mem::MaybeUninit::uninit(); ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr()); let pollfd = pollfd.assume_init(); pollfd.fd diff --git a/gstreamer/src/bus_windows.rs b/gstreamer/src/bus_windows.rs index 86ef13cf4..5a45cdcc7 100644 --- a/gstreamer/src/bus_windows.rs +++ b/gstreamer/src/bus_windows.rs @@ -28,7 +28,7 @@ impl WindowsBusExtManual for Bus { fn pollfd(&self) -> windows::io::RawHandle { #[cfg(windows)] unsafe { - let mut pollfd = mem::MaybeUninit::zeroed(); + let mut pollfd = mem::MaybeUninit::uninit(); ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr()); let pollfd = pollfd.assume_init(); pollfd.fd as *mut _ diff --git a/gstreamer/src/memory.rs b/gstreamer/src/memory.rs index 7ccae7497..fe399b310 100644 --- a/gstreamer/src/memory.rs +++ b/gstreamer/src/memory.rs @@ -125,7 +125,7 @@ impl Memory { pub fn into_mapped_memory_readable(self) -> Result, Self> { unsafe { - let mut map_info = mem::MaybeUninit::zeroed(); + let mut map_info = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_memory_map( self.as_mut_ptr(), map_info.as_mut_ptr(), @@ -145,7 +145,7 @@ impl Memory { pub fn into_mapped_memory_writable(self) -> Result, Self> { unsafe { - let mut map_info = mem::MaybeUninit::zeroed(); + let mut map_info = mem::MaybeUninit::uninit(); let res: bool = from_glib(ffi::gst_memory_map( self.as_mut_ptr(), map_info.as_mut_ptr(), @@ -259,7 +259,7 @@ impl MemoryRef { pub fn map_readable(&self) -> Result, glib::BoolError> { unsafe { - let mut map_info = mem::MaybeUninit::zeroed(); + let mut map_info = mem::MaybeUninit::uninit(); let res = ffi::gst_memory_map(self.as_mut_ptr(), map_info.as_mut_ptr(), ffi::GST_MAP_READ); if res == glib::ffi::GTRUE { @@ -276,7 +276,7 @@ impl MemoryRef { pub fn map_writable(&mut self) -> Result, glib::BoolError> { unsafe { - let mut map_info = mem::MaybeUninit::zeroed(); + let mut map_info = mem::MaybeUninit::uninit(); let res = ffi::gst_memory_map( self.as_mut_ptr(), map_info.as_mut_ptr(), diff --git a/gstreamer/src/segment.rs b/gstreamer/src/segment.rs index 29a09a223..2729c9281 100644 --- a/gstreamer/src/segment.rs +++ b/gstreamer/src/segment.rs @@ -76,7 +76,7 @@ impl FormattedSegment { pub fn new() -> Self { assert_initialized_main_thread!(); let segment = unsafe { - let mut segment = mem::MaybeUninit::zeroed(); + let mut segment = mem::MaybeUninit::uninit(); ffi::gst_segment_init(segment.as_mut_ptr(), T::default_format().into_glib()); segment.assume_init() };