summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-08-25 10:07:54 +0200
committerStefan Metzmacher <metze@samba.org>2010-08-26 13:29:21 +0200
commita701484230bf1119900287326f7a57c07776e4e9 (patch)
tree9ac2e5fbed645e23860508294201a8753d3bdb83
parent3c7a7bbb9a6258744523f41935f3967e48056787 (diff)
downloadsamba-a701484230bf1119900287326f7a57c07776e4e9.tar.gz
samba-a701484230bf1119900287326f7a57c07776e4e9.tar.bz2
samba-a701484230bf1119900287326f7a57c07776e4e9.zip
pidl:Samba3/ClientNDR: remove unused ParseOutputArgument function
metze
-rw-r--r--pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm74
-rwxr-xr-xpidl/tests/samba3-cli.pl12
2 files changed, 3 insertions, 83 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index 95ff4af7ce..67051a8783 100644
--- a/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -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) = @_;
diff --git a/pidl/tests/samba3-cli.pl b/pidl/tests/samba3-cli.pl
index 319f1dd7c3..c758ef4542 100755
--- a/pidl/tests/samba3-cli.pl
+++ b/pidl/tests/samba3-cli.pl
@@ -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");