diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-01-06 07:29:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:27 -0500 |
commit | 66af8726e525d6978936d5e950b0e4c3af66c86c (patch) | |
tree | d6d0df755ffff7d574eb73d314455e80f062527e | |
parent | 939d37a0f2f1c5193bdbdd20d4fad387a79c5d99 (diff) | |
download | samba-66af8726e525d6978936d5e950b0e4c3af66c86c.tar.gz samba-66af8726e525d6978936d5e950b0e4c3af66c86c.tar.bz2 samba-66af8726e525d6978936d5e950b0e4c3af66c86c.zip |
r4557: support for [flags()] on typedef enum|bitmap
NDR_PAHEX is handled by ndr_print_enum() now
metze
(This used to be commit c3b2d2cca37193fead0df1a8808c3ffcd5180a89)
-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) |