diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2023-05-07 22:13:56 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-07 16:13:56 +0200 |
| commit | 9f38e81735b10668d64974033b4bb5097219ee34 (patch) | |
| tree | 57827cc130a3e79a46c58f4e5ce8946c78f4131a /src/wrapped/wrappedfreetype.c | |
| parent | 47ecde75ec19a58f458c1131ec1968d11d58e7e1 (diff) | |
| download | box64-9f38e81735b10668d64974033b4bb5097219ee34.tar.gz box64-9f38e81735b10668d64974033b4bb5097219ee34.zip | |
[WRAPPER] Used RunFunctionFmt for better sign-extend handling (#768)
* [WRAPPER] Used RunFunctionFmt for better sign-extend handling * [WRAPPER] Fixed some typos * [WRAPPER] Use L for unsigned long for better portability * [WRAPPER] More replace from U to L
Diffstat (limited to 'src/wrapped/wrappedfreetype.c')
| -rwxr-xr-x | src/wrapped/wrappedfreetype.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/src/wrapped/wrappedfreetype.c b/src/wrapped/wrappedfreetype.c index aacad276..6088f033 100755 --- a/src/wrapped/wrappedfreetype.c +++ b/src/wrapped/wrappedfreetype.c @@ -133,10 +133,10 @@ GO(4) // FT_Generic_Finalizer #define GO(A) \ -static uintptr_t my_FT_Generic_Finalizer_fct_##A = 0; \ -static void my_FT_Generic_Finalizer_##A(void* object) \ -{ \ - RunFunction(my_context, my_FT_Generic_Finalizer_fct_##A, 1, object); \ +static uintptr_t my_FT_Generic_Finalizer_fct_##A = 0; \ +static void my_FT_Generic_Finalizer_##A(void* object) \ +{ \ + RunFunctionFmt(my_context, my_FT_Generic_Finalizer_fct_##A, "p", object); \ } SUPER() #undef GO @@ -156,15 +156,15 @@ static void* find_FT_Generic_Finalizer_Fct(void* fct) } // FTC_Face_Requester #define GO(A) \ -static uintptr_t my_FTC_Face_Requester_fct_##A = 0; \ -static int my_FTC_Face_Requester_##A(void* face_id, void* lib, void* req, void* aface) \ -{ \ - int ret = (int)RunFunction(my_context, my_FTC_Face_Requester_fct_##A, 4, face_id, lib, req, aface); \ - if(aface && *(void**)aface) { \ - FT_FaceRec_t *f = *(FT_FaceRec_t**)aface; \ - f->generic.finalizer = find_FT_Generic_Finalizer_Fct(f->generic.finalizer); \ - } \ - return ret; \ +static uintptr_t my_FTC_Face_Requester_fct_##A = 0; \ +static int my_FTC_Face_Requester_##A(void* face_id, void* lib, void* req, void* aface) \ +{ \ + int ret = (int)RunFunctionFmt(my_context, my_FTC_Face_Requester_fct_##A, "pppp", face_id, lib, req, aface); \ + if(aface && *(void**)aface) { \ + FT_FaceRec_t *f = *(FT_FaceRec_t**)aface; \ + f->generic.finalizer = find_FT_Generic_Finalizer_Fct(f->generic.finalizer); \ + } \ + return ret; \ } SUPER() #undef GO @@ -184,10 +184,10 @@ static void* find_FTC_Face_Requester_Fct(void* fct) } // FT_Alloc #define GO(A) \ -static uintptr_t my_FT_Alloc_fct_##A = 0; \ -static void* my_FT_Alloc_##A(void* memory, long size) \ -{ \ - return (void*)RunFunction(my_context, my_FT_Alloc_fct_##A, 2, memory, size);\ +static uintptr_t my_FT_Alloc_fct_##A = 0; \ +static void* my_FT_Alloc_##A(void* memory, long size) \ +{ \ + return (void*)RunFunctionFmt(my_context, my_FT_Alloc_fct_##A, "pl", memory, size); \ } SUPER() #undef GO @@ -207,10 +207,10 @@ static void* find_FT_Alloc_Fct(void* fct) } // FT_Free #define GO(A) \ -static uintptr_t my_FT_Free_fct_##A = 0; \ -static void my_FT_Free_##A(void* memory, void* p) \ -{ \ - RunFunction(my_context, my_FT_Free_fct_##A, 2, memory, p); \ +static uintptr_t my_FT_Free_fct_##A = 0; \ +static void my_FT_Free_##A(void* memory, void* p) \ +{ \ + RunFunctionFmt(my_context, my_FT_Free_fct_##A, "pp", memory, p); \ } SUPER() #undef GO @@ -230,10 +230,10 @@ static void* find_FT_Free_Fct(void* fct) } // FT_Realloc #define GO(A) \ -static uintptr_t my_FT_Realloc_fct_##A = 0; \ -static void* my_FT_Realloc_##A(void* memory, long cur, long size, void* p) \ -{ \ - return (void*)RunFunction(my_context, my_FT_Realloc_fct_##A, 4, memory, cur, size, p); \ +static uintptr_t my_FT_Realloc_fct_##A = 0; \ +static void* my_FT_Realloc_##A(void* memory, long cur, long size, void* p) \ +{ \ + return (void*)RunFunctionFmt(my_context, my_FT_Realloc_fct_##A, "pllp", memory, cur, size, p); \ } SUPER() #undef GO @@ -253,10 +253,10 @@ static void* find_FT_Realloc_Fct(void* fct) } // FT_Outline_MoveToFunc #define GO(A) \ -static uintptr_t my_FT_Outline_MoveToFunc_fct_##A = 0; \ -static int my_FT_Outline_MoveToFunc_##A(void* to, void* user) \ -{ \ - return (int)RunFunction(my_context, my_FT_Outline_MoveToFunc_fct_##A, 2, to, user); \ +static uintptr_t my_FT_Outline_MoveToFunc_fct_##A = 0; \ +static int my_FT_Outline_MoveToFunc_##A(void* to, void* user) \ +{ \ + return (int)RunFunctionFmt(my_context, my_FT_Outline_MoveToFunc_fct_##A, "pp", to, user); \ } SUPER() #undef GO @@ -277,10 +277,10 @@ static void* find_FT_Outline_MoveToFunc_Fct(void* fct) // FT_Outline_LineToFunc #define GO(A) \ -static uintptr_t my_FT_Outline_LineToFunc_fct_##A = 0; \ -static int my_FT_Outline_LineToFunc_##A(void* to, void* user) \ -{ \ - return (int)RunFunction(my_context, my_FT_Outline_LineToFunc_fct_##A, 2, to, user); \ +static uintptr_t my_FT_Outline_LineToFunc_fct_##A = 0; \ +static int my_FT_Outline_LineToFunc_##A(void* to, void* user) \ +{ \ + return (int)RunFunctionFmt(my_context, my_FT_Outline_LineToFunc_fct_##A, "pp", to, user); \ } SUPER() #undef GO @@ -301,10 +301,10 @@ static void* find_FT_Outline_LineToFunc_Fct(void* fct) // FT_Outline_ConicToFunc #define GO(A) \ -static uintptr_t my_FT_Outline_ConicToFunc_fct_##A = 0; \ -static int my_FT_Outline_ConicToFunc_##A(void* ctl, void* to, void* user) \ -{ \ - return (int)RunFunction(my_context, my_FT_Outline_ConicToFunc_fct_##A, 3, ctl, to, user); \ +static uintptr_t my_FT_Outline_ConicToFunc_fct_##A = 0; \ +static int my_FT_Outline_ConicToFunc_##A(void* ctl, void* to, void* user) \ +{ \ + return (int)RunFunctionFmt(my_context, my_FT_Outline_ConicToFunc_fct_##A, "ppp", ctl, to, user); \ } SUPER() #undef GO @@ -325,10 +325,10 @@ static void* find_FT_Outline_ConicToFunc_Fct(void* fct) // FT_Outline_CubicToFunc #define GO(A) \ -static uintptr_t my_FT_Outline_CubicToFunc_fct_##A = 0; \ -static int my_FT_Outline_CubicToFunc_##A(void* ctl1, void* ctl2, void* to, void* user) \ -{ \ - return (int)RunFunction(my_context, my_FT_Outline_CubicToFunc_fct_##A, 4, ctl1, ctl2, to, user); \ +static uintptr_t my_FT_Outline_CubicToFunc_fct_##A = 0; \ +static int my_FT_Outline_CubicToFunc_##A(void* ctl1, void* ctl2, void* to, void* user) \ +{ \ + return (int)RunFunctionFmt(my_context, my_FT_Outline_CubicToFunc_fct_##A, "pppp", ctl1, ctl2, to, user); \ } SUPER() #undef GO @@ -378,13 +378,13 @@ static FT_MemoryRec_t* find_FT_MemoryRec_Struct(FT_MemoryRec_t* s) static uintptr_t my_iofunc = 0; static unsigned long my_FT_Stream_IoFunc(FT_StreamRec_t* stream, unsigned long offset, unsigned char* buffer, unsigned long count ) { - return (unsigned long)RunFunction(my_context, my_iofunc, 4, stream, offset, buffer, count); + return (unsigned long)RunFunctionFmt(my_context, my_iofunc, "pLpL", stream, offset, buffer, count); } static uintptr_t my_closefunc = 0; static void my_FT_Stream_CloseFunc(FT_StreamRec_t* stream) { - RunFunction(my_context, my_closefunc, 1, stream); + RunFunctionFmt(my_context, my_closefunc, "p", stream); } EXPORT int my_FT_Open_Face(x64emu_t* emu, void* library, FT_Open_Args_t* args, long face_index, void* aface) |