mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
fix qfcc's incorrect allocation/initialization for pointers (eg, float [] foo)
This commit is contained in:
parent
938037c5ea
commit
ad6d847728
2 changed files with 8 additions and 5 deletions
|
@ -479,7 +479,6 @@ void () menu_init =
|
|||
InputLine_SetWidth (lanConfig_port_il, 10);
|
||||
lanConfig_join_il = InputLine_Create (4, 24, ' ');
|
||||
InputLine_SetWidth (lanConfig_join_il, 26);
|
||||
input_active = NIL; //FIXME def alloc bug in qfcc
|
||||
switch (gametype ()) {
|
||||
case "netquake":
|
||||
do_single_player = 1;
|
||||
|
|
|
@ -185,6 +185,7 @@ PR_GetDef (type_t *type, const char *name, def_t *scope, int *allocate)
|
|||
d->used = 1; // always `used'
|
||||
d->parent = def;
|
||||
} else if (type->aux_type->type == ev_pointer) {
|
||||
//FIXME I don't think this is right for a field pointer
|
||||
size = PR_GetTypeSize (type->aux_type->aux_type);
|
||||
pr.size_fields += type->aux_type->num_parms * size;
|
||||
} else {
|
||||
|
@ -194,21 +195,24 @@ PR_GetDef (type_t *type, const char *name, def_t *scope, int *allocate)
|
|||
} else if (type->type == ev_pointer) {
|
||||
dstatement_t *st;
|
||||
statref_t *ref;
|
||||
int ofs;
|
||||
|
||||
if (pr_scope) {
|
||||
st = (dstatement_t *) &G_INT (def->ofs);
|
||||
ref = PR_NewStatref (st, 4);
|
||||
ref->next = def->refs;
|
||||
def->refs = ref;
|
||||
G_INT (def->ofs) = 1;
|
||||
ofs = 1;
|
||||
} else {
|
||||
G_INT (def->ofs) = *allocate;
|
||||
ofs = *allocate;
|
||||
}
|
||||
|
||||
size = PR_GetTypeSize (type->aux_type);
|
||||
*allocate += type->num_parms * size;
|
||||
if (type->num_parms)
|
||||
if (type->num_parms) {
|
||||
*allocate += type->num_parms * size;
|
||||
def->initialized = def->constant = 1;
|
||||
G_INT (def->ofs) = ofs;
|
||||
}
|
||||
}
|
||||
|
||||
return def;
|
||||
|
|
Loading…
Reference in a new issue