Skip to content

Commit

Permalink
fix: ffi type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Dec 13, 2023
1 parent a138442 commit 937051e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dojo.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct CJsonRpcClient CJsonRpcClient;
typedef struct ToriiClient ToriiClient;

typedef struct Error {
const char *message;
char *message;
} Error;

typedef enum Result_____ToriiClient_Tag {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ pub unsafe extern "C" fn entity_free(entity: *mut Entity) {
#[allow(clippy::missing_safety_doc)]
pub unsafe extern "C" fn error_free(error: *mut Error) {
if !error.is_null() {
let _: String = CString::from_raw((*error).message as *mut i8)
let _: String = CString::from_raw((*error).message)
.into_string()
.unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub struct CHashItem<K, V> {
#[derive(Debug, Clone)]
#[repr(C)]
pub struct Error {
pub message: *const c_char,
pub message: *mut c_char,
}

#[derive(Clone, Debug)]
Expand Down

0 comments on commit 937051e

Please sign in to comment.