1
0
Fork 0
forked from fte/fteqw

Fix msvc compile issue reported by ericw. Tighten some syntax checks.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5734 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-07-19 01:38:42 +00:00
parent 00dc8aad4f
commit 4d1a45109c
3 changed files with 11 additions and 20 deletions

View file

@ -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");

View file

@ -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;

View file

@ -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
{