Skip to content
Snippets Groups Projects
Commit d5b7c595 authored by Scott Lahteine's avatar Scott Lahteine Committed by Richard Wackerbarth
Browse files

Use static locals in utf_mapper.h

parent 9bdab4f3
No related branches found
No related tags found
No related merge requests found
...@@ -130,9 +130,10 @@ ...@@ -130,9 +130,10 @@
} }
#elif ENABLED(MAPPER_C2C3) #elif ENABLED(MAPPER_C2C3)
uint8_t utf_hi_char; // UTF-8 high part
bool seen_c2 = false; char charset_mapper(char c) {
char charset_mapper(char c){ static uint8_t utf_hi_char; // UTF-8 high part
static bool seen_c2 = false;
uint8_t d = c; uint8_t d = c;
if ( d >= 0x80 ) { // UTF-8 handling if ( d >= 0x80 ) { // UTF-8 handling
if ( (d >= 0xc0) && (!seen_c2) ) { if ( (d >= 0xc0) && (!seen_c2) ) {
...@@ -160,12 +161,12 @@ ...@@ -160,12 +161,12 @@
} }
#elif ENABLED(MAPPER_D0D1_MOD) #elif ENABLED(MAPPER_D0D1_MOD)
uint8_t utf_hi_char; // UTF-8 high part
bool seen_d5 = false;
char charset_mapper(char c) { char charset_mapper(char c) {
// it is a Russian alphabet translation // it is a Russian alphabet translation
// except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё // except 0401 --> 0xa2 = Ё, 0451 --> 0xb5 = ё
static uint8_t utf_hi_char; // UTF-8 high part
static bool seen_d5 = false;
uint8_t d = c; uint8_t d = c;
if (d >= 0x80) { // UTF-8 handling if (d >= 0x80) { // UTF-8 handling
if (d >= 0xd0 && !seen_d5) { if (d >= 0xd0 && !seen_d5) {
...@@ -197,9 +198,10 @@ ...@@ -197,9 +198,10 @@
} }
#elif ENABLED(MAPPER_D0D1) #elif ENABLED(MAPPER_D0D1)
uint8_t utf_hi_char; // UTF-8 high part
bool seen_d5 = false;
char charset_mapper(char c) { char charset_mapper(char c) {
static uint8_t utf_hi_char; // UTF-8 high part
static bool seen_d5 = false;
uint8_t d = c; uint8_t d = c;
if (d >= 0x80u) { // UTF-8 handling if (d >= 0x80u) { // UTF-8 handling
if (d >= 0xd0u && !seen_d5) { if (d >= 0xd0u && !seen_d5) {
...@@ -227,10 +229,11 @@ ...@@ -227,10 +229,11 @@
} }
#elif ENABLED(MAPPER_E382E383) #elif ENABLED(MAPPER_E382E383)
uint8_t utf_hi_char; // UTF-8 high part
bool seen_e3 = false; char charset_mapper(char c) {
bool seen_82_83 = false; static uint8_t utf_hi_char; // UTF-8 high part
char charset_mapper(char c){ static bool seen_e3 = false;
static bool seen_82_83 = false;
uint8_t d = c; uint8_t d = c;
if (d >= 0x80) { // UTF-8 handling if (d >= 0x80) { // UTF-8 handling
if (d == 0xe3 && !seen_e3) { if (d == 0xe3 && !seen_e3) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment