Skip to content

Commit

Permalink
dereferenceするのではなくread_unalignedで読む
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Sep 8, 2023
1 parent 7d0b3e1 commit da29768
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/voicevox_core_c_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ pub unsafe extern "C" fn voicevox_user_dict_add_word(
output_word_uuid: NonNull<[u8; 16]>,
) -> VoicevoxResultCode {
into_result_code_with_error((|| {
let word = (*word).try_into_word()?;
let word = word.read_unaligned().try_into_word()?;
let uuid = {
let mut dict = user_dict.dict.lock().expect("lock failed");
dict.add_word(word)?
Expand Down Expand Up @@ -1092,7 +1092,7 @@ pub unsafe extern "C" fn voicevox_user_dict_update_word(
) -> 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.read_unaligned().try_into_word()?;
{
let mut dict = user_dict.dict.lock().expect("lock failed");
dict.update_word(word_uuid, word)?;
Expand Down

0 comments on commit da29768

Please sign in to comment.