diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-08-01 15:17:41 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-08-01 15:46:11 +0200 |
commit | 0ea3760cae85226f6fbc59a9ca6b9eb9e2ab577b (patch) | |
tree | 6dbb7d4088ebc4047eb4d92f6c25850ea4053a3f /pidl/lib/Parse | |
parent | eb9aa9b9f41212849f605fb0cecef0b940e906d6 (diff) | |
download | samba-0ea3760cae85226f6fbc59a9ca6b9eb9e2ab577b.tar.gz samba-0ea3760cae85226f6fbc59a9ca6b9eb9e2ab577b.tar.bz2 samba-0ea3760cae85226f6fbc59a9ca6b9eb9e2ab577b.zip |
pidl:NDR/Parser: allow [string,size_of()] together
metze
Diffstat (limited to 'pidl/lib/Parse')
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 406fc02cec..3d31366abf 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -198,6 +198,12 @@ sub ParseArrayPushHeader($$$$$$) } else { $size = $length = "ndr_string_length($var_name, sizeof(*$var_name))"; } + if (defined($l->{SIZE_IS})) { + $size = ParseExpr($l->{SIZE_IS}, $env, $e); + } + if (defined($l->{LENGTH_IS})) { + $length = ParseExpr($l->{LENGTH_IS}, $env, $e); + } } else { $size = ParseExpr($l->{SIZE_IS}, $env, $e); $length = ParseExpr($l->{LENGTH_IS}, $env, $e); @@ -352,7 +358,7 @@ sub ParseArrayPullHeader($$$$$$) $self->pidl("}"); } - if ($l->{IS_CONFORMANT} and not $l->{IS_ZERO_TERMINATED}) { + if ($l->{IS_CONFORMANT} and (defined($l->{SIZE_IS}) or not $l->{IS_ZERO_TERMINATED})) { $self->defer("if ($var_name) {"); $self->defer_indent; my $size = ParseExprExt($l->{SIZE_IS}, $env, $e->{ORIGINAL}, @@ -364,7 +370,7 @@ sub ParseArrayPullHeader($$$$$$) $self->defer("}"); } - if ($l->{IS_VARYING} and not $l->{IS_ZERO_TERMINATED}) { + if ($l->{IS_VARYING} and (defined($l->{LENGTH_IS}) or not $l->{IS_ZERO_TERMINATED})) { $self->defer("if ($var_name) {"); $self->defer_indent; my $length = ParseExprExt($l->{LENGTH_IS}, $env, $e->{ORIGINAL}, @@ -775,7 +781,7 @@ sub ParseElementPrint($$$$$) $var_name = get_pointer_to($var_name); } - if ($l->{IS_ZERO_TERMINATED}) { + if ($l->{IS_ZERO_TERMINATED} and not defined($l->{LENGTH_IS})) { $length = "ndr_string_length($var_name, sizeof(*$var_name))"; } else { $length = ParseExprExt($l->{LENGTH_IS}, $env, $e->{ORIGINAL}, @@ -1273,6 +1279,9 @@ sub ParseStructPushPrimitives($$$$$) } else { $size = "ndr_string_length($varname->$e->{NAME}, sizeof(*$varname->$e->{NAME}))"; } + if (defined($e->{LEVELS}[0]->{SIZE_IS})) { + $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e->{ORIGINAL}); + } } else { $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e->{ORIGINAL}); } |