@@ -295,17 +295,6 @@ typedef enum {
295295 OP_NUM_OPCODES
296296} OPCODE ;
297297
298- #define USENAMETABLE (hdr ) \
299- ((hdr)->defsize==sizeof(AMX_FUNCSTUBNT))
300- #define NUMENTRIES (hdr ,field ,nextfield ) \
301- (unsigned)(((hdr)->nextfield - (hdr)->field) / (hdr)->defsize)
302- #define GETENTRY (hdr ,table ,index ) \
303- (AMX_FUNCSTUB *)((unsigned char*)(hdr) + (unsigned)(hdr)->table + (unsigned)index*(hdr)->defsize)
304- #define GETENTRYNAME (hdr ,entry ) \
305- ( USENAMETABLE(hdr) \
306- ? (char *)((unsigned char*)(hdr) + (unsigned)((AMX_FUNCSTUBNT*)(entry))->nameofs) \
307- : ((AMX_FUNCSTUB*)(entry))->name )
308-
309298#if !defined NDEBUG
310299 static int check_endian (void )
311300 {
@@ -940,7 +929,7 @@ int AMXAPI amx_Init(AMX *amx,void *program)
940929 #endif
941930 #endif
942931 int numlibraries ,i ;
943- AMX_FUNCSTUB * lib ;
932+ AMX_FUNCSTUB * lib ;
944933 AMX_ENTRY libinit ;
945934 #endif
946935
@@ -1256,13 +1245,13 @@ int AMXAPI amx_Cleanup(AMX *amx)
12561245 #endif
12571246 AMX_HEADER * hdr ;
12581247 int numlibraries ,i ;
1259- AMX_FUNCSTUB * lib ;
1248+ AMX_FUNCSTUB * lib ;
12601249 AMX_ENTRY libcleanup ;
12611250 #endif
12621251
12631252 /* unload all extension modules */
12641253 #if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ ) && !defined AMX_NODYNALOAD
1265- hdr = (AMX_HEADER * )amx -> base ;
1254+ hdr = (AMX_HEADER * )amx -> base ;
12661255 assert (hdr -> magic == AMX_MAGIC );
12671256 numlibraries = NUMENTRIES (hdr ,libraries ,pubvars );
12681257 for (i = 0 ; i < numlibraries ; i ++ ) {
@@ -1407,7 +1396,7 @@ int AMXAPI amx_GetNative(AMX *amx, int index, char *funcname)
14071396 return AMX_ERR_NONE ;
14081397}
14091398
1410- int AMXAPI amx_FindNative (AMX * amx , const char * name , int * index )
1399+ int AMXAPI amx_FindNative (AMX * amx , const char * name , int * index )
14111400{
14121401 int first ,last ,mid ,result ;
14131402 char pname [sNAMEMAX + 1 ];
@@ -1524,7 +1513,7 @@ int AMXAPI amx_FindPubVar(AMX *amx, const char *varname, cell *amx_addr)
15241513{
15251514 int first ,last ,mid ,result ;
15261515 char pname [sNAMEMAX + 1 ];
1527- cell paddr ;
1516+ cell paddr = 0 ;
15281517
15291518 amx_NumPubVars (amx , & last );
15301519 last -- ; /* last valid index is 1 less than the number of functions */
@@ -1603,7 +1592,7 @@ int AMXAPI amx_GetTag(AMX *amx, int index, char *tagname, cell *tag_id)
16031592int AMXAPI amx_FindTagId (AMX * amx , cell tag_id , char * tagname )
16041593{
16051594 int first ,last ,mid ;
1606- cell mid_id ;
1595+ cell mid_id = tag_id ;
16071596
16081597 #if !defined NDEBUG
16091598 /* verify that the tagname table is sorted on the tag_id */
@@ -1683,7 +1672,7 @@ static AMX_NATIVE findfunction(const char *name, const AMX_NATIVE_INFO *list, in
16831672 int i ;
16841673
16851674 assert (list != NULL );
1686- for (i = 0 ; list [ i ]. name != NULL && (i < number || number == -1 ); i ++ )
1675+ for (i = 0 ; (i < number || number == -1 ) && list [ i ]. name != NULL ; i ++ )
16871676 if (strcmp (name ,list [i ].name )== 0 )
16881677 return list [i ].func ;
16891678 return NULL ;
@@ -1731,9 +1720,6 @@ AMX_NATIVE_INFO * AMXAPI amx_NativeInfo(const char *name, AMX_NATIVE func)
17311720}
17321721#endif /* AMX_NATIVEINFO */
17331722
1734-
1735- #define STKMARGIN ((cell)(16*sizeof(cell)))
1736-
17371723#if defined AMX_PUSHXXX
17381724
17391725int AMXAPI amx_Push (AMX * amx , cell value )
@@ -3245,14 +3231,14 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
32453231 break ;
32463232 case OP_LOAD_I :
32473233 /* verify address */
3248- if (pri >=hea && pri < stk || (ucell )pri >=(ucell )amx -> stp )
3234+ if (( pri >=hea && pri < stk ) || (ucell )pri >=(ucell )amx -> stp )
32493235 ABORT (amx ,AMX_ERR_MEMACCESS );
32503236 pri = _R (data ,pri );
32513237 break ;
32523238 case OP_LODB_I :
32533239 GETPARAM (offs );
32543240 /* verify address */
3255- if (pri >=hea && pri < stk || (ucell )pri >=(ucell )amx -> stp )
3241+ if (( pri >=hea && pri < stk ) || (ucell )pri >=(ucell )amx -> stp )
32563242 ABORT (amx ,AMX_ERR_MEMACCESS );
32573243 switch ((int )offs ) {
32583244 case 1 :
@@ -3318,14 +3304,14 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
33183304 break ;
33193305 case OP_STOR_I :
33203306 /* verify address */
3321- if (alt >=hea && alt < stk || (ucell )alt >=(ucell )amx -> stp )
3307+ if (( alt >=hea && alt < stk ) || (ucell )alt >=(ucell )amx -> stp )
33223308 ABORT (amx ,AMX_ERR_MEMACCESS );
33233309 _W (data ,alt ,pri );
33243310 break ;
33253311 case OP_STRB_I :
33263312 GETPARAM (offs );
33273313 /* verify address */
3328- if (alt >=hea && alt < stk || (ucell )alt >=(ucell )amx -> stp )
3314+ if (( alt >=hea && alt < stk ) || (ucell )alt >=(ucell )amx -> stp )
33293315 ABORT (amx ,AMX_ERR_MEMACCESS );
33303316 switch ((int )offs ) {
33313317 case 1 :
@@ -3342,15 +3328,15 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
33423328 case OP_LIDX :
33433329 offs = pri * sizeof (cell )+ alt ;
33443330 /* verify address */
3345- if (offs >=hea && offs < stk || (ucell )offs >=(ucell )amx -> stp )
3331+ if (( offs >=hea && offs < stk ) || (ucell )offs >=(ucell )amx -> stp )
33463332 ABORT (amx ,AMX_ERR_MEMACCESS );
33473333 pri = _R (data ,offs );
33483334 break ;
33493335 case OP_LIDX_B :
33503336 GETPARAM (offs );
33513337 offs = (pri << (int )offs )+ alt ;
33523338 /* verify address */
3353- if (offs >=hea && offs < stk || (ucell )offs >=(ucell )amx -> stp )
3339+ if (( offs >=hea && offs < stk ) || (ucell )offs >=(ucell )amx -> stp )
33543340 ABORT (amx ,AMX_ERR_MEMACCESS );
33553341 pri = _R (data ,offs );
33563342 break ;
@@ -3840,13 +3826,13 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
38403826 /* verify top & bottom memory addresses, for both source and destination
38413827 * addresses
38423828 */
3843- if (pri >=hea && pri < stk || (ucell )pri >=(ucell )amx -> stp )
3829+ if (( pri >=hea && pri < stk ) || (ucell )pri >=(ucell )amx -> stp )
38443830 ABORT (amx ,AMX_ERR_MEMACCESS );
3845- if ((pri + offs )> hea && (pri + offs )< stk || (ucell )(pri + offs )> (ucell )amx -> stp )
3831+ if ((( pri + offs )> hea && (pri + offs )< stk ) || (ucell )(pri + offs )> (ucell )amx -> stp )
38463832 ABORT (amx ,AMX_ERR_MEMACCESS );
3847- if (alt >=hea && alt < stk || (ucell )alt >=(ucell )amx -> stp )
3833+ if (( alt >=hea && alt < stk ) || (ucell )alt >=(ucell )amx -> stp )
38483834 ABORT (amx ,AMX_ERR_MEMACCESS );
3849- if ((alt + offs )> hea && (alt + offs )< stk || (ucell )(alt + offs )> (ucell )amx -> stp )
3835+ if ((( alt + offs )> hea && (alt + offs )< stk ) || (ucell )(alt + offs )> (ucell )amx -> stp )
38503836 ABORT (amx ,AMX_ERR_MEMACCESS );
38513837 #if defined _R_DEFAULT
38523838 memcpy (data + (int )alt , data + (int )pri , (int )offs );
@@ -3866,13 +3852,13 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
38663852 /* verify top & bottom memory addresses, for both source and destination
38673853 * addresses
38683854 */
3869- if (pri >=hea && pri < stk || (ucell )pri >=(ucell )amx -> stp )
3855+ if (( pri >=hea && pri < stk ) || (ucell )pri >=(ucell )amx -> stp )
38703856 ABORT (amx ,AMX_ERR_MEMACCESS );
3871- if ((pri + offs )> hea && (pri + offs )< stk || (ucell )(pri + offs )> (ucell )amx -> stp )
3857+ if ((( pri + offs )> hea && (pri + offs )< stk ) || (ucell )(pri + offs )> (ucell )amx -> stp )
38723858 ABORT (amx ,AMX_ERR_MEMACCESS );
3873- if (alt >=hea && alt < stk || (ucell )alt >=(ucell )amx -> stp )
3859+ if (( alt >=hea && alt < stk ) || (ucell )alt >=(ucell )amx -> stp )
38743860 ABORT (amx ,AMX_ERR_MEMACCESS );
3875- if ((alt + offs )> hea && (alt + offs )< stk || (ucell )(alt + offs )> (ucell )amx -> stp )
3861+ if ((( alt + offs )> hea && (alt + offs )< stk ) || (ucell )(alt + offs )> (ucell )amx -> stp )
38763862 ABORT (amx ,AMX_ERR_MEMACCESS );
38773863 #if defined _R_DEFAULT
38783864 pri = memcmp (data + (int )alt , data + (int )pri , (int )offs );
@@ -3887,9 +3873,9 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
38873873 case OP_FILL :
38883874 GETPARAM (offs );
38893875 /* verify top & bottom memory addresses (destination only) */
3890- if (alt >=hea && alt < stk || (ucell )alt >=(ucell )amx -> stp )
3876+ if (( alt >=hea && alt < stk ) || (ucell )alt >=(ucell )amx -> stp )
38913877 ABORT (amx ,AMX_ERR_MEMACCESS );
3892- if ((alt + offs )> hea && (alt + offs )< stk || (ucell )(alt + offs )> (ucell )amx -> stp )
3878+ if ((( alt + offs )> hea && (alt + offs )< stk ) || (ucell )(alt + offs )> (ucell )amx -> stp )
38933879 ABORT (amx ,AMX_ERR_MEMACCESS );
38943880 for (i = (int )alt ; (size_t )offs >=sizeof (cell ); i += sizeof (cell ), offs -= sizeof (cell ))
38953881 _W32 (data ,i ,pri );
@@ -4283,17 +4269,6 @@ int AMXAPI amx_Release(AMX *amx,cell amx_addr)
42834269
42844270#if defined AMX_XXXSTRING || defined AMX_UTF8XXX
42854271
4286- #define CHARBITS (8*sizeof(char))
4287- #if PAWN_CELL_SIZE == 16
4288- #define CHARMASK (0xffffu << 8*(2-sizeof(char)))
4289- #elif PAWN_CELL_SIZE == 32
4290- #define CHARMASK (0xffffffffuL << 8*(4-sizeof(char)))
4291- #elif PAWN_CELL_SIZE == 64
4292- #define CHARMASK (0xffffffffffffffffuLL << 8*(8-sizeof(char)))
4293- #else
4294- #error Unsupported cell size
4295- #endif
4296-
42974272int AMXAPI amx_StrLen (const cell * cstr , int * length )
42984273{
42994274 int len ;
0 commit comments