summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/eparser.pm4
-rw-r--r--source4/build/pidl/header.pm4
-rw-r--r--source4/build/pidl/parser.pm2
-rw-r--r--source4/build/pidl/util.pm45
4 files changed, 43 insertions, 12 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index f6403992ad..1893a31573 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -445,10 +445,6 @@ sub RewriteHeader($$$)
s/^\#include\ \"librpc\/gen_ndr\/ndr_(.*?).h\"$
/\#include \"packet-dcerpc-$1.h\"/smgx;
- # Convert samba fixed width types to stdint types
-
- s/((u)?int)([0-9]+)/$1$3_t/smg;
-
# Rename struct ndr_pull to struct pidl_pull
s/struct ndr_pull \*ndr/struct pidl_pull \*ndr/smg;
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm
index 51983460ed..c1fb5e6619 100644
--- a/source4/build/pidl/header.pm
+++ b/source4/build/pidl/header.pm
@@ -191,7 +191,7 @@ sub HeaderType($$$)
my $bitmap = util::get_bitmap($e->{TYPE});
$res .= util::bitmap_type_decl($bitmap);
} elsif (util::is_scalar_type($data)) {
- $res .= "$data";
+ $res .= util::map_type($data);
} elsif (util::has_property($e, "switch_is")) {
$res .= "union $data";
} else {
@@ -349,7 +349,7 @@ sub HeaderFunction($)
HeaderFunctionInOut($fn, "out");
if ($fn->{RETURN_TYPE} && $fn->{RETURN_TYPE} ne "void") {
tabs();
- $res .= "$fn->{RETURN_TYPE} result;\n";
+ $res .= util::map_type($fn->{RETURN_TYPE}) . " result;\n";
}
$tab_depth--;
tabs();
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index 1368099403..ac29fe0285 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -470,7 +470,7 @@ sub ParseElementPullSwitch($$$$)
if (!defined $utype ||
!util::has_property($utype, "nodiscriminant")) {
my $e2 = find_sibling($e, $switch);
- my $type_decl = $e2->{TYPE};
+ my $type_decl = util::map_type($e2->{TYPE});
pidl "\tif (($ndr_flags) & NDR_SCALARS) {\n";
if (util::is_enum($e2->{TYPE})) {
$type_decl = util::enum_type_decl($e2);
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index 48fd9469b8..277c6c0253 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -259,7 +259,7 @@ sub get_bitmap($)
return $bitmap_list{$name};
}
-sub bitmap_type_decl($)
+sub bitmap_type_fn($)
{
my $bitmap = shift;
@@ -273,12 +273,13 @@ sub bitmap_type_decl($)
return "uint32";
}
-sub bitmap_type_fn($)
+sub bitmap_type_decl($)
{
my $bitmap = shift;
- return bitmap_type_decl($bitmap);
+ return map_type(bitmap_type_fn($bitmap));
}
+
my %type_alignments =
(
"char" => 1,
@@ -291,8 +292,8 @@ my %type_alignments =
"long" => 4,
"int32" => 4,
"uint32" => 4,
- "int64" => 4,
- "uint64" => 4,
+ "dlong" => 4,
+ "udlong" => 4,
"NTTIME" => 4,
"NTTIME_1sec" => 4,
"time_t" => 4,
@@ -301,6 +302,7 @@ my %type_alignments =
"WERROR" => 4,
"boolean32" => 4,
"unsigned32" => 4,
+ "hyper" => 8,
"HYPER_T" => 8,
"NTTIME_hyper" => 8
);
@@ -519,5 +521,38 @@ sub make_str($)
return "\"" . $str . "\"";
}
+
+# provide mappings between IDL base types and types in our headers
+my %type_mappings =
+ (
+ "int8" => "int8_t",
+ "uint8" => "uint8_t",
+ "short" => "int16_t",
+ "wchar_t" => "uint16_t",
+ "int16" => "int16_t",
+ "uint16" => "uint16_t",
+ "int32" => "int32_t",
+ "uint32" => "uint32_t",
+ "int64" => "int64_t",
+ "uint64" => "uint64_t",
+ "dlong" => "int64_t",
+ "udlong" => "uint64_t",
+ "hyper" => "uint64_t",
+ "HYPER_T" => "uint64_t",
+ "hyper" => "uint64_t",
+ "NTTIME_1sec" => "NTTIME",
+ "NTTIME_hyper" => "NTTIME"
+ );
+
+# map from a IDL type to a C header type
+sub map_type($)
+{
+ my $name = shift;
+ if (my $ret = $type_mappings{$name}) {
+ return $ret;
+ }
+ return $name;
+}
+
1;