r15778: Fix bug printing ref pointers.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 21 May 2006 15:01:47 +0000 (15:01 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:08:18 +0000 (14:08 -0500)
(This used to be commit 030272e79b621c2c54354f4c89cc25c202d2dbbc)

source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index 5a8ef53e1471fb80ca5e4ac69b2787b74ad8a080..2797c6c490eb9d99d6aac99f1b71ae11a623d514 100644 (file)
@@ -702,13 +702,15 @@ sub ParseElementPrint($$$)
 
        foreach my $l (@{$e->{LEVELS}}) {
                if ($l->{TYPE} eq "POINTER") {
+                       if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) {
                        pidl "ndr_print_ptr(ndr, \"$e->{NAME}\", $var_name);";
                        pidl "ndr->depth++;";
-                       if ($l->{POINTER_TYPE} ne "ref") {
-                               pidl "if ($var_name) {";
-                               indent;
+                               if ($l->{POINTER_TYPE} ne "ref") {
+                                       pidl "if ($var_name) {";
+                                       indent;
+                               }
+                               $var_name = get_value_of($var_name);
                        }
-                       $var_name = get_value_of($var_name);
                } elsif ($l->{TYPE} eq "ARRAY") {
                        my $length;
 
@@ -757,11 +759,13 @@ sub ParseElementPrint($$$)
 
        foreach my $l (reverse @{$e->{LEVELS}}) {
                if ($l->{TYPE} eq "POINTER") {
-                       if ($l->{POINTER_TYPE} ne "ref") {
-                               deindent;
-                               pidl "}";
+                       if ($l->{POINTER_TYPE} ne "ref" or has_property($e, "keepref")) {
+                               if ($l->{POINTER_TYPE} ne "ref") {
+                                       deindent;
+                                       pidl "}";
+                               }
+                               pidl "ndr->depth--;";
                        }
-                       pidl "ndr->depth--;";
                } elsif (($l->{TYPE} eq "ARRAY")
                        and not is_charset_array($e,$l)
                        and not has_fast_array($e,$l)) {