| Summary: | Wrong use of ctype functions | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Christian Biere <christianbiere> |
| Component: | main | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 1.2.11 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | Adds "unsigned char" casts in macro definitions. | ||
|
Description
Christian Biere
2006-10-06 20:35:17 UTC
Created attachment 166 [details]
Adds "unsigned char" casts in macro definitions.
The attached patch adds unsigned char casts for the macros SDL_isspace(), SDL_isdigit(), SDL_toupper(), SDL_tolower() when they are mapped to the ctype functions. This makes them slightly different from the ctype functions because EOF (usually -1) is not handled. However, SDL only uses them for strings not FILE I/O e.g. fgetc(), so this modification should be sufficient. The advantage is that it fixes all 3rd party code which might have been using these incorrectly as well (modulo the mentioned caveat).
I would rather fix these at the individual calls in SDL_string.c ... changing the macro would be bad practice, since it adds an unexpected behaviour to it, even if it mostly works. --ryan. I corrected SDL_string.c directly. Fixed in svn revision #2980 for the 1.2 branch and #2981 for the 1.3 branch. --ryan. |