code tweaks for legacy systems
This commit is contained in:
parent
e276de96d7
commit
d86fff04f5
@ -442,7 +442,7 @@ static int fnc_modlibdirs (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
|
||||
hawk_t* hawk = hawk_rtx_gethawk(rtx);
|
||||
hawk_val_t* r;
|
||||
|
||||
r = hawk_rtx_makestrvalwithoocstr(rtx, (hawk->opt.mod[0].len > 0)? hawk->opt.mod[0].ptr: HAWK_T(HAWK_DEFAULT_MODLIBDIRS));
|
||||
r = hawk_rtx_makestrvalwithoocstr(rtx, (hawk->opt.mod[0].len > 0)? (const hawk_ooch_t*)hawk->opt.mod[0].ptr: (const hawk_ooch_t*)HAWK_T(HAWK_DEFAULT_MODLIBDIRS));
|
||||
if (HAWK_UNLIKELY(!r)) return -1;
|
||||
|
||||
hawk_rtx_setretval (rtx, r);
|
||||
|
@ -6806,7 +6806,7 @@ retry:
|
||||
if (hawk_comp_oochars_bcstr(HAWK_OOECS_PTR(tok->name), HAWK_OOECS_LEN(tok->name), "@SCRIPTNAME", 0) == 0)
|
||||
{
|
||||
/* special parser-level word @SCRIPTNAME. substitute an actual value for it */
|
||||
if (HAWK_UNLIKELY(hawk_ooecs_cpy(tok->name, (tok->loc.file? tok->loc.file: HAWK_T(""))) == (hawk_oow_t)-1)) return -1;
|
||||
if (HAWK_UNLIKELY(hawk_ooecs_cpy(tok->name, (tok->loc.file? (const hawk_ooch_t*)tok->loc.file: (const hawk_ooch_t*)HAWK_T(""))) == (hawk_oow_t)-1)) return -1;
|
||||
SET_TOKEN_TYPE (hawk, tok, TOK_STR);
|
||||
}
|
||||
else if (hawk_comp_oochars_bcstr(HAWK_OOECS_PTR(tok->name), HAWK_OOECS_LEN(tok->name), "@SCRIPTLINE", 0) == 0)
|
||||
@ -7453,8 +7453,8 @@ static hawk_mod_t* query_module (hawk_t* hawk, const hawk_oocs_t segs[], int nse
|
||||
#endif
|
||||
/* attempt to find an external module */
|
||||
HAWK_MEMSET (&spec, 0, HAWK_SIZEOF(spec));
|
||||
spec.prefix = (hawk->opt.mod[1].len > 0)? hawk->opt.mod[1].ptr: HAWK_T(HAWK_DEFAULT_MODPREFIX);
|
||||
spec.postfix = (hawk->opt.mod[2].len > 0)? hawk->opt.mod[2].ptr: HAWK_T(HAWK_DEFAULT_MODPOSTFIX);
|
||||
spec.prefix = (hawk->opt.mod[1].len > 0)? (const hawk_ooch_t*)hawk->opt.mod[1].ptr: (const hawk_ooch_t*)HAWK_T(HAWK_DEFAULT_MODPREFIX);
|
||||
spec.postfix = (hawk->opt.mod[2].len > 0)? (const hawk_ooch_t*)hawk->opt.mod[2].ptr: (const hawk_ooch_t*)HAWK_T(HAWK_DEFAULT_MODPOSTFIX);
|
||||
spec.name = segs[0].ptr; /* the caller must ensure that this segment is null-terminated */
|
||||
|
||||
if (!hawk->prm.modopen || !hawk->prm.modgetsym || !hawk->prm.modclose)
|
||||
@ -7463,7 +7463,7 @@ static hawk_mod_t* query_module (hawk_t* hawk, const hawk_oocs_t segs[], int nse
|
||||
goto open_fail;
|
||||
}
|
||||
|
||||
spec.libdir = (hawk->opt.mod[0].len > 0)? hawk->opt.mod[0].ptr: HAWK_T(HAWK_DEFAULT_MODLIBDIRS);
|
||||
spec.libdir = (hawk->opt.mod[0].len > 0)? (const hawk_ooch_t*)hawk->opt.mod[0].ptr: (const hawk_ooch_t*)HAWK_T(HAWK_DEFAULT_MODLIBDIRS);
|
||||
do
|
||||
{
|
||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||
@ -7491,7 +7491,9 @@ static hawk_mod_t* query_module (hawk_t* hawk, const hawk_oocs_t segs[], int nse
|
||||
open_fail:
|
||||
bem = hawk_backuperrmsg(hawk);
|
||||
hawk_seterrfmt (hawk, HAWK_NULL, HAWK_ENOENT, HAWK_T("'%js%js%js' for module '%js' not found - %js"),
|
||||
(spec.prefix? spec.prefix: HAWK_T("")), spec.name, (spec.postfix? spec.postfix: HAWK_T("")),
|
||||
(spec.prefix? (const hawk_ooch_t*)spec.prefix: (const hawk_ooch_t*)HAWK_T("")),
|
||||
spec.name,
|
||||
(spec.postfix? (const hawk_ooch_t*)spec.postfix: (const hawk_ooch_t*)HAWK_T("")),
|
||||
spec.name, bem);
|
||||
return HAWK_NULL;
|
||||
}
|
||||
|
@ -819,7 +819,7 @@ static hawk_oow_t ip4ad_to_ucstr (const struct in_addr* ipad, hawk_uch_t* buf, h
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
|
||||
#if (HAWK_SIZEOF_STRUCT_SOCKADDR_IN6 > 0)
|
||||
static hawk_oow_t ip6ad_to_ucstr (const struct in6_addr* ipad, hawk_uch_t* buf, hawk_oow_t size)
|
||||
{
|
||||
/*
|
||||
@ -918,6 +918,7 @@ static hawk_oow_t ip6ad_to_ucstr (const struct in6_addr* ipad, hawk_uch_t* buf,
|
||||
|
||||
#undef IP6ADDR_NWORDS
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
hawk_oow_t hawk_gem_skadtoucstr (hawk_gem_t* gem, const hawk_skad_t* _skad, hawk_uch_t* buf, hawk_oow_t len, int flags)
|
||||
@ -952,6 +953,7 @@ hawk_oow_t hawk_gem_skadtoucstr (hawk_gem_t* gem, const hawk_skad_t* _skad, hawk
|
||||
}
|
||||
break;
|
||||
|
||||
#if (HAWK_SIZEOF_STRUCT_SOCKADDR_IN6 > 0)
|
||||
case HAWK_AF_INET6:
|
||||
if (flags & HAWK_SKAD_TO_BCSTR_PORT)
|
||||
{
|
||||
@ -1007,6 +1009,7 @@ hawk_oow_t hawk_gem_skadtoucstr (hawk_gem_t* gem, const hawk_skad_t* _skad, hawk
|
||||
}
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
case HAWK_AF_UNIX:
|
||||
if (flags & HAWK_SKAD_TO_BCSTR_ADDR)
|
||||
@ -1065,7 +1068,7 @@ static hawk_oow_t ip4ad_to_bcstr (const struct in_addr* ipad, hawk_bch_t* buf, h
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
|
||||
#if (HAWK_SIZEOF_STRUCT_SOCKADDR_IN6 > 0)
|
||||
static hawk_oow_t ip6ad_to_bcstr (const struct in6_addr* ipad, hawk_bch_t* buf, hawk_oow_t size)
|
||||
{
|
||||
/*
|
||||
@ -1164,6 +1167,7 @@ static hawk_oow_t ip6ad_to_bcstr (const struct in6_addr* ipad, hawk_bch_t* buf,
|
||||
|
||||
#undef IP6ADDR_NWORDS
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
hawk_oow_t hawk_gem_skadtobcstr (hawk_gem_t* gem, const hawk_skad_t* _skad, hawk_bch_t* buf, hawk_oow_t len, int flags)
|
||||
@ -1198,6 +1202,7 @@ hawk_oow_t hawk_gem_skadtobcstr (hawk_gem_t* gem, const hawk_skad_t* _skad, hawk
|
||||
}
|
||||
break;
|
||||
|
||||
#if (HAWK_SIZEOF_STRUCT_SOCKADDR_IN6 > 0)
|
||||
case HAWK_AF_INET6:
|
||||
if (flags & HAWK_SKAD_TO_BCSTR_PORT)
|
||||
{
|
||||
@ -1254,6 +1259,7 @@ hawk_oow_t hawk_gem_skadtobcstr (hawk_gem_t* gem, const hawk_skad_t* _skad, hawk
|
||||
}
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
case HAWK_AF_UNIX:
|
||||
if (flags & HAWK_SKAD_TO_BCSTR_ADDR)
|
||||
@ -1540,12 +1546,14 @@ hawk_oow_t hawk_ipad_bytes_to_ucstr (const hawk_uint8_t* iptr, hawk_oow_t ilen,
|
||||
return ip4ad_to_ucstr(&ip4ad, buf, blen);
|
||||
}
|
||||
|
||||
#if (HAWK_SIZEOF_STRUCT_SOCKADDR_IN6 > 0)
|
||||
case HAWK_IP6AD_LEN:
|
||||
{
|
||||
struct in6_addr ip6ad;
|
||||
HAWK_MEMCPY (&ip6ad.s6_addr, iptr, ilen);
|
||||
return ip6ad_to_ucstr(&ip6ad, buf, blen);
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
if (blen > 0) buf[blen] = '\0';
|
||||
@ -1564,12 +1572,14 @@ hawk_oow_t hawk_ipad_bytes_to_bcstr (const hawk_uint8_t* iptr, hawk_oow_t ilen,
|
||||
return ip4ad_to_bcstr(&ip4ad, buf, blen);
|
||||
}
|
||||
|
||||
#if (HAWK_SIZEOF_STRUCT_SOCKADDR_IN6 > 0)
|
||||
case HAWK_IP6AD_LEN:
|
||||
{
|
||||
struct in6_addr ip6ad;
|
||||
HAWK_MEMCPY (&ip6ad.s6_addr, iptr, ilen);
|
||||
return ip6ad_to_bcstr(&ip6ad, buf, blen);
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
if (blen > 0) buf[blen] = '\0';
|
||||
@ -1581,10 +1591,12 @@ int hawk_uchars_to_ipad_bytes (const hawk_uch_t* str, hawk_oow_t slen, hawk_uint
|
||||
{
|
||||
if (blen >= HAWK_IP6AD_LEN)
|
||||
{
|
||||
#if (HAWK_SIZEOF_STRUCT_SOCKADDR_IN6 > 0)
|
||||
struct in6_addr i6;
|
||||
if (uchars_to_ipv6(str, slen, &i6) <= -1) goto ipv4;
|
||||
HAWK_MEMCPY (buf, i6.s6_addr, 16);
|
||||
return HAWK_IP6AD_LEN;
|
||||
#endif
|
||||
}
|
||||
else if (blen >= HAWK_IP4AD_LEN)
|
||||
{
|
||||
@ -1602,10 +1614,12 @@ int hawk_bchars_to_ipad_bytes (const hawk_bch_t* str, hawk_oow_t slen, hawk_uint
|
||||
{
|
||||
if (blen >= HAWK_IP6AD_LEN)
|
||||
{
|
||||
#if (HAWK_SIZEOF_STRUCT_SOCKADDR_IN6 > 0)
|
||||
struct in6_addr i6;
|
||||
if (bchars_to_ipv6(str, slen, &i6) <= -1) goto ipv4;
|
||||
HAWK_MEMCPY (buf, i6.s6_addr, 16);
|
||||
return HAWK_IP6AD_LEN;
|
||||
#endif
|
||||
}
|
||||
else if (blen >= HAWK_IP4AD_LEN)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user