Skip Menu |

This queue is for tickets about the Win32-API CPAN distribution.

Report information
The Basics
Id: 48006
Status: resolved
Worked: 1.5 hours (90 min)
Priority: 0/
Queue: Win32-API

People
Owner: BULKDD [...] cpan.org
Requestors: killing [...] multiplay.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.46
  • 0.47
  • 0.48
  • 0.49
  • 0.50
  • 0.53
  • 0.54
  • 0.55
  • 0.56
  • 0.57
  • 0.58
  • 0.59
Fixed in: (no value)



Subject: Warnings from Win32::API::Struct
loads of warnings when using the module: return $self->{align} unless $self->{align} eq 'auto'; Should it be: return $self->{align} unless ! defined $self->{align} || $self-> {align} eq 'auto'; But not 100% sure? In addition there are a number of debug lines which also cause loads of warnings: Struct.pm:221 DEBUG "(PM)Struct::getPack: $self->{__typedef__} (buffer) = pack($packing, @items)\n"; Struct.pm:229 DEBUG "(PM)Struct::Pack: $self->{__typedef__}(buffer) = pack($packing, @$items)\n"; Hope this helps. Regards Steve
CC: libwin32 [...] perl.org
Subject: Re: [rt.cpan.org #48006] Warnings from Win32::API::Struct
Date: Sun, 19 Jul 2009 13:07:14 -0700
To: bug-Win32-API [...] rt.cpan.org
From: Bill Luebkert <dbecoll [...] roadrunner.com>
Cosimo Streppone via RT wrote: Show quoted text
> Sun Jul 19 10:43:11 2009: Request 48006 was acted upon. > Transaction: Ticket created by COSIMO > Queue: Win32-API > Subject: Warnings from Win32::API::Struct > Broken in: (no value) > Severity: Normal > Owner: COSIMO > Requestors: killing@multiplay.co.uk > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48006 > > > > loads of warnings when using the module: > > return $self->{align} unless $self->{align} eq 'auto'; > > Should it be: > > return $self->{align} unless ! defined $self->{align} || $self-> > {align} eq 'auto'; > > But not 100% sure? > > In addition there are a number of debug lines which also cause loads > of warnings: > > Struct.pm:221 DEBUG "(PM)Struct::getPack: $self->{__typedef__} > (buffer) = pack($packing, @items)\n"; > Struct.pm:229 DEBUG "(PM)Struct::Pack: $self->{__typedef__}(buffer) > = pack($packing, @$items)\n";
I think there are some bugs in there too. Does sizeof work properly in the current version ? There might be alignment issues too. I'm using 0.50. Here's a test case that should show the sizeof problem: use strict; use warnings; use Win32::API::Struct; typedef Win32::API::Struct PROCESSENTRY32 => qw( DWORD dwSize; DWORD cntUsage; DWORD th32ProcessID; DWORD th32DefaultHeapID; DWORD th32ModuleID; DWORD cntThreads; DWORD th32ParentProcessID; LONG pcPriClassBase; DWORD dwFlags; char szExeFile[260]; ); # 9*4=36+260=296 my $pe32 = new Win32::API::Struct ('PROCESSENTRY32'); my $size = $pe32->sizeof; print "size=$size should be 296\n"; __END__ This produces: size=40 should be 296 I changed my version of Struct.pm to alleviate the symptom, but not sure if it's the correct change (my changes on the right >): 143,147c144,148 < if(defined $align and $align > 0) { < return scalar(@{ $self->{typedef} }) * $align; < } else { < return $size; < } --- Show quoted text
> # if(defined $align and $align > 0) { $Bill - comment out this align test > # return scalar(@{ $self->{typedef} }) * $align; $Bill > # } else { $Bill > # return $size; $Bill > # } $Bill
189c190 < ($name, $type, my $orig) = @$member; # $Bill - just a strict issue --- Show quoted text
> ($name, $type, $orig) = @$member;
246c247 < ($name, $type, $orig) = @$member; --- Show quoted text
> ($name, $type, my $orig) = @$member; # $Bill - just a strict issue
There may be other issues.
Thanks Bill, this is now a test case, so I can track progress.
Here's two useful articles on structs and packing. Thanks Bill for the pointer. Data alignment considerations http://msdn.microsoft.com/en-us/library/aa505951(loband).aspx Data alignment examples http://msdn.microsoft.com/en-us/library/aa505952.aspx
Subject: Re: [rt.cpan.org #48006] Warnings from Win32::API::Struct
Date: Thu, 20 Aug 2009 17:57:48 -0700
To: bug-Win32-API [...] rt.cpan.org
From: Bill Luebkert <dbecoll [...] roadrunner.com>
Cosimo Streppone via RT wrote: Show quoted text
> > Here's two useful articles on structs and packing. Thanks Bill for the > pointer. > > Data alignment considerations > http://msdn.microsoft.com/en-us/library/aa505951(loband).aspx > > Data alignment examples > http://msdn.microsoft.com/en-us/library/aa505952.aspx
Wouldn't it be nice if they could just concisely state the rules in an ordered bullet list instead of forcing you to guess and test ? :)
RT-Send-CC: libwin32 [...] perl.org, dbecoll [...] roadrunner.com
This bug should be fixed in HEAD. I'm rolling out a new release soon, but would be nice if you guys could confirm it works for you. http://github.com/cosimo/perl5-win32-api/ This is going to be 0.60_dev.
RT-Send-CC: libwin32 [...] perl.org, dbecoll [...] roadrunner.com
On Thu Apr 01 08:57:47 2010, COSIMO wrote: Show quoted text
> This bug should be fixed in HEAD. > I'm rolling out a new release soon, > but would be nice if you guys could confirm it works for you. > > http://github.com/cosimo/perl5-win32-api/ > > This is going to be 0.60_dev.
The process modules struct test became test file 06_rt_74578.t and does pass right now. Is there any remaining issues in this ticket?
RT-Send-CC: libwin32 [...] perl.org, dbecoll [...] roadrunner.com
On Fri Oct 19 05:07:30 2012, BULKDD wrote: Show quoted text
> On Thu Apr 01 08:57:47 2010, COSIMO wrote:
> > This bug should be fixed in HEAD. > > I'm rolling out a new release soon, > > but would be nice if you guys could confirm it works for you. > > > > http://github.com/cosimo/perl5-win32-api/ > > > > This is going to be 0.60_dev.
> > The process modules struct test became test file 06_rt_74578.t and does > pass right now. Is there any remaining issues in this ticket?
30 days no response, closing.