Fix Clang warnings/errors
This commit is contained in:
parent
1e6e6f0fbf
commit
23d35625fd
@ -1860,7 +1860,7 @@ int AMXAPI amx_PushString(AMX *amx, cell *amx_addr, cell **phys_addr, const char
|
|||||||
* supports this too.
|
* supports this too.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NEXT(cip) goto **cip++
|
#define NEXT(cip) goto **(void **)cip++
|
||||||
|
|
||||||
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
|
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
|
||||||
{
|
{
|
||||||
@ -2047,14 +2047,14 @@ static const void * const amx_opcodelist[] = {
|
|||||||
NEXT(cip);
|
NEXT(cip);
|
||||||
op_load_i:
|
op_load_i:
|
||||||
/* verify address */
|
/* verify address */
|
||||||
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp)
|
if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
pri=_R(data,pri);
|
pri=_R(data,pri);
|
||||||
NEXT(cip);
|
NEXT(cip);
|
||||||
op_lodb_i:
|
op_lodb_i:
|
||||||
GETPARAM(offs);
|
GETPARAM(offs);
|
||||||
/* verify address */
|
/* verify address */
|
||||||
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp)
|
if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
switch (offs) {
|
switch (offs) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -2120,14 +2120,14 @@ static const void * const amx_opcodelist[] = {
|
|||||||
NEXT(cip);
|
NEXT(cip);
|
||||||
op_stor_i:
|
op_stor_i:
|
||||||
/* verify address */
|
/* verify address */
|
||||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
_W(data,alt,pri);
|
_W(data,alt,pri);
|
||||||
NEXT(cip);
|
NEXT(cip);
|
||||||
op_strb_i:
|
op_strb_i:
|
||||||
GETPARAM(offs);
|
GETPARAM(offs);
|
||||||
/* verify address */
|
/* verify address */
|
||||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
switch (offs) {
|
switch (offs) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -2144,7 +2144,7 @@ static const void * const amx_opcodelist[] = {
|
|||||||
op_lidx:
|
op_lidx:
|
||||||
offs=pri*sizeof(cell)+alt; /* implicit shift value for a cell */
|
offs=pri*sizeof(cell)+alt; /* implicit shift value for a cell */
|
||||||
/* verify address */
|
/* verify address */
|
||||||
if (offs>=hea && offs<stk || (ucell)offs>=(ucell)amx->stp)
|
if ((offs>=hea && offs<stk) || (ucell)offs>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
pri=_R(data,offs);
|
pri=_R(data,offs);
|
||||||
NEXT(cip);
|
NEXT(cip);
|
||||||
@ -2152,7 +2152,7 @@ static const void * const amx_opcodelist[] = {
|
|||||||
GETPARAM(offs);
|
GETPARAM(offs);
|
||||||
offs=(pri << (int)offs)+alt;
|
offs=(pri << (int)offs)+alt;
|
||||||
/* verify address */
|
/* verify address */
|
||||||
if (offs>=hea && offs<stk || (ucell)offs>=(ucell)amx->stp)
|
if ((offs>=hea && offs<stk) || (ucell)offs>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
pri=_R(data,offs);
|
pri=_R(data,offs);
|
||||||
NEXT(cip);
|
NEXT(cip);
|
||||||
@ -2641,13 +2641,13 @@ static const void * const amx_opcodelist[] = {
|
|||||||
/* verify top & bottom memory addresses, for both source and destination
|
/* verify top & bottom memory addresses, for both source and destination
|
||||||
* addresses
|
* addresses
|
||||||
*/
|
*/
|
||||||
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp)
|
if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
if ((pri+offs)>hea && (pri+offs)<stk || (ucell)(pri+offs)>(ucell)amx->stp)
|
if (((pri+offs)>hea && (pri+offs)<stk) || (ucell)(pri+offs)>(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp)
|
if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
#if defined _R_DEFAULT
|
#if defined _R_DEFAULT
|
||||||
memcpy(data+(int)alt, data+(int)pri, (int)offs);
|
memcpy(data+(int)alt, data+(int)pri, (int)offs);
|
||||||
@ -2667,13 +2667,13 @@ static const void * const amx_opcodelist[] = {
|
|||||||
/* verify top & bottom memory addresses, for both source and destination
|
/* verify top & bottom memory addresses, for both source and destination
|
||||||
* addresses
|
* addresses
|
||||||
*/
|
*/
|
||||||
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp)
|
if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
if ((pri+offs)>hea && (pri+offs)<stk || (ucell)(pri+offs)>(ucell)amx->stp)
|
if (((pri+offs)>hea && (pri+offs)<stk) || (ucell)(pri+offs)>(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp)
|
if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
#if defined _R_DEFAULT
|
#if defined _R_DEFAULT
|
||||||
pri=memcmp(data+(int)alt, data+(int)pri, (int)offs);
|
pri=memcmp(data+(int)alt, data+(int)pri, (int)offs);
|
||||||
@ -2688,9 +2688,9 @@ static const void * const amx_opcodelist[] = {
|
|||||||
op_fill:
|
op_fill:
|
||||||
GETPARAM(offs);
|
GETPARAM(offs);
|
||||||
/* verify top & bottom memory addresses */
|
/* verify top & bottom memory addresses */
|
||||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp)
|
if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||||
for (i=(int)alt; offs>=(int)sizeof(cell); i+=sizeof(cell), offs-=sizeof(cell))
|
for (i=(int)alt; offs>=(int)sizeof(cell); i+=sizeof(cell), offs-=sizeof(cell))
|
||||||
_W32(data,i,pri);
|
_W32(data,i,pri);
|
||||||
@ -4242,7 +4242,7 @@ int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr)
|
|||||||
data=(amx->data!=NULL) ? amx->data : amx->base+(int)hdr->dat;
|
data=(amx->data!=NULL) ? amx->data : amx->base+(int)hdr->dat;
|
||||||
|
|
||||||
assert(phys_addr!=NULL);
|
assert(phys_addr!=NULL);
|
||||||
if (amx_addr>=amx->hea && amx_addr<amx->stk || amx_addr<0 || amx_addr>=amx->stp) {
|
if ((amx_addr>=amx->hea && amx_addr<amx->stk) || amx_addr<0 || amx_addr>=amx->stp) {
|
||||||
*phys_addr=NULL;
|
*phys_addr=NULL;
|
||||||
return AMX_ERR_MEMACCESS;
|
return AMX_ERR_MEMACCESS;
|
||||||
} /* if */
|
} /* if */
|
||||||
@ -4491,19 +4491,19 @@ static const long utf8_lowmark[5] = { 0x80, 0x800, 0x10000L, 0x200000L, 0x400000
|
|||||||
switch (followup) {
|
switch (followup) {
|
||||||
case 4:
|
case 4:
|
||||||
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
||||||
result = (result << 6) | c & 0x3f;
|
result = (result << 6) | (c & 0x3f);
|
||||||
case 3:
|
case 3:
|
||||||
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
||||||
result = (result << 6) | c & 0x3f;
|
result = (result << 6) | (c & 0x3f);
|
||||||
case 2:
|
case 2:
|
||||||
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
||||||
result = (result << 6) | c & 0x3f;
|
result = (result << 6) | (c & 0x3f);
|
||||||
case 1:
|
case 1:
|
||||||
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
||||||
result = (result << 6) | c & 0x3f;
|
result = (result << 6) | (c & 0x3f);
|
||||||
case 0:
|
case 0:
|
||||||
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
if (((c=*string++) & 0xc0) != 0x80) goto error;
|
||||||
result = (result << 6) | c & 0x3f;
|
result = (result << 6) | (c & 0x3f);
|
||||||
} /* switch */
|
} /* switch */
|
||||||
/* Do additional checks: shortest encoding & reserved positions. The
|
/* Do additional checks: shortest encoding & reserved positions. The
|
||||||
* lowmark limits also depends on the code length; it can be read from
|
* lowmark limits also depends on the code length; it can be read from
|
||||||
@ -4511,7 +4511,7 @@ static const long utf8_lowmark[5] = { 0x80, 0x800, 0x10000L, 0x200000L, 0x400000
|
|||||||
*/
|
*/
|
||||||
if (result<utf8_lowmark[followup])
|
if (result<utf8_lowmark[followup])
|
||||||
goto error;
|
goto error;
|
||||||
if (result>=0xd800 && result<=0xdfff || result==0xfffe || result==0xffff)
|
if ((result>=0xd800 && result<=0xdfff) || result==0xfffe || result==0xffff)
|
||||||
goto error;
|
goto error;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
@ -4546,40 +4546,40 @@ int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value)
|
|||||||
} else if (value<0x800) {
|
} else if (value<0x800) {
|
||||||
/* 110xxxxx 10xxxxxx */
|
/* 110xxxxx 10xxxxxx */
|
||||||
if (maxchars < 2) goto error;
|
if (maxchars < 2) goto error;
|
||||||
*string++ = (char)((value>>6) & 0x1f | 0xc0);
|
*string++ = (char)(((value>>6) & 0x1f) | 0xc0);
|
||||||
*string++ = (char)(value & 0x3f | 0x80);
|
*string++ = (char)((value & 0x3f) | 0x80);
|
||||||
} else if (value<0x10000) {
|
} else if (value<0x10000) {
|
||||||
/* 1110xxxx 10xxxxxx 10xxxxxx (16 bits, BMP plane) */
|
/* 1110xxxx 10xxxxxx 10xxxxxx (16 bits, BMP plane) */
|
||||||
if (maxchars < 3) goto error;
|
if (maxchars < 3) goto error;
|
||||||
if (value>=0xd800 && value<=0xdfff || value==0xfffe || value==0xffff)
|
if ((value>=0xd800 && value<=0xdfff) || value==0xfffe || value==0xffff)
|
||||||
goto error; /* surrogate pairs and invalid characters */
|
goto error; /* surrogate pairs and invalid characters */
|
||||||
*string++ = (char)((value>>12) & 0x0f | 0xe0);
|
*string++ = (char)(((value>>12) & 0x0f) | 0xe0);
|
||||||
*string++ = (char)((value>>6) & 0x3f | 0x80);
|
*string++ = (char)(((value>>6) & 0x3f) | 0x80);
|
||||||
*string++ = (char)(value & 0x3f | 0x80);
|
*string++ = (char)((value & 0x3f) | 0x80);
|
||||||
} else if (value<0x200000) {
|
} else if (value<0x200000) {
|
||||||
/* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
|
/* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
|
||||||
if (maxchars < 4) goto error;
|
if (maxchars < 4) goto error;
|
||||||
*string++ = (char)((value>>18) & 0x07 | 0xf0);
|
*string++ = (char)(((value>>18) & 0x07) | 0xf0);
|
||||||
*string++ = (char)((value>>12) & 0x3f | 0x80);
|
*string++ = (char)(((value>>12) & 0x3f) | 0x80);
|
||||||
*string++ = (char)((value>>6) & 0x3f | 0x80);
|
*string++ = (char)(((value>>6) & 0x3f) | 0x80);
|
||||||
*string++ = (char)(value & 0x3f | 0x80);
|
*string++ = (char)((value & 0x3f) | 0x80);
|
||||||
} else if (value<0x4000000) {
|
} else if (value<0x4000000) {
|
||||||
/* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
|
/* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
|
||||||
if (maxchars < 5) goto error;
|
if (maxchars < 5) goto error;
|
||||||
*string++ = (char)((value>>24) & 0x03 | 0xf8);
|
*string++ = (char)(((value>>24) & 0x03) | 0xf8);
|
||||||
*string++ = (char)((value>>18) & 0x3f | 0x80);
|
*string++ = (char)(((value>>18) & 0x3f) | 0x80);
|
||||||
*string++ = (char)((value>>12) & 0x3f | 0x80);
|
*string++ = (char)(((value>>12) & 0x3f) | 0x80);
|
||||||
*string++ = (char)((value>>6) & 0x3f | 0x80);
|
*string++ = (char)(((value>>6) & 0x3f) | 0x80);
|
||||||
*string++ = (char)(value & 0x3f | 0x80);
|
*string++ = (char)((value & 0x3f) | 0x80);
|
||||||
} else {
|
} else {
|
||||||
/* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx (31 bits) */
|
/* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx (31 bits) */
|
||||||
if (maxchars < 6) goto error;
|
if (maxchars < 6) goto error;
|
||||||
*string++ = (char)((value>>30) & 0x01 | 0xfc);
|
*string++ = (char)(((value>>30) & 0x01) | 0xfc);
|
||||||
*string++ = (char)((value>>24) & 0x3f | 0x80);
|
*string++ = (char)(((value>>24) & 0x3f) | 0x80);
|
||||||
*string++ = (char)((value>>18) & 0x3f | 0x80);
|
*string++ = (char)(((value>>18) & 0x3f) | 0x80);
|
||||||
*string++ = (char)((value>>12) & 0x3f | 0x80);
|
*string++ = (char)(((value>>12) & 0x3f) | 0x80);
|
||||||
*string++ = (char)((value>>6) & 0x3f | 0x80);
|
*string++ = (char)(((value>>6) & 0x3f) | 0x80);
|
||||||
*string++ = (char)(value & 0x3f | 0x80);
|
*string++ = (char)((value & 0x3f) | 0x80);
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
if (endptr!=NULL)
|
if (endptr!=NULL)
|
||||||
|
@ -1100,7 +1100,7 @@ static cell AMX_NATIVE_CALL n_getvalue(AMX *amx,const cell *params)
|
|||||||
if (c=='\n' && inlist(amx,'\r',params+2,(int)params[0]/sizeof(cell)-1)!=0)
|
if (c=='\n' && inlist(amx,'\r',params+2,(int)params[0]/sizeof(cell)-1)!=0)
|
||||||
c='\r';
|
c='\r';
|
||||||
#endif
|
#endif
|
||||||
if ((chars>1 || chars>0 && sign>0)
|
if ((chars>1 || (chars>0 && sign>0))
|
||||||
&& (n=inlist(amx,c,params+2,(int)params[0]/sizeof(cell)-1))!=0)
|
&& (n=inlist(amx,c,params+2,(int)params[0]/sizeof(cell)-1))!=0)
|
||||||
{
|
{
|
||||||
if (n>0)
|
if (n>0)
|
||||||
|
@ -179,7 +179,7 @@ static cell AMX_NATIVE_CALL setarg(AMX *amx,const cell *params)
|
|||||||
/* adjust the address in "value" in case of an array access */
|
/* adjust the address in "value" in case of an array access */
|
||||||
value+=params[2]*sizeof(cell);
|
value+=params[2]*sizeof(cell);
|
||||||
/* verify the address */
|
/* verify the address */
|
||||||
if (value<0 || value>=amx->hea && value<amx->stk)
|
if (value<0 || (value>=amx->hea && value<amx->stk))
|
||||||
return 0;
|
return 0;
|
||||||
/* set the value indirectly */
|
/* set the value indirectly */
|
||||||
* (cell *)(data+(int)value) = params[3];
|
* (cell *)(data+(int)value) = params[3];
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
#define HAVE_SAFESTR
|
#define HAVE_SAFESTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined strlcpy
|
#if defined strlcpy && !defined HAVE_STRLCPY
|
||||||
#define HAVE_STRLCPY
|
#define HAVE_STRLCPY
|
||||||
#endif
|
#endif
|
||||||
#if defined strlcat
|
#if defined strlcat && !defined HAVE_STRLCAT
|
||||||
#define HAVE_STRLCAT
|
#define HAVE_STRLCAT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user