mirror of
https://github.com/samba-team/samba.git
synced 2025-12-05 12:23:50 +03:00
r15652: Fix aliases mechanism (fixes #3710)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
a3dbab619b
commit
3e89ef0875
@@ -37,7 +37,7 @@ $VERSION = '0.01';
|
||||
@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
|
||||
|
||||
use strict;
|
||||
use Parse::Pidl::Typelist qw(hasType getType);
|
||||
use Parse::Pidl::Typelist qw(hasType getType expandAlias);
|
||||
use Parse::Pidl::Util qw(has_property property_matches);
|
||||
|
||||
# Alignment of the built-in scalar types
|
||||
@@ -364,6 +364,8 @@ sub ParseElement($)
|
||||
{
|
||||
my $e = shift;
|
||||
|
||||
$e->{TYPE} = expandAlias($e->{TYPE});
|
||||
|
||||
return {
|
||||
NAME => $e->{NAME},
|
||||
TYPE => $e->{TYPE},
|
||||
@@ -549,7 +551,7 @@ sub ParseFunction($$$)
|
||||
}
|
||||
|
||||
if ($d->{RETURN_TYPE} ne "void") {
|
||||
$rettype = $d->{RETURN_TYPE};
|
||||
$rettype = expandAlias($d->{RETURN_TYPE});
|
||||
}
|
||||
|
||||
my $async = 0;
|
||||
|
||||
@@ -7,7 +7,7 @@ package Parse::Pidl::Typelist;
|
||||
|
||||
require Exporter;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT_OK = qw(hasType getType mapType scalar_is_reference);
|
||||
@EXPORT_OK = qw(hasType getType mapType scalar_is_reference expandAlias);
|
||||
use vars qw($VERSION);
|
||||
$VERSION = '0.01';
|
||||
|
||||
@@ -72,6 +72,29 @@ my %scalars = (
|
||||
"ipv4address" => "const char *",
|
||||
);
|
||||
|
||||
my %aliases = (
|
||||
"error_status_t" => "uint32",
|
||||
"boolean8" => "uint8",
|
||||
"boolean32" => "uint32",
|
||||
"DWORD" => "uint32",
|
||||
"int" => "int32",
|
||||
"WORD" => "uint16",
|
||||
"char" => "uint8",
|
||||
"long" => "int32",
|
||||
"short" => "int16",
|
||||
"HYPER_T" => "hyper",
|
||||
"HRESULT" => "COMRESULT",
|
||||
);
|
||||
|
||||
sub expandAlias($)
|
||||
{
|
||||
my $name = shift;
|
||||
|
||||
return $aliases{$name} if defined($aliases{$name});
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
# map from a IDL type to a C header type
|
||||
sub mapScalarType($)
|
||||
{
|
||||
@@ -148,24 +171,6 @@ sub RegisterScalars()
|
||||
}
|
||||
}
|
||||
|
||||
my %aliases = (
|
||||
"DWORD" => "uint32",
|
||||
"int" => "int32",
|
||||
"WORD" => "uint16",
|
||||
"char" => "uint8",
|
||||
"long" => "int32",
|
||||
"short" => "int16",
|
||||
"HYPER_T" => "hyper",
|
||||
"HRESULT" => "COMRESULT",
|
||||
);
|
||||
|
||||
sub RegisterAliases()
|
||||
{
|
||||
foreach (keys %aliases) {
|
||||
$typedefs{$_} = $typedefs{$aliases{$_}};
|
||||
}
|
||||
}
|
||||
|
||||
sub enum_type_fn($)
|
||||
{
|
||||
my $enum = shift;
|
||||
@@ -196,6 +201,7 @@ sub mapType($)
|
||||
my $t = shift;
|
||||
return "void" unless defined($t);
|
||||
my $dt;
|
||||
$t = expandAlias($t);
|
||||
|
||||
unless ($dt or ($dt = getType($t))) {
|
||||
# Best guess
|
||||
@@ -237,6 +243,5 @@ sub LoadIdl($)
|
||||
}
|
||||
|
||||
RegisterScalars();
|
||||
RegisterAliases();
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user