2008-02-22, 20:32
In trying to compile for x86_64 I ran into this:
Then on line 612 we do another thing that's unportable because pointers are 64 bits on the x86_64 architecture. In addition, this seems to be completely useless because the as far as I can tell the pTex memory is just leaked after the function returns a few lines below this! pTex is local, it's never freed, and it doens't appear to be referenced. What is going on?
I've even commented out 604 and 612 and it seems to have no consequence on an 32 bit build.
Similar code is used in LoadAnim on lines 714-727. This probably does something on the XBOX, but not in Linux (opinion!).
Thoughts? Otherwise I may just "fix" this in my x86_64 patch.
Quote:601 #ifndef HAS_SDLLine 604 is terribly unportable because ppTexture contains pointers which change the size and therefore change how it's mapped onto the pTex structure. Not only that but it seems to be completely useless. In the call on line 610 the current state of ppTexture is completely ignored.
602 *ppTexture = (LPDIRECT3DTEXTURE8)pTex;
603 #else
604 *ppTexture = (SDL_Surface*)pTex;
605 #endif
606
607 #ifdef HAS_XBOX_D3D
608 (*ppTexture)->Register(ResData);
609 #else
610 GetTextureFromData(pTex, ResData, ppTexture);
611 #endif
612 *(DWORD*)(pTex + 1) = (DWORD)(BYTE*)UnpackedBuf;
Then on line 612 we do another thing that's unportable because pointers are 64 bits on the x86_64 architecture. In addition, this seems to be completely useless because the as far as I can tell the pTex memory is just leaked after the function returns a few lines below this! pTex is local, it's never freed, and it doens't appear to be referenced. What is going on?
I've even commented out 604 and 612 and it seems to have no consequence on an 32 bit build.
Similar code is used in LoadAnim on lines 714-727. This probably does something on the XBOX, but not in Linux (opinion!).
Thoughts? Otherwise I may just "fix" this in my x86_64 patch.