Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit 44b1d71

Browse files
committed
Fix for issue #50.
Formatting & minor changes.
1 parent 1c03bcf commit 44b1d71

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

amx/amx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ static int VerifyPcode(AMX *amx)
656656
#if defined AMX_NO_PACKED_OPC
657657
opmask= ~0;
658658
#else
659-
opmask = (1UL << sizeof(cell)*4)-1;
659+
opmask=(1UL << sizeof(cell)*4)-1;
660660
#endif
661661

662662
/* sanity checks */
@@ -3527,7 +3527,7 @@ int AMXAPI amx_StrLen(const cell *cstr, int *length)
35273527
len=len - len % sizeof(cell); /* len = multiple of "cell" bytes */
35283528
while ((c & CHARMASK)!=0) {
35293529
len++;
3530-
c = (ucell)c << 8*sizeof(char);
3530+
c=(ucell)c << 8*sizeof(char);
35313531
} /* if */
35323532
#endif
35333533
} else {

amx/amx.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ int AMXAPI amx_Allot(AMX *amx, int cells, cell **address);
482482
int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, const cell *params);
483483
int AMXAPI amx_Cleanup(AMX *amx);
484484
int AMXAPI amx_Clone(AMX *amxClone, AMX *amxSource, void *data);
485-
int AMXAPI amx_ConsoleInit(AMX *amx);
486485
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index);
487486
int AMXAPI amx_FindNative(AMX *amx, const char *name, int *index);
488487
int AMXAPI amx_FindPublic(AMX *amx, const char *name, int *index);
@@ -515,7 +514,6 @@ int AMXAPI amx_SetCallback(AMX *amx, AMX_CALLBACK callback);
515514
int AMXAPI amx_SetDebugHook(AMX *amx, AMX_DEBUG debug);
516515
int AMXAPI amx_SetString(cell *dest, const char *source, int pack, int use_wchar, size_t size);
517516
int AMXAPI amx_SetUserData(AMX *amx, long tag, void *ptr);
518-
int AMXAPI amx_StringInit(AMX *amx);
519517
int AMXAPI amx_StrLen(const cell *cstring, int *length);
520518
int AMXAPI amx_UTF8Check(const char *string, int *length);
521519
int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value);

compiler/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ IF(UNIX)
5151
ENDIF(UNIX)
5252

5353
FILE(READ svnrev.h SVNREV_STR)
54-
STRING(REGEX REPLACE ".*#define[ \t]+SVN_REV[ \t]+([0-9]+).*" "\\1" PAWNC_REV "${SVNREV_STR}")
54+
STRING(REGEX REPLACE ".*#define[ \t]+SVNREV_NUM[ \t]+([0-9]+).*" "\\1" PAWNC_REV "${SVNREV_STR}")
5555
FILE(READ sc1.c SC1_STR)
5656
STRING(REGEX REPLACE ".*#define[ \t]+VERSION_STR[ \t]+\"([0-9]+).*" "\\1" PAWNC_MAJOR "${SC1_STR}")
5757
STRING(REGEX REPLACE ".*#define[ \t]+VERSION_STR[ \t]+\"([0-9]+).([0-9]+).*" "\\2" PAWNC_MINOR "${SC1_STR}")
@@ -68,10 +68,10 @@ SET_TARGET_PROPERTIES(pawnc PROPERTIES
6868
SOVERSION "${PAWNC_MAJOR}"
6969
VERSION "${PAWNC_VER}")
7070

71-
CONFIGURE_FILE(pawnc.pc.in pawnc.pc @ONLY)
72-
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pawnc.pc
73-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
74-
71+
CONFIGURE_FILE(pawnc.pc.in pawnc.pc @ONLY)
72+
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pawnc.pc
73+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
74+
7575
ADD_EXECUTABLE(pawncc ${PAWNCC_SRCS})
7676

7777
# Utility to create GraphViz "dot" files from the XML report (if the report contains states)

compiler/sc1.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ int main(int argc, char *argv[])
186186
return pc_compile(argc,argv);
187187
}
188188

189-
#endif /* !defined NO_MAIN */
190-
191189
/* pc_printf()
192190
* Called for general purpose "console" output. This function prints general
193191
* purpose messages; errors go through pc_error(). The function is modelled
@@ -440,6 +438,9 @@ long pc_lengthbin(void *handle)
440438
return ftell((FILE*)handle);
441439
}
442440

441+
#endif /* !defined NO_MAIN */
442+
443+
443444
#if !(defined __MSDOS__ || defined __WIN32__ || defined _Windows)
444445
int posix_spawnl(char *pgm,...)
445446
{
@@ -892,7 +893,7 @@ int pc_compile(int argc, char *argv[])
892893
retcode=jmpcode;
893894
} /* if */
894895
#if defined __LINUX__ || defined __FreeBSD__ || defined __OpenBSD__
895-
br_deinit();
896+
br_deinit();
896897
#endif
897898
#if defined FORTIFY
898899
Fortify_ListAllMemory();

compiler/sc2.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,9 @@ SC_FUNC void lex_fetchindent(const unsigned char *string,const unsigned char *po
19121912

19131913
pc_stmtindent=0;
19141914
pc_indentmask=0;
1915-
for (pc_indentbits=0; pc_indentbits<(int)(pos-string); pc_indentbits++) {
1915+
if (pos-string>255)
1916+
return;
1917+
for (pc_indentbits = 0; pc_indentbits < (unsigned)(pos - string); pc_indentbits++) {
19161918
assert(pc_tabsize>0);
19171919
if (string[pc_indentbits]=='\t') {
19181920
pc_stmtindent += (int)(pc_tabsize - (pc_stmtindent+pc_tabsize) % pc_tabsize);

compiler/sc3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ static int hier14(value *lval1)
10001000
* negative value would do).
10011001
*/
10021002
for (i=0; i<sDIMEN_MAX; i++)
1003-
arrayidx1[i]=arrayidx2[i]=(cell)((ucell)-1 << (pc_cellsize*8-1));
1003+
arrayidx1[i]=arrayidx2[i]=(cell)((ucell)~0UL << (pc_cellsize*8-1));
10041004
org_arrayidx=lval1->arrayidx; /* save current pointer, to reset later */
10051005
if (lval1->arrayidx==NULL)
10061006
lval1->arrayidx=arrayidx1;

compiler/scpack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static void write_pairtable(FILE *output, unsigned char pairtable[128][2], char
303303

304304
/* dump the pair table */
305305
fprintf(output, "/*-*SCPACK start of pair table, do not change or remove this line */\n");
306-
fprintf(output, "const unsigned char %s[][2] = {", tablename);
306+
fprintf(output, "const unsigned char %s[128][2] = {", tablename);
307307
for (i=0; i<128 && pairtable[i][0]!=0 && pairtable[i][1]!=0; i++) {
308308
if ((i % 16)==0)
309309
fprintf(output, "\n ");

0 commit comments

Comments
 (0)