From 324274bc164dedc01ee6a6f0506065d8e87fca23 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 8 Apr 2022 07:19:48 +0000 Subject: [PATCH] fixed some type mismatch warnings --- hawk/Makefile.in | 2 +- hawk/lib/fio.c | 2 +- hawk/lib/hawk.h | 7 ------- hawk/lib/rio-prv.h | 2 +- hawk/lib/rio.c | 2 +- hawk/lib/run.c | 5 +++++ hawk/mod/mod-sed.c | 11 ++--------- hawk/pkgs/hawk.spec.in | 1 + hawk/t/t-005.c | 5 ----- 9 files changed, 12 insertions(+), 25 deletions(-) diff --git a/hawk/Makefile.in b/hawk/Makefile.in index 002e65f8..6b25e600 100644 --- a/hawk/Makefile.in +++ b/hawk/Makefile.in @@ -170,7 +170,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/ar-lib \ $(top_srcdir)/ac/config.sub $(top_srcdir)/ac/install-sh \ $(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing \ $(top_srcdir)/ac/tap-driver.sh $(top_srcdir)/pkgs/hawk.spec.in \ - ac/ar-lib ac/compile ac/config.guess ac/config.sub \ + ac/ar-lib ac/compile ac/config.guess ac/config.sub ac/depcomp \ ac/install-sh ac/ltmain.sh ac/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) diff --git a/hawk/lib/fio.c b/hawk/lib/fio.c index a9d59acc..40d9fa7e 100644 --- a/hawk/lib/fio.c +++ b/hawk/lib/fio.c @@ -866,7 +866,7 @@ int hawk_fio_init (hawk_fio_t* fio, hawk_gem_t* gem, const hawk_ooch_t* path, in #if defined(HAWK_OOCH_IS_BCH) /* nothing to do */ #else - if (path_mb != path_mb_buf && path_mb != path) + if (path_mb != path_mb_buf && path_mb != (hawk_bch_t*)path) { hawk_gem_freemem (fio->gem, path_mb); } diff --git a/hawk/lib/hawk.h b/hawk/lib/hawk.h index 8518db5b..da2d5fa0 100644 --- a/hawk/lib/hawk.h +++ b/hawk/lib/hawk.h @@ -1695,13 +1695,6 @@ HAWK_EXPORT void hawk_seterruvfmt ( # define hawk_seterrvfmt hawk_seterrbvfmt #endif -HAWK_EXPORT void hawk_seterror ( - hawk_t* hawk, - const hawk_loc_t* errloc, - hawk_errnum_t errnum, - const hawk_oocs_t* errarg -); - /** * The hawk_getopt() function gets the value of an option * specified by \a id into the buffer pointed to by \a value. diff --git a/hawk/lib/rio-prv.h b/hawk/lib/rio-prv.h index f7ec038b..c82ba583 100644 --- a/hawk/lib/rio-prv.h +++ b/hawk/lib/rio-prv.h @@ -44,7 +44,7 @@ extern "C" { #endif hawk_rio_type_t hawk_rtx_intoriotype (hawk_rtx_t* rtx, hawk_in_type_t in_type); -hawk_rio_type_t hawk_rtx_outtoriotype (hawk_rtx_t* rtx, hawk_in_type_t out_type); +hawk_rio_type_t hawk_rtx_outtoriotype (hawk_rtx_t* rtx, hawk_out_type_t out_type); int hawk_rtx_readio ( hawk_rtx_t* rtx, hawk_in_type_t in_type, diff --git a/hawk/lib/rio.c b/hawk/lib/rio.c index ae3303ba..d6c40674 100644 --- a/hawk/lib/rio.c +++ b/hawk/lib/rio.c @@ -98,7 +98,7 @@ hawk_rio_type_t hawk_rtx_intoriotype (hawk_rtx_t* rtx, hawk_in_type_t in_type) return in_type_map[in_type]; } -hawk_rio_type_t hawk_rtx_outtoriotype (hawk_rtx_t* rtx, hawk_in_type_t out_type) +hawk_rio_type_t hawk_rtx_outtoriotype (hawk_rtx_t* rtx, hawk_out_type_t out_type) { return out_type_map[out_type]; } diff --git a/hawk/lib/run.c b/hawk/lib/run.c index 178c829d..0c1815d6 100644 --- a/hawk/lib/run.c +++ b/hawk/lib/run.c @@ -9801,11 +9801,15 @@ wp_mod_main: if ((fmt[i] != 's' && !HAWK_BYTE_PRINTABLE(curc)) || fmt[i] == 'w' || fmt[i] == 'W') { hawk_bch_t xbuf[3]; + #if 0 /* the range check isn't needed for hawk_bch_t. it's always <= 0xFF */ + if (curc <= 0xFF) { + #endif if (hawk_becs_ncat(out, HAWK_BT("\\x"), 2) == (hawk_oow_t)-1) goto s_fail; hawk_byte_to_bcstr(curc, xbuf, HAWK_COUNTOF(xbuf), bytetombs_flagged_radix, HAWK_BT('0')); if (hawk_becs_ncat(out, xbuf, 2) == (hawk_oow_t)-1) goto s_fail; + #if 0 } else if (curc <= 0xFFFF) { @@ -9829,6 +9833,7 @@ wp_mod_main: hawk_byte_to_bcstr(u32 & 0xFF, xbuf, HAWK_COUNTOF(xbuf), bytetombs_flagged_radix, HAWK_BT('0')); if (hawk_becs_ncat(out, xbuf, 2) == (hawk_oow_t)-1) goto s_fail; } + #endif } else { diff --git a/hawk/mod/mod-sed.c b/hawk/mod/mod-sed.c index 5bd4aca0..e5883250 100644 --- a/hawk/mod/mod-sed.c +++ b/hawk/mod/mod-sed.c @@ -93,7 +93,7 @@ static int fnc_file_to_file (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi) /* result = sed::file_to_file ("s/ABC/123/g", input_file, output_file [, option_string]) */ - sed = hawk_sed_openstdwithmmgr(hawk_rtx_getgem(rtx), 0, hawk_rtx_getcmgr(rtx), HAWK_NULL); + sed = hawk_sed_openstdwithmmgr(hawk_rtx_getmmgr(rtx), 0, hawk_rtx_getcmgr(rtx), HAWK_NULL); if (sed == HAWK_NULL) { ret = -2; @@ -213,14 +213,7 @@ oops: return 0; } -typedef struct fnctab_t fnctab_t; -struct fnctab_t -{ - const hawk_ooch_t* name; - hawk_mod_sym_fnc_t info; -}; - -static fnctab_t fnctab[] = +static hawk_mod_fnc_tab_t fnctab[] = { /* keep this table sorted for binary search in query(). */ { HAWK_T("file_to_file"), { { 3, 3, HAWK_NULL }, fnc_file_to_file, 0 } }, diff --git a/hawk/pkgs/hawk.spec.in b/hawk/pkgs/hawk.spec.in index bc6cb870..8461a454 100644 --- a/hawk/pkgs/hawk.spec.in +++ b/hawk/pkgs/hawk.spec.in @@ -61,6 +61,7 @@ CFLAGS="${RPM_OPT_FLAGS} -fPIC" CXXFLAGS="${RPM_OPT_FLAGS} -fPIC" ./configure \ %endif --with-mysql=yes \ --enable-mod-mysql=yes \ + --enable-mod-sed=yes \ --enable-mod-uci=no ##CC=gcc44 CXX=g++44 make diff --git a/hawk/t/t-005.c b/hawk/t/t-005.c index e9f6e896..e54767cc 100644 --- a/hawk/t/t-005.c +++ b/hawk/t/t-005.c @@ -51,7 +51,6 @@ static void test1 (void) printf ("[%s]\n", HAWK_BECS_PTR(b)); hawk_becs_close (b); - return 0; } static void test2 (void) @@ -71,8 +70,6 @@ static void test2 (void) OK_X (q == 3); OK_X (dst[q] == src[q]); for (i = 0; i < q; i++) OK_X (dst[i] == sxx[i]); - - return 0; } hawk_bch_t* subst (hawk_bch_t* buf, hawk_oow_t bsz, const hawk_bcs_t* ident, void* ctx) @@ -105,8 +102,6 @@ static void test3 (void) OK_X (hawk_count_bcstr(ptr) == 29); OK_X (hawk_comp_bcstr(ptr, "USERNAME=sam,GROUPNAME=coders", 0) == 0); free (ptr); - - return 0; } int main ()