-static inline int XMPP_GetUtf8SequenceLength(const char *CharS, const char *CharE)
-{
- /* if this is is migrated to strbuf, remove this copy. */
- int n = 0;
- unsigned char test = (1<<7);
-
- if ((*CharS & 0xC0) != 0xC0)
- return 1;
-
- while ((n < 8) &&
- ((test & ((unsigned char)*CharS)) != 0))
- {
- test = test >> 1;
- n ++;
- }
- if ((n > 6) || ((CharE - CharS) < n))
- n = 0;
- return n;
-}