use the ascii locale safe handling instead of ctype API
This commit is contained in:
parent
567390f59d
commit
2352bea153
|
@ -25,6 +25,7 @@
|
||||||
* Implementation of conversion from DOM tree to box tree.
|
* Implementation of conversion from DOM tree to box tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include <dom/dom.h>
|
#include <dom/dom.h>
|
||||||
|
|
||||||
#include "utils/errors.h"
|
#include "utils/errors.h"
|
||||||
|
@ -967,20 +968,20 @@ box_text_transform(char *s, unsigned int len, enum css_text_transform_e tt)
|
||||||
case CSS_TEXT_TRANSFORM_UPPERCASE:
|
case CSS_TEXT_TRANSFORM_UPPERCASE:
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
if ((unsigned char) s[i] < 0x80)
|
if ((unsigned char) s[i] < 0x80)
|
||||||
s[i] = toupper(s[i]);
|
s[i] = ascii_to_upper(s[i]);
|
||||||
break;
|
break;
|
||||||
case CSS_TEXT_TRANSFORM_LOWERCASE:
|
case CSS_TEXT_TRANSFORM_LOWERCASE:
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
if ((unsigned char) s[i] < 0x80)
|
if ((unsigned char) s[i] < 0x80)
|
||||||
s[i] = tolower(s[i]);
|
s[i] = ascii_to_lower(s[i]);
|
||||||
break;
|
break;
|
||||||
case CSS_TEXT_TRANSFORM_CAPITALIZE:
|
case CSS_TEXT_TRANSFORM_CAPITALIZE:
|
||||||
if ((unsigned char) s[0] < 0x80)
|
if ((unsigned char) s[0] < 0x80)
|
||||||
s[0] = toupper(s[0]);
|
s[0] = ascii_to_upper(s[0]);
|
||||||
for (i = 1; i < len; ++i)
|
for (i = 1; i < len; ++i)
|
||||||
if ((unsigned char) s[i] < 0x80 &&
|
if ((unsigned char) s[i] < 0x80 &&
|
||||||
isspace(s[i - 1]))
|
ascii_is_space(s[i - 1]))
|
||||||
s[i] = toupper(s[i]);
|
s[i] = ascii_to_upper(s[i]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue