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 451

Summary: #define SDL_memset4 memset is wrong
Product: SDL Reporter: Christian Walther <cwalther>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 1.2   
Hardware: PowerPC   
OS: Mac OS X (All)   
URL: http://libsdl.org/cgi/viewvc.cgi/branches/SDL-1.2/include/SDL_stdinc.h?r1=3038&r2=3037&pathrev=3038

Description Christian Walther 2007-07-08 06:31:46 UTC
SDL_stdinc.h rev. 3038 (http://libsdl.org/cgi/viewvc.cgi/branches/SDL-1.2/include/SDL_stdinc.h?r1=3038&r2=3037&pathrev=3038) changed the definition of SDL_memset4 to:

#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memset4(dst, val, len) memset(dst, val, (len)*4)
#elif ...

This is wrong, and causes e.g. SDL_FillRect to malfunction (e.g. in testcursor.c). memset fills every byte of memory with the given byte value, while SDL_memset4 is apparently supposed to fill every 32-bit word of memory with the given 32-bit value.

I can fix this by reverting the first hunk of rev. 3038. The other two changes, to SDL_memcpy and SDL_memcpy4, look OK to me.
Comment 1 Sam Lantinga 2007-07-08 07:25:36 UTC
Good catch.  This is fixed in subversion revisions 3175 and 3176.  Thanks!