Fix print_system_info return value

This commit is contained in:
Ephraim Kunz 2022-11-22 10:10:03 -07:00
parent 520ea9d4d8
commit d3825debff
4 changed files with 11 additions and 7 deletions

View file

@ -1,7 +1,7 @@
//! Standalone functions that have no associated type.
use crate::WhisperToken;
use std::ffi::{c_int, CString};
use std::ffi::{c_int, CStr, CString};
/// Return the id of the specified language, returns -1 if not found
///
@ -47,6 +47,8 @@ pub fn token_transcribe() -> WhisperToken {
///
/// # C++ equivalent
/// `const char * whisper_print_system_info()`
pub fn print_system_info() {
unsafe { whisper_rs_sys::whisper_print_system_info() };
}
pub fn print_system_info() -> &'static str {
let c_buf = unsafe { whisper_rs_sys::whisper_print_system_info() };
let c_str = unsafe { CStr::from_ptr(c_buf) };
c_str.to_str().unwrap()
}