diff options
-rw-r--r-- | source4/build/pidl/parser.pm | 10 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm index 33937b5800..077fcd4385 100644 --- a/source4/build/pidl/parser.pm +++ b/source4/build/pidl/parser.pm @@ -817,9 +817,8 @@ sub ParseEnumPull($) my($enum) = shift; my($type_fn) = util::enum_type_fn($enum); - start_flags($enum); - pidl "\t$type_fn v;\n"; + start_flags($enum); pidl "\tNDR_CHECK(ndr_pull_$type_fn(ndr, &v));\n"; pidl "\t*r = v;\n"; @@ -832,10 +831,10 @@ sub ParseEnumPrint($) { my($enum) = shift; - start_flags($enum); - pidl "\tconst char *val = NULL;\n\n"; + start_flags($enum); + pidl "\tswitch (r) {\n"; my $els = \@{$enum->{ELEMENTS}}; foreach my $i (0 .. $#{$els}) { @@ -874,9 +873,8 @@ sub ParseBitmapPull($) my($bitmap) = shift; my($type_fn) = util::bitmap_type_fn($bitmap); - start_flags($bitmap); - pidl "\t$type_fn v;\n"; + start_flags($bitmap); pidl "\tNDR_CHECK(ndr_pull_$type_fn(ndr, &v));\n"; pidl "\t*r = v;\n"; diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 8c9664771d..13ac087978 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -1002,7 +1002,11 @@ void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type) void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type, const char *val, uint_t value) { - ndr->print(ndr, "%-25s: %s (%d)", name, val?val:"UNKNOWN_ENUM_VALUE", value); + if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) { + ndr->print(ndr, "%-25s: %s (0x%X)", name, val?val:"UNKNOWN_ENUM_VALUE", value); + } else { + ndr->print(ndr, "%-25s: %s (%d)", name, val?val:"UNKNOWN_ENUM_VALUE", value); + } } void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint_t flag, uint_t value) |