diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-03-31 00:37:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:11:21 -0500 |
commit | e124ec95188933fa4244356edb664601359c489f (patch) | |
tree | fb81861b58a88dc615656787c3c58addf1fe3825 /source4 | |
parent | 848329b9a0a66281f699d1ae2c9e267c91ce0f43 (diff) | |
download | samba-e124ec95188933fa4244356edb664601359c489f.tar.gz samba-e124ec95188933fa4244356edb664601359c489f.tar.bz2 samba-e124ec95188933fa4244356edb664601359c489f.zip |
r6143: Put compression support in the subcontext handling functions rather
then at the element level.
(This used to be commit fac5edd2b71759c82232713f77ab91b41ed09250)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/ndr_parser.pm | 81 |
1 files changed, 36 insertions, 45 deletions
diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm index 6f8029d338..bc466503b4 100644 --- a/source4/build/pidl/ndr_parser.pm +++ b/source4/build/pidl/ndr_parser.pm @@ -560,6 +560,8 @@ sub ParseSubcontextPushStart($$) { my $e = shift; my $ndr_flags = shift; + my $compression = util::has_property($e, "compression"); + my $retndr; pidl "if (($ndr_flags) & NDR_SCALARS) {"; indent; @@ -570,7 +572,13 @@ sub ParseSubcontextPushStart($$) pidl "_ndr_$e->{NAME}->flags = ndr->flags;"; pidl ""; - return "_ndr_$e->{NAME}"; + $retndr = "_ndr_$e->{NAME}"; + + if (defined $compression) { + $retndr = ParseCompressionPushStart($e, $retndr, "NDR_SCALARS"); + } + + return $retndr } sub ParseSubcontextPushEnd($) @@ -578,13 +586,19 @@ sub ParseSubcontextPushEnd($) my $e = shift; my $header_size = util::has_property($e, "subcontext"); my $size_is = util::has_property($e, "subcontext_size"); + my $compression = util::has_property($e, "compression"); + my $ndr = "_ndr_$e->{NAME}"; + + if (defined $compression) { + ParseCompressionPushEnd($e, $ndr); + } if (not defined($size_is)) { $size_is = "-1"; } - pidl "NDR_CHECK(ndr_push_subcontext_header(ndr, $header_size, $size_is, _ndr_$e->{NAME}));"; - pidl "NDR_CHECK(ndr_push_bytes(ndr, _ndr_$e->{NAME}->data, _ndr_$e->{NAME}->offset));"; + pidl "NDR_CHECK(ndr_push_subcontext_header(ndr, $header_size, $size_is, $ndr));"; + pidl "NDR_CHECK(ndr_push_bytes(ndr, $ndr->data, $ndr->offset));"; deindent; pidl "}"; } @@ -595,6 +609,8 @@ sub ParseSubcontextPullStart($$) my $ndr_flags = shift; my $header_size = util::has_property($e, "subcontext"); my $size_is = util::has_property($e, "subcontext_size"); + my $retndr = "_ndr_$e->{NAME}"; + my $compression = util::has_property($e, "compression"); if (not defined($size_is)) { $size_is = "-1"; @@ -602,10 +618,15 @@ sub ParseSubcontextPullStart($$) pidl "if (($ndr_flags) & NDR_SCALARS) {"; indent; - pidl "struct ndr_pull *_ndr_$e->{NAME};"; - pidl "NDR_ALLOC(ndr, _ndr_$e->{NAME});"; - pidl "NDR_CHECK(ndr_pull_subcontext_header(ndr, $header_size, $size_is, _ndr_$e->{NAME}));"; - return "_ndr_$e->{NAME}"; + pidl "struct ndr_pull *$retndr;"; + pidl "NDR_ALLOC(ndr, $retndr);"; + pidl "NDR_CHECK(ndr_pull_subcontext_header(ndr, $header_size, $size_is, $retndr));"; + + if (defined $compression) { + $retndr = ParseCompressionPullStart($e, $retndr, $ndr_flags); + } + + return $retndr; } sub ParseSubcontextPullEnd($) @@ -613,14 +634,20 @@ sub ParseSubcontextPullEnd($) my $e = shift; my $header_size = util::has_property($e, "subcontext"); my $size_is = util::has_property($e, "subcontext_size"); + my $subndr = "_ndr_$e->{NAME}"; + my $compression = util::has_property($e, "compression"); + + if (defined $compression) { + ParseCompressionPullEnd($e, $subndr); + } my $advance; if (defined ($size_is)) { $advance = "$size_is"; } elsif ($header_size) { - $advance = "_ndr_$e->{NAME}->data_size"; + $advance = "$subndr->data_size"; } else { - $advance = "_ndr_$e->{NAME}->offset"; + $advance = "$subndr->offset"; } pidl "NDR_CHECK(ndr_pull_advance(ndr, $advance));"; deindent; @@ -637,10 +664,8 @@ sub ParseElementPushScalar($$$) my $cprefix = c_push_prefix($e); my $ptr_prefix = c_ptr_prefix($e); my $sub_size = util::has_property($e, "subcontext"); - my $compression = util::has_property($e, "compression"); my $ndr = "ndr"; my $subndr = undef; - my $comndr = undef; start_flags($e); @@ -651,10 +676,6 @@ sub ParseElementPushScalar($$$) if (defined $sub_size and $e->{POINTERS} == 0) { $subndr = ParseSubcontextPushStart($e, "NDR_SCALARS"); $ndr = $subndr; - if (defined $compression) { - $comndr = ParseCompressionPushStart($e, $subndr, "NDR_SCALARS"); - $ndr = $comndr; - } } if (Ndr::need_wire_pointer($e)) { @@ -672,9 +693,6 @@ sub ParseElementPushScalar($$$) } if (defined $sub_size and $e->{POINTERS} == 0) { - if (defined $compression) { - ParseCompressionPushEnd($e, $subndr); - } ParseSubcontextPushEnd($e); } @@ -795,10 +813,8 @@ sub ParseElementPullScalar($$$) my $cprefix = c_pull_prefix($e); my $ptr_prefix = c_ptr_prefix($e); my $sub_size = util::has_property($e, "subcontext"); - my $compression = util::has_property($e, "compression"); my $ndr = "ndr"; my $subndr = undef; - my $comndr = undef; start_flags($e); @@ -806,10 +822,6 @@ sub ParseElementPullScalar($$$) $subndr = ParseSubcontextPullStart($e, $ndr_flags); $ndr = $subndr; $ndr_flags = "NDR_SCALARS|NDR_BUFFERS"; - if (defined $compression) { - $comndr = ParseCompressionPullStart($e, $subndr, $ndr_flags); - $ndr = $comndr; - } } if (Ndr::is_inline_array($e)) { @@ -833,9 +845,6 @@ sub ParseElementPullScalar($$$) } if (defined $sub_size && $e->{POINTERS} == 0) { - if (defined $compression) { - ParseCompressionPullEnd($e, $subndr); - } ParseSubcontextPullEnd($e); } @@ -874,10 +883,8 @@ sub ParseElementPushBuffer($$) my($var_prefix) = shift; my $cprefix = c_push_prefix($e); my $sub_size = util::has_property($e, "subcontext"); - my $compression = util::has_property($e, "compression"); my $ndr = "ndr"; my $subndr = undef; - my $comndr = undef; return unless (need_buffers_section($e)); @@ -907,10 +914,6 @@ sub ParseElementPushBuffer($$) $subndr = ParseSubcontextPushStart($e, $ndr_flags); $ndr = $subndr; $ndr_flags = "NDR_SCALARS|NDR_BUFFERS"; - if (defined $compression) { - $comndr = ParseCompressionPushStart($e, $subndr, $ndr_flags); - $ndr = $comndr; - } } if (util::array_size($e)) { @@ -924,9 +927,6 @@ sub ParseElementPushBuffer($$) } if (defined $sub_size) { - if (defined $compression) { - ParseCompressionPushEnd($e, $subndr); - } ParseSubcontextPushEnd($e); } @@ -946,10 +946,8 @@ sub ParseElementPullBuffer($$) my($var_prefix) = shift; my $cprefix = c_pull_prefix($e); my $sub_size = util::has_property($e, "subcontext"); - my $compression = util::has_property($e, "compression"); my $ndr = "ndr"; my $subndr = undef; - my $comndr = undef; return unless (need_buffers_section($e)); @@ -981,10 +979,6 @@ sub ParseElementPullBuffer($$) $subndr = ParseSubcontextPullStart($e, $ndr_flags); $ndr = $subndr; $ndr_flags = "NDR_SCALARS|NDR_BUFFERS"; - if (defined $compression) { - $comndr = ParseCompressionPullStart($e, $subndr, $ndr_flags); - $ndr = $comndr; - } } if (util::array_size($e)) { @@ -998,9 +992,6 @@ sub ParseElementPullBuffer($$) } if (defined $sub_size) { - if (defined $compression) { - ParseCompressionPullEnd($e, $subndr); - } ParseSubcontextPullEnd($e); } |