pidl:NDR/Parser: $size can be 'foo / 2' so we need to add '(' and ')'
authorStefan Metzmacher <metze@samba.org>
Wed, 25 Nov 2009 13:21:32 +0000 (14:21 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 26 Nov 2009 10:47:41 +0000 (11:47 +0100)
foo / 5 * sizeof(bar)' isn't the same as
'(foo / 2) * sizeof(bar)'.

metze

pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index d598989fad202a0889985ec688b5d0486fc6d1de..af28bda1082e0a44bb902b904c42968811a32984 100644 (file)
@@ -2140,7 +2140,7 @@ sub AllocateArrayLevel($$$$$$)
                $self->pidl("}");
                if (grep(/in/,@{$e->{DIRECTION}}) and
                    grep(/out/,@{$e->{DIRECTION}})) {
-                       $self->pidl("memcpy(r->out.$e->{NAME}, r->in.$e->{NAME}, $size * sizeof(*r->in.$e->{NAME}));");
+                       $self->pidl("memcpy(r->out.$e->{NAME}, r->in.$e->{NAME}, ($size) * sizeof(*r->in.$e->{NAME}));");
                }
                return;
        }