aboutsummaryrefslogtreecommitdiffstats
path: root/src/utf8.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-04-13 02:38:09 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-04-13 02:38:09 +0000
commitf765c262754bdb181cffa686c9bdf19b6ae184bb (patch)
tree4542f9c8fa2519b01146054407bddb5e78d9b98c /src/utf8.c
parent375e3ffed496c995383156f9675fa95f145e05bf (diff)
downloadmpd-f765c262754bdb181cffa686c9bdf19b6ae184bb.tar.gz
mpd-f765c262754bdb181cffa686c9bdf19b6ae184bb.tar.xz
mpd-f765c262754bdb181cffa686c9bdf19b6ae184bb.zip
fix a small booboo and add some debugging stuff
git-svn-id: https://svn.musicpd.org/mpd/trunk@708 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/utf8.c')
-rw-r--r--src/utf8.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/utf8.c b/src/utf8.c
index aa427e99b..140316150 100644
--- a/src/utf8.c
+++ b/src/utf8.c
@@ -59,7 +59,7 @@ int validateUtf8Char(unsigned char * utf8Char) {
if(utf8Char[0]>=0xC0 && utf8Char[0]<=0xFD) {
int count = 1;
- unsigned char t = 0x20;
+ unsigned char t = 1 << 5;
int i;
while(count < 6 && (t & utf8Char[0])) {
t = (t >> 1);
@@ -69,7 +69,7 @@ int validateUtf8Char(unsigned char * utf8Char) {
for(i=1;i<=count;i++) {
if(utf8Char[i] < 0x80 || utf8Char[i] > 0xBF) return 0;
}
- return count;
+ return count+1;
}
else return 0;
}
@@ -79,7 +79,7 @@ int validUtf8String(unsigned char * string) {
while(*string) {
ret = validateUtf8Char(string);
- if(!ret) return 0;
+ if(0==ret) return 0;
string+= ret;
}