We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 421

Summary: Missing const specification forces use of const_cast in application code
Product: SDL Reporter: esigra
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 1.2   
Hardware: Other   
OS: Linux   
Attachments: Patch against SDL-1.2.11 that fixes 2 occurences of the bug for me.

Description esigra 2007-03-26 02:06:05 UTC
Some const specifications are missing in the SDL code. This forces us who develop applications based on SDL to use const_cast. This is really ugly and needs to be fixed. For example the first parameter of SDL_MapRGB and SDL_MapRGBA.
Comment 1 esigra 2007-03-26 02:08:07 UTC
Created attachment 203 [details]
Patch against SDL-1.2.11 that fixes 2 occurences of the bug for me.
Comment 2 Ryan C. Gordon 2007-04-04 02:43:58 UTC
Fixed in svn revision #3008 for the 1.2 branch and #3009 for the 1.3 branch.

Thanks!

--ryan.

Comment 3 esigra 2008-04-09 11:46:46 UTC
This bug also needs to be fixed for SDL_GetRGB and SDL_GetRGBA (those should not change the format of the surface either). Until this is fixed, I still need to const_cast the format parameter in calls to those functions.
Comment 4 Sam Lantinga 2009-04-13 02:04:28 UTC
This was fixed for SDL 1.2 in revision 4487.  This was already fixed for SDL 1.3.

Thanks!