From 814e36d3c8eab8f8a5da20478081df3f0cb5e346 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 15 Feb 2011 22:25:40 +0900 Subject: [PATCH] Correct an error message and tidy some code. --- tools/qfcc/source/struct.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/qfcc/source/struct.c b/tools/qfcc/source/struct.c index ce57b4166..5eb5f13ed 100644 --- a/tools/qfcc/source/struct.c +++ b/tools/qfcc/source/struct.c @@ -252,7 +252,7 @@ emit_structure (const char *name, int su, struct_def_t *defs, type_t *type, struct_def = struct_sym->s.def; if (struct_def->initialized) - internal_error (0, "structure %s must be global or static", name); + internal_error (0, "structure %s already initialized", name); struct_def->initialized = struct_def->constant = 1; struct_def->nosave = 1; @@ -270,9 +270,10 @@ emit_structure (const char *name, int su, struct_def_t *defs, type_t *type, data = &val[type_size (field_def.type)]; } else { if (is_array (field_def.type)) { + type_t *type = field_def.type->t.array.type; for (j = 0; j < field_def.type->t.array.size; j++) { defs[i].emit (&field_def, data, j); - field_def.offset+=type_size (field_def.type->t.array.type); + field_def.offset += type_size (type); } } else { defs[i].emit (&field_def, data, 0);