mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
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
This commit is contained in:
parent
ab1c92950f
commit
a20e095b1f
@ -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 {
|
||||
|
@ -301,4 +301,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");
|
||||
|
Loading…
Reference in New Issue
Block a user