Skip to content

Commit e0cba25

Browse files
author
Thiadmer Riemersma
committed
Prepare for release: fix issues found in regression testing, fix issues found by static analysis.
Signed-off-by: Thiadmer Riemersma <[email protected]>
1 parent 6310f91 commit e0cba25

28 files changed

+681
-674
lines changed

amx/amx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* License for the specific language governing permissions and limitations
1515
* under the License.
1616
*
17-
* Version: $Id: amx.c 6973 2023-08-05 20:07:04Z thiadmer $
17+
* Version: $Id: amx.c 7151 2024-03-23 16:08:18Z thiadmer $
1818
*/
1919

2020
#define WIN32_LEAN_AND_MEAN
@@ -93,7 +93,7 @@
9393
#define AMX_EXPLIT_FUNCTIONS
9494
#endif
9595
#if !defined AMX_EXPLIT_FUNCTIONS
96-
/* no constant set, set them all */
96+
/* no constant set, set them all (except amx_InitJIT() and other JIT support) */
9797
#define AMX_ALIGN /* amx_Align16(), amx_Align32() and amx_Align64() */
9898
#define AMX_ALLOT /* amx_Allot() and amx_Release() */
9999
#define AMX_DEFCALLBACK /* amx_Callback() */
@@ -102,7 +102,6 @@
102102
#define AMX_EXEC /* amx_Exec() */
103103
#define AMX_FLAGS /* amx_Flags() */
104104
#define AMX_INIT /* amx_Init() */
105-
#define AMX_JIT /* amx_InitJIT() and other JIT support */
106105
#define AMX_MEMINFO /* amx_MemInfo() */
107106
#define AMX_NAMELENGTH /* amx_NameLength() */
108107
#define AMX_NATIVEINFO /* amx_NativeInfo() */

amx/amx.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* License for the specific language governing permissions and limitations
1515
* under the License.
1616
*
17-
* Version: $Id: amx.h 6965 2023-07-20 15:44:35Z thiadmer $
17+
* Version: $Id: amx.h 7152 2024-03-23 20:47:23Z thiadmer $
1818
*/
1919

2020
#ifndef AMX_H_INCLUDED
@@ -158,7 +158,7 @@ extern "C" {
158158
#define AMXAPI __stdcall
159159
#elif defined CDECL
160160
#define AMXAPI __cdecl
161-
#elif defined GCC_HASCLASSVISIBILITY
161+
#elif defined GCC_HASCLASSVISIBILITY && defined __cplusplus
162162
#define AMXAPI __attribute__((visibility("default")))
163163
#else
164164
#define AMXAPI
@@ -263,7 +263,7 @@ typedef int (AMXAPI *AMX_IDLE)(struct tagAMX *amx, int AMXAPI Exec(struct tagAMX
263263
#else
264264
#pragma pack(push)
265265
#pragma pack(1) /* structures must be packed (byte-aligned) */
266-
#if defined __TURBOC__
266+
#if defined __BORLANDC__
267267
#pragma option -a- /* "pack" pragma for older Borland compilers */
268268
#endif
269269
#endif

amx/amxdbg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License for the specific language governing permissions and limitations
1818
* under the License.
1919
*
20-
* Version: $Id: amxdbg.h 6131 2020-04-29 19:47:15Z thiadmer $
20+
* Version: $Id: amxdbg.h 7152 2024-03-23 20:47:23Z thiadmer $
2121
*/
2222

2323
#ifndef AMXDBG_H_INCLUDED
@@ -52,7 +52,7 @@ extern "C" {
5252
#else
5353
#pragma pack(push)
5454
#pragma pack(1) /* structures must be packed (byte-aligned) */
55-
#if defined __TURBOC__
55+
#if defined __BORLANDC__
5656
#pragma option -a- /* "pack" pragma for older Borland compilers */
5757
#endif
5858
#endif

amx/amxfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* License for the specific language governing permissions and limitations
1515
* under the License.
1616
*
17-
* Version: $Id: amxfile.c 6965 2023-07-20 15:44:35Z thiadmer $
17+
* Version: $Id: amxfile.c 6969 2023-07-26 12:26:41Z thiadmer $
1818
*/
1919
#if defined _UNICODE || defined __UNICODE__ || defined UNICODE
2020
# if !defined UNICODE /* for Windows */

amx/amxtime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* License for the specific language governing permissions and limitations
1515
* under the License.
1616
*
17-
* Version: $Id: amxtime.c 6965 2023-07-20 15:44:35Z thiadmer $
17+
* Version: $Id: amxtime.c 6969 2023-07-26 12:26:41Z thiadmer $
1818
*/
1919
#include <time.h>
2020
#include <assert.h>

amx/minIni.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License for the specific language governing permissions and limitations
1818
* under the License.
1919
*
20-
* Version: $Id: minIni.c 5691 2017-06-09 19:48:22Z thiadmer $
20+
* Version: $Id: minIni.c 6965 2023-07-20 15:44:35Z thiadmer $
2121
*/
2222

2323
#if (defined _UNICODE || defined __UNICODE__ || defined UNICODE) && !defined INI_ANSIONLY

amx/osdefs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,20 @@
8484
* eCos option management.
8585
*/
8686
#include <pkgconf/pawn.h>
87-
#if CYGPKG_PAWN_AMX_ANSIONLY==1
87+
#if defined CYGPKG_PAWN_AMX_ANSIONLY && CYGPKG_PAWN_AMX_ANSIONLY==1
8888
#define AMX_ANSIONLY
8989
#endif
9090
#define PAWN_CELL_SIZE CYGPKG_PAWN_AMX_CELLSIZE
91-
#if CYGPKG_PAWN_CORE_RANDOM==0
91+
#if defined CYGPKG_PAWN_CORE_RANDOM && CYGPKG_PAWN_CORE_RANDOM==0
9292
#define AMX_NORANDOM
9393
#endif
94-
#if CYGPKG_PAWN_CORE_PROPERTY==0
94+
#if defined CYGPKG_PAWN_CORE_PROPERTY && CYGPKG_PAWN_CORE_PROPERTY==0
9595
#define AMX_NOPROPLIST
9696
#endif
97-
#if CYGPKG_PAWN_AMX_CONS_FIXEDPOINT==1
97+
#if defined CYGPKG_PAWN_AMX_CONS_FIXEDPOINT && CYGPKG_PAWN_AMX_CONS_FIXEDPOINT==1
9898
#define FIXEDPOINT
9999
#endif
100-
#if CYGPKG_PAWN_AMX_CONS_FLOATPOINT==1
100+
#if defined CYGPKG_PAWN_AMX_CONS_FLOATPOINT && CYGPKG_PAWN_AMX_CONS_FLOATPOINT==1
101101
#define FLOATPOINT
102102
#endif
103103
#endif

amx/pawndbg.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* License for the specific language governing permissions and limitations
2929
* under the License.
3030
*
31-
* Version: $Id: pawndbg.c 6131 2020-04-29 19:47:15Z thiadmer $
31+
* Version: $Id: pawndbg.c 7133 2024-03-05 10:31:12Z thiadmer $
3232
*
3333
*
3434
* Command line options:
@@ -1228,12 +1228,12 @@ static void remote_write_rs232(AMX *amx,cell vaddr,int number)
12281228
while (number>0) {
12291229
num=(number>10) ? 10 : number;
12301230
number-=num;
1231-
sprintf(buffer,"?W%lx",(long)vaddr);
1231+
sprintf(buffer,"?W%lx",(unsigned long)vaddr);
12321232
while (num>0) {
12331233
cptr=VirtAddressToPhys(amx,vaddr);
12341234
assert(cptr!=NULL);
12351235
strcat(buffer,",");
1236-
sprintf(buffer+strlen(buffer),"%x",*cptr);
1236+
sprintf(buffer+strlen(buffer),"%lx",(unsigned long)*cptr);
12371237
num--;
12381238
vaddr+=sizeof(cell);
12391239
} /* while */

compiler/libpawnc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* License for the specific language governing permissions and limitations
1717
* under the License.
1818
*
19-
* Version: $Id: libpawnc.c 6131 2020-04-29 19:47:15Z thiadmer $
19+
* Version: $Id: libpawnc.c 7152 2024-03-23 20:47:23Z thiadmer $
2020
*/
2121
#include <assert.h>
2222
#include <stdio.h>
@@ -124,12 +124,10 @@ int pc_printf(const char *message,...)
124124
*/
125125
int pc_error(int number,const char *message,const char *filename,int firstline,int lastline,va_list argptr)
126126
{
127-
static char *prefix[3]={ "error", "fatal error", "warning" };
127+
static const char *prefix[3]={ "error", "fatal error", "warning" };
128128

129129
if (number!=0) {
130-
char *pre;
131-
132-
pre=prefix[number/100];
130+
const char *pre=prefix[number/100];
133131
if (firstline>=0)
134132
fprintf(stderr,"%s(%d -- %d) : %s %03d: ",filename,firstline,lastline,pre,number);
135133
else
@@ -252,7 +250,7 @@ int pc_eofsrc(void *handle)
252250
/* should return a pointer, which is used as a "magic cookie" to all I/O
253251
* functions; return NULL for failure
254252
*/
255-
void *pc_openasm(char *filename)
253+
void *pc_openasm(const char *filename)
256254
{
257255
#if defined __MSDOS__ || defined PAWN_LIGHT
258256
return fopen(filename,"w+t");
@@ -309,7 +307,7 @@ char *pc_readasm(void *handle, char *string, int maxchars)
309307
/* Should return a pointer, which is used as a "magic cookie" to all I/O
310308
* functions; return NULL for failure.
311309
*/
312-
void *pc_openbin(char *filename)
310+
void *pc_openbin(const char *filename)
313311
{
314312
return fopen(filename,"wb");
315313
}

compiler/pawndisasm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* License for the specific language governing permissions and limitations
1515
* under the License.
1616
*
17-
* Version: $Id: pawndisasm.c 6969 2023-07-26 12:26:41Z thiadmer $
17+
* Version: $Id: pawndisasm.c 6970 2023-07-28 20:12:00Z thiadmer $
1818
*/
1919
#include <assert.h>
2020
#include <inttypes.h>

0 commit comments

Comments
 (0)