From de222a34c8ed714e603b1fb86df6474e145124d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 19 Jan 2004 17:54:33 +0000 Subject: [PATCH] (length_type): TSequenceOf: add up the size of all the elements, don't use just the size of the last element. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13276 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/asn1/gen_length.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/asn1/gen_length.c b/lib/asn1/gen_length.c index 778997424..27fd88c49 100644 --- a/lib/asn1/gen_length.c +++ b/lib/asn1/gen_length.c @@ -126,8 +126,12 @@ length_type (const char *name, const Type *t, const char *variable) variable, variable); fprintf (codefile, "for(i = (%s)->len - 1; i >= 0; --i){\n", name); + fprintf (codefile, "int oldret = %s;\n" + "%s = 0;\n", variable, variable); asprintf (&n, "&(%s)->val[i]", name); length_type(n, t->subtype, variable); + fprintf (codefile, "%s += oldret;\n", + variable); fprintf (codefile, "}\n"); fprintf (codefile,