From c713b58a00b7cb5ef34b101ba5b74c8d9ec505ba Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 1 Feb 2008 23:09:37 +0100 Subject: pidl/NDR: fix handling of multilevel pointers in function elements The 2nd or higher level of wire pointers needs to be marked as deferred. metze (This used to be commit d7970d70329e0d4f9de30ccfcedd03e583817fa2) --- source4/pidl/lib/Parse/Pidl/NDR.pm | 8 ++++---- source4/pidl/tests/ndr.pl | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm index 1106247355..86ed1a8d10 100644 --- a/source4/pidl/lib/Parse/Pidl/NDR.pm +++ b/source4/pidl/lib/Parse/Pidl/NDR.pm @@ -173,9 +173,9 @@ sub GetElementLevelTable($$) # # --metze # - if ($i == 1) { - $pt = pointer_type($e); - } else { + $pt = pointer_type($e); + if ($i > 1) { + $is_deferred = 1 if ($pt ne "ref" and $e->{PARENT}->{TYPE} eq "FUNCTION"); $pt = $pointer_default; } @@ -195,7 +195,7 @@ sub GetElementLevelTable($$) $pointer_idx++; # everything that follows will be deferred - $is_deferred = 1 if ($e->{PARENT}->{TYPE} ne "FUNCTION"); + $is_deferred = 1 if ($level ne "TOP"); my $array_size = shift @size_is; my $array_length; diff --git a/source4/pidl/tests/ndr.pl b/source4/pidl/tests/ndr.pl index 758c3dddb7..504b7ec8de 100755 --- a/source4/pidl/tests/ndr.pl +++ b/source4/pidl/tests/ndr.pl @@ -299,14 +299,14 @@ is_deeply(GetElementLevelTable($e, "unique"), [ }, { LEVEL_INDEX => 2, - IS_DEFERRED => 0, + IS_DEFERRED => 1, TYPE => 'POINTER', POINTER_TYPE => "unique", POINTER_INDEX => 2, LEVEL => 'EMBEDDED' }, { - 'IS_DEFERRED' => 0, + 'IS_DEFERRED' => 1, 'LEVEL_INDEX' => 3, 'DATA_TYPE' => 'uint8', 'CONTAINS_DEFERRED' => 0, @@ -337,7 +337,7 @@ is_deeply(GetElementLevelTable($e, "unique"), [ }, { LEVEL_INDEX => 1, - IS_DEFERRED => 0, + IS_DEFERRED => 1, TYPE => 'POINTER', POINTER_TYPE => "unique", POINTER_INDEX => 1, @@ -345,14 +345,14 @@ is_deeply(GetElementLevelTable($e, "unique"), [ }, { LEVEL_INDEX => 2, - IS_DEFERRED => 0, + IS_DEFERRED => 1, TYPE => 'POINTER', POINTER_TYPE => "unique", POINTER_INDEX => 2, LEVEL => 'EMBEDDED' }, { - 'IS_DEFERRED' => 0, + 'IS_DEFERRED' => 1, 'LEVEL_INDEX' => 3, 'DATA_TYPE' => 'uint8', 'CONTAINS_DEFERRED' => 0, @@ -383,7 +383,7 @@ is_deeply(GetElementLevelTable($e, "ref"), [ }, { LEVEL_INDEX => 1, - IS_DEFERRED => 0, + IS_DEFERRED => 1, TYPE => 'POINTER', POINTER_TYPE => "ref", POINTER_INDEX => 1, @@ -391,14 +391,14 @@ is_deeply(GetElementLevelTable($e, "ref"), [ }, { LEVEL_INDEX => 2, - IS_DEFERRED => 0, + IS_DEFERRED => 1, TYPE => 'POINTER', POINTER_TYPE => "ref", POINTER_INDEX => 2, LEVEL => 'EMBEDDED' }, { - 'IS_DEFERRED' => 0, + 'IS_DEFERRED' => 1, 'LEVEL_INDEX' => 3, 'DATA_TYPE' => 'uint8', 'CONTAINS_DEFERRED' => 0, @@ -437,14 +437,14 @@ is_deeply(GetElementLevelTable($e, "ref"), [ }, { LEVEL_INDEX => 2, - IS_DEFERRED => 0, + IS_DEFERRED => 1, TYPE => 'POINTER', POINTER_TYPE => "ref", POINTER_INDEX => 2, LEVEL => 'EMBEDDED' }, { - 'IS_DEFERRED' => 0, + 'IS_DEFERRED' => 1, 'LEVEL_INDEX' => 3, 'DATA_TYPE' => 'uint8', 'CONTAINS_DEFERRED' => 0, -- cgit