Don't use UTF-strlen() if the text is not UTF

This commit is contained in:
AnHardt 2016-07-12 19:59:03 +02:00
parent a1de96d152
commit 54d35230df

View file

@ -2481,7 +2481,11 @@ void lcd_init() {
int lcd_strlen(const char* s) { int lcd_strlen(const char* s) {
int i = 0, j = 0; int i = 0, j = 0;
while (s[i]) { while (s[i]) {
if ((s[i] & 0xc0) != 0x80) j++; #ifdef MAPPER_NON
j++;
#else
if ((s[i] & 0xc0) != 0x80) j++;
#endif
i++; i++;
} }
return j; return j;
@ -2490,7 +2494,11 @@ int lcd_strlen(const char* s) {
int lcd_strlen_P(const char* s) { int lcd_strlen_P(const char* s) {
int j = 0; int j = 0;
while (pgm_read_byte(s)) { while (pgm_read_byte(s)) {
if ((pgm_read_byte(s) & 0xc0) != 0x80) j++; #ifdef MAPPER_NON
j++;
#else
if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
#endif
s++; s++;
} }
return j; return j;