From c85a464caaf02c0956f66322986e85f979a6ead9 Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Sun, 26 Nov 2000 09:18:57 +0000 Subject: [PATCH] work around gcc lacking support for no-size arrays in structures git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@107 d7cf8633-e32d-0410-b094-e92efae38249 --- model_alias.c | 2 +- model_alias.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/model_alias.c b/model_alias.c index 2f7b5f24..d4fe2971 100644 --- a/model_alias.c +++ b/model_alias.c @@ -722,7 +722,7 @@ void Mod_LoadQ2AliasModel (model_t *mod, void *buffer) mod->type = mod_alias; mod->aliastype = ALIASTYPE_MD2; - framesize = sizeof(md2memframe_t) + LittleLong(pinmodel->num_xyz) * sizeof(trivert2); + framesize = sizeof(md2memframesize_t) + LittleLong(pinmodel->num_xyz) * sizeof(trivert2); // LordHavoc: calculate size for in memory version size = sizeof(md2mem_t) + LittleLong(pinmodel->num_st) * sizeof(md2stvert_t) diff --git a/model_alias.h b/model_alias.h index aafcb33d..2b0031e2 100644 --- a/model_alias.h +++ b/model_alias.h @@ -151,7 +151,7 @@ typedef struct float scale[3]; // multiply byte verts by this float translate[3]; // then add this char name[16]; // frame name from grabbing - trivertx_t verts[]; // variable sized + trivertx_t verts[1]; // variable sized } md2frame_t; // LordHavoc: memory representation is different than disk @@ -159,9 +159,16 @@ typedef struct { float scale[3]; // multiply byte verts by this float translate[3]; // then add this - trivert2 verts[]; // variable sized + trivert2 verts[1]; // variable sized } md2memframe_t; +// must match md2memframe_t, this is just used for sizeof() +typedef struct +{ + float scale[3]; // multiply byte verts by this + float translate[3]; // then add this +} md2memframesize_t; + // the glcmd format: // a positive integer starts a tristrip command, followed by that many -- 2.39.2