From 9cc601b321b3fac05a6657c861cbba6effe55088 Mon Sep 17 00:00:00 2001 From: mrwastl Date: Fri, 3 Jun 2011 18:33:22 +0200 Subject: code beautifying, preparations for debugging encodedCharAdjustCounter() --- glcdgraphics/common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'glcdgraphics/common.c') diff --git a/glcdgraphics/common.c b/glcdgraphics/common.c index 7bfcc74..8d6e8f6 100644 --- a/glcdgraphics/common.c +++ b/glcdgraphics/common.c @@ -10,6 +10,7 @@ */ #include +#include #include "common.h" @@ -58,8 +59,11 @@ std::string trim(const std::string & s) } -// character to return when erraneous utf-8 sequence (for now: '_') -#define UTF8_ERRCODE 0x005F +// character to return when erraneous utf-8 sequence (for now: space) +#define UTF8_ERRCODE 0x0020 +// for debugging issues return '_' instead: +//#define UTF8_ERRCODE 0x005F + void encodedCharAdjustCounter(const bool isutf8, const std::string & str, uint32_t & c, unsigned int & i) { if (i >= str.length()) @@ -72,7 +76,6 @@ void encodedCharAdjustCounter(const bool isutf8, const std::string & str, uint32 c1 = (i+1 < str.length()) ? str[i+1] : 0; c2 = (i+2 < str.length()) ? str[i+2] : 0; c3 = (i+3 < str.length()) ? str[i+3] : 0; - //c0 &=0xff; c1 &=0xff; c2 &=0xff; c3 &=0xff; if ( (c0 & 0x80) == 0x00) { // one byte: 0xxxxxxx -- cgit v1.2.3