...
The following character classification routines functions are affected:
| | | |
| | | |
| | | |
| | | |
...
Code Block | ||
---|---|---|
| ||
size_t count_whitespace(char const *s, size_t length) {
char const *t = s;
/* possibly *t < 0 */
while (isspace(*t) && (t - s < length))
++t;
return t - s;
}
|
Compliant Solution (Unsigned Char)
...
Code Block | ||
---|---|---|
| ||
size_t count_whitespace( const unsigned char *s, size_t length) { const unsigned char *t = s; while (isspace(*t) && (t - s < length)) ++t; return t - s; } |
...
Code Block | ||
---|---|---|
| ||
size_t count_whitespace( char const *s, size_t length) { char const *t = s; while (isspace((unsigned char)*t) && (t - s < length)) ++t; return t - s; } |
...
Wiki Markup |
---|
\[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] Section 7.4, "Character handling <ctype.h><{{ctype.h}}>" \[[Kettlewell 02|AA. C References#Kettle 02]\] Section 1.1, "<ctype.h><{{ctype.h}}> And Characters Types" |
...
STR36-C. Do not specify the bound of a character array initialized with a string literal 07. Characters and Strings (STR) 08. Memory Management (MEM)