From 7f870dbcd31bef5c16788292e40e0a274b8e2376 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 16 Jun 2022 05:38:43 +0000 Subject: [PATCH] fixed minor code glitches for some legacy compilers --- hawk/lib/err.c | 6 ++++-- hawk/lib/gem-nwif.c | 12 ++++++------ hawk/lib/hawk-mtx.h | 4 ++-- hawk/lib/hawk.h | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hawk/lib/err.c b/hawk/lib/err.c index f85d5c3e..6941ee08 100644 --- a/hawk/lib/err.c +++ b/hawk/lib/err.c @@ -24,7 +24,7 @@ #include "hawk-prv.h" -static hawk_loc_t _nullloc = { 0, 0, HAWK_NULL }; +static const hawk_loc_t _nullloc = { 0, 0, HAWK_NULL }; const hawk_ooch_t* hawk_dfl_errstr (hawk_errnum_t errnum) { @@ -212,7 +212,9 @@ const hawk_ooch_t* hawk_dfl_errstr (hawk_errnum_t errnum) HAWK_T("I/O error with file '${0}'") }; - return (errnum >= 0 && errnum < HAWK_COUNTOF(errstr))? errstr[errnum]: HAWK_T("unknown error"); + static const hawk_ooch_t* unknown_error = HAWK_T("unknown error"); + + return (errnum >= 0 && errnum < HAWK_COUNTOF(errstr))? errstr[errnum]: unknown_error; } hawk_errstr_t hawk_geterrstr (hawk_t* hawk) diff --git a/hawk/lib/gem-nwif.c b/hawk/lib/gem-nwif.c index a48861c0..e8dbb2df 100644 --- a/hawk/lib/gem-nwif.c +++ b/hawk/lib/gem-nwif.c @@ -184,7 +184,7 @@ int hawk_gem_bcstrtoifindex (hawk_gem_t* gem, const hawk_bch_t* ptr, unsigned in num = ifc.ifc_len / HAWK_SIZEOF(struct ifreq); for (i = 0; i < num; i++) { - if (hawk_comp_bcstr(ptr, ifc.ifc_req[i].ifr_name) == 0) + if (hawk_comp_bcstr(ptr, ifc.ifc_req[i].ifr_name, 0) == 0) { free_sco_ifconf (gem, &ifc); *index = i + 1; @@ -267,7 +267,7 @@ int hawk_gem_bcharstoifindex (hawk_gem_t* gem, const hawk_bch_t* ptr, hawk_oow_t num = ifc.ifc_len / HAWK_SIZEOF(struct ifreq); for (i = 0; i < num; i++) { - if (hawk_comp_bchars_bcstr(ptr, len, ifc.ifc_req[i].ifr_name) == 0) + if (hawk_comp_bchars_bcstr(ptr, len, ifc.ifc_req[i].ifr_name, 0) == 0) { free_sco_ifconf (gem, &ifc); *index = i + 1; @@ -359,7 +359,7 @@ int hawk_gem_ucstrtoifindex (hawk_gem_t* gem, const hawk_uch_t* ptr, unsigned in num = ifc.ifc_len / HAWK_SIZEOF(struct ifreq); for (i = 0; i < num; i++) { - if (hawk_comp_bcstr(tmp, ifc.ifc_req[i].ifr_name) == 0) + if (hawk_comp_bcstr(tmp, ifc.ifc_req[i].ifr_name, 0) == 0) { free_sco_ifconf (gem, &ifc); *index = i + 1; @@ -445,7 +445,7 @@ int hawk_gem_ucharstoifindex (hawk_gem_t* gem, const hawk_uch_t* ptr, hawk_oow_t hawk_oow_t wl, ml; wl = len; ml = HAWK_COUNTOF(tmp) - 1; - if (hawk_gem_convutobchars(ptr, &wl, tmp, &ml) <= -1) return -1; + if (hawk_gem_convutobchars(gem, ptr, &wl, tmp, &ml) <= -1) return -1; tmp[ml] = '\0'; if (get_sco_ifconf(gem, &ifc) <= -1) return -1; @@ -453,7 +453,7 @@ int hawk_gem_ucharstoifindex (hawk_gem_t* gem, const hawk_uch_t* ptr, hawk_oow_t num = ifc.ifc_len / HAWK_SIZEOF(struct ifreq); for (i = 0; i < num; i++) { - if (hawk_comp_bcstr(tmp, ifc.ifc_req[i].ifr_name) == 0) + if (hawk_comp_bcstr(gem, tmp, ifc.ifc_req[i].ifr_name) == 0) { free_sco_ifconf (gem, &ifc); *index = i + 1; @@ -633,7 +633,7 @@ int hawk_gem_ifindextoucstr (hawk_gem_t* gem, unsigned int index, hawk_uch_t* bu } wl = len; - x = hawk_gem_convbtoucstr(ifc.ifc_req[index - 1].ifr_name, &ml, buf, &wl, 0); + x = hawk_gem_convbtoucstr(gem, ifc.ifc_req[index - 1].ifr_name, &ml, buf, &wl, 0); free_sco_ifconf (gem, &ifc); if (x == -2 && wl > 1) buf[wl - 1] = '\0'; diff --git a/hawk/lib/hawk-mtx.h b/hawk/lib/hawk-mtx.h index 1b61101b..e7dad337 100644 --- a/hawk/lib/hawk-mtx.h +++ b/hawk/lib/hawk-mtx.h @@ -94,7 +94,7 @@ HAWK_EXPORT hawk_mtx_t* hawk_mtx_open ( ); HAWK_EXPORT void hawk_mtx_close ( - hawk_mtx_t* mtx + hawk_mtx_t* mtx ); HAWK_EXPORT int hawk_mtx_init ( @@ -103,7 +103,7 @@ HAWK_EXPORT int hawk_mtx_init ( ); HAWK_EXPORT void hawk_mtx_fini ( - hawk_mtx_t* mtx + hawk_mtx_t* mtx ); #if defined(HAWK_HAVE_INLINE) diff --git a/hawk/lib/hawk.h b/hawk/lib/hawk.h index b59655eb..7580898b 100644 --- a/hawk/lib/hawk.h +++ b/hawk/lib/hawk.h @@ -77,7 +77,7 @@ */ #define HAWK_HDR \ hawk_oow_t _instsize; \ - hawk_gem_t _gem; + hawk_gem_t _gem typedef struct hawk_alt_t hawk_alt_t; struct hawk_alt_t