Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit ac9a1ea

Browse files
regen
1 parent 6c11826 commit ac9a1ea

File tree

4 files changed

+50
-31
lines changed

4 files changed

+50
-31
lines changed

src/auto/date_time.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,18 @@ impl DateTime {
277277

278278
pub fn get_ymd(&self) -> (i32, i32, i32) {
279279
unsafe {
280-
let mut year = mem::uninitialized();
281-
let mut month = mem::uninitialized();
282-
let mut day = mem::uninitialized();
283-
glib_sys::g_date_time_get_ymd(self.to_glib_none().0, &mut year, &mut month, &mut day);
280+
let mut year = mem::MaybeUninit::uninit();
281+
let mut month = mem::MaybeUninit::uninit();
282+
let mut day = mem::MaybeUninit::uninit();
283+
glib_sys::g_date_time_get_ymd(
284+
self.to_glib_none().0,
285+
year.as_mut_ptr(),
286+
month.as_mut_ptr(),
287+
day.as_mut_ptr(),
288+
);
289+
let year = year.assume_init();
290+
let month = month.assume_init();
291+
let day = day.assume_init();
284292
(year, month, day)
285293
}
286294
}

src/auto/functions.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ pub fn assertion_message_cmpstr(
8282

8383
pub fn base64_decode(text: &str) -> Vec<u8> {
8484
unsafe {
85-
let mut out_len = mem::uninitialized();
85+
let mut out_len = mem::MaybeUninit::uninit();
8686
let ret = FromGlibContainer::from_glib_full_num(
87-
glib_sys::g_base64_decode(text.to_glib_none().0, &mut out_len),
88-
out_len as usize,
87+
glib_sys::g_base64_decode(text.to_glib_none().0, out_len.as_mut_ptr()),
88+
out_len.assume_init() as usize,
8989
);
9090
ret
9191
}
@@ -434,18 +434,18 @@ pub fn dpgettext2(domain: Option<&str>, context: &str, msgid: &str) -> Option<GS
434434
pub fn file_get_contents<P: AsRef<std::path::Path>>(filename: P) -> Result<Vec<u8>, Error> {
435435
unsafe {
436436
let mut contents = ptr::null_mut();
437-
let mut length = mem::uninitialized();
437+
let mut length = mem::MaybeUninit::uninit();
438438
let mut error = ptr::null_mut();
439439
let _ = glib_sys::g_file_get_contents(
440440
filename.as_ref().to_glib_none().0,
441441
&mut contents,
442-
&mut length,
442+
length.as_mut_ptr(),
443443
&mut error,
444444
);
445445
if error.is_null() {
446446
Ok(FromGlibContainer::from_glib_full_num(
447447
contents,
448-
length as usize,
448+
length.assume_init() as usize,
449449
))
450450
} else {
451451
Err(from_glib_full(error))
@@ -1064,17 +1064,20 @@ pub fn shell_parse_argv<P: AsRef<std::ffi::OsStr>>(
10641064
command_line: P,
10651065
) -> Result<Vec<std::ffi::OsString>, Error> {
10661066
unsafe {
1067-
let mut argcp = mem::uninitialized();
1067+
let mut argcp = mem::MaybeUninit::uninit();
10681068
let mut argvp = ptr::null_mut();
10691069
let mut error = ptr::null_mut();
10701070
let _ = glib_sys::g_shell_parse_argv(
10711071
command_line.as_ref().to_glib_none().0,
1072-
&mut argcp,
1072+
argcp.as_mut_ptr(),
10731073
&mut argvp,
10741074
&mut error,
10751075
);
10761076
if error.is_null() {
1077-
Ok(FromGlibContainer::from_glib_full_num(argvp, argcp as usize))
1077+
Ok(FromGlibContainer::from_glib_full_num(
1078+
argvp,
1079+
argcp.assume_init() as usize,
1080+
))
10781081
} else {
10791082
Err(from_glib_full(error))
10801083
}

src/auto/key_file.rs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ impl KeyFile {
6666

6767
pub fn get_double_list(&self, group_name: &str, key: &str) -> Result<Vec<f64>, Error> {
6868
unsafe {
69-
let mut length = mem::uninitialized();
69+
let mut length = mem::MaybeUninit::uninit();
7070
let mut error = ptr::null_mut();
7171
let ret = glib_sys::g_key_file_get_double_list(
7272
self.to_glib_none().0,
7373
group_name.to_glib_none().0,
7474
key.to_glib_none().0,
75-
&mut length,
75+
length.as_mut_ptr(),
7676
&mut error,
7777
);
7878
if error.is_null() {
7979
Ok(FromGlibContainer::from_glib_container_num(
8080
ret,
81-
length as usize,
81+
length.assume_init() as usize,
8282
))
8383
} else {
8484
Err(from_glib_full(error))
@@ -88,11 +88,12 @@ impl KeyFile {
8888

8989
pub fn get_groups(&self) -> (Vec<GString>, usize) {
9090
unsafe {
91-
let mut length = mem::uninitialized();
91+
let mut length = mem::MaybeUninit::uninit();
9292
let ret = FromGlibPtrContainer::from_glib_full(glib_sys::g_key_file_get_groups(
9393
self.to_glib_none().0,
94-
&mut length,
94+
length.as_mut_ptr(),
9595
));
96+
let length = length.assume_init();
9697
(ret, length)
9798
}
9899
}
@@ -133,19 +134,19 @@ impl KeyFile {
133134

134135
pub fn get_integer_list(&self, group_name: &str, key: &str) -> Result<Vec<i32>, Error> {
135136
unsafe {
136-
let mut length = mem::uninitialized();
137+
let mut length = mem::MaybeUninit::uninit();
137138
let mut error = ptr::null_mut();
138139
let ret = glib_sys::g_key_file_get_integer_list(
139140
self.to_glib_none().0,
140141
group_name.to_glib_none().0,
141142
key.to_glib_none().0,
142-
&mut length,
143+
length.as_mut_ptr(),
143144
&mut error,
144145
);
145146
if error.is_null() {
146147
Ok(FromGlibContainer::from_glib_container_num(
147148
ret,
148-
length as usize,
149+
length.assume_init() as usize,
149150
))
150151
} else {
151152
Err(from_glib_full(error))
@@ -155,14 +156,15 @@ impl KeyFile {
155156

156157
pub fn get_keys(&self, group_name: &str) -> Result<(Vec<GString>, usize), Error> {
157158
unsafe {
158-
let mut length = mem::uninitialized();
159+
let mut length = mem::MaybeUninit::uninit();
159160
let mut error = ptr::null_mut();
160161
let ret = glib_sys::g_key_file_get_keys(
161162
self.to_glib_none().0,
162163
group_name.to_glib_none().0,
163-
&mut length,
164+
length.as_mut_ptr(),
164165
&mut error,
165166
);
167+
let length = length.assume_init();
166168
if error.is_null() {
167169
Ok((FromGlibPtrContainer::from_glib_full(ret), length))
168170
} else {
@@ -218,18 +220,21 @@ impl KeyFile {
218220
locale: Option<&str>,
219221
) -> Result<Vec<GString>, Error> {
220222
unsafe {
221-
let mut length = mem::uninitialized();
223+
let mut length = mem::MaybeUninit::uninit();
222224
let mut error = ptr::null_mut();
223225
let ret = glib_sys::g_key_file_get_locale_string_list(
224226
self.to_glib_none().0,
225227
group_name.to_glib_none().0,
226228
key.to_glib_none().0,
227229
locale.to_glib_none().0,
228-
&mut length,
230+
length.as_mut_ptr(),
229231
&mut error,
230232
);
231233
if error.is_null() {
232-
Ok(FromGlibContainer::from_glib_full_num(ret, length as usize))
234+
Ok(FromGlibContainer::from_glib_full_num(
235+
ret,
236+
length.assume_init() as usize,
237+
))
233238
} else {
234239
Err(from_glib_full(error))
235240
}
@@ -259,17 +264,20 @@ impl KeyFile {
259264

260265
pub fn get_string_list(&self, group_name: &str, key: &str) -> Result<Vec<GString>, Error> {
261266
unsafe {
262-
let mut length = mem::uninitialized();
267+
let mut length = mem::MaybeUninit::uninit();
263268
let mut error = ptr::null_mut();
264269
let ret = glib_sys::g_key_file_get_string_list(
265270
self.to_glib_none().0,
266271
group_name.to_glib_none().0,
267272
key.to_glib_none().0,
268-
&mut length,
273+
length.as_mut_ptr(),
269274
&mut error,
270275
);
271276
if error.is_null() {
272-
Ok(FromGlibContainer::from_glib_full_num(ret, length as usize))
277+
Ok(FromGlibContainer::from_glib_full_num(
278+
ret,
279+
length.assume_init() as usize,
280+
))
273281
} else {
274282
Err(from_glib_full(error))
275283
}

src/auto/versions.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ a080a17)
2-
from gir-files (https://github.com/gtk-rs/gir-files @ 6b1fe0b)
1+
Generated by gir (https://github.com/gtk-rs/gir @ fb0b31c)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 8befbe7)

0 commit comments

Comments
 (0)