diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index 6b6a9c530..934fa4880 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -2126,7 +2126,7 @@ void CL_SendCmd (double frametime, qboolean mainloop) else { // don't count this message when calculating PL - cl.outframes[i].latency = -3; + cl.outframes[(cl.movesequence-1) & UPDATE_MASK].latency = -3; // drop this message cls.netchan.outgoing_sequence++; dropcount++; diff --git a/engine/client/image.c b/engine/client/image.c index 713ed0afa..3f73e58a8 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -6212,6 +6212,7 @@ static void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t if (!tex_path[i].enabled) continue; buf = NULL; + fsize = 0; if (tex_path[i].args == 3 && tex->subpath) { char subpath[MAX_QPATH]; diff --git a/engine/common/sha1.c b/engine/common/sha1.c index 9c4e5d118..b50a0ae5d 100644 --- a/engine/common/sha1.c +++ b/engine/common/sha1.c @@ -39,14 +39,14 @@ This file came to FTE via EzQuake. typedef struct { unsigned int state[5]; - unsigned int count[2]; + size_t count[2]; unsigned char buffer[64]; } SHA1_CTX; #define DIGEST_SIZE 20 void SHA1Transform(unsigned int state[5], const unsigned char buffer[64]); void SHA1Init(SHA1_CTX* context); -void SHA1Update(SHA1_CTX* context, const unsigned char* data, unsigned int len); +void SHA1Update(SHA1_CTX* context, const unsigned char* data, size_t len); void SHA1Final(unsigned char digest[DIGEST_SIZE], SHA1_CTX* context); @@ -122,9 +122,9 @@ void SHA1Init(SHA1_CTX* context) /* Run your data through this. */ -void SHA1Update(SHA1_CTX* context, const unsigned char* data, unsigned int len) +void SHA1Update(SHA1_CTX* context, const unsigned char* data, size_t len) { - unsigned int i, j; + size_t i, j; j = (context->count[0] >> 3) & 63; if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; @@ -250,7 +250,7 @@ size_t HMAC(hashfunc_t *hashfunc, unsigned char *digest, size_t maxdigestsize, char innerhash[HMAC_DIGEST_MAXSIZE]; char block[64]; - int innerhashsize; + size_t innerhashsize; /* Reduce the key's size, so that it is never larger than a block. */ diff --git a/engine/gl/gl_shadow.c b/engine/gl/gl_shadow.c index 7a1b3f62b..5e9a9c2d3 100644 --- a/engine/gl/gl_shadow.c +++ b/engine/gl/gl_shadow.c @@ -2246,7 +2246,7 @@ static void Sh_GenShadowFace(dlight_t *l, vec3_t axis[3], int lighttype, shadowm qboolean Sh_GenShadowMap (dlight_t *l, int lighttype, vec3_t axis[3], qbyte *lvis, int smsize) { - int restorefbo; + int restorefbo = 0; int f,lf; float oprojs[16], oprojv[16], oview[16]; pxrect_t oprect; diff --git a/engine/qclib/cmdlib.h b/engine/qclib/cmdlib.h index a9ff97953..592818bbb 100644 --- a/engine/qclib/cmdlib.h +++ b/engine/qclib/cmdlib.h @@ -97,8 +97,8 @@ void ExtractFileExtension (char *path, char *dest); long ParseNum (char *str); -unsigned short *QCC_makeutf16(char *mem, unsigned int len, int *outlen, pbool *errors); -char *QCC_SanitizeCharSet(char *mem, unsigned int *len, pbool *freeresult, int *origfmt); +unsigned short *QCC_makeutf16(char *mem, size_t len, int *outlen, pbool *errors); +char *QCC_SanitizeCharSet(char *mem, size_t *len, pbool *freeresult, int *origfmt); char *QCC_COM_Parse (const char *data); diff --git a/engine/qclib/qcc_cmdlib.c b/engine/qclib/qcc_cmdlib.c index 44aead190..1d1cdb3cf 100644 --- a/engine/qclib/qcc_cmdlib.c +++ b/engine/qclib/qcc_cmdlib.c @@ -966,7 +966,7 @@ unsigned int utf8_check(const void *in, unsigned int *value) //read utf-16 chars and output the 'native' utf-8. //we don't expect essays written in code, so we don't need much actual support for utf-8. -static char *decodeUTF(int type, unsigned char *inputf, unsigned int inbytes, unsigned int *outlen, pbool usemalloc) +static char *decodeUTF(int type, unsigned char *inputf, size_t inbytes, size_t *outlen, pbool usemalloc) { char *utf8, *start; unsigned int inc; @@ -1079,7 +1079,7 @@ static char *decodeUTF(int type, unsigned char *inputf, unsigned int inbytes, un //the gui is a windows program. //this means that its fucked. //on the plus side, its okay with a bom... -unsigned short *QCC_makeutf16(char *mem, unsigned int len, int *outlen, pbool *errors) +unsigned short *QCC_makeutf16(char *mem, size_t len, int *outlen, pbool *errors) { unsigned int code; int l; @@ -1272,13 +1272,8 @@ void QCC_AddFile (char *filename) qcc_cachedsourcefile_t *sfile; progfuncs_t *progfuncs = qccprogfuncs; char *mem; - int len; - len = externs->FileSize(filename); - if (len < 0) - externs->Abort("failed to find file %s", filename); - mem = qccHunkAlloc(sizeof(qcc_cachedsourcefile_t) + len+1); + size_t len; - mem = externs->ReadFile(filename, QCC_LoadFileHunk, NULL, &len); if (!mem) externs->Abort("failed to find file %s", filename); diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index f2bea90aa..0e7c49e95 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -1261,7 +1261,7 @@ static void QCC_GenerateFieldDefs(QCC_def_t *def, char *fieldname, int ofs, QCC_ { //the qcvm cannot cope with struct fields. so we need to generate lots of fake ones. char sub[256]; unsigned int p, a; - int parms = type->num_parms; + unsigned int parms = type->num_parms; if (type->type == ev_union) parms = 1; //unions only generate the first element. it simplifies things (should really just be the biggest). for (p = 0; p < parms; p++) @@ -1560,7 +1560,7 @@ pbool QCC_WriteData (int crc) funcs[i].parm_start = functions[i].merged->parm_start; funcs[i].locals = functions[i].merged->locals; funcs[i].numparms = functions[i].merged->numparms; - for(p = 0; p < funcs[i].numparms; p++) + for(p = 0; p < (unsigned)funcs[i].numparms; p++) funcs[i].parm_size[p] = functions[i].merged->parm_size[p]; } else if (functions[i].code == -1) @@ -2756,7 +2756,7 @@ static unsigned char *QCC_LoadFileHunkAlloc(void *ctx, size_t size) /*load a progs into the current compile state.*/ void QCC_ImportProgs(const char *filename) { - int flen; + size_t flen; dprograms_t *prog; //these keywords are implicitly enabled by #merge @@ -3681,7 +3681,7 @@ Copy a file into the pak file */ void QCC_PackFile (char *src, char *name) { - int remaining; + size_t remaining; #if 1 char *f; #else @@ -4613,7 +4613,7 @@ pbool QCC_main (int argc, char **argv) //as part of the quake engine time_t long_time; extern QCC_type_t *pr_classtype; - int p; + size_t p; extern int qccpersisthunk; char *s;