diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-06-17 21:40:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:23 -0500 |
commit | 82dfe0b29b4d090a20e0bc07a22ee47a5f38330a (patch) | |
tree | 943ea812dc54e9c40249117fceab250d6f5ecf67 /source4/build/pidl/ndr_parser.pm | |
parent | cd39847e815bea73b6bcae63541dd36b1715aa6c (diff) | |
download | samba-82dfe0b29b4d090a20e0bc07a22ee47a5f38330a.tar.gz samba-82dfe0b29b4d090a20e0bc07a22ee47a5f38330a.tar.bz2 samba-82dfe0b29b4d090a20e0bc07a22ee47a5f38330a.zip |
r7702: Implement [charset()] attribute.
(This used to be commit 7012e10bb6252a7e602e80f05c914a783610088c)
Diffstat (limited to 'source4/build/pidl/ndr_parser.pm')
-rw-r--r-- | source4/build/pidl/ndr_parser.pm | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm index 4eab424c75..dc3635f6e4 100644 --- a/source4/build/pidl/ndr_parser.pm +++ b/source4/build/pidl/ndr_parser.pm @@ -550,7 +550,11 @@ sub ParseElementPushLevel my $nl = Ndr::GetNextLevel($e, $l); - pidl "NDR_CHECK(ndr_push_array_$nl->{DATA_TYPE}($ndr, $ndr_flags, $var_name, $length));"; + if (util::has_property($e, "charset")) { + pidl "NDR_CHECK(ndr_push_charset($ndr, $ndr_flags, $var_name, $length, sizeof(" . typelist::mapType($nl->{DATA_TYPE}) . "), $e->{PROPERTIES}->{charset}));"; + } else { + pidl "NDR_CHECK(ndr_push_array_$nl->{DATA_TYPE}($ndr, $ndr_flags, $var_name, $length));"; + } return; } } elsif ($l->{TYPE} eq "SWITCH") { @@ -688,8 +692,12 @@ sub ParseElementPrint($$$) } if (is_scalar_array($e, $l)) { - my $nl = Ndr::GetNextLevel($e, $l); - pidl "ndr_print_array_$nl->{DATA_TYPE}(ndr, \"$e->{NAME}\", $var_name, $length);"; + if (util::has_property($e, "charset")) { + pidl "ndr_print_string(ndr, \"$e->{NAME}\", $var_name);"; + } else { + my $nl = Ndr::GetNextLevel($e, $l); + pidl "ndr_print_array_$nl->{DATA_TYPE}(ndr, \"$e->{NAME}\", $var_name, $length);"; + } last; } @@ -844,10 +852,14 @@ sub ParseElementPullLevel } my $nl = Ndr::GetNextLevel($e, $l); - pidl "NDR_CHECK(ndr_pull_array_$nl->{DATA_TYPE}($ndr, $ndr_flags, $var_name, $length));"; - if ($l->{IS_ZERO_TERMINATED}) { - # Make sure last element is zero! - pidl "NDR_CHECK(ndr_check_string_terminator($ndr, $var_name, ndr_get_array_length(ndr, " . get_pointer_to($var_name) . "), sizeof(*$var_name)));"; + if (util::has_property($e, "charset")) { + pidl "NDR_CHECK(ndr_pull_charset($ndr, $ndr_flags, ".get_pointer_to($var_name).", $length, sizeof(" . typelist::mapType($nl->{DATA_TYPE}) . "), $e->{PROPERTIES}->{charset}));"; + } else { + pidl "NDR_CHECK(ndr_pull_array_$nl->{DATA_TYPE}($ndr, $ndr_flags, $var_name, $length));"; + if ($l->{IS_ZERO_TERMINATED}) { + # Make sure last element is zero! + pidl "NDR_CHECK(ndr_check_string_terminator($ndr, $var_name, $length, sizeof(*$var_name)));"; + } } return; } @@ -901,7 +913,7 @@ sub ParseElementPullLevel if ($l->{IS_ZERO_TERMINATED}) { # Make sure last element is zero! - pidl "NDR_CHECK(ndr_check_string_terminator($ndr, $var_name, ndr_get_array_length(ndr, " . get_pointer_to($var_name) . "), sizeof(*$var_name)));"; + pidl "NDR_CHECK(ndr_check_string_terminator($ndr, $var_name, $length, sizeof(*$var_name)));"; } } @@ -1867,6 +1879,8 @@ sub AllocateArrayLevel($$$$$) { my ($e,$l,$ndr,$env,$size) = @_; + return if (util::has_property($e, "charset")); + my $var = ParseExpr($e->{NAME}, $env); check_null_pointer($size); |