GCC Wallification
This commit is contained in:
parent
6786b0e356
commit
81ac41037b
@ -6,9 +6,9 @@ MM_ROOT = ../metamod/metamod
|
|||||||
|
|
||||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||||
|
|
||||||
OPT_FLAGS = -O2 -fno-strict-aliasing -funroll-loops -s -fomit-frame-pointer -pipe
|
OPT_FLAGS = -O2 -fno-strict-aliasing -funroll-loops -s -fomit-frame-pointer -pipe
|
||||||
DEBUG_FLAGS = -g -ggdb3
|
DEBUG_FLAGS = -g -ggdb3
|
||||||
CPP = gcc-4.1
|
CPP = gcc-3.4
|
||||||
NAME = amxmodx
|
NAME = amxmodx
|
||||||
|
|
||||||
BIN_SUFFIX_32 = mm_i386.so
|
BIN_SUFFIX_32 = mm_i386.so
|
||||||
@ -47,7 +47,7 @@ ifeq "$(BINLOG)" "true"
|
|||||||
CFLAGS += -DBINLOG_ENABLED
|
CFLAGS += -DBINLOG_ENABLED
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DLINUX -DNDEBUG -fPIC -Wno-deprecated -DHAVE_STDINT_H -static-libgcc -fno-rtti -fno-exceptions
|
CFLAGS += -DLINUX -DNDEBUG -DAMX_NOPROPLIST -fPIC -Wall -Werror -DHAVE_STDINT_H -static-libgcc -fno-rtti -fno-exceptions
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -214,7 +214,7 @@ typedef struct tagAMX_NATIVE_INFO {
|
|||||||
|
|
||||||
typedef struct tagAMX_FUNCSTUB {
|
typedef struct tagAMX_FUNCSTUB {
|
||||||
ucell address PACKED;
|
ucell address PACKED;
|
||||||
char name[sEXPMAX+1] PACKED;
|
char name[sEXPMAX+1];
|
||||||
} PACKED AMX_FUNCSTUB;
|
} PACKED AMX_FUNCSTUB;
|
||||||
|
|
||||||
typedef struct tagFUNCSTUBNT {
|
typedef struct tagFUNCSTUBNT {
|
||||||
@ -265,8 +265,8 @@ typedef struct tagAMX {
|
|||||||
typedef struct tagAMX_HEADER {
|
typedef struct tagAMX_HEADER {
|
||||||
int32_t size PACKED; /* size of the "file" */
|
int32_t size PACKED; /* size of the "file" */
|
||||||
uint16_t magic PACKED; /* signature */
|
uint16_t magic PACKED; /* signature */
|
||||||
char file_version PACKED; /* file format version */
|
char file_version; /* file format version */
|
||||||
char amx_version PACKED; /* required version of the AMX */
|
char amx_version; /* required version of the AMX */
|
||||||
int16_t flags PACKED;
|
int16_t flags PACKED;
|
||||||
int16_t defsize PACKED; /* size of a definition record */
|
int16_t defsize PACKED; /* size of a definition record */
|
||||||
int32_t cod PACKED; /* initial value of COD - code block */
|
int32_t cod PACKED; /* initial value of COD - code block */
|
||||||
|
@ -65,8 +65,8 @@ extern "C" {
|
|||||||
typedef struct tagAMX_DBG_HDR {
|
typedef struct tagAMX_DBG_HDR {
|
||||||
int32_t size PACKED; /* size of the debug information chunk */
|
int32_t size PACKED; /* size of the debug information chunk */
|
||||||
uint16_t magic PACKED; /* signature, must be 0xf1ef */
|
uint16_t magic PACKED; /* signature, must be 0xf1ef */
|
||||||
char file_version PACKED; /* file format version */
|
char file_version; /* file format version */
|
||||||
char amx_version PACKED; /* required version of the AMX */
|
char amx_version; /* required version of the AMX */
|
||||||
int16_t flags PACKED; /* currently unused */
|
int16_t flags PACKED; /* currently unused */
|
||||||
int16_t files PACKED; /* number of entries in the "file" table */
|
int16_t files PACKED; /* number of entries in the "file" table */
|
||||||
int16_t lines PACKED; /* number of entries in the "line" table */
|
int16_t lines PACKED; /* number of entries in the "line" table */
|
||||||
@ -74,51 +74,51 @@ typedef struct tagAMX_DBG_HDR {
|
|||||||
int16_t tags PACKED; /* number of entries in the "tag" table */
|
int16_t tags PACKED; /* number of entries in the "tag" table */
|
||||||
int16_t automatons PACKED; /* number of entries in the "automaton" table */
|
int16_t automatons PACKED; /* number of entries in the "automaton" table */
|
||||||
int16_t states PACKED; /* number of entries in the "state" table */
|
int16_t states PACKED; /* number of entries in the "state" table */
|
||||||
} AMX_DBG_HDR PACKED;
|
} PACKED AMX_DBG_HDR;
|
||||||
#define AMX_DBG_MAGIC 0xf1ef
|
#define AMX_DBG_MAGIC 0xf1ef
|
||||||
|
|
||||||
typedef struct tagAMX_DBG_FILE {
|
typedef struct tagAMX_DBG_FILE {
|
||||||
ucell address PACKED; /* address in the code segment where generated code (for this file) starts */
|
ucell address PACKED; /* address in the code segment where generated code (for this file) starts */
|
||||||
const char name[1] PACKED; /* ASCII string, zero-terminated */
|
const char name[1]; /* ASCII string, zero-terminated */
|
||||||
} AMX_DBG_FILE PACKED;
|
} PACKED AMX_DBG_FILE;
|
||||||
|
|
||||||
typedef struct tagAMX_DBG_LINE {
|
typedef struct tagAMX_DBG_LINE {
|
||||||
ucell address PACKED; /* address in the code segment where generated code (for this line) starts */
|
ucell address PACKED; /* address in the code segment where generated code (for this line) starts */
|
||||||
int32_t line PACKED; /* line number */
|
int32_t line PACKED; /* line number */
|
||||||
} AMX_DBG_LINE PACKED;
|
} PACKED AMX_DBG_LINE;
|
||||||
|
|
||||||
typedef struct tagAMX_DBG_SYMBOL {
|
typedef struct tagAMX_DBG_SYMBOL {
|
||||||
ucell address PACKED; /* address in the data segment or relative to the frame */
|
ucell address PACKED; /* address in the data segment or relative to the frame */
|
||||||
int16_t tag PACKED; /* tag for the symbol */
|
int16_t tag PACKED; /* tag for the symbol */
|
||||||
ucell codestart PACKED; /* address in the code segment from which this symbol is valid (in scope) */
|
ucell codestart PACKED; /* address in the code segment from which this symbol is valid (in scope) */
|
||||||
ucell codeend PACKED; /* address in the code segment until which this symbol is valid (in scope) */
|
ucell codeend PACKED; /* address in the code segment until which this symbol is valid (in scope) */
|
||||||
char ident PACKED; /* kind of symbol (function/variable) */
|
char ident; /* kind of symbol (function/variable) */
|
||||||
char vclass PACKED; /* class of symbol (global/local) */
|
char vclass; /* class of symbol (global/local) */
|
||||||
int16_t dim PACKED; /* number of dimensions */
|
int16_t dim PACKED; /* number of dimensions */
|
||||||
const char name[1] PACKED; /* ASCII string, zero-terminated */
|
const char name[1]; /* ASCII string, zero-terminated */
|
||||||
} AMX_DBG_SYMBOL PACKED;
|
} PACKED AMX_DBG_SYMBOL;
|
||||||
|
|
||||||
typedef struct tagAMX_DBG_SYMDIM {
|
typedef struct tagAMX_DBG_SYMDIM {
|
||||||
int16_t tag PACKED; /* tag for the array dimension */
|
int16_t tag PACKED; /* tag for the array dimension */
|
||||||
ucell size PACKED; /* size of the array dimension */
|
ucell size PACKED; /* size of the array dimension */
|
||||||
} AMX_DBG_SYMDIM PACKED;
|
} PACKED AMX_DBG_SYMDIM;
|
||||||
|
|
||||||
typedef struct tagAMX_DBG_TAG {
|
typedef struct tagAMX_DBG_TAG {
|
||||||
int16_t tag PACKED; /* tag id */
|
int16_t tag PACKED; /* tag id */
|
||||||
const char name[1] PACKED; /* ASCII string, zero-terminated */
|
const char name[1]; /* ASCII string, zero-terminated */
|
||||||
} AMX_DBG_TAG PACKED;
|
} PACKED AMX_DBG_TAG;
|
||||||
|
|
||||||
typedef struct tagAMX_DBG_MACHINE {
|
typedef struct tagAMX_DBG_MACHINE {
|
||||||
int16_t automaton PACKED; /* automaton id */
|
int16_t automaton PACKED; /* automaton id */
|
||||||
ucell address PACKED; /* address of state variable */
|
ucell address PACKED; /* address of state variable */
|
||||||
const char name[1] PACKED; /* ASCII string, zero-terminated */
|
const char name[1]; /* ASCII string, zero-terminated */
|
||||||
} AMX_DBG_MACHINE PACKED;
|
} PACKED AMX_DBG_MACHINE;
|
||||||
|
|
||||||
typedef struct tagAMX_DBG_STATE {
|
typedef struct tagAMX_DBG_STATE {
|
||||||
int16_t state PACKED; /* state id */
|
int16_t state PACKED; /* state id */
|
||||||
int16_t automaton PACKED; /* automaton id */
|
int16_t automaton PACKED; /* automaton id */
|
||||||
const char name[1] PACKED; /* ASCII string, zero-terminated */
|
const char name[1]; /* ASCII string, zero-terminated */
|
||||||
} AMX_DBG_STATE PACKED;
|
} PACKED AMX_DBG_STATE;
|
||||||
|
|
||||||
typedef struct tagAMX_DBG {
|
typedef struct tagAMX_DBG {
|
||||||
AMX_DBG_HDR _FAR *hdr PACKED; /* points to the AMX_DBG header */
|
AMX_DBG_HDR _FAR *hdr PACKED; /* points to the AMX_DBG header */
|
||||||
@ -128,7 +128,7 @@ typedef struct tagAMX_DBG {
|
|||||||
AMX_DBG_TAG _FAR **tagtbl PACKED;
|
AMX_DBG_TAG _FAR **tagtbl PACKED;
|
||||||
AMX_DBG_MACHINE _FAR **automatontbl PACKED;
|
AMX_DBG_MACHINE _FAR **automatontbl PACKED;
|
||||||
AMX_DBG_STATE _FAR **statetbl PACKED;
|
AMX_DBG_STATE _FAR **statetbl PACKED;
|
||||||
} AMX_DBG PACKED;
|
} PACKED AMX_DBG;
|
||||||
|
|
||||||
#if !defined iVARIABLE
|
#if !defined iVARIABLE
|
||||||
#define iVARIABLE 1 /* cell that has an address and that can be fetched directly (lvalue) */
|
#define iVARIABLE 1 /* cell that has an address and that can be fetched directly (lvalue) */
|
||||||
|
@ -2912,7 +2912,7 @@ static cell AMX_NATIVE_CALL register_byval(AMX *amx, cell *params)
|
|||||||
|
|
||||||
//get the destination string
|
//get the destination string
|
||||||
char *data = get_amxstring(amx, params[2], 0, len);
|
char *data = get_amxstring(amx, params[2], 0, len);
|
||||||
void *PT;
|
void *PT = NULL;
|
||||||
|
|
||||||
//copy
|
//copy
|
||||||
ucy(p, dtr);
|
ucy(p, dtr);
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
struct TableEntry
|
struct TableEntry
|
||||||
{
|
{
|
||||||
mint8_t cellSize ;
|
mint8_t cellSize;
|
||||||
mint32_t origSize PACKED; // contains AMX_HEADER->stp
|
mint32_t origSize PACKED; // contains AMX_HEADER->stp
|
||||||
mint32_t offset PACKED;
|
mint32_t offset PACKED;
|
||||||
};
|
};
|
||||||
@ -300,7 +300,7 @@ size_t CAmxxReader::GetBufferSize()
|
|||||||
|
|
||||||
#undef DATAREAD
|
#undef DATAREAD
|
||||||
#define DATAREAD(addr, itemsize, itemcount) \
|
#define DATAREAD(addr, itemsize, itemcount) \
|
||||||
if (fread(addr, itemsize, itemcount, m_pFile) != itemcount) \
|
if (fread(addr, itemsize, itemcount, m_pFile) != static_cast<size_t>(itemcount)) \
|
||||||
{ \
|
{ \
|
||||||
if (feof(m_pFile)) \
|
if (feof(m_pFile)) \
|
||||||
m_Status = Err_FileInvalid; \
|
m_Status = Err_FileInvalid; \
|
||||||
|
@ -139,7 +139,7 @@ void BinLog::WriteOp(BinLogOp op, int plug, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, plug);
|
va_start(ap, plug);
|
||||||
|
|
||||||
AMX *amx;
|
AMX *amx = NULL;
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
AMX_DBG *dbg = NULL;
|
AMX_DBG *dbg = NULL;
|
||||||
CPluginMngr::CPlugin *pl = NULL;
|
CPluginMngr::CPlugin *pl = NULL;
|
||||||
|
@ -1195,7 +1195,7 @@ AMX *MNF_GetAmxScript(int id)
|
|||||||
while (iter && id--)
|
while (iter && id--)
|
||||||
++iter;
|
++iter;
|
||||||
|
|
||||||
if (iter == NULL)
|
if (iter == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return (*iter).getAMX();
|
return (*iter).getAMX();
|
||||||
@ -1208,7 +1208,7 @@ const char *MNF_GetAmxScriptName(int id)
|
|||||||
while (iter && id--)
|
while (iter && id--)
|
||||||
++iter;
|
++iter;
|
||||||
|
|
||||||
if (iter == NULL)
|
if (iter == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return (*iter).getName();
|
return (*iter).getName();
|
||||||
|
@ -110,7 +110,7 @@ void _Setup_Optimizer_Stage2(AMX *amx, cell *oplist, cell *cip)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
//we don't do these yet because of radix stuff >:\
|
/* we don't do these yet because of radix stuff >:\ */
|
||||||
//FIND_NATIVE("floatsin", N_Float_Sin);
|
//FIND_NATIVE("floatsin", N_Float_Sin);
|
||||||
//FIND_NATIVE("floatcos", N_Float_Cos);
|
//FIND_NATIVE("floatcos", N_Float_Cos);
|
||||||
//FIND_NATIVE("floattan", N_Float_Tan);
|
//FIND_NATIVE("floattan", N_Float_Tan);
|
||||||
|
@ -1,359 +1,359 @@
|
|||||||
#include "amxmodx.h"
|
#include "amxmodx.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* About the double array hack *
|
* About the double array hack *
|
||||||
***************************
|
***************************
|
||||||
|
|
||||||
Double arrays in Pawn are vectors offset by the current offset. For example:
|
Double arrays in Pawn are vectors offset by the current offset. For example:
|
||||||
|
|
||||||
new array[2][2]
|
new array[2][2]
|
||||||
|
|
||||||
In this array, index 0 contains the offset from the current offset which
|
In this array, index 0 contains the offset from the current offset which
|
||||||
results in the final vector [2] (at [0][2]). Meaning, to dereference [1][2],
|
results in the final vector [2] (at [0][2]). Meaning, to dereference [1][2],
|
||||||
it is equivalent to:
|
it is equivalent to:
|
||||||
|
|
||||||
address = &array[1] + array[1] + 2 * sizeof(cell)
|
address = &array[1] + array[1] + 2 * sizeof(cell)
|
||||||
|
|
||||||
The fact that each offset is from the _current_ position rather than the _base_
|
The fact that each offset is from the _current_ position rather than the _base_
|
||||||
position is very important. It means that if you to try to swap vector positions,
|
position is very important. It means that if you to try to swap vector positions,
|
||||||
the offsets will no longer match, because their current position has changed. A
|
the offsets will no longer match, because their current position has changed. A
|
||||||
simple and ingenious way around this is to back up the positions in a separate array,
|
simple and ingenious way around this is to back up the positions in a separate array,
|
||||||
then to overwrite each position in the old array with absolute indices. Pseudo C++ code:
|
then to overwrite each position in the old array with absolute indices. Pseudo C++ code:
|
||||||
|
|
||||||
cell *array; //assumed to be set to the 2+D array
|
cell *array; //assumed to be set to the 2+D array
|
||||||
cell *old_offsets = new cell[2];
|
cell *old_offsets = new cell[2];
|
||||||
for (int i=0; i<2; i++)
|
for (int i=0; i<2; i++)
|
||||||
{
|
{
|
||||||
old_offsets = array[i];
|
old_offsets = array[i];
|
||||||
array[i] = i;
|
array[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
Now, you can swap the array indices with no problem, and do a reverse-lookup to find the original addresses.
|
Now, you can swap the array indices with no problem, and do a reverse-lookup to find the original addresses.
|
||||||
After sorting/modification is done, you must relocate the new indices. For example, if the two vectors in our
|
After sorting/modification is done, you must relocate the new indices. For example, if the two vectors in our
|
||||||
demo array were swapped, array[0] would be 1 and array[1] would be 0. This is invalid to the virtual machine.
|
demo array were swapped, array[0] would be 1 and array[1] would be 0. This is invalid to the virtual machine.
|
||||||
Luckily, this is also simple -- all the information is there.
|
Luckily, this is also simple -- all the information is there.
|
||||||
|
|
||||||
for (int i=0; i<2; i++)
|
for (int i=0; i<2; i++)
|
||||||
{
|
{
|
||||||
//get the # of the vector we want to relocate in
|
//get the # of the vector we want to relocate in
|
||||||
cell vector_index = array[i];
|
cell vector_index = array[i];
|
||||||
//get the real address of this vector
|
//get the real address of this vector
|
||||||
char *real_address = (char *)array + (vector_index * sizeof(cell)) + old_offsets[vector_index];
|
char *real_address = (char *)array + (vector_index * sizeof(cell)) + old_offsets[vector_index];
|
||||||
//calc and store the new distance offset
|
//calc and store the new distance offset
|
||||||
array[i] = real_address - ( (char *)array + (vector_index + sizeof(cell)) )
|
array[i] = real_address - ( (char *)array + (vector_index + sizeof(cell)) )
|
||||||
}
|
}
|
||||||
|
|
||||||
Note that the inner expression can be heavily reduced; it is expanded for readability.
|
Note that the inner expression can be heavily reduced; it is expanded for readability.
|
||||||
**********************************/
|
**********************************/
|
||||||
|
|
||||||
enum SortOrder
|
enum SortOrder
|
||||||
{
|
{
|
||||||
Sort_Ascending = 0,
|
Sort_Ascending = 0,
|
||||||
Sort_Descending = 1,
|
Sort_Descending = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
int sort_ints_asc(const void *int1, const void *int2)
|
int sort_ints_asc(const void *int1, const void *int2)
|
||||||
{
|
{
|
||||||
return (*(int *)int1) - (*(int *)int2);
|
return (*(int *)int1) - (*(int *)int2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sort_ints_desc(const void *int1, const void *int2)
|
int sort_ints_desc(const void *int1, const void *int2)
|
||||||
{
|
{
|
||||||
return (*(int *)int2) - (*(int *)int1);
|
return (*(int *)int2) - (*(int *)int1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL SortIntegers(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL SortIntegers(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
cell *array = get_amxaddr(amx, params[1]);
|
cell *array = get_amxaddr(amx, params[1]);
|
||||||
cell array_size = params[2];
|
cell array_size = params[2];
|
||||||
cell type = params[3];
|
cell type = params[3];
|
||||||
|
|
||||||
if (type == Sort_Ascending)
|
if (type == Sort_Ascending)
|
||||||
{
|
{
|
||||||
qsort(array, array_size, sizeof(cell), sort_ints_asc);
|
qsort(array, array_size, sizeof(cell), sort_ints_asc);
|
||||||
} else {
|
} else {
|
||||||
qsort(array, array_size, sizeof(cell), sort_ints_desc);
|
qsort(array, array_size, sizeof(cell), sort_ints_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sort_floats_asc(const void *float1, const void *float2)
|
int sort_floats_asc(const void *float1, const void *float2)
|
||||||
{
|
{
|
||||||
REAL r1 = *(REAL *)float1;
|
REAL r1 = *(REAL *)float1;
|
||||||
REAL r2 = *(REAL *)float2;
|
REAL r2 = *(REAL *)float2;
|
||||||
|
|
||||||
if (r1 < r2)
|
if (r1 < r2)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
} else if (r2 < r1) {
|
} else if (r2 < r1) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sort_floats_desc(const void *float1, const void *float2)
|
int sort_floats_desc(const void *float1, const void *float2)
|
||||||
{
|
{
|
||||||
REAL r1 = *(REAL *)float1;
|
REAL r1 = *(REAL *)float1;
|
||||||
REAL r2 = *(REAL *)float2;
|
REAL r2 = *(REAL *)float2;
|
||||||
|
|
||||||
if (r1 < r2)
|
if (r1 < r2)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
} else if (r2 < r1) {
|
} else if (r2 < r1) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL SortFloats(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL SortFloats(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
cell *array = get_amxaddr(amx, params[1]);
|
cell *array = get_amxaddr(amx, params[1]);
|
||||||
cell array_size = params[2];
|
cell array_size = params[2];
|
||||||
cell type = params[3];
|
cell type = params[3];
|
||||||
|
|
||||||
if (type == Sort_Ascending)
|
if (type == Sort_Ascending)
|
||||||
{
|
{
|
||||||
qsort(array, array_size, sizeof(cell), sort_floats_asc);
|
qsort(array, array_size, sizeof(cell), sort_floats_asc);
|
||||||
} else {
|
} else {
|
||||||
qsort(array, array_size, sizeof(cell), sort_floats_desc);
|
qsort(array, array_size, sizeof(cell), sort_floats_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell *g_CurStringArray = NULL;
|
static cell *g_CurStringArray = NULL;
|
||||||
static cell *g_CurRebaseMap = NULL;
|
static cell *g_CurRebaseMap = NULL;
|
||||||
|
|
||||||
int sort_strings_asc(const void *blk1, const void *blk2)
|
int sort_strings_asc(const void *blk1, const void *blk2)
|
||||||
{
|
{
|
||||||
cell reloc1 = *(cell *)blk1;
|
cell reloc1 = *(cell *)blk1;
|
||||||
cell reloc2 = *(cell *)blk2;
|
cell reloc2 = *(cell *)blk2;
|
||||||
|
|
||||||
register cell *str1 = (cell *)((char *)(&g_CurStringArray[reloc1]) + g_CurRebaseMap[reloc1]);
|
register cell *str1 = (cell *)((char *)(&g_CurStringArray[reloc1]) + g_CurRebaseMap[reloc1]);
|
||||||
register cell *str2 = (cell *)((char *)(&g_CurStringArray[reloc2]) + g_CurRebaseMap[reloc2]);
|
register cell *str2 = (cell *)((char *)(&g_CurStringArray[reloc2]) + g_CurRebaseMap[reloc2]);
|
||||||
|
|
||||||
while (*str1 == *str2++)
|
while (*str1 == *str2++)
|
||||||
{
|
{
|
||||||
if (*str1++ == 0)
|
if (*str1++ == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*str1 - *(str2 - 1));
|
return (*str1 - *(str2 - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
int sort_strings_desc(const void *blk1, const void *blk2)
|
int sort_strings_desc(const void *blk1, const void *blk2)
|
||||||
{
|
{
|
||||||
cell reloc1 = *(cell *)blk1;
|
cell reloc1 = *(cell *)blk1;
|
||||||
cell reloc2 = *(cell *)blk2;
|
cell reloc2 = *(cell *)blk2;
|
||||||
|
|
||||||
register cell *str1 = (cell *)((char *)(&g_CurStringArray[reloc1]) + g_CurRebaseMap[reloc1]);
|
register cell *str1 = (cell *)((char *)(&g_CurStringArray[reloc1]) + g_CurRebaseMap[reloc1]);
|
||||||
register cell *str2 = (cell *)((char *)(&g_CurStringArray[reloc2]) + g_CurRebaseMap[reloc2]);
|
register cell *str2 = (cell *)((char *)(&g_CurStringArray[reloc2]) + g_CurRebaseMap[reloc2]);
|
||||||
|
|
||||||
while (*str1 == *str2++)
|
while (*str1 == *str2++)
|
||||||
{
|
{
|
||||||
if (*str1++ == 0)
|
if (*str1++ == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*(str2 - 1) - *str1);
|
return (*(str2 - 1) - *str1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL SortStrings(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL SortStrings(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
cell *array = get_amxaddr(amx, params[1]);
|
cell *array = get_amxaddr(amx, params[1]);
|
||||||
cell array_size = params[2];
|
cell array_size = params[2];
|
||||||
cell type = params[3];
|
cell type = params[3];
|
||||||
|
|
||||||
/** HACKHACK - back up the old indices, replace the indices with something easier */
|
/** HACKHACK - back up the old indices, replace the indices with something easier */
|
||||||
cell amx_addr, *phys_addr;
|
cell amx_addr, *phys_addr;
|
||||||
int err;
|
int err;
|
||||||
if ((err=amx_Allot(amx, array_size, &amx_addr, &phys_addr)) != AMX_ERR_NONE)
|
if ((err=amx_Allot(amx, array_size, &amx_addr, &phys_addr)) != AMX_ERR_NONE)
|
||||||
{
|
{
|
||||||
LogError(amx, err, "Ran out of memory");
|
LogError(amx, err, "Ran out of memory");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_CurStringArray = array;
|
g_CurStringArray = array;
|
||||||
g_CurRebaseMap = phys_addr;
|
g_CurRebaseMap = phys_addr;
|
||||||
|
|
||||||
for (int i=0; i<array_size; i++)
|
for (int i=0; i<array_size; i++)
|
||||||
{
|
{
|
||||||
phys_addr[i] = array[i];
|
phys_addr[i] = array[i];
|
||||||
array[i] = i;
|
array[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == Sort_Ascending)
|
if (type == Sort_Ascending)
|
||||||
{
|
{
|
||||||
qsort(array, array_size, sizeof(cell), sort_strings_asc);
|
qsort(array, array_size, sizeof(cell), sort_strings_asc);
|
||||||
} else {
|
} else {
|
||||||
qsort(array, array_size, sizeof(cell), sort_strings_desc);
|
qsort(array, array_size, sizeof(cell), sort_strings_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* END HACKHACK - restore what we damaged so Pawn doesn't throw up.
|
/* END HACKHACK - restore what we damaged so Pawn doesn't throw up.
|
||||||
* We'll browse through each index of the array and patch up the distance.
|
* We'll browse through each index of the array and patch up the distance.
|
||||||
*/
|
*/
|
||||||
for (int i=0; i<array_size; i++)
|
for (int i=0; i<array_size; i++)
|
||||||
{
|
{
|
||||||
/* Compute the final address of the old array and subtract the new location.
|
/* Compute the final address of the old array and subtract the new location.
|
||||||
* This is the fixed up distance.
|
* This is the fixed up distance.
|
||||||
*/
|
*/
|
||||||
array[i] = ((char *)&array[array[i]] + phys_addr[array[i]]) - (char *)&array[i];
|
array[i] = ((char *)&array[array[i]] + phys_addr[array[i]]) - (char *)&array[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
amx_Release(amx, amx_addr);
|
amx_Release(amx, amx_addr);
|
||||||
|
|
||||||
g_CurStringArray = NULL;
|
g_CurStringArray = NULL;
|
||||||
g_CurRebaseMap = NULL;
|
g_CurRebaseMap = NULL;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sort_info
|
struct sort_info
|
||||||
{
|
{
|
||||||
int pfn;
|
int pfn;
|
||||||
cell data_addr;
|
cell data_addr;
|
||||||
cell data_size;
|
cell data_size;
|
||||||
cell array_addr;
|
cell array_addr;
|
||||||
cell *array_base;
|
cell *array_base;
|
||||||
cell *array_remap;
|
cell *array_remap;
|
||||||
AMX *amx;
|
AMX *amx;
|
||||||
};
|
};
|
||||||
|
|
||||||
static CStack<sort_info *> g_AMXSortStack;
|
static CStack<sort_info *> g_AMXSortStack;
|
||||||
|
|
||||||
int sort1d_amx_custom(const void *elem1, const void *elem2)
|
int sort1d_amx_custom(const void *elem1, const void *elem2)
|
||||||
{
|
{
|
||||||
cell c1 = *(cell *)elem1;
|
cell c1 = *(cell *)elem1;
|
||||||
cell c2 = *(cell *)elem2;
|
cell c2 = *(cell *)elem2;
|
||||||
sort_info *pInfo = g_AMXSortStack.front();
|
sort_info *pInfo = g_AMXSortStack.front();
|
||||||
|
|
||||||
return executeForwards(pInfo->pfn, c1, c2, pInfo->array_addr, pInfo->data_addr, pInfo->data_size);
|
return executeForwards(pInfo->pfn, c1, c2, pInfo->array_addr, pInfo->data_addr, pInfo->data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL SortCustom1D(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL SortCustom1D(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
cell *array = get_amxaddr(amx, params[1]);
|
cell *array = get_amxaddr(amx, params[1]);
|
||||||
cell array_size = params[2];
|
cell array_size = params[2];
|
||||||
int len;
|
int len;
|
||||||
const char *funcname = get_amxstring(amx, params[3], 0, len);
|
const char *funcname = get_amxstring(amx, params[3], 0, len);
|
||||||
|
|
||||||
int pfn = registerSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
int pfn = registerSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
if (pfn < 0)
|
if (pfn < 0)
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "The public function \"%s\" was not found.", funcname);
|
LogError(amx, AMX_ERR_NATIVE, "The public function \"%s\" was not found.", funcname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sort_info *pInfo = new sort_info;
|
sort_info *pInfo = new sort_info;
|
||||||
|
|
||||||
pInfo->pfn = pfn;
|
pInfo->pfn = pfn;
|
||||||
pInfo->data_addr = params[4];
|
pInfo->data_addr = params[4];
|
||||||
pInfo->data_size = params[5];
|
pInfo->data_size = params[5];
|
||||||
pInfo->array_addr = params[1];
|
pInfo->array_addr = params[1];
|
||||||
pInfo->array_remap = NULL;
|
pInfo->array_remap = NULL;
|
||||||
pInfo->array_base = NULL;
|
pInfo->array_base = NULL;
|
||||||
|
|
||||||
g_AMXSortStack.push(pInfo);
|
g_AMXSortStack.push(pInfo);
|
||||||
qsort(array, array_size, sizeof(cell), sort1d_amx_custom);
|
qsort(array, array_size, sizeof(cell), sort1d_amx_custom);
|
||||||
g_AMXSortStack.pop();
|
g_AMXSortStack.pop();
|
||||||
|
|
||||||
delete pInfo;
|
delete pInfo;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sort2d_amx_custom(const void *elem1, const void *elem2)
|
int sort2d_amx_custom(const void *elem1, const void *elem2)
|
||||||
{
|
{
|
||||||
cell c1 = *(cell *)elem1;
|
cell c1 = *(cell *)elem1;
|
||||||
cell c2 = *(cell *)elem2;
|
cell c2 = *(cell *)elem2;
|
||||||
sort_info *pInfo = g_AMXSortStack.front();
|
sort_info *pInfo = g_AMXSortStack.front();
|
||||||
|
|
||||||
cell c1_addr = pInfo->array_addr + (c1 * sizeof(cell)) + pInfo->array_remap[c1];
|
cell c1_addr = pInfo->array_addr + (c1 * sizeof(cell)) + pInfo->array_remap[c1];
|
||||||
cell c2_addr = pInfo->array_addr + (c2 * sizeof(cell)) + pInfo->array_remap[c2];
|
cell c2_addr = pInfo->array_addr + (c2 * sizeof(cell)) + pInfo->array_remap[c2];
|
||||||
|
|
||||||
cell *c1_r = get_amxaddr(pInfo->amx, c1_addr);
|
//cell *c1_r = get_amxaddr(pInfo->amx, c1_addr);
|
||||||
cell *c2_r = get_amxaddr(pInfo->amx, c2_addr);
|
//cell *c2_r = get_amxaddr(pInfo->amx, c2_addr);
|
||||||
|
|
||||||
return executeForwards(pInfo->pfn, c1_addr, c2_addr, pInfo->array_addr, pInfo->data_addr, pInfo->data_size);
|
return executeForwards(pInfo->pfn, c1_addr, c2_addr, pInfo->array_addr, pInfo->data_addr, pInfo->data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL SortCustom2D(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL SortCustom2D(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
cell *array = get_amxaddr(amx, params[1]);
|
cell *array = get_amxaddr(amx, params[1]);
|
||||||
cell array_size = params[2];
|
cell array_size = params[2];
|
||||||
int len;
|
int len;
|
||||||
const char *funcname = get_amxstring(amx, params[3], 0, len);
|
const char *funcname = get_amxstring(amx, params[3], 0, len);
|
||||||
|
|
||||||
/** back up the old indices, replace the indices with something easier */
|
/** back up the old indices, replace the indices with something easier */
|
||||||
cell amx_addr, *phys_addr;
|
cell amx_addr, *phys_addr;
|
||||||
int err;
|
int err;
|
||||||
if ((err=amx_Allot(amx, array_size, &amx_addr, &phys_addr)) != AMX_ERR_NONE)
|
if ((err=amx_Allot(amx, array_size, &amx_addr, &phys_addr)) != AMX_ERR_NONE)
|
||||||
{
|
{
|
||||||
LogError(amx, err, "Ran out of memory");
|
LogError(amx, err, "Ran out of memory");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pfn = registerSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
int pfn = registerSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
if (pfn < 0)
|
if (pfn < 0)
|
||||||
{
|
{
|
||||||
amx_Release(amx, amx_addr);
|
amx_Release(amx, amx_addr);
|
||||||
LogError(amx, AMX_ERR_NATIVE, "The public function \"%s\" was not found.", funcname);
|
LogError(amx, AMX_ERR_NATIVE, "The public function \"%s\" was not found.", funcname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sort_info *pInfo = new sort_info;
|
sort_info *pInfo = new sort_info;
|
||||||
|
|
||||||
pInfo->pfn = pfn;
|
pInfo->pfn = pfn;
|
||||||
pInfo->data_addr = params[4];
|
pInfo->data_addr = params[4];
|
||||||
pInfo->data_size = params[5];
|
pInfo->data_size = params[5];
|
||||||
pInfo->array_addr = params[1];
|
pInfo->array_addr = params[1];
|
||||||
pInfo->amx = amx;
|
pInfo->amx = amx;
|
||||||
|
|
||||||
/** Same process as in strings, back up the old indices for later fixup */
|
/** Same process as in strings, back up the old indices for later fixup */
|
||||||
pInfo->array_base = array;
|
pInfo->array_base = array;
|
||||||
pInfo->array_remap = phys_addr;
|
pInfo->array_remap = phys_addr;
|
||||||
|
|
||||||
for (int i=0; i<array_size; i++)
|
for (int i=0; i<array_size; i++)
|
||||||
{
|
{
|
||||||
phys_addr[i] = array[i];
|
phys_addr[i] = array[i];
|
||||||
array[i] = i;
|
array[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_AMXSortStack.push(pInfo);
|
g_AMXSortStack.push(pInfo);
|
||||||
qsort(array, array_size, sizeof(cell), sort2d_amx_custom);
|
qsort(array, array_size, sizeof(cell), sort2d_amx_custom);
|
||||||
g_AMXSortStack.pop();
|
g_AMXSortStack.pop();
|
||||||
|
|
||||||
/** Fixup process! */
|
/** Fixup process! */
|
||||||
for (int i=0; i<array_size; i++)
|
for (int i=0; i<array_size; i++)
|
||||||
{
|
{
|
||||||
/* Compute the final address of the old array and subtract the new location.
|
/* Compute the final address of the old array and subtract the new location.
|
||||||
* This is the fixed up distance.
|
* This is the fixed up distance.
|
||||||
*/
|
*/
|
||||||
array[i] = ((char *)&array[array[i]] + phys_addr[array[i]]) - (char *)&array[i];
|
array[i] = ((char *)&array[array[i]] + phys_addr[array[i]]) - (char *)&array[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
amx_Release(amx, amx_addr);
|
amx_Release(amx, amx_addr);
|
||||||
unregisterSPForward(pInfo->pfn);
|
unregisterSPForward(pInfo->pfn);
|
||||||
delete pInfo;
|
delete pInfo;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
AMX_NATIVE_INFO g_SortNatives[] =
|
AMX_NATIVE_INFO g_SortNatives[] =
|
||||||
{
|
{
|
||||||
{"SortIntegers", SortIntegers},
|
{"SortIntegers", SortIntegers},
|
||||||
{"SortFloats", SortFloats},
|
{"SortFloats", SortFloats},
|
||||||
{"SortStrings", SortStrings},
|
{"SortStrings", SortStrings},
|
||||||
{"SortCustom1D", SortCustom1D},
|
{"SortCustom1D", SortCustom1D},
|
||||||
{"SortCustom2D", SortCustom2D},
|
{"SortCustom2D", SortCustom2D},
|
||||||
|
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "amxmodx.h"
|
#include "amxmodx.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined __linux__ && !defined _vsnprintf
|
||||||
#define _vsnprintf vsnprintf
|
#define _vsnprintf vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -224,7 +224,7 @@ void RankSystem::updatePos( RankStats* rr , Stats* s )
|
|||||||
* Who put these backwards...
|
* Who put these backwards...
|
||||||
*/
|
*/
|
||||||
#define TRYREAD(t_var, t_num, t_size, t_file) \
|
#define TRYREAD(t_var, t_num, t_size, t_file) \
|
||||||
if (fread(t_var, t_size, t_num, t_file) != t_num) { \
|
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
|
|||||||
|
|
||||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||||
|
|
||||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer -Wall -fno-strict-aliasing
|
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer -fno-strict-aliasing
|
||||||
DEBUG_FLAGS = -g -ggdb3
|
DEBUG_FLAGS = -g -ggdb3
|
||||||
CPP = gcc-4.1
|
CPP = gcc-4.1
|
||||||
NAME = csx
|
NAME = csx
|
||||||
@ -35,7 +35,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -34,7 +34,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX)
|
BINARY = $(NAME)_$(BIN_SUFFIX)
|
||||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||||
|
@ -538,6 +538,9 @@ static cell AMX_NATIVE_CALL objective_set_data(AMX *amx, cell *params){ // index
|
|||||||
case CP_model_axis :
|
case CP_model_axis :
|
||||||
strcpy(GET_CP_PD(pent).model_axis,szValue);
|
strcpy(GET_CP_PD(pent).model_axis,szValue);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -638,6 +641,9 @@ static cell AMX_NATIVE_CALL objective_get_data(AMX *amx, cell *params){ // flagi
|
|||||||
MF_SetAmxString(amx,params[3],GET_CP_PD(mObjects.obj[index].pEdict).model_axis,len);
|
MF_SetAmxString(amx,params[3],GET_CP_PD(mObjects.obj[index].pEdict).model_axis,len);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -729,6 +735,9 @@ static cell AMX_NATIVE_CALL area_set_data(AMX *amx, cell *params){ // index, key
|
|||||||
case CA_sprite:
|
case CA_sprite:
|
||||||
strcpy(GET_CA_PD( mObjects.obj[index].pAreaEdict ).hud_sprite,szValue);
|
strcpy(GET_CA_PD( mObjects.obj[index].pAreaEdict ).hud_sprite,szValue);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ void RankSystem::updatePos( RankStats* rr , Stats* s )
|
|||||||
* Who put these backwards...
|
* Who put these backwards...
|
||||||
*/
|
*/
|
||||||
#define TRYREAD(t_var, t_num, t_size, t_file) \
|
#define TRYREAD(t_var, t_num, t_size, t_file) \
|
||||||
if (fread(t_var, t_size, t_num, t_file) != t_num) { \
|
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX)
|
BINARY = $(NAME)_$(BIN_SUFFIX)
|
||||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||||
|
@ -35,7 +35,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -37,7 +37,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti -Wno-invalid-offsetof
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti -Wno-invalid-offsetof
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -35,7 +35,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h> /* For ntohl */
|
#include <netinet/in.h> /* For ntohl */
|
||||||
|
#include <arpa/inet.h>
|
||||||
#else
|
#else
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@ -649,7 +650,7 @@ char *_get_name (GeoIP* gi, unsigned long ipnum) {
|
|||||||
org_buf = malloc(sizeof(char) * (strlen(buf)+1));
|
org_buf = malloc(sizeof(char) * (strlen(buf)+1));
|
||||||
strcpy(org_buf, buf);
|
strcpy(org_buf, buf);
|
||||||
} else {
|
} else {
|
||||||
buf_pointer = gi->cache + (long)record_pointer;
|
buf_pointer = (char *)gi->cache + (long)record_pointer;
|
||||||
org_buf = malloc(sizeof(char) * (strlen(buf_pointer)+1));
|
org_buf = malloc(sizeof(char) * (strlen(buf_pointer)+1));
|
||||||
strcpy(org_buf, buf_pointer);
|
strcpy(org_buf, buf_pointer);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,10 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
|
# Strip C++ options for compiling *.c files
|
||||||
|
C_CFLAGS := $(shell echo $(CFLAGS) | sed -e 's/-fvisibility-inlines-hidden//' | sed -e 's/-fno-rtti//')
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
@ -47,19 +50,23 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
|
$(BIN_DIR)/%.o: %.c
|
||||||
|
$(CPP) $(INCLUDE) $(C_CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
all:
|
all:
|
||||||
mkdir -p $(BIN_DIR)
|
mkdir -p $(BIN_DIR)
|
||||||
mkdir -p $(BIN_DIR)/sdk
|
|
||||||
$(MAKE) geoip
|
$(MAKE) geoip
|
||||||
|
|
||||||
amd64:
|
amd64:
|
||||||
$(MAKE) all AMD64=true
|
$(MAKE) all AMD64=true
|
||||||
|
|
||||||
geoip: $(OBJ_LINUX)
|
geoip: $(OBJ_LINUX)
|
||||||
|
echo ZUMBAWUMBA $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
@ -74,4 +81,4 @@ clean:
|
|||||||
rm -rf Debug/*.o
|
rm -rf Debug/*.o
|
||||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_32)
|
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_32)
|
||||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_64)
|
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -Dstricmp=strcasecmp -fno-rtti -static-libgcc
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -Dstricmp=strcasecmp -fno-rtti -static-libgcc
|
||||||
CFLAGS += -DSM_DEFAULT_THREADER
|
CFLAGS += -DSM_DEFAULT_THREADER
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
|
@ -7,6 +7,8 @@ namespace SourceMod
|
|||||||
{
|
{
|
||||||
class IResultRow
|
class IResultRow
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IResultRow() { };
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* This will return NULL if the entry is NULL.
|
* This will return NULL if the entry is NULL.
|
||||||
@ -26,6 +28,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class IResultSet
|
class IResultSet
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IResultSet() { };
|
||||||
public:
|
public:
|
||||||
//free the handle if necessary (see IQuery).
|
//free the handle if necessary (see IQuery).
|
||||||
virtual void FreeHandle() =0;
|
virtual void FreeHandle() =0;
|
||||||
@ -65,6 +69,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class IQuery
|
class IQuery
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IQuery() { };
|
||||||
public:
|
public:
|
||||||
//you must free the handle when done
|
//you must free the handle when done
|
||||||
virtual void FreeHandle() =0;
|
virtual void FreeHandle() =0;
|
||||||
@ -94,6 +100,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class IDatabase
|
class IDatabase
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IDatabase() { };
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Closes the database and frees the handle.
|
* Closes the database and frees the handle.
|
||||||
@ -130,6 +138,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class ISQLDriver
|
class ISQLDriver
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~ISQLDriver() { };
|
||||||
public:
|
public:
|
||||||
virtual IDatabase *Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) =0;
|
virtual IDatabase *Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) =0;
|
||||||
virtual const char *NameString() =0;
|
virtual const char *NameString() =0;
|
||||||
|
@ -92,6 +92,8 @@ namespace SourceMod
|
|||||||
*/
|
*/
|
||||||
class IThread
|
class IThread
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IThread() { };
|
||||||
public:
|
public:
|
||||||
//Called when the thread runs
|
//Called when the thread runs
|
||||||
virtual void RunThread(IThreadHandle *pHandle) =0;
|
virtual void RunThread(IThreadHandle *pHandle) =0;
|
||||||
@ -107,6 +109,8 @@ namespace SourceMod
|
|||||||
*/
|
*/
|
||||||
class IThreadCreator
|
class IThreadCreator
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IThreadCreator() { };
|
||||||
public:
|
public:
|
||||||
//Makes a thread and cleans up the handle for you
|
//Makes a thread and cleans up the handle for you
|
||||||
virtual void MakeThread(IThread *pThread) =0;
|
virtual void MakeThread(IThread *pThread) =0;
|
||||||
@ -147,6 +151,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class IEventSignal
|
class IEventSignal
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IEventSignal() { };
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Waits for the signal.
|
* Waits for the signal.
|
||||||
|
@ -34,7 +34,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX)
|
BINARY = $(NAME)_$(BIN_SUFFIX)
|
||||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||||
|
@ -20,6 +20,8 @@ public:
|
|||||||
|
|
||||||
class IVaultMngr
|
class IVaultMngr
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IVaultMngr() { }
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Note: Will return NULL if the vault failed to create.
|
* Note: Will return NULL if the vault failed to create.
|
||||||
|
@ -35,7 +35,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fexceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fexceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -35,7 +35,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -35,7 +35,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
ifeq "$(AMD64)" "true"
|
ifeq "$(AMD64)" "true"
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||||
|
@ -31,25 +31,29 @@ C_OBJECTS = $(SQL)/attach.c $(SQL)/auth.c $(SQL)/btree.c $(SQL)/build.c \
|
|||||||
$(SQL)/prepare.c $(SQL)/expr.c $(SQL)/callback.c $(SQL)/alter.c \
|
$(SQL)/prepare.c $(SQL)/expr.c $(SQL)/callback.c $(SQL)/alter.c \
|
||||||
$(SQL)/vdbefifo.c $(SQL)/complete.c $(SQL)/analyze.c
|
$(SQL)/vdbefifo.c $(SQL)/complete.c $(SQL)/analyze.c
|
||||||
|
|
||||||
|
CFLAGS = -Wall -Werror
|
||||||
|
CPPFLAGS = -Wall -Wno-non-virtual-dtor -Werror
|
||||||
|
|
||||||
LINK = -static-libgcc -lpthread /lib/libgcc_eh.a /lib/libstdc++.a
|
LINK = -static-libgcc -lpthread /lib/libgcc_eh.a /lib/libstdc++.a
|
||||||
|
|
||||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||||
-I$(MM_ROOT) -I$(HLSDK)/common -I$(SQL) -I./sqlitepp -I./sdk -I./thread
|
-I$(MM_ROOT) -I$(HLSDK)/common -I$(SQL) -I./sqlitepp -I./sdk -I./thread
|
||||||
|
|
||||||
|
ifeq "$(DEBUG)" "true"
|
||||||
|
BIN_DIR = Debug
|
||||||
|
CFLAGS += $(DEBUG_FLAGS)
|
||||||
|
CPPFLAGS += $(DEBUG_FLAGS)
|
||||||
|
else
|
||||||
|
BIN_DIR = Release
|
||||||
|
CFLAGS += $(OPT_FLAGS)
|
||||||
|
CPPFLAGS += $(OPT_FLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
|
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
CFLAGS += -fvisibility=hidden
|
||||||
endif
|
CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||||
|
|
||||||
ifeq "$(DEBUG)" "true"
|
|
||||||
BIN_DIR = Debug
|
|
||||||
CFLAGS = $(DEBUG_FLAGS)
|
|
||||||
CPPFLAGS = $(DEBUG_FLAGS)
|
|
||||||
else
|
|
||||||
BIN_DIR = Release
|
|
||||||
CFLAGS = $(OPT_FLAGS)
|
|
||||||
CPPFLAGS = $(OPT_FLAGS)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPPFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti
|
CPPFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti
|
||||||
|
@ -5392,9 +5392,9 @@ int sqlite3BtreeDelete(BtCursor *pCur){
|
|||||||
*/
|
*/
|
||||||
BtCursor leafCur;
|
BtCursor leafCur;
|
||||||
unsigned char *pNext;
|
unsigned char *pNext;
|
||||||
int szNext; /* The compiler warning is wrong: szNext is always
|
int szNext = 0; /* The compiler warning is wrong: szNext is always
|
||||||
** initialized before use. Adding an extra initialization
|
** initialized before use. Adding an extra initialization
|
||||||
** to silence the compiler slows down the code. */
|
** to silence the compiler slows down the code. */
|
||||||
int notUsed;
|
int notUsed;
|
||||||
unsigned char *tempCell = 0;
|
unsigned char *tempCell = 0;
|
||||||
assert( !pPage->leafData );
|
assert( !pPage->leafData );
|
||||||
|
@ -230,7 +230,7 @@ static int vxprintf(
|
|||||||
char buf[etBUFSIZE]; /* Conversion buffer */
|
char buf[etBUFSIZE]; /* Conversion buffer */
|
||||||
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
|
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
|
||||||
etByte errorflag = 0; /* True if an error is encountered */
|
etByte errorflag = 0; /* True if an error is encountered */
|
||||||
etByte xtype; /* Conversion paradigm */
|
etByte xtype = 0; /* Conversion paradigm */
|
||||||
char *zExtra; /* Extra memory used for etTCLESCAPE conversions */
|
char *zExtra; /* Extra memory used for etTCLESCAPE conversions */
|
||||||
static const char spaces[] =
|
static const char spaces[] =
|
||||||
" ";
|
" ";
|
||||||
|
@ -688,7 +688,7 @@ static void generateSortTail(
|
|||||||
int cont = sqlite3VdbeMakeLabel(v);
|
int cont = sqlite3VdbeMakeLabel(v);
|
||||||
int addr;
|
int addr;
|
||||||
int iTab;
|
int iTab;
|
||||||
int pseudoTab;
|
int pseudoTab = 0;
|
||||||
ExprList *pOrderBy = p->pOrderBy;
|
ExprList *pOrderBy = p->pOrderBy;
|
||||||
|
|
||||||
iTab = pOrderBy->iECursor;
|
iTab = pOrderBy->iECursor;
|
||||||
|
@ -7,6 +7,8 @@ namespace SourceMod
|
|||||||
{
|
{
|
||||||
class IResultRow
|
class IResultRow
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IResultRow() { };
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* This will return NULL if the entry is NULL.
|
* This will return NULL if the entry is NULL.
|
||||||
@ -26,6 +28,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class IResultSet
|
class IResultSet
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IResultSet() { };
|
||||||
public:
|
public:
|
||||||
//free the handle if necessary (see IQuery).
|
//free the handle if necessary (see IQuery).
|
||||||
virtual void FreeHandle() =0;
|
virtual void FreeHandle() =0;
|
||||||
@ -65,6 +69,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class IQuery
|
class IQuery
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IQuery() { };
|
||||||
public:
|
public:
|
||||||
//you must free the handle when done
|
//you must free the handle when done
|
||||||
virtual void FreeHandle() =0;
|
virtual void FreeHandle() =0;
|
||||||
@ -94,6 +100,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class IDatabase
|
class IDatabase
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IDatabase() { };
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Closes the database and frees the handle.
|
* Closes the database and frees the handle.
|
||||||
@ -130,6 +138,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class ISQLDriver
|
class ISQLDriver
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~ISQLDriver() { };
|
||||||
public:
|
public:
|
||||||
virtual IDatabase *Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) =0;
|
virtual IDatabase *Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) =0;
|
||||||
virtual const char *NameString() =0;
|
virtual const char *NameString() =0;
|
||||||
|
@ -92,6 +92,8 @@ namespace SourceMod
|
|||||||
*/
|
*/
|
||||||
class IThread
|
class IThread
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IThread() { };
|
||||||
public:
|
public:
|
||||||
//Called when the thread runs
|
//Called when the thread runs
|
||||||
virtual void RunThread(IThreadHandle *pHandle) =0;
|
virtual void RunThread(IThreadHandle *pHandle) =0;
|
||||||
@ -107,6 +109,8 @@ namespace SourceMod
|
|||||||
*/
|
*/
|
||||||
class IThreadCreator
|
class IThreadCreator
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IThreadCreator() { };
|
||||||
public:
|
public:
|
||||||
//Makes a thread and cleans up the handle for you
|
//Makes a thread and cleans up the handle for you
|
||||||
virtual void MakeThread(IThread *pThread) =0;
|
virtual void MakeThread(IThread *pThread) =0;
|
||||||
@ -147,6 +151,8 @@ namespace SourceMod
|
|||||||
|
|
||||||
class IEventSignal
|
class IEventSignal
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IEventSignal() { };
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Waits for the signal.
|
* Waits for the signal.
|
||||||
|
@ -234,7 +234,7 @@ void RankSystem::updatePos( RankStats* rr , Stats* s )
|
|||||||
* Who put these backwards...
|
* Who put these backwards...
|
||||||
*/
|
*/
|
||||||
#define TRYREAD(t_var, t_num, t_size, t_file) \
|
#define TRYREAD(t_var, t_num, t_size, t_file) \
|
||||||
if (fread(t_var, t_size, t_num, t_file) != t_num) { \
|
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H
|
||||||
|
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX)
|
BINARY = $(NAME)_$(BIN_SUFFIX)
|
||||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||||
|
@ -34,7 +34,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX)
|
BINARY = $(NAME)_$(BIN_SUFFIX)
|
||||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||||
|
@ -233,7 +233,7 @@ void RankSystem::updatePos( RankStats* rr , Stats* s )
|
|||||||
* Who put these backwards...
|
* Who put these backwards...
|
||||||
*/
|
*/
|
||||||
#define TRYREAD(t_var, t_num, t_size, t_file) \
|
#define TRYREAD(t_var, t_num, t_size, t_file) \
|
||||||
if (fread(t_var, t_size, t_num, t_file) != t_num) { \
|
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ else
|
|||||||
CFLAGS = $(OPT_FLAGS)
|
CFLAGS = $(OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||||
|
|
||||||
BINARY = $(NAME)_$(BIN_SUFFIX)
|
BINARY = $(NAME)_$(BIN_SUFFIX)
|
||||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||||
|
Loading…
Reference in New Issue
Block a user