mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
Add support for double type in pidl.
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
This commit is contained in:
parent
688efbbc68
commit
00bfe9c286
@ -125,6 +125,18 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags,
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
parse a double
|
||||
*/
|
||||
_PUBLIC_ enum ndr_err_code ndr_pull_double(struct ndr_pull *ndr, int ndr_flags, double *v)
|
||||
{
|
||||
NDR_PULL_ALIGN(ndr, 8);
|
||||
NDR_PULL_NEED_BYTES(ndr, 8);
|
||||
memcpy(v, ndr->data+ndr->offset, 8);
|
||||
ndr->offset += 8;
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
parse a pointer referent identifier
|
||||
*/
|
||||
@ -388,6 +400,18 @@ _PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, u
|
||||
return ndr_push_udlong(ndr, NDR_SCALARS, v);
|
||||
}
|
||||
|
||||
/*
|
||||
push a double
|
||||
*/
|
||||
_PUBLIC_ enum ndr_err_code ndr_push_double(struct ndr_push *ndr, int ndr_flags, double v)
|
||||
{
|
||||
NDR_PUSH_ALIGN(ndr, 8);
|
||||
NDR_PUSH_NEED_BYTES(ndr, 8);
|
||||
memcpy(ndr->data+ndr->offset, &v, 8);
|
||||
ndr->offset += 8;
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
push a pointer
|
||||
*/
|
||||
@ -506,7 +530,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags,
|
||||
}
|
||||
|
||||
/*
|
||||
push a NTTIME
|
||||
push a NTTIME_1sec
|
||||
*/
|
||||
_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
|
||||
{
|
||||
@ -679,6 +703,11 @@ _PUBLIC_ void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v
|
||||
ndr->print(ndr, "%-25s: 0x%016llx (%lld)", name, (unsigned long long)v, (long long)v);
|
||||
}
|
||||
|
||||
_PUBLIC_ void ndr_print_double(struct ndr_print *ndr, const char *name, double v)
|
||||
{
|
||||
ndr->print(ndr, "%-25s: %f", name, v);
|
||||
}
|
||||
|
||||
_PUBLIC_ void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v)
|
||||
{
|
||||
ndr_print_dlong(ndr, name, v);
|
||||
|
@ -53,6 +53,7 @@ my $scalar_alignment = {
|
||||
'int32' => 4,
|
||||
'uint32' => 4,
|
||||
'hyper' => 8,
|
||||
'double' => 8,
|
||||
'pointer' => 8,
|
||||
'dlong' => 4,
|
||||
'udlong' => 4,
|
||||
|
@ -38,6 +38,7 @@ my %scalars = (
|
||||
"dlong" => "int64_t",
|
||||
"udlong" => "uint64_t",
|
||||
"udlongr" => "uint64_t",
|
||||
"double" => "double",
|
||||
"pointer" => "void*",
|
||||
"DATA_BLOB" => "DATA_BLOB",
|
||||
"string" => "const char *",
|
||||
|
@ -4,7 +4,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 46;
|
||||
use Test::More tests => 47;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin";
|
||||
use Util;
|
||||
@ -480,6 +480,7 @@ $ne = ParseElement($e, undef);
|
||||
is($ne->{REPRESENTATION_TYPE}, "uint8");
|
||||
|
||||
is(align_type("hyper"), 8);
|
||||
is(align_type("double"), 8);
|
||||
is(align_type("uint32"), 4);
|
||||
is(align_type("uint16"), 2);
|
||||
is(align_type("uint8"), 1);
|
||||
|
@ -4,7 +4,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 54;
|
||||
use Test::More tests => 56;
|
||||
use FindBin qw($RealBin);
|
||||
use lib "$RealBin";
|
||||
use Util;
|
||||
@ -21,6 +21,7 @@ is("int32", expandAlias("int32"));
|
||||
is("uint32_t", mapScalarType("uint32"));
|
||||
is("void", mapScalarType("void"));
|
||||
is("uint64_t", mapScalarType("hyper"));
|
||||
is("double", mapScalarType("double"));
|
||||
|
||||
my $x = { TYPE => "ENUM", NAME => "foo", EXTRADATA => 1 };
|
||||
addType($x);
|
||||
@ -34,6 +35,11 @@ is_deeply(getType("uint16"), {
|
||||
TYPE => "TYPEDEF",
|
||||
DATA => { NAME => "uint16", TYPE => "SCALAR" }});
|
||||
|
||||
is_deeply(getType("double"), {
|
||||
NAME => "double",
|
||||
TYPE => "TYPEDEF",
|
||||
DATA => { NAME => "double", TYPE => "SCALAR" }});
|
||||
|
||||
is(0, typeIs("someUnknownType", "ENUM"));
|
||||
is(0, typeIs("foo", "ENUM"));
|
||||
addType({NAME => "mytypedef", TYPE => "TYPEDEF", DATA => { TYPE => "ENUM" }});
|
||||
|
Loading…
x
Reference in New Issue
Block a user