From 9c671b852707db16549a9d4d06a38fb45136a679 Mon Sep 17 00:00:00 2001 From: Nishi Date: Wed, 23 Sep 2026 18:14:10 +0900 Subject: [PATCH] some fixes --- lib/sj4core/init.c | 24 ++++++++++++------------ lib/sj4ime/ime.c | 4 ++-- lib/sj4lib/sj.c | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/sj4core/init.c b/lib/sj4core/init.c index bfa754c..8270feb 100644 --- a/lib/sj4core/init.c +++ b/lib/sj4core/init.c @@ -82,21 +82,21 @@ Sj4Context* alloccontext(const char* dic) { if(ctx == NULL) return NULL; if((ctx->work = calloc(1, sizeof(*ctx->work))) == NULL) { - free(ctx); + free((char*)ctx); return NULL; } if((ctx->stdy = calloc(1, sizeof(*ctx->stdy))) == NULL) { - free(ctx->work); - free(ctx); + free((char*)ctx->work); + free((char*)ctx); return NULL; } if((node = calloc(1, sizeof(*node))) == NULL) { - free(ctx->stdy); - free(ctx->work); - free(ctx); + free((char*)ctx->stdy); + free((char*)ctx->work); + free((char*)ctx); return NULL; } @@ -128,19 +128,19 @@ void free_context(Sj4Context* ctx) { DICTL* next = node->next; if(node->dict != NULL) closedict(ctx, (DictFile*)node->dict); - free(node); + free((char*)node); node = next; } freework(ctx); - if(ctx->jrec_pool != NULL) free(ctx->jrec_pool); - if(ctx->clrec_pool != NULL) free(ctx->clrec_pool); + if(ctx->jrec_pool != NULL) free((char*)ctx->jrec_pool); + if(ctx->clrec_pool != NULL) free((char*)ctx->clrec_pool); - free(ctx->stdy); - free(ctx->work); + free((char*)ctx->stdy); + free((char*)ctx->work); - free(ctx); + free((char*)ctx); } #endif diff --git a/lib/sj4ime/ime.c b/lib/sj4ime/ime.c index 99cbd9f..4398f3c 100644 --- a/lib/sj4ime/ime.c +++ b/lib/sj4ime/ime.c @@ -42,7 +42,7 @@ Sj4Ime* sj4_ime(int charset, const char* dict, Sj4ImePacket packet) { if((ime = calloc(1, sizeof(*ime))) == NULL) return NULL; if((ime->lib = sj4_open(charset, dict)) == NULL) { - free(ime); + free((char*)ime); return NULL; } @@ -236,5 +236,5 @@ void* sj4_ime_convbuf(Sj4Ime* ime) { void sj4_ime_close(Sj4Ime* ime) { sj4_close(ime->lib); - free(ime); + free((char*)ime); } diff --git a/lib/sj4lib/sj.c b/lib/sj4lib/sj.c index 802dfa5..24ab3ad 100644 --- a/lib/sj4lib/sj.c +++ b/lib/sj4lib/sj.c @@ -28,7 +28,7 @@ Sj4Lib* sj4_open(int charset, const char* dic) { if((ctx = calloc(1, sizeof(*ctx))) == NULL) return NULL; if((ctx->ctx = alloccontext(dic)) == NULL) { - free(ctx); + free((char*)ctx); return NULL; } @@ -96,5 +96,5 @@ int sj4_prevkan(Sj4Lib* ctx) { void sj4_close(Sj4Lib* ctx) { free_context(ctx->ctx); - free(ctx); + free((char*)ctx); }