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

Commit d97731c

Browse files
authored
Merge pull request #504 from GuillaumeGomez/regen
Regen
2 parents 5223c51 + d3aa54e commit d97731c

12 files changed

+68
-49
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ matrix:
1515
rust: beta
1616
env: GTK=3.24 FEATURES=subclassing,v2_48
1717
- os: linux
18-
rust: 1.34.0
18+
rust: 1.36.0
1919
env: GTK=3.14 FEATURES=subclassing
2020
- os: linux
21-
rust: 1.34.0
21+
rust: 1.36.0
2222
env: GTK=3.24 FEATURES=subclassing,v2_48
2323
- os: osx
2424
rust: nightly

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)

src/key_file.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,21 @@ impl KeyFile {
131131

132132
pub fn get_boolean_list(&self, group_name: &str, key: &str) -> Result<Vec<bool>, Error> {
133133
unsafe {
134-
let mut length = mem::uninitialized();
134+
let mut length = mem::MaybeUninit::uninit();
135135
let mut error = ptr::null_mut();
136136
let ret = glib_sys::g_key_file_get_boolean_list(
137137
self.to_glib_none().0,
138138
group_name.to_glib_none().0,
139139
key.to_glib_none().0,
140-
&mut length,
140+
length.as_mut_ptr(),
141141
&mut error,
142142
);
143143
if !error.is_null() {
144144
return Err(from_glib_full(error));
145145
}
146146
Ok(FromGlibContainer::from_glib_container_num(
147147
ret,
148-
length as usize,
148+
length.assume_init() as usize,
149149
))
150150
}
151151
}

src/main_context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ use SourceId;
1313
impl MainContext {
1414
pub fn prepare(&self) -> (bool, i32) {
1515
unsafe {
16-
let mut priority = mem::uninitialized();
16+
let mut priority = mem::MaybeUninit::uninit();
1717

1818
let res = from_glib(glib_sys::g_main_context_prepare(
1919
self.to_glib_none().0,
20-
&mut priority,
20+
priority.as_mut_ptr(),
2121
));
22-
22+
let priority = priority.assume_init();
2323
(res, priority)
2424
}
2525
}

src/object.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ impl<T: ObjectType> ObjectExt for T {
14361436

14371437
fn downgrade(&self) -> WeakRef<T> {
14381438
unsafe {
1439-
let w = WeakRef(Box::new(mem::uninitialized()), PhantomData);
1439+
let w = WeakRef(Box::new(mem::zeroed()), PhantomData);
14401440
gobject_sys::g_weak_ref_init(
14411441
mut_override(&*w.0),
14421442
self.as_object_ref().to_glib_none().0,
@@ -1530,7 +1530,7 @@ pub struct WeakRef<T: ObjectType>(Box<gobject_sys::GWeakRef>, PhantomData<*const
15301530
impl<T: ObjectType> WeakRef<T> {
15311531
pub fn new() -> WeakRef<T> {
15321532
unsafe {
1533-
let w = WeakRef(Box::new(mem::uninitialized()), PhantomData);
1533+
let w = WeakRef(Box::new(mem::zeroed()), PhantomData);
15341534
gobject_sys::g_weak_ref_init(mut_override(&*w.0), ptr::null_mut());
15351535
w
15361536
}
@@ -1560,7 +1560,7 @@ impl<T: ObjectType> Drop for WeakRef<T> {
15601560
impl<T: ObjectType> Clone for WeakRef<T> {
15611561
fn clone(&self) -> Self {
15621562
unsafe {
1563-
let c = WeakRef(Box::new(mem::uninitialized()), PhantomData);
1563+
let c = WeakRef(Box::new(mem::zeroed()), PhantomData);
15641564

15651565
let o = gobject_sys::g_weak_ref_get(mut_override(&*self.0));
15661566
gobject_sys::g_weak_ref_init(mut_override(&*c.0), o);

src/time_val.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ pub use glib_sys::GTimeVal as TimeVal;
1010

1111
pub fn get_current_time() -> TimeVal {
1212
unsafe {
13-
let mut ret = mem::uninitialized();
14-
glib_sys::g_get_current_time(&mut ret);
15-
ret
13+
let mut ret = mem::MaybeUninit::uninit();
14+
glib_sys::g_get_current_time(ret.as_mut_ptr());
15+
ret.assume_init()
1616
}
1717
}
1818

@@ -27,6 +27,6 @@ impl<'a> ToGlibPtrMut<'a, *mut glib_sys::GTimeVal> for TimeVal {
2727

2828
impl Uninitialized for TimeVal {
2929
unsafe fn uninitialized() -> TimeVal {
30-
mem::uninitialized()
30+
mem::zeroed()
3131
}
3232
}

src/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl Value {
201201
#[doc(hidden)]
202202
pub fn into_raw(mut self) -> gobject_sys::GValue {
203203
unsafe {
204-
let ret = mem::replace(&mut self.0, mem::uninitialized());
204+
let ret = ptr::read(&self.0);
205205
mem::forget(self);
206206
ret
207207
}

0 commit comments

Comments
 (0)