Browse Source

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

AnHardt 9 years ago
parent
commit
54d35230df
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      Marlin/ultralcd.cpp

+ 10
- 2
Marlin/ultralcd.cpp View File

2481
 int lcd_strlen(const char* s) {
2481
 int lcd_strlen(const char* s) {
2482
   int i = 0, j = 0;
2482
   int i = 0, j = 0;
2483
   while (s[i]) {
2483
   while (s[i]) {
2484
-    if ((s[i] & 0xc0) != 0x80) j++;
2484
+    #ifdef MAPPER_NON
2485
+      j++;
2486
+    #else
2487
+      if ((s[i] & 0xc0) != 0x80) j++;
2488
+    #endif
2485
     i++;
2489
     i++;
2486
   }
2490
   }
2487
   return j;
2491
   return j;
2490
 int lcd_strlen_P(const char* s) {
2494
 int lcd_strlen_P(const char* s) {
2491
   int j = 0;
2495
   int j = 0;
2492
   while (pgm_read_byte(s)) {
2496
   while (pgm_read_byte(s)) {
2493
-    if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
2497
+    #ifdef MAPPER_NON
2498
+      j++; 
2499
+    #else
2500
+      if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
2501
+    #endif
2494
     s++;
2502
     s++;
2495
   }
2503
   }
2496
   return j;
2504
   return j;

Loading…
Cancel
Save