r4517: Revert previous commit about giving arrays of scalars their own subtree.
authorTim Potter <tpot@samba.org>
Tue, 4 Jan 2005 23:15:33 +0000 (23:15 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:08:17 +0000 (13:08 -0500)
Generate code to display using proto_tree_add_bytes() instead.
(This used to be commit 6e480fab3a0f70ae17dd7c0b39da924361a354d5)

source4/build/pidl/eparser.pm

index a67aa0626d3627de88b7fbad23d6f13f505e6e12..0038f53123ca8e6fb0aba9876670351c1d914999 100644 (file)
@@ -173,34 +173,38 @@ sub NeededTypedef($)
        if ($t->{DATA}->{TYPE} eq "STRUCT") {
 
            for my $e (@{$t->{DATA}->{ELEMENTS}}) {
-
                $e->{PARENT} = $t->{DATA};
-
                if ($needed{"pull_$t->{NAME}"}) {
                    $needed{"pull_$e->{TYPE}"} = 1;
                }
            
                if (util::is_scalar_type($e->{TYPE})) {
-
+               
                    if (defined($e->{ARRAY_LEN}) or 
                        util::has_property($e, "size_is")) {
 
-                       $needed{"ett_$e->{NAME}"} = 1;
+                       # Arrays of scalar types are FT_BYTES
+                   
+                       $needed{"hf_$e->{NAME}_$e->{TYPE}_array"} = {
+                           'name' => field2name($e->{NAME}),
+                           'type' => $e->{TYPE},
+                           'ft'   => "FT_BYTES",
+                           'base' => elementbase($e)
+                           };
 
                    } else {
-               
                        $needed{"hf_$e->{NAME}_$e->{TYPE}"} = {
                            'name' => field2name($e->{NAME}),
                            'type' => $e->{TYPE},
                            'ft'   => type2ft($e->{TYPE}),
                            'base' => elementbase($e)
                            };
-                       
-                       $e->{PARENT} = $t->{DATA};
-                       
-                       if ($needed{"pull_$t->{NAME}"}) {
-                           $needed{"pull_$e->{TYPE}"} = 1;
-                       }
+                   }
+                   
+                   $e->{PARENT} = $t->{DATA};
+                   
+                   if ($needed{"pull_$t->{NAME}"}) {
+                       $needed{"pull_$e->{TYPE}"} = 1;
                    }
 
                } else {
@@ -433,7 +437,7 @@ sub RewriteC($$$)
 
        s/(ndr_pull_array([^\(_]*?)\(ndr, (NDR_[^,]*?), ([^\)].*?)\);)/ndr_pull_array$2( ndr, $3, tree, $4);/smg;
 
-       s/(ndr_pull_array_([^\(]*?)\(ndr, (NDR_[^,]*?), (r->((in|out).)?([^,]*?)), (.*?)\);)/ndr_pull_array_$2( ndr, $3, get_subtree(tree, \"$7\", ndr, ett_$7), $4, $8);/smg;
+       s/(ndr_pull_array_([^\(]*?)\(ndr, (NDR_[^,]*?), (r->((in|out).)?([^,]*?)), (.*?)\);)/ndr_pull_array_$2( ndr, $3, tree, hf_$7_$2_array, $4, $8);/smg;
  
        # Save ndr_pull_relative[12]() calls from being wrapped by the
        # proceeding regexp.