diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-11-25 14:31:34 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2009-11-26 14:13:54 +0100 |
commit | c4746758fe7b3e2e352cfa6f9efd39a40f9f39c5 (patch) | |
tree | d31008c47c6874210f8e76b1ce438446c04251a6 /pidl | |
parent | 164a33d4e9d6b90507d2db96a24c67eb514b5af4 (diff) | |
download | samba-c4746758fe7b3e2e352cfa6f9efd39a40f9f39c5.tar.gz |
pidl:Samba3/ClientNDR: $size can be 'foo / 2' so we need to add '(' and ')'
foo / 5 * sizeof(bar)' isn't the same as
'(foo / 2) * sizeof(bar)'.
metze
(cherry picked from commit a20e095b1fffb6d690609c924d03cafedbbce8f3)
(cherry picked from commit 941aa3f8fc43c1720e1b59d1dbcec290eae1abc6)
Diffstat (limited to 'pidl')
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm | 4 | ||||
-rwxr-xr-x | pidl/tests/samba3-cli.pl | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm index 3fc63a49991..b26a08e0292 100644 --- a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm +++ b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm @@ -105,9 +105,9 @@ sub ParseOutputArgument($$$;$$) } else { my $size_is = ParseExpr($l->{SIZE_IS}, $env, $e->{ORIGINAL}); if (has_property($e, "charset")) { - $self->pidl("memcpy(CONST_DISCARD(char *, $o$e->{NAME}), ${r}out.$e->{NAME}, $size_is * sizeof(*$o$e->{NAME}));"); + $self->pidl("memcpy(discard_const_p(uint8_t, $o$e->{NAME}), ${r}out.$e->{NAME}, ($size_is) * sizeof(*$o$e->{NAME}));"); } else { - $self->pidl("memcpy($o$e->{NAME}, ${r}out.$e->{NAME}, $size_is * sizeof(*$o$e->{NAME}));"); + $self->pidl("memcpy($o$e->{NAME}, ${r}out.$e->{NAME}, ($size_is) * sizeof(*$o$e->{NAME}));"); } } } else { diff --git a/pidl/tests/samba3-cli.pl b/pidl/tests/samba3-cli.pl index be4bf0a65c3..0d283a2d5aa 100755 --- a/pidl/tests/samba3-cli.pl +++ b/pidl/tests/samba3-cli.pl @@ -333,4 +333,4 @@ my $e = { NAME => "foo", ORIGINAL => { FILE => "f", LINE => -1 }, LEVELS => [ { TYPE => "ARRAY", SIZE_IS => "mysize" }, { TYPE => "DATA", DATA_TYPE => "int" } ]}; $x->ParseOutputArgument($fn, $e); -is($x->{res}, "memcpy(foo, r.out.foo, mysize * sizeof(*foo));\n"); +is($x->{res}, "memcpy(foo, r.out.foo, (mysize) * sizeof(*foo));\n"); |