Skip to content

Commit

Permalink
workaround for Convert::Binary::C bug in 0.74
Browse files Browse the repository at this point in the history
  wrong declarations: 'char'(type) '*baz'(declarator) => 'char*' 'baz'
  fixes 02struct.t tests 4,5
  • Loading branch information
rurban committed May 17, 2010
1 parent 1c5baf9 commit 02bea51
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/C/DynaLib/Struct.pm
Expand Up @@ -227,9 +227,19 @@ sub Parse {
# all structs and unions
for my $s ($c->compound) {
my $record = $s->{identifier};
if (defined (${"${record}::template"})) {
if (defined (${"${record}::template"})) { # already parsed
carp "Redefinition of ".$s->{type}." $record\n";
}
# Convert::Binary::C bug in 0.74
# fixup wrong declarations: 'char'(type) '*baz'(declarator) => 'char*' 'baz'
for (0..@{$s->{declarations}}) {
my $d = $s->{declarations}->[$_];
if (substr($d->{declarators}[0]->{declarator},0,1) eq '*') {
$s->{declarations}->[$_]->{declarators}[0]->{declarator} =
substr($d->{declarators}[0]->{declarator},1);
$s->{declarations}->[$_]->{type} .= "*";
}
}
my @members = _members(@{$s->{declarations}});
Define C::DynaLib::Struct($record,
_pack_names(@{$s->{declarations}}),
Expand Down

0 comments on commit 02bea51

Please sign in to comment.