diff options
author | Tim Potter <tpot@samba.org> | 2001-12-08 21:43:22 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-12-08 21:43:22 +0000 |
commit | 6ec1278d16a34973dae42e51cd089d9411e25467 (patch) | |
tree | 5b634ef5ed28d643cc6052f5473d4498a4c4273a /source4/build/pidl/eparser.pm | |
parent | d99084e3ecdfba821be1672a51ed0c429c11afa8 (diff) | |
download | samba-6ec1278d16a34973dae42e51cd089d9411e25467.tar.gz samba-6ec1278d16a34973dae42e51cd089d9411e25467.tar.bz2 samba-6ec1278d16a34973dae42e51cd089d9411e25467.zip |
Reinvented has_properties() function lost after HD crash. )-:
Fixed up handling of pointer to scalar type.
(This used to be commit eb3dbe113f9f4e755436caa974394e73a285cb03)
Diffstat (limited to 'source4/build/pidl/eparser.pm')
-rw-r--r-- | source4/build/pidl/eparser.pm | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index f0e53961dd..a2ad3c2d0e 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -24,6 +24,25 @@ sub is_scalar_type($) return 0; } +sub has_property($$) +{ + my($props) = shift; + my($p) = shift; + + foreach my $d (@{$props}) { + if (ref($d) ne "HASH") { + return 1, if ($d eq $p); + return 1, if ($d eq "in,out" && ($p eq "in" || $p eq "out")); + } else { + foreach my $k (keys %{$d}) { + $res .= "[$k($d->{$k})] "; + } + } + } + + return 0; +} + ##################################################################### # parse a properties list sub ParseProperties($) @@ -63,11 +82,9 @@ sub ParseElement($$) # Arg is a policy handle - foreach my $prop (@{$elt->{PROPERTIES}}) { - if ($prop =~ /context_handle/) { - $res .= "\toffset = prs_policy_hnd(tvb, offset, pinfo, tree);\n"; - return; - } + if (has_property($elt->{PROPERTIES}, "context_handle")) { + $res .= "\toffset = prs_policy_hnd(tvb, offset, pinfo, tree);\n"; + return; } # Parse type @@ -89,9 +106,9 @@ sub ParseElement($$) } else { - # Scalars are not buffers + # Scalars are not buffers, except if they are pointed to - if (!is_scalar_type($elt->{TYPE})) { + if (!is_scalar_type($elt->{TYPE}) || $elt->{POINTERS}) { # If we have a pointer, check it @@ -234,10 +251,8 @@ sub ParseFunctionArg($$) my($arg) = shift; my($io) = shift; # "in" or "out" - if (@{$arg->{PROPERTIES}}[0] =~ /$io/) { - my $is_pol = 0; - - ParseElement($arg, "scalars"); + if (has_property($arg->{PROPERTIES}, $io)) { + ParseElement($arg, "scalars|buffers"); } } |