pidl:Samba3/ClientNDR: remove unused ParseOutputArgument function
authorStefan Metzmacher <metze@samba.org>
Wed, 25 Aug 2010 08:07:54 +0000 (10:07 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 26 Aug 2010 11:29:21 +0000 (13:29 +0200)
metze

pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
pidl/tests/samba3-cli.pl

index 95ff4af7cee9c7c235e6cbbdf5dd073f2f6bff92..67051a8783de4524b3c769f8090f749f47fc04c5 100644 (file)
@@ -9,7 +9,7 @@ package Parse::Pidl::Samba3::ClientNDR;
 
 use Exporter;
 @ISA = qw(Exporter);
-@EXPORT_OK = qw(ParseFunction $res $res_hdr ParseOutputArgument);
+@EXPORT_OK = qw(ParseFunction $res $res_hdr);
 
 use strict;
 use Parse::Pidl qw(fatal warning error);
@@ -86,78 +86,6 @@ sub ParseInvalidResponse($$)
        }
 }
 
-sub ParseOutputArgument($$$;$$$)
-{
-       my ($self, $fn, $e, $r, $o, $invalid_response_type) = @_;
-       my $level = 0;
-       $r = "r." unless defined($r);
-       $o = "" unless defined($o);
-       $invalid_response_type = "sync" unless defined($invalid_response_type);
-
-       if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY") {
-               $self->pidl("return NT_STATUS_NOT_SUPPORTED;");
-               error($e->{ORIGINAL}, "[out] argument is not a pointer or array");
-               return;
-       }
-
-       if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
-               $level = 1;
-               if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") {
-                       $self->pidl("if ($o$e->{NAME} && ${r}out.$e->{NAME}) {");
-                       $self->indent;
-               }
-       }
-
-       if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") {
-               # This is a call to GenerateFunctionInEnv intentionally. 
-               # Since the data is being copied into a user-provided data 
-               # structure, the user should be able to know the size beforehand 
-               # to allocate a structure of the right size.
-               my $in_env = GenerateFunctionInEnv($fn, $r);
-               my $out_env = GenerateFunctionOutEnv($fn, $r);
-               my $l = $e->{LEVELS}[$level];
-               unless (defined($l->{SIZE_IS})) {
-                       $self->pidl('#error No size known for [out] array `$e->{NAME}');
-                       error($e->{ORIGINAL}, "no size known for [out] array `$e->{NAME}'");
-               } else {
-                       my $in_size_is = ParseExpr($l->{SIZE_IS}, $in_env, $e->{ORIGINAL});
-                       my $out_size_is = ParseExpr($l->{SIZE_IS}, $out_env, $e->{ORIGINAL});
-                       my $out_length_is = $out_size_is;
-                       if (defined($l->{LENGTH_IS})) {
-                               $out_length_is = ParseExpr($l->{LENGTH_IS}, $out_env, $e->{ORIGINAL});
-                       }
-                       if ($out_size_is ne $in_size_is) {
-                               $self->pidl("if (($out_size_is) > ($in_size_is)) {");
-                               $self->indent;
-                               $self->ParseInvalidResponse($invalid_response_type);
-                               $self->deindent;
-                               $self->pidl("}");
-                       }
-                       if ($out_length_is ne $out_size_is) {
-                               $self->pidl("if (($out_length_is) > ($out_size_is)) {");
-                               $self->indent;
-                               $self->ParseInvalidResponse($invalid_response_type);
-                               $self->deindent;
-                               $self->pidl("}");
-                       }
-                       if (has_property($e, "charset")) {
-                               $self->pidl("memcpy(discard_const_p(uint8_t *, $o$e->{NAME}), ${r}out.$e->{NAME}, ($out_length_is) * sizeof(*$o$e->{NAME}));");
-                       } else {
-                               $self->pidl("memcpy($o$e->{NAME}, ${r}out.$e->{NAME}, ($out_length_is) * sizeof(*$o$e->{NAME}));");
-                       }
-               }
-       } else {
-               $self->pidl("*$o$e->{NAME} = *${r}out.$e->{NAME};");
-       }
-
-       if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
-               if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") {
-                       $self->deindent;
-                       $self->pidl("}");
-               }
-       }
-}
-
 sub ParseFunctionAsyncState($$$)
 {
        my ($self, $if, $fn) = @_;
index 319f1dd7c3b5165f34408aa015f2ef120bdb849d..c758ef45425b0bb8456ebeff408d399442cae240 100755 (executable)
@@ -4,12 +4,12 @@
 use strict;
 use warnings;
 
-use Test::More tests => 9;
+use Test::More tests => 8;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
 use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction ParseOutputArgument);
+use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction);
 use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv);
 
 # Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work
@@ -234,11 +234,3 @@ NTSTATUS rpccli_bar(struct rpc_pipe_client *cli,
 
 ");
 
-$x = new Parse::Pidl::Samba3::ClientNDR();
-
-$fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" };
-my $e = { NAME => "foo", ORIGINAL => { FILE => "f", LINE => -1 },
-          LEVELS => [ { TYPE => "ARRAY", SIZE_IS => "mysize" }, { TYPE => "DATA", DATA_TYPE => "int" } ]};
-
-$x->ParseOutputArgument($fn, $e);
-is($x->{res}, "memcpy(foo, r.out.foo, (mysize) * sizeof(*foo));\n");