summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/NDR.pm
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-02-01 10:30:47 +0100
committerStefan Metzmacher <metze@samba.org>2008-02-07 08:33:18 +0100
commit1ea5b06307b6057297700ce2b65b2055994869e2 (patch)
tree00fcb5133256ca6aca9cf18ce038c816c6426ec2 /source4/pidl/lib/Parse/Pidl/NDR.pm
parentc6a6fa184125f94a0891b613daffb44d93d0e803 (diff)
downloadsamba-1ea5b06307b6057297700ce2b65b2055994869e2.tar.gz
samba-1ea5b06307b6057297700ce2b65b2055994869e2.tar.bz2
samba-1ea5b06307b6057297700ce2b65b2055994869e2.zip
pidl: get the pointer types correct when an element has multiple pointers
Only the first level gets the pointer type from the pointer property, the others get them from the pointer_default() interface property see http://msdn2.microsoft.com/en-us/library/aa378984(VS.85).aspx (Here they talk about the rightmost pointer, but testing shows they mean the leftmost pointer.) metze (This used to be commit aa8518521b2a6a7110c84c4981c53acce7389ee9)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/NDR.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm35
1 files changed, 24 insertions, 11 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index fb1e65854c..1106247355 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -72,9 +72,9 @@ my $scalar_alignment = {
'ipv4address' => 4
};
-sub GetElementLevelTable($)
+sub GetElementLevelTable($$)
{
- my $e = shift;
+ my ($e, $pointer_default) = @_;
my $order = [];
my $is_deferred = 0;
@@ -157,25 +157,38 @@ sub GetElementLevelTable($)
# Next, all the pointers
foreach my $i (1..$e->{POINTERS}) {
- my $pt = pointer_type($e);
-
my $level = "EMBEDDED";
# Top level "ref" pointers do not have a referrent identifier
- $level = "TOP" if ( defined($pt)
- and $i == 1
- and $e->{PARENT}->{TYPE} eq "FUNCTION");
+ $level = "TOP" if ($i == 1 and $e->{PARENT}->{TYPE} eq "FUNCTION");
+
+ my $pt;
+ #
+ # Only the first level gets the pointer type from the
+ # pointer property, the others get them from
+ # the pointer_default() interface property
+ #
+ # see http://msdn2.microsoft.com/en-us/library/aa378984(VS.85).aspx
+ # (Here they talk about the rightmost pointer, but testing shows
+ # they mean the leftmost pointer.)
+ #
+ # --metze
+ #
+ if ($i == 1) {
+ $pt = pointer_type($e);
+ } else {
+ $pt = $pointer_default;
+ }
push (@$order, {
TYPE => "POINTER",
- # for now, there can only be one pointer type per element
- POINTER_TYPE => pointer_type($e),
+ POINTER_TYPE => $pt,
POINTER_INDEX => $pointer_idx,
IS_DEFERRED => "$is_deferred",
LEVEL => $level
});
warning($e, "top-level \[out\] pointer `$e->{NAME}' is not a \[ref\] pointer")
- if ($i == 1 and pointer_type($e) ne "ref" and
+ if ($i == 1 and $pt ne "ref" and
$e->{PARENT}->{TYPE} eq "FUNCTION" and
not has_property($e, "in"));
@@ -391,7 +404,7 @@ sub ParseElement($$)
NAME => $e->{NAME},
TYPE => $e->{TYPE},
PROPERTIES => $e->{PROPERTIES},
- LEVELS => GetElementLevelTable($e),
+ LEVELS => GetElementLevelTable($e, $pointer_default),
REPRESENTATION_TYPE => ($e->{PROPERTIES}->{represent_as} or $e->{TYPE}),
ALIGN => align_type($e->{TYPE}),
ORIGINAL => $e