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.
| Summary: |
SDL_memset4() freeze |
| Product: |
SDL
|
Reporter: |
Jehan <jehan.dev> |
| Component: |
*don't know* | Assignee: |
Ryan C. Gordon <icculus> |
| Status: |
RESOLVED
FIXED
|
QA Contact: |
Sam Lantinga <slouken> |
| Severity: |
normal
|
|
|
| Priority: |
P2
|
CC: |
sezeroz
|
| Version: |
HG 2.0 | |
|
| Hardware: |
Other | |
|
| OS: |
Other | |
|
When below SDL_memset4() is called with len = 0. SW is freezing on Iphone platform. #define SDL_memset4(dst, val, len) \ do { \ unsigned _count = (len); \ unsigned _n = (_count + 3) / 4; \ Uint32 *_p = SDL_static_cast(Uint32 *, dst); \ Uint32 _val = (val); \ switch (_count % 4) { \ case 0: do { *_p++ = _val; \ case 3: *_p++ = _val; \ case 2: *_p++ = _val; \ case 1: *_p++ = _val; \ } while ( --_n ); \ } \ } while(0) Indeed if we enter the loop when n=0. We will be locked into an infinite loop due to pre-increment (--n). I assume that this function should just return if len == 0, Do you agree? I suggest a break when entering the do{}whiile(0) : if(!len) break;