summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-10-10 11:47:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:38 -0500
commitb94fcbd306bbf758d26fb40c7c0a1b00ba6fe38d (patch)
tree434bc01d544becf32a0ba22cd96eefaf8b102826
parentb0e342e389d19377ad6c1b4236e60306d662ddab (diff)
downloadsamba-b94fcbd306bbf758d26fb40c7c0a1b00ba6fe38d.tar.gz
samba-b94fcbd306bbf758d26fb40c7c0a1b00ba6fe38d.tar.bz2
samba-b94fcbd306bbf758d26fb40c7c0a1b00ba6fe38d.zip
r10868: make flag(NDR_PAHEX) possible to use and show the union level in hex
metze (This used to be commit 7efb92adc057ad8a993eb9de66c3806608747104)
-rw-r--r--source4/librpc/ndr/ndr_basic.c6
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm8
2 files changed, 10 insertions, 4 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 23e686f76f..8f2cf49a1c 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -711,7 +711,11 @@ void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t)
void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type)
{
- ndr->print(ndr, "%-25s: union %s(case %d)", name, type, level);
+ if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) {
+ ndr->print(ndr, "%-25s: union %s(case 0x%X)", name, type, level);
+ } else {
+ ndr->print(ndr, "%-25s: union %s(case %d)", name, type, level);
+ }
}
void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level)
diff --git a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
index da60a02059..2ccbc057fc 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm
@@ -1624,15 +1624,17 @@ sub ParseUnionPrint($$)
my ($e,$name) = @_;
my $have_default = 0;
- pidl "int level = ndr_print_get_switch_value(ndr, r);";
-
+ pidl "int level;";
foreach my $el (@{$e->{ELEMENTS}}) {
DeclareArrayVariables($el);
}
- pidl "ndr_print_union(ndr, name, level, \"$name\");";
start_flags($e);
+ pidl "level = ndr_print_get_switch_value(ndr, r);";
+
+ pidl "ndr_print_union(ndr, name, level, \"$name\");";
+
pidl "switch (level) {";
indent;
foreach my $el (@{$e->{ELEMENTS}}) {