X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-common%2Futf8.c;h=ab10ba06a05238ab8c505fb43939f13c9fb75387;hb=60e78c0afb11eaafbdbe974a7d42751029afff83;hp=f52ce552ac62d747c54caf2529f793b71cefe4e1;hpb=9541ceb22b5ecd525e16a318b95329a38240a7a4;p=catta diff --git a/avahi-common/utf8.c b/avahi-common/utf8.c index f52ce55..ab10ba0 100644 --- a/avahi-common/utf8.c +++ b/avahi-common/utf8.c @@ -1,5 +1,3 @@ -/* $Id */ - /* This file is based on the GLIB utf8 validation functions. The * original license text follows. */ @@ -37,8 +35,8 @@ (((Char) & 0xFFFFF800) != 0xD800) && \ ((Char) < 0xFDD0 || (Char) > 0xFDEF) && \ ((Char) & 0xFFFE) != 0xFFFE) - - + + #define CONTINUATION_CHAR \ do { \ if ((*(const unsigned char *)p & 0xc0) != 0x80) /* 10xxxxxx */ \ @@ -60,11 +58,8 @@ avahi_utf8_valid (const char *str) { if (*(const unsigned char *)p < 128) /* done */; - else + else { - const char *last; - - last = p; if ((*(const unsigned char *)p & 0xe0) == 0xc0) /* 110xxxxx */ { if ( ((*(const unsigned char *)p & 0x1e) == 0)) @@ -88,7 +83,7 @@ avahi_utf8_valid (const char *str) } else goto error; - + p++; CONTINUATION_CHAR; TWO_REMAINING: @@ -96,16 +91,16 @@ avahi_utf8_valid (const char *str) CONTINUATION_CHAR; p++; CONTINUATION_CHAR; - + if ( (val < min)) goto error; if ( (!UNICODE_VALID(val))) goto error; - } - + } + continue; - + error: return NULL; }