diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-11 06:53:12 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-11 06:53:12 +0000 |
commit | 023a8fcb80f13f06c32ad5515e046b2017eaed09 (patch) | |
tree | 9f093329cd88704563e341f9f02f9198845c2692 /source4/build/pidl/util.pm | |
parent | bde602b9e1192945d7c0139fd4226b431fc214f2 (diff) | |
download | samba-023a8fcb80f13f06c32ad5515e046b2017eaed09.tar.gz samba-023a8fcb80f13f06c32ad5515e046b2017eaed09.tar.bz2 samba-023a8fcb80f13f06c32ad5515e046b2017eaed09.zip |
fixed the NDR structure alignment rules
still not perfect, but works for all the cases I have seen so far
(This used to be commit ce15cc87fbbe8ee0d383ad115168e9be29fe9efc)
Diffstat (limited to 'source4/build/pidl/util.pm')
-rw-r--r-- | source4/build/pidl/util.pm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm index 72176abab3..d6c493398c 100644 --- a/source4/build/pidl/util.pm +++ b/source4/build/pidl/util.pm @@ -187,6 +187,30 @@ sub is_scalar_type($) return 0; } +# return the NDR alignment for a type +sub type_align($) +{ + my($e) = shift; + my $type = $e->{TYPE}; + + if ($e->{POINTERS} || array_size($e)) { + # FIXME: we really should recurse here + return 4; + } + + return 4, if ($type eq "uint32"); + return 4, if ($type eq "long"); + return 2, if ($type eq "short"); + return 1, if ($type eq "char"); + return 1, if ($type eq "uint8"); + return 2, if ($type eq "uint16"); + return 4, if ($type eq "NTTIME"); + return 8, if ($type eq "hyper"); + return 2, if ($type eq "wchar_t"); + + return 0; +} + # this is used to determine if the ndr push/pull functions will need # a ndr_flags field to split by buffers/scalars sub is_builtin_type($) |