From cc66577f1c6561af6aebd5341ff9fb7ca0e0cb43 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 16 Nov 2001 01:09:17 +0000 Subject: [PATCH] fixes for building on alpha (linux) --- include/compat.h | 2 +- libs/gamecode/engine/pr_opcode.c | 8 ++++---- libs/util/hash.c | 4 ++-- libs/util/zone.c | 2 +- qw/source/sv_ents.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/compat.h b/include/compat.h index ee808a502..b1e5bc5f3 100644 --- a/include/compat.h +++ b/include/compat.h @@ -99,6 +99,6 @@ extern int vsnprintf(char *s, size_t maxlen, const char *format, va_list arg); #endif #undef field_offset -#define field_offset(type,field) ((int)&(((type *)0)->field)) +#define field_offset(type,field) ((size_t)&(((type *)0)->field)) #endif // __compat_h diff --git a/libs/gamecode/engine/pr_opcode.c b/libs/gamecode/engine/pr_opcode.c index 6dfc8c14c..2451a6447 100644 --- a/libs/gamecode/engine/pr_opcode.c +++ b/libs/gamecode/engine/pr_opcode.c @@ -260,7 +260,7 @@ check_branch (progs_t *pr, dstatement_t *st, opcode_t *op, short offset) address += offset; if (address < 0 || address >= pr->progs->numstatements) PR_Error (pr, "PR_Check_Opcodes: invalid branch (statement %d: %s)\n", - st - pr->pr_statements, op->opname); + (int)(st - pr->pr_statements), op->opname); } static inline void @@ -269,9 +269,9 @@ check_global (progs_t *pr, dstatement_t *st, opcode_t *op, etype_t type, { if (type == ev_void && operand) { if (st->op != OP_RETURN && st->op != OP_DONE) //FIXME need better "not used flags" - PR_Error (pr, "PR_Check_Opcodes: non-zero global index in void operand (statement %d: %s)\n", st - pr->pr_statements, op->opname); + PR_Error (pr, "PR_Check_Opcodes: non-zero global index in void operand (statement %d: %s)\n", (int)(st - pr->pr_statements), op->opname); } else if (operand >= pr->progs->numglobals) { - PR_Error (pr, "PR_Check_Opcodes: out of bounds global index (statement %d: %s)\n", st - pr->pr_statements, op->opname); + PR_Error (pr, "PR_Check_Opcodes: out of bounds global index (statement %d: %s)\n", (int)(st - pr->pr_statements), op->opname); } } @@ -288,7 +288,7 @@ PR_Check_Opcodes (progs_t *pr) if (!op) { PR_Error (pr, "PR_Check_Opcodes: unknown opcode %d at statement %d\n", - st->op, st - pr->pr_statements); + st->op, (int)(st - pr->pr_statements)); } switch (st->op) { case OP_IF: diff --git a/libs/util/hash.c b/libs/util/hash.c index 39817eba4..673cd73d4 100644 --- a/libs/util/hash.c +++ b/libs/util/hash.c @@ -352,8 +352,8 @@ Hash_Stats (hashtab_t *tab) chains++; } } - Sys_Printf ("%d elements\n", tab->num_ele); - Sys_Printf ("%d / %d chains\n", chains, tab->tab_size); + Sys_Printf ("%d elements\n", (int)tab->num_ele); + Sys_Printf ("%d / %d chains\n", chains, (int)tab->tab_size); if (chains) { double average = (double) tab->num_ele / chains; double variance = 0; diff --git a/libs/util/zone.c b/libs/util/zone.c index 89b582f72..ddb23497c 100644 --- a/libs/util/zone.c +++ b/libs/util/zone.c @@ -1083,7 +1083,7 @@ QA_alloc (unsigned flags, ...) && QA_alloc_callback && QA_alloc_callback (size)); if (!mem && failure == QA_NOFAIL) - Sys_Error ("QA_alloc: could not allocate %d bytes!\n", size); + Sys_Error ("QA_alloc: could not allocate %d bytes!\n", (int)size); return mem; } else { diff --git a/qw/source/sv_ents.c b/qw/source/sv_ents.c index 0c5229cb6..fc3b2c0a0 100644 --- a/qw/source/sv_ents.c +++ b/qw/source/sv_ents.c @@ -572,8 +572,8 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg) state->glow_size = bound (-1024, (int) SVfloat (ent, glow_size), 1016) >> 3; - if (sv_fields.glow_color != -1 && SVvector (ent, glow_color)) - state->glow_color = (int) SVvector (ent, glow_color); + if (sv_fields.glow_color != -1 && SVfloat (ent, glow_color)) + state->glow_color = (int) SVfloat (ent, glow_color); if (sv_fields.colormod != -1 && SVvector (ent, colormod)[0]