diff --git a/engine/qclib/initlib.c b/engine/qclib/initlib.c index bff140bdf..940375477 100644 --- a/engine/qclib/initlib.c +++ b/engine/qclib/initlib.c @@ -1084,10 +1084,10 @@ void QCBUILTIN PF_memgetval (pubprogfuncs_t *inst, struct globalvars_s *globals) //read 32 bits from a pointer. int dst = G_INT(OFS_PARM0); float ofs = G_FLOAT(OFS_PARM1); - int size = 4; + int size = sizeof(int); if (ofs != (float)(int)ofs) PR_RunWarning(inst, "PF_memgetval: non-integer offset\n"); - dst += ofs; + dst += ofs*size; if (dst < 0 || dst+size >= inst->stringtablesize) { PR_RunError(inst, "PF_memgetval: invalid dest\n"); @@ -1104,10 +1104,10 @@ void QCBUILTIN PF_memsetval (pubprogfuncs_t *inst, struct globalvars_s *globals) int dst = G_INT(OFS_PARM0); float ofs = G_FLOAT(OFS_PARM1); int val = G_INT(OFS_PARM2); - int size = 4; + int size = sizeof(int); if (ofs != (float)(int)ofs) PR_RunWarning(inst, "PF_memsetval: non-integer offset\n"); - dst += ofs; + dst += ofs*size; if (dst < 0 || dst+size >= inst->stringtablesize) { PR_RunError(inst, "PF_memsetval: invalid dest\n"); diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 6d9b37fbc..49516c53e 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -4,6 +4,7 @@ struct edict_s; #include "progsint.h" //#include "crc.h" +#include "qcc.h" #ifdef _WIN32 //this is windows all files are written with this endian standard. we do this to try to get a little more speed. @@ -516,19 +517,6 @@ mfunction_t *ED_FindFunction (progfuncs_t *progfuncs, const char *name, progsnum return NULL; } -#ifdef _WIN32 -static void VARGS QC_snprintfz (char *dest, size_t size, const char *fmt, ...) -{ - va_list args; - va_start (args, fmt); - _vsnprintf (dest, size-1, fmt, args); - va_end (args); - //make sure its terminated. - dest[size-1] = 0; -} -#else -#define QC_snprintfz snprintf -#endif /* ============ PR_ValueString @@ -891,7 +879,6 @@ Returns a string with a description and the contents of a global, padded to 20 field width ============ */ -#include "qcc.h" char *PR_GlobalString (progfuncs_t *progfuncs, int ofs, struct QCC_type_s **typehint) { char *s; diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index c270daf3e..229a4c44d 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -15854,7 +15854,11 @@ QCC_type_t *QCC_PR_ParseEnum(pbool flags) else name = NULL; if (QCC_PR_CheckToken(":")) + { basetype = QCC_PR_ParseType(false, false); + if (!basetype) + QCC_PR_ParseError(ERR_NOTATYPE, "enumflags - must be numeric type"); + } else if (strictenum) QCC_PR_Expect(":"); } @@ -15862,7 +15866,7 @@ QCC_type_t *QCC_PR_ParseEnum(pbool flags) } if (flags && basetype->type != ev_float && basetype->type != ev_integer && basetype->type != ev_vector) - QCC_PR_ParseError(ERR_NOTANUMBER, "enumflags - must be numeric type"); + QCC_PR_ParseError(ERR_NOTATYPE, "enumflags - must be numeric type"); if (name) { @@ -16045,7 +16049,7 @@ void QCC_PR_ParseDefs (char *classname, pbool fatal) type = QCC_PR_ParseType(false, false); if (!type) { - QCC_PR_ParseError(ERR_NOTANAME, "typedef found unexpected tokens"); + QCC_PR_ParseError(ERR_NOTATYPE, "typedef found unexpected tokens"); } do {