From f5f2fde40f9f8c3dbc82eeaedcdca7d7f9b6f56c Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 12 Jan 2006 17:42:11 +0000 Subject: [PATCH] genevent 0.5 git-svn-id: http://ltt.polymtl.ca/svn@1473 04897980-b3bd-0310-b5e0-8ef037075253 --- genevent-new/genevent.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/genevent-new/genevent.c b/genevent-new/genevent.c index a691d481..aba40e52 100644 --- a/genevent-new/genevent.c +++ b/genevent-new/genevent.c @@ -1068,8 +1068,15 @@ int print_type_write_fct(type_descriptor_t * td, FILE *fd, unsigned int tabs, fprintf(fd, "{\n"); - print_tabs(1, fd); - fprintf(fd, "size_t size;\n"); + switch(td->type) { + case STRING: + print_tabs(1, fd); + fprintf(fd, "size_t size;\n"); + break; + default: + break; + } + print_tabs(1, fd); fprintf(fd, "size_t align;\n"); fprintf(fd, "\n"); @@ -1126,11 +1133,9 @@ int print_type_write_fct(type_descriptor_t * td, FILE *fd, unsigned int tabs, fprintf(fd, "/* Contains only fixed size fields : use compiler sizeof() */\n"); fprintf(fd, "\n"); print_tabs(1, fd); - fprintf(fd, "size = sizeof("); + fprintf(fd, "*len += sizeof("); if(print_type(td, fd, 0, basename, field_name)) return 1; fprintf(fd, ");\n"); - print_tabs(1, fd); - fprintf(fd, "*len += size;\n"); } else { /* The type contains nested variable size subtypes : * we must write field by field. */ -- 2.34.1