On Dec 9, 2013, at 10:07 AM, Tom Browder wrote:

> Clue 1: The light.sh pngs show a brighter light in the reference png
> versus the generated one.

Basically, the lights in the generated image aren't enabled, probably because 
structparsing failed (they are described by a structparse string).

> As an aside: in reworking the sp_hook func sigs I made several changes
> similar to this due to the 'void *base' input:
> 
> -  i = (int *)(base + sdp->sp_offset);
> + i = (int *)((int *)base + sdp->sp_offset);
> 
> I don't think this should make any difference if I were to change it to:
> 
> -  i = (int *)(base + sdp->sp_offset);
> + i = (int *)((some-non-void-type *)base + sdp->sp_offset);
> 
> or would it?

Big difference.  Almost certainly the bug, too.

Say sp_offset is 4.  Casting base to an int* and incrementing by 4 will 
increment from base by 4*sizeof(int), i.e., 8 or 16 bytes.  That is a dramatic 
change from what it used to be, 4*sizeof(char), i.e., 4 bytes.  Basically, it's 
incrementing too far forward in memory and treating that block as an array of 
integers, necessarily getting garbage values.

This should work:  i = (int *)((char *)base + sdp->sp_offset);
Could probably use a uint8_t* too.

Cheers!
Sean



------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to