fixed minor code glitches for some legacy compilers

This commit is contained in:
hyung-hwan 2022-06-16 05:38:43 +00:00
parent d57444cb31
commit 7f870dbcd3
4 changed files with 13 additions and 11 deletions

View File

@ -24,7 +24,7 @@
#include "hawk-prv.h" #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) 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}'") 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) hawk_errstr_t hawk_geterrstr (hawk_t* hawk)

View File

@ -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); num = ifc.ifc_len / HAWK_SIZEOF(struct ifreq);
for (i = 0; i < num; i++) 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); free_sco_ifconf (gem, &ifc);
*index = i + 1; *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); num = ifc.ifc_len / HAWK_SIZEOF(struct ifreq);
for (i = 0; i < num; i++) 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); free_sco_ifconf (gem, &ifc);
*index = i + 1; *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); num = ifc.ifc_len / HAWK_SIZEOF(struct ifreq);
for (i = 0; i < num; i++) 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); free_sco_ifconf (gem, &ifc);
*index = i + 1; *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; hawk_oow_t wl, ml;
wl = len; ml = HAWK_COUNTOF(tmp) - 1; 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'; tmp[ml] = '\0';
if (get_sco_ifconf(gem, &ifc) <= -1) return -1; 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); num = ifc.ifc_len / HAWK_SIZEOF(struct ifreq);
for (i = 0; i < num; i++) 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); free_sco_ifconf (gem, &ifc);
*index = i + 1; *index = i + 1;
@ -633,7 +633,7 @@ int hawk_gem_ifindextoucstr (hawk_gem_t* gem, unsigned int index, hawk_uch_t* bu
} }
wl = len; 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); free_sco_ifconf (gem, &ifc);
if (x == -2 && wl > 1) buf[wl - 1] = '\0'; if (x == -2 && wl > 1) buf[wl - 1] = '\0';

View File

@ -77,7 +77,7 @@
*/ */
#define HAWK_HDR \ #define HAWK_HDR \
hawk_oow_t _instsize; \ hawk_oow_t _instsize; \
hawk_gem_t _gem; hawk_gem_t _gem
typedef struct hawk_alt_t hawk_alt_t; typedef struct hawk_alt_t hawk_alt_t;
struct hawk_alt_t struct hawk_alt_t