From 62d93057e9718800496a2fdffa13a2df73f033ee Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Sat, 9 Sep 2023 00:07:26 +0900 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E6=95=B0=E3=81=AE`VoicevoxUserDictWor?= =?UTF-8?q?d*`=E3=81=8Cunaligned=E3=81=A7=E3=81=82=E3=82=8B=E3=81=93?= =?UTF-8?q?=E3=81=A8=E3=82=92=E8=A8=B1=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/voicevox_core_c_api/src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/voicevox_core_c_api/src/lib.rs b/crates/voicevox_core_c_api/src/lib.rs index 738c36c8a..a51f89b27 100644 --- a/crates/voicevox_core_c_api/src/lib.rs +++ b/crates/voicevox_core_c_api/src/lib.rs @@ -956,6 +956,7 @@ pub struct VoicevoxUserDict { } /// ユーザー辞書の単語。 +#[derive(Clone, Copy)] #[repr(C)] pub struct VoicevoxUserDictWord { /// 表記 @@ -1056,11 +1057,11 @@ pub unsafe extern "C" fn voicevox_user_dict_load( #[no_mangle] pub unsafe extern "C" fn voicevox_user_dict_add_word( user_dict: &VoicevoxUserDict, - word: &VoicevoxUserDictWord, // FIXME: に従う + word: *const VoicevoxUserDictWord, // FIXME: に従う output_word_uuid: NonNull<[u8; 16]>, ) -> VoicevoxResultCode { into_result_code_with_error((|| { - let word = word.try_into_word()?; + let word = (*word).try_into_word()?; let uuid = { let mut dict = user_dict.dict.lock().expect("lock failed"); dict.add_word(word)? @@ -1087,11 +1088,11 @@ pub unsafe extern "C" fn voicevox_user_dict_add_word( pub unsafe extern "C" fn voicevox_user_dict_update_word( user_dict: &VoicevoxUserDict, word_uuid: &[u8; 16], - word: &VoicevoxUserDictWord, // FIXME: に従う + word: *const VoicevoxUserDictWord, // FIXME: に従う ) -> VoicevoxResultCode { into_result_code_with_error((|| { let word_uuid = Uuid::from_slice(word_uuid).map_err(CApiError::InvalidUuid)?; - let word = word.try_into_word()?; + let word = (*word).try_into_word()?; { let mut dict = user_dict.dict.lock().expect("lock failed"); dict.update_word(word_uuid, word)?;