mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-25 11:39:37 +00:00
FFI: Use std::os::raw::c_char instead of i8 or libc's c_char
This fixes an issue where the string pointer type in the generated bindings was const int8_t *. This works the same way, but could be confusing.
This commit is contained in:
parent
b972f44bc9
commit
6b726463cd
|
@ -3,6 +3,7 @@
|
|||
use std::{
|
||||
cell::RefCell,
|
||||
ffi::{CStr, CString, NulError},
|
||||
os::raw::c_char,
|
||||
ptr,
|
||||
};
|
||||
|
||||
|
@ -24,7 +25,7 @@ fn set_last_error<E: Into<Vec<u8>>>(err: E) -> Result<(), NulError> {
|
|||
/// This string will be valid until at least the next call to `tts_get_error`.
|
||||
/// It is never called internally by the library.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn tts_get_error() -> *const i8 {
|
||||
pub extern "C" fn tts_get_error() -> *const c_char {
|
||||
LAST_ERROR.with(|err| match &*err.borrow() {
|
||||
Some(e) => e.as_ptr(),
|
||||
None => ptr::null(),
|
||||
|
@ -91,7 +92,7 @@ pub unsafe extern "C" fn tts_supported_features(tts: *const TTS) -> Features {
|
|||
#[no_mangle]
|
||||
pub unsafe extern "C" fn tts_speak(
|
||||
tts: *mut TTS,
|
||||
text: *const i8,
|
||||
text: *const c_char,
|
||||
interrupt: bool,
|
||||
utterance: *mut *mut UtteranceId,
|
||||
) -> bool {
|
||||
|
|
Loading…
Reference in New Issue
Block a user