From 568166b4e24f67cc520833a1a8f9be3c78ff062a Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 23 Sep 2024 20:31:11 +0900 Subject: [PATCH] minor code change for type consisitency --- lib/fmt.c | 2 +- lib/gc.c | 2 +- lib/prim.c | 4 ++-- lib/std.c | 2 +- pas/hcl.pas | 3 ++- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/fmt.c b/lib/fmt.c index 5378d6f..8025efe 100644 --- a/lib/fmt.c +++ b/lib/fmt.c @@ -1180,7 +1180,7 @@ static int fmt_outv (hcl_t* hcl, hcl_fmtout_t* fmtout, va_list ap) { /*HCL_ASSERT (hcl, fb.out.ptr == fb.out.sbuf);*/ - fb.out.ptr = HCL_MMGR_ALLOC(fmtout->mmgr, HCL_SIZEOF(hcl_bch_t) * (newcapa + 1)); + fb.out.ptr = (hcl_bch_t*)HCL_MMGR_ALLOC(fmtout->mmgr, HCL_SIZEOF(hcl_bch_t) * (newcapa + 1)); if (!fb.out.ptr) goto oops; fb.out.capa = newcapa; } diff --git a/lib/gc.c b/lib/gc.c index f2200d6..8aa06ab 100644 --- a/lib/gc.c +++ b/lib/gc.c @@ -1393,7 +1393,7 @@ void hcl_popvolats (hcl_t* hcl, hcl_oow_t count) hcl_oop_t hcl_shallowcopy (hcl_t* hcl, hcl_oop_t oop) { - if (HCL_OOP_IS_POINTER(oop) && HCL_OBJ_GET_CLASS(oop) != hcl->c_symbol) + if (HCL_OOP_IS_POINTER(oop) && HCL_OBJ_GET_CLASS(oop) != (hcl_oop_t)hcl->c_symbol) { hcl_oop_t z; hcl_oow_t total_bytes; diff --git a/lib/prim.c b/lib/prim.c index ad36b7b..3bb44ef 100644 --- a/lib/prim.c +++ b/lib/prim.c @@ -477,13 +477,13 @@ static hcl_pfrc_t pf_gets (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs) newcapa = capa + HCL_COUNTOF(buf); if (ptr == buf) { - tmp = hcl_allocmem(hcl, HCL_SIZEOF(*ptr) * newcapa); + tmp = (hcl_ooch_t*)hcl_allocmem(hcl, HCL_SIZEOF(*ptr) * newcapa); if (HCL_UNLIKELY(!tmp)) return HCL_PF_FAILURE; HCL_MEMCPY (tmp, buf, HCL_SIZEOF(buf)); } else { - tmp = hcl_reallocmem(hcl, ptr, HCL_SIZEOF(*ptr) * newcapa); + tmp = (hcl_ooch_t*)hcl_reallocmem(hcl, ptr, HCL_SIZEOF(*ptr) * newcapa); if (HCL_UNLIKELY(!tmp)) { hcl_freemem(hcl, ptr); diff --git a/lib/std.c b/lib/std.c index d59aff4..55abcd4 100644 --- a/lib/std.c +++ b/lib/std.c @@ -2852,7 +2852,7 @@ static void cb_opt_set (hcl_t* hcl, hcl_option_t id, const void* value) #if defined(_WIN32) #if defined(HCL_OOCH_IS_UCH) && (HCL_SIZEOF_UCH_T == HCL_SIZEOF_WCHAR_T) - fd = _wopen(hcl->option.log_target_u, _O_CREAT | _O_WRONLY | _O_APPEND | _O_BINARY , 0644); + fd = _wopen((const wchar_t*)hcl->option.log_target_u, _O_CREAT | _O_WRONLY | _O_APPEND | _O_BINARY , 0644); #else fd = _open(hcl->option.log_target_b, _O_CREAT | _O_WRONLY | _O_APPEND | _O_BINARY , 0644); #endif diff --git a/pas/hcl.pas b/pas/hcl.pas index 63088e8..f1836d7 100644 --- a/pas/hcl.pas +++ b/pas/hcl.pas @@ -1,6 +1,7 @@ unit HCL; {$mode objfpc}{$H+} +{$macro on} {$linklib hcl} {$linklib c} {$linklib dl} @@ -267,7 +268,7 @@ begin (* included file *) nf := NamedHandlePtr(arg^.includer^.handle); basedir := SysUtils.ExtractFilePath(nf^.name); - name := UTF8Encode(arg^.name); + name := System.UTF8Encode(WideString(arg^.name)); if SysUtils.CompareStr(basedir, '') <> 0 then name := SysUtils.ConcatPaths([basedir, name]); end;