add conversion of &str to CString in set_language method
This commit is contained in:
parent
e28baf78d4
commit
b4420ad1ba
1 changed files with 3 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use std::ffi::c_int;
|
||||
use std::ffi::{c_int, CString};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub enum SamplingStrategy {
|
||||
|
|
@ -113,7 +113,8 @@ impl<'a> FullParams<'a> {
|
|||
///
|
||||
/// Defaults to "en".
|
||||
pub fn set_language(&mut self, language: &'a str) {
|
||||
self.fp.language = language.as_ptr() as *const _;
|
||||
let c_lang = CString::new(language).expect("Language contains null byte");
|
||||
self.fp.language = c_lang.into_raw() as *const _;
|
||||
}
|
||||
|
||||
/// Set the callback for new segments.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue