From 38254186dab5bf460960281380f5a7b6d99ebfe9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 4 Apr 2007 12:30:49 +0000 Subject: [PATCH] other than floats, progs should now be int size safe --- include/QF/pr_comp.h | 90 ++++++++++++++++-------------- include/QF/pr_debug.h | 36 ++++++------ include/QF/pr_obj.h | 28 +++++----- include/QF/progs.h | 38 +++++++------ include/QF/qtypes.h | 1 + libs/gamecode/engine/pr_builtins.c | 2 +- libs/gamecode/engine/pr_debug.c | 78 +++++++++++++------------- libs/gamecode/engine/pr_edict.c | 13 +++-- libs/gamecode/engine/pr_opcode.c | 2 +- libs/gamecode/engine/pr_resolve.c | 8 +-- libs/gamecode/engine/pr_zone.c | 4 +- 11 files changed, 156 insertions(+), 144 deletions(-) diff --git a/include/QF/pr_comp.h b/include/QF/pr_comp.h index 363aaf341..364e636db 100644 --- a/include/QF/pr_comp.h +++ b/include/QF/pr_comp.h @@ -23,9 +23,13 @@ #include "QF/qtypes.h" -typedef int func_t; -typedef int string_t; -typedef int pointer_t; +typedef int32_t func_t; +typedef int32_t string_t; +typedef int32_t pointer_t; +typedef int16_t pr_short_t; +typedef uint16_t pr_ushort_t; +typedef int32_t pr_int_t; +typedef uint32_t pr_uint_t; typedef enum { ev_void, @@ -329,19 +333,19 @@ typedef struct opcode_s { } opcode_t; extern opcode_t pr_opcodes[]; -opcode_t *PR_Opcode (short opcode); +opcode_t *PR_Opcode (pr_short_t opcode); void PR_Opcode_Init (void); typedef struct statement_s { - pr_opcode_e op:16; - unsigned short a,b,c; + pr_opcode_e op:16; + pr_ushort_t a,b,c; } dstatement_t; typedef struct ddef_s { - unsigned short type; // if DEF_SAVEGLOBGAL bit is set + pr_ushort_t type; // if DEF_SAVEGLOBGAL bit is set // the variable needs to be saved in savegames - unsigned short ofs; - int s_name; + pr_ushort_t ofs; + pr_int_t s_name; } ddef_t; #define DEF_SAVEGLOBAL (1<<15) @@ -349,62 +353,62 @@ typedef struct ddef_s { #define MAX_PARMS 8 typedef struct dfunction_s { - int first_statement; // negative numbers are builtins - int parm_start; - int locals; // total ints of parms + locals + pr_int_t first_statement; // negative numbers are builtins + pr_int_t parm_start; + pr_int_t locals; // total ints of parms + locals - int profile; // runtime + pr_int_t profile; // runtime - int s_name; - int s_file; // source file defined in + pr_int_t s_name; + pr_int_t s_file; // source file defined in - int numparms; - byte parm_size[MAX_PARMS]; + pr_int_t numparms; + uint8_t parm_size[MAX_PARMS]; } dfunction_t; typedef union pr_type_u { - float float_var; - string_t string_var; - func_t func_var; - int entity_var; - float vector_var[1]; // really 3, but this structure must be 32 bits - float quat_var[1]; // really 4, but this structure must be 32 bits - int integer_var; - pointer_t pointer_var; - unsigned int uinteger_var; + float float_var; + string_t string_var; + func_t func_var; + pr_int_t entity_var; + float vector_var[1]; // really 3, but this structure must be 32 bits + float quat_var[1]; // really 4, but this structure must be 32 bits + pr_int_t integer_var; + pointer_t pointer_var; + pr_uint_t uinteger_var; } pr_type_t; typedef struct pr_va_list_s { - int count; - pointer_t list; // pr_type_t + pr_int_t count; + pointer_t list; // pr_type_t } pr_va_list_t; #define PROG_ID_VERSION 6 #define PROG_VERSION 0x00fff005 // MMmmmRRR 0.fff.005 (hex) typedef struct dprograms_s { - unsigned int version; - unsigned int crc; // check of header file + pr_uint_t version; + pr_uint_t crc; // check of header file - unsigned int ofs_statements; - unsigned int numstatements; // statement 0 is an error + pr_uint_t ofs_statements; + pr_uint_t numstatements; // statement 0 is an error - unsigned int ofs_globaldefs; - unsigned int numglobaldefs; + pr_uint_t ofs_globaldefs; + pr_uint_t numglobaldefs; - unsigned int ofs_fielddefs; - unsigned int numfielddefs; + pr_uint_t ofs_fielddefs; + pr_uint_t numfielddefs; - unsigned int ofs_functions; - int numfunctions; // function 0 is an empty + pr_uint_t ofs_functions; + pr_int_t numfunctions; // function 0 is an empty - unsigned int ofs_strings; - int numstrings; // first string is a null string + pr_uint_t ofs_strings; + pr_int_t numstrings; // first string is a null string - unsigned int ofs_globals; - unsigned int numglobals; + pr_uint_t ofs_globals; + pr_uint_t numglobals; - unsigned int entityfields; + pr_uint_t entityfields; } dprograms_t; #endif // __pr_comp_h diff --git a/include/QF/pr_debug.h b/include/QF/pr_debug.h index dcd9b8707..908bca5bb 100644 --- a/include/QF/pr_debug.h +++ b/include/QF/pr_debug.h @@ -32,34 +32,36 @@ #ifndef __pr_debug_h #define __pr_debug_h +#include "QF/pr_comp.h" + typedef struct pr_auxfunction_s { - unsigned int function; // function def this aux info is for - unsigned int source_line; // first source line for this function - unsigned int line_info; // index to first lineno entry - unsigned int local_defs; // index to the first local def - unsigned int num_locals; // number of local defs + pr_uint_t function; // function def this aux info is for + pr_uint_t source_line; // first source line for this function + pr_uint_t line_info; // index to first lineno entry + pr_uint_t local_defs; // index to the first local def + pr_uint_t num_locals; // number of local defs } pr_auxfunction_t; typedef struct pr_lineno_s { union { - unsigned int func; // (line==0) index of function aux info - unsigned int addr; // (line!=0) dstatement_t address + pr_uint_t func; // (line==0) index of function aux info + pr_uint_t addr; // (line!=0) dstatement_t address } fa; - unsigned int line; + pr_uint_t line; } pr_lineno_t; #define PROG_DEBUG_VERSION 0x00001001 // MMmmmRRR 0.001.001 (hex) typedef struct pr_debug_header_s { - int version; - unsigned short crc; // of the progs.dat this progs.sym file is for - unsigned short you_tell_me_and_we_will_both_know; - unsigned int auxfunctions; - unsigned int num_auxfunctions; - unsigned int linenos; - unsigned int num_linenos; - unsigned int locals; - unsigned int num_locals; + pr_int_t version; + pr_ushort_t crc; // of the progs.dat this progs.sym file is for + pr_ushort_t you_tell_me_and_we_will_both_know; + pr_uint_t auxfunctions; + pr_uint_t num_auxfunctions; + pr_uint_t linenos; + pr_uint_t num_linenos; + pr_uint_t locals; + pr_uint_t num_locals; } pr_debug_header_t; #endif//__pr_debug_h diff --git a/include/QF/pr_obj.h b/include/QF/pr_obj.h index 545db98fe..bed621a3a 100644 --- a/include/QF/pr_obj.h +++ b/include/QF/pr_obj.h @@ -34,7 +34,7 @@ #include "QF/pr_comp.h" -#define PR_BITS_PER_INT (sizeof (int) * 8) +#define PR_BITS_PER_INT (sizeof (pr_int_t) * 8) #define __PR_CLS_INFO(cls) ((cls)->info) #define __PR_CLS_ISINFO(cls, mask) ((__PR_CLS_INFO (cls) & (mask)) == (mask)) @@ -90,9 +90,9 @@ typedef struct pr_class_s { pointer_t class_pointer; // pr_class_t pointer_t super_class; // pr_class_t string_t name; - int version; - unsigned int info; - int instance_size; + pr_int_t version; + pr_uint_t info; + pr_int_t instance_size; pointer_t ivars; // pr_ivar_list_t pointer_t methods; // pr_method_list_t pointer_t dtable; @@ -120,13 +120,13 @@ typedef struct pr_category_s { typedef struct pr_protocol_list_s { pointer_t next; - int count; + pr_int_t count; pointer_t list[1]; // pr_protocol_t } pr_protocol_list_t; typedef struct pr_method_list_s { pointer_t method_next; - int method_count; + pr_int_t method_count; struct pr_method_s { pointer_t method_name; // pr_sel_t string_t method_types; @@ -136,7 +136,7 @@ typedef struct pr_method_list_s { typedef struct pr_method_s pr_method_t; typedef struct pr_method_description_list_s { - int count; + pr_int_t count; struct pr_method_description_s { pointer_t name; // pr_sel_t string_t types; @@ -145,11 +145,11 @@ typedef struct pr_method_description_list_s { typedef struct pr_method_description_s pr_method_description_t; typedef struct pr_ivar_list_s { - int ivar_count; + pr_int_t ivar_count; struct pr_ivar_s { string_t ivar_name; string_t ivar_type; - int ivar_offset; + pr_int_t ivar_offset; } ivar_list[1]; } pr_ivar_list_t; typedef struct pr_ivar_s pr_ivar_t; @@ -163,10 +163,10 @@ typedef struct pr_static_instances_s { } pr_static_instances_t; typedef struct pr_symtab_s { - int sel_ref_cnt; + pr_int_t sel_ref_cnt; pointer_t refs; // pr_sel_t - int cls_def_cnt; - int cat_def_cnt; + pr_int_t cls_def_cnt; + pr_int_t cat_def_cnt; pointer_t defs[1]; // variable array of cls_def_cnt class // pointers then cat_def_cnt category // pointers followed by a null terminated @@ -175,8 +175,8 @@ typedef struct pr_symtab_s { } pr_symtab_t; typedef struct pr_module_s { - int version; - int size; + pr_int_t version; + pr_int_t size; string_t name; pointer_t symtab; // pr_symtab_t } pr_module_t; diff --git a/include/QF/progs.h b/include/QF/progs.h index c92b7770f..ffa4c31d8 100644 --- a/include/QF/progs.h +++ b/include/QF/progs.h @@ -174,6 +174,7 @@ void PR_AddLoadFinishFunc (progs_t *pr, pr_load_func_t *func); /** Run all load functions. Any load function returning false will abort the load operation. \param pr pointer to ::progs_t VM struct + \return true for success, false for failure Calls the first set of internal load functions followed by the supplied symbol resolution function, if any (progs_t::resolve), the second set of @@ -187,6 +188,7 @@ int PR_RunLoadFuncs (progs_t *pr); /** Validate the opcodes and statement addresses in the progs. This is an internal load function. \param pr pointer to ::progs_t VM struct + \return true for success, false for failure \todo should this be elsewhere? */ @@ -217,15 +219,15 @@ struct edict_s { void ED_ClearEdict (progs_t *pr, edict_t *e, int val); edict_t *ED_Alloc (progs_t *pr); void ED_Free (progs_t *pr, edict_t *ed); -edict_t *ED_EdictNum(progs_t *pr, int n); -int ED_NumForEdict(progs_t *pr, edict_t *e); +edict_t *ED_EdictNum(progs_t *pr, pr_int_t n); +pr_int_t ED_NumForEdict(progs_t *pr, edict_t *e); void ED_Count (progs_t *pr); -qboolean PR_EdictValid (progs_t *pr, int e); +qboolean PR_EdictValid (progs_t *pr, pr_int_t e); // pr_debug.c void ED_Print (progs_t *pr, edict_t *ed); void ED_PrintEdicts (progs_t *pr, const char *fieldval); -void ED_PrintNum (progs_t *pr, int ent); +void ED_PrintNum (progs_t *pr, pr_int_t ent); // pr_parse.c struct script_s; @@ -262,8 +264,8 @@ void ED_EntityParseFunction (progs_t *pr); */ //@{ -ddef_t *PR_FieldAtOfs (progs_t *pr, int ofs); -ddef_t *PR_GlobalAtOfs (progs_t *pr, int ofs); +ddef_t *PR_FieldAtOfs (progs_t *pr, pr_int_t ofs); +ddef_t *PR_GlobalAtOfs (progs_t *pr, pr_int_t ofs); ddef_t *PR_FindField (progs_t *pr, const char *name); ddef_t *PR_FindGlobal (progs_t *pr, const char *name); @@ -948,7 +950,7 @@ typedef struct { builtin_proc proc; /// The number of the builtin for \#N in QC. -1 for automatic allocation. /// 0 or >= ::PR_AUTOBUILTIN is invalid. - int binum; + pr_int_t binum; } builtin_t; /** Aliased over the dfunction_t entry for builtin functions. Removes one @@ -956,7 +958,7 @@ typedef struct { \bug alignment access violations on 64 bit architectures (eg, alpha) */ typedef struct { - int first_statement; + pr_int_t first_statement; builtin_proc func; } bfunction_t; @@ -979,7 +981,7 @@ builtin_t *PR_FindBuiltin (progs_t *pr, const char *name); \param num number of the builtin function to lookup \return pointer to the builtin function entry, or NULL if not found */ -builtin_t *PR_FindBuiltinNum (progs_t *pr, int num); +builtin_t *PR_FindBuiltinNum (progs_t *pr, pr_int_t num); /** Fixup all automaticly resolved builtin functions (func = #0 in QC). Performs any necessary builtin function number mapping. Also edits the @@ -988,6 +990,7 @@ builtin_t *PR_FindBuiltinNum (progs_t *pr, int num); during progs load. \bug alignment access violations on 64 bit architectures (eg, alpha) \param pr pointer to ::progs_t VM struct + \return true for success, false for failure */ int PR_RelocateBuiltins (progs_t *pr); @@ -1022,6 +1025,7 @@ int PR_RelocateBuiltins (progs_t *pr); /** Initialize the string tables using the strings supplied by the progs. Automaticly called at progs load. \param pr pointer to ::progs_t VM struct + \return true for success, false for failure */ int PR_LoadStrings (progs_t *pr); @@ -1260,8 +1264,8 @@ void *PR_Resources_Find (progs_t *pr, const char *name); void PR_Zone_Init (progs_t *pr); void PR_Zone_Free (progs_t *pr, void *ptr); -void *PR_Zone_Malloc (progs_t *pr, int size); -void *PR_Zone_Realloc (progs_t *pr, void *ptr, int size); +void *PR_Zone_Malloc (progs_t *pr, pr_int_t size); +void *PR_Zone_Realloc (progs_t *pr, void *ptr, pr_int_t size); //@} @@ -1275,12 +1279,12 @@ void PR_Debug_Init (void); void PR_Debug_Init_Cvars (void); int PR_LoadDebug (progs_t *pr); pr_auxfunction_t *PR_Get_Lineno_Func (progs_t *pr, pr_lineno_t *lineno); -unsigned int PR_Get_Lineno_Addr (progs_t *pr, pr_lineno_t *lineno); -unsigned int PR_Get_Lineno_Line (progs_t *pr, pr_lineno_t *lineno); -pr_lineno_t *PR_Find_Lineno (progs_t *pr, unsigned int addr); +pr_uint_t PR_Get_Lineno_Addr (progs_t *pr, pr_lineno_t *lineno); +pr_uint_t PR_Get_Lineno_Line (progs_t *pr, pr_lineno_t *lineno); +pr_lineno_t *PR_Find_Lineno (progs_t *pr, pr_uint_t addr); const char *PR_Get_Source_File (progs_t *pr, pr_lineno_t *lineno); -const char *PR_Get_Source_Line (progs_t *pr, unsigned int addr); -ddef_t *PR_Get_Local_Def (progs_t *pr, int offs); +const char *PR_Get_Source_Line (progs_t *pr, pr_uint_t addr); +ddef_t *PR_Get_Local_Def (progs_t *pr, pr_int_t offs); void PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents); void PR_DumpState (progs_t *pr); void PR_StackTrace (progs_t *pr); @@ -1467,7 +1471,7 @@ struct progs_s { \return C pointer represented by the parameter. 0 offset -> NULL */ static inline pr_type_t * -PR_GetPointer (progs_t *pr, int o) +PR_GetPointer (progs_t *pr, pr_uint_t o) { return o ? pr->pr_globals + o : 0; } diff --git a/include/QF/qtypes.h b/include/QF/qtypes.h index aba037975..e10f9cf5a 100644 --- a/include/QF/qtypes.h +++ b/include/QF/qtypes.h @@ -32,6 +32,7 @@ #define __qtypes_h #include +#include #ifdef HAVE_SYSTEM_MSG_T # define msg_t sys_msg_t diff --git a/libs/gamecode/engine/pr_builtins.c b/libs/gamecode/engine/pr_builtins.c index dbc36c8e2..33b47bac2 100644 --- a/libs/gamecode/engine/pr_builtins.c +++ b/libs/gamecode/engine/pr_builtins.c @@ -137,7 +137,7 @@ PR_FindBuiltin (progs_t *pr, const char *name) } builtin_t * -PR_FindBuiltinNum (progs_t *pr, int num) +PR_FindBuiltinNum (progs_t *pr, pr_int_t num) { builtin_t bi; diff --git a/libs/gamecode/engine/pr_debug.c b/libs/gamecode/engine/pr_debug.c index 620eb4efa..bb13a5c27 100644 --- a/libs/gamecode/engine/pr_debug.c +++ b/libs/gamecode/engine/pr_debug.c @@ -65,7 +65,7 @@ typedef struct { char *name; char *text; line_t *lines; - unsigned int num_lines; + pr_uint_t num_lines; progs_t *pr; } file_t; @@ -186,9 +186,9 @@ PR_Load_Source_File (progs_t *pr, const char *fname) VISIBLE int PR_LoadDebug (progs_t *pr) { - char *sym_path; - const char *path_end, *sym_file; - unsigned int i; + char *sym_path; + const char *path_end, *sym_file; + pr_uint_t i; ddef_t *def; pr_type_t *str = 0; @@ -302,7 +302,7 @@ PR_Get_Lineno_Func (progs_t *pr, pr_lineno_t *lineno) return &pr->auxfunctions[lineno->fa.func]; } -unsigned int +pr_uint_t PR_Get_Lineno_Addr (progs_t *pr, pr_lineno_t *lineno) { pr_auxfunction_t *f; @@ -313,7 +313,7 @@ PR_Get_Lineno_Addr (progs_t *pr, pr_lineno_t *lineno) return pr->pr_functions[f->function].first_statement; } -unsigned int +pr_uint_t PR_Get_Lineno_Line (progs_t *pr, pr_lineno_t *lineno) { if (lineno->line) @@ -322,18 +322,18 @@ PR_Get_Lineno_Line (progs_t *pr, pr_lineno_t *lineno) } pr_lineno_t * -PR_Find_Lineno (progs_t *pr, unsigned int addr) +PR_Find_Lineno (progs_t *pr, pr_uint_t addr) { - int i; - pr_lineno_t *lineno = 0; + pr_uint_t i; + pr_lineno_t *lineno = 0; if (!pr->debug) return 0; if (!pr->debug->num_linenos) return 0; - for (i = pr->debug->num_linenos - 1; i >= 0; i--) { - if (PR_Get_Lineno_Addr (pr, &pr->linenos[i]) <= addr) { - lineno = &pr->linenos[i]; + for (i = pr->debug->num_linenos; i > 0; i--) { + if (PR_Get_Lineno_Addr (pr, &pr->linenos[i - 1]) <= addr) { + lineno = &pr->linenos[i - 1]; break; } } @@ -350,13 +350,13 @@ PR_Get_Source_File (progs_t *pr, pr_lineno_t *lineno) } const char * -PR_Get_Source_Line (progs_t *pr, unsigned int addr) +PR_Get_Source_Line (progs_t *pr, pr_uint_t addr) { - const char *fname; - unsigned int line; - file_t *file; - pr_auxfunction_t *func; - pr_lineno_t *lineno; + const char *fname; + pr_uint_t line; + file_t *file; + pr_auxfunction_t *func; + pr_lineno_t *lineno; lineno = PR_Find_Lineno (pr, addr); if (!lineno || PR_Get_Lineno_Addr (pr, lineno) != addr) @@ -378,11 +378,11 @@ PR_Get_Source_Line (progs_t *pr, unsigned int addr) } ddef_t * -PR_Get_Local_Def (progs_t *pr, int offs) +PR_Get_Local_Def (progs_t *pr, pr_int_t offs) { - unsigned int i; - dfunction_t *func = pr->pr_xfunction; - pr_auxfunction_t *aux_func; + pr_uint_t i; + dfunction_t *func = pr->pr_xfunction; + pr_auxfunction_t *aux_func; if (!func) return 0; @@ -428,7 +428,7 @@ value_string (progs_t *pr, etype_t type, pr_type_t *val) { static dstring_t *line; ddef_t *def; - int ofs; + pr_int_t ofs; edict_t *edict; dfunction_t *f; const char *str; @@ -537,7 +537,7 @@ value_string (progs_t *pr, etype_t type, pr_type_t *val) } static ddef_t * -def_string (progs_t *pr, int ofs, dstring_t *dstr) +def_string (progs_t *pr, pr_int_t ofs, dstring_t *dstr) { ddef_t *def = 0; const char *name; @@ -554,11 +554,11 @@ def_string (progs_t *pr, int ofs, dstring_t *dstr) } static const char * -global_string (progs_t *pr, int ofs, etype_t type, int contents) +global_string (progs_t *pr, pr_int_t ofs, etype_t type, int contents) { - ddef_t *def = NULL; - static dstring_t *line = NULL; - const char *s; + static dstring_t *line = NULL; + ddef_t *def = NULL; + const char *s; if (!line) line = dstring_newstr(); @@ -595,11 +595,11 @@ global_string (progs_t *pr, int ofs, etype_t type, int contents) } VISIBLE void -PR_PrintStatement (progs_t * pr, dstatement_t *s, int contents) +PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents) { - int addr = s - pr->pr_statements; + int addr = s - pr->pr_statements; const char *fmt; - opcode_t *op; + opcode_t *op; static dstring_t *line; if (!line) @@ -641,7 +641,7 @@ PR_PrintStatement (progs_t * pr, dstatement_t *s, int contents) } else { const char *str; char mode = fmt[1], opchar = fmt[2]; - long opval; + pr_int_t opval; etype_t optype; switch (opchar) { @@ -705,8 +705,8 @@ dump_frame (progs_t *pr, prstack_t *frame) if (pr_debug->int_val && pr->debug) { pr_lineno_t *lineno = PR_Find_Lineno (pr, frame->s); pr_auxfunction_t *func = PR_Get_Lineno_Func (pr, lineno); - unsigned int line = PR_Get_Lineno_Line (pr, lineno); - int addr = PR_Get_Lineno_Addr (pr, lineno); + pr_uint_t line = PR_Get_Lineno_Line (pr, lineno); + pr_int_t addr = PR_Get_Lineno_Addr (pr, lineno); line += func->source_line; if (addr == frame->s) { @@ -731,8 +731,8 @@ dump_frame (progs_t *pr, prstack_t *frame) void PR_StackTrace (progs_t *pr) { - int i; - prstack_t top; + int i; + prstack_t top; if (pr->pr_depth == 0) { Sys_Printf ("\n"); @@ -749,8 +749,8 @@ PR_StackTrace (progs_t *pr) VISIBLE void PR_Profile (progs_t * pr) { - int max, num, i; - dfunction_t *best, *f; + int max, num, i; + dfunction_t *best, *f; num = 0; do { @@ -782,7 +782,7 @@ VISIBLE void ED_Print (progs_t *pr, edict_t *ed) { int type, l; - unsigned int i; + pr_uint_t i; const char *name; ddef_t *d; pr_type_t *v; diff --git a/libs/gamecode/engine/pr_edict.c b/libs/gamecode/engine/pr_edict.c index 2ef4aef7e..35a637e4c 100644 --- a/libs/gamecode/engine/pr_edict.c +++ b/libs/gamecode/engine/pr_edict.c @@ -147,7 +147,7 @@ ED_Free (progs_t *pr, edict_t *ed) VISIBLE void -ED_PrintNum (progs_t *pr, int ent) +ED_PrintNum (progs_t *pr, pr_int_t ent) { ED_Print (pr, EDICT_NUM (pr, ent)); } @@ -221,19 +221,20 @@ ED_Count (progs_t *pr) } edict_t * -ED_EdictNum (progs_t *pr, int n) +ED_EdictNum (progs_t *pr, pr_int_t n) { - int offs = n * pr->pr_edict_size; + pr_int_t offs = n * pr->pr_edict_size; + if (offs < 0 || n >= pr->pr_edictareasize) PR_RunError (pr, "EDICT_NUM: bad number %i", n); return PROG_TO_EDICT (pr, offs); } -int +pr_int_t ED_NumForEdict (progs_t *pr, edict_t *e) { - int b; + pr_int_t b; b = NUM_FOR_BAD_EDICT (pr, e); @@ -245,7 +246,7 @@ ED_NumForEdict (progs_t *pr, edict_t *e) } qboolean -PR_EdictValid (progs_t *pr, int e) +PR_EdictValid (progs_t *pr, pr_int_t e) { if (e < 0 || e >= pr->pr_edictareasize) return false; diff --git a/libs/gamecode/engine/pr_opcode.c b/libs/gamecode/engine/pr_opcode.c index 95d9684e9..8c4fecb78 100644 --- a/libs/gamecode/engine/pr_opcode.c +++ b/libs/gamecode/engine/pr_opcode.c @@ -1160,7 +1160,7 @@ opcode_compare (void *_opa, void *_opb, void *unused) } opcode_t * -PR_Opcode (short opcode) +PR_Opcode (pr_short_t opcode) { opcode_t op; diff --git a/libs/gamecode/engine/pr_resolve.c b/libs/gamecode/engine/pr_resolve.c index ae292cebe..57a8f1b44 100644 --- a/libs/gamecode/engine/pr_resolve.c +++ b/libs/gamecode/engine/pr_resolve.c @@ -56,10 +56,10 @@ static __attribute__ ((used)) const char rcsid[] = ddef_t * -PR_GlobalAtOfs (progs_t * pr, int ofs) +PR_GlobalAtOfs (progs_t * pr, pr_int_t ofs) { ddef_t *def; - unsigned int i; + pr_uint_t i; for (i = 0; i < pr->progs->numglobaldefs; i++) { def = &pr->pr_globaldefs[i]; @@ -70,10 +70,10 @@ PR_GlobalAtOfs (progs_t * pr, int ofs) } VISIBLE ddef_t * -PR_FieldAtOfs (progs_t * pr, int ofs) +PR_FieldAtOfs (progs_t * pr, pr_int_t ofs) { ddef_t *def; - unsigned int i; + pr_uint_t i; for (i = 0; i < pr->progs->numfielddefs; i++) { def = &pr->pr_fielddefs[i]; diff --git a/libs/gamecode/engine/pr_zone.c b/libs/gamecode/engine/pr_zone.c index accddbf78..5f8a9c6eb 100644 --- a/libs/gamecode/engine/pr_zone.c +++ b/libs/gamecode/engine/pr_zone.c @@ -61,13 +61,13 @@ PR_Zone_Free (progs_t *pr, void *ptr) } VISIBLE void * -PR_Zone_Malloc (progs_t *pr, int size) +PR_Zone_Malloc (progs_t *pr, pr_int_t size) { return Z_Malloc (pr->zone, size); } VISIBLE void * -PR_Zone_Realloc (progs_t *pr, void *ptr, int size) +PR_Zone_Realloc (progs_t *pr, void *ptr, pr_int_t size) { return Z_Realloc (pr->zone, ptr, size); }