Hi Aleksander, Thanks for the QC... It's a new day, and I'm fresh, so hopefully no dumb mistakes.
Jeff On Tue, Feb 2, 2010 at 3:13 AM, Aleksander Morgado <[email protected]> wrote: > Hi Jeff, > >> I believe the problem arises because, in the case of >> PDF_FORCE_BIGNUMS, a struct is being pushed on the stack and accessed >> incorrectly in the called function. I was able to duplicate the issue >> in the attached struct-test.c. In the test file, I create a similar >> struct initialized to 1 (ie, high=0, low=1). I then push on the stack >> to Print: >> >> $ ./struct-test.exe >> high=-1079373640, low=134513824 >> high=1, low=0 >> > > For the first case, your NEW_MY_ADT64_T() function is not returning > anything, thus the values printed are undefined. The proper way would be > including the 'return t' at the end: > MY_ADT64_T NEW_MY_ADT64_T(int32_t high, uint32_t low) > { > MY_ADT64_T t; > t.high = high; > t.low = low; > return t; > } > > For the second case, you are initializing the variable as follows: > MY_ADT64_T t2 = {0,1}; > And your struct is defined having 'low' as first variable in the struct: > struct MY_ADT64_S > { > uint32_t low; > int32_t high; > }; > > Thus, when initializing t2={0,1}, you are initializing low=0 and high=1, > which is exactly what you print... > > Cheers, > -Aleksander >
