mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-25 13:19:36 +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::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
ffi::{CStr, CString, NulError},
|
ffi::{CStr, CString, NulError},
|
||||||
|
os::raw::c_char,
|
||||||
ptr,
|
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`.
|
/// This string will be valid until at least the next call to `tts_get_error`.
|
||||||
/// It is never called internally by the library.
|
/// It is never called internally by the library.
|
||||||
#[no_mangle]
|
#[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() {
|
LAST_ERROR.with(|err| match &*err.borrow() {
|
||||||
Some(e) => e.as_ptr(),
|
Some(e) => e.as_ptr(),
|
||||||
None => ptr::null(),
|
None => ptr::null(),
|
||||||
|
@ -91,7 +92,7 @@ pub unsafe extern "C" fn tts_supported_features(tts: *const TTS) -> Features {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn tts_speak(
|
pub unsafe extern "C" fn tts_speak(
|
||||||
tts: *mut TTS,
|
tts: *mut TTS,
|
||||||
text: *const i8,
|
text: *const c_char,
|
||||||
interrupt: bool,
|
interrupt: bool,
|
||||||
utterance: *mut *mut UtteranceId,
|
utterance: *mut *mut UtteranceId,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user