* remove "const" from return type of pa_utf8_filter() since it desn't make any sense
authorLennart Poettering <lennart@poettering.net>
Tue, 16 May 2006 00:44:47 +0000 (00:44 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 May 2006 00:44:47 +0000 (00:44 +0000)
* fix pa_utf8_filter() to not skip the next character too if it found an invalid one

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@877 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/polypcore/utf8.c
src/polypcore/utf8.h

index 95b73d5..bb8621e 100644 (file)
@@ -61,7 +61,7 @@ static inline void merge_continuation_char(uint32_t *u_ch, uint8_t ch) {
     *u_ch |= ch & 0x3f;
 }
 
-static const char* utf8_validate (const char *str, char *output) {
+static char* utf8_validate(const char *str, char *output) {
     uint32_t val = 0;
     uint32_t min = 0;
     const uint8_t *p, *last;
@@ -131,7 +131,7 @@ ONE_REMAINING:
 error:
             if (o) {
                 *o = FILTER_CHAR;
-                p = last + 1; /* We retry at the next character */
+                p = last; /* We retry at the next character */
             } else
                 goto failure;
         }
@@ -145,7 +145,7 @@ error:
         return output;
     }
 
-    return str;
+    return (char*) str;
 
 failure:
     return NULL;
@@ -155,7 +155,7 @@ const char* pa_utf8_valid (const char *str) {
     return utf8_validate(str, NULL);
 }
 
-const char* pa_utf8_filter (const char *str) {
+char* pa_utf8_filter (const char *str) {
     char *new_str;
 
     new_str = pa_xnew(char, strlen(str) + 1);
index 5f1fc5d..6d1e4a7 100644 (file)
@@ -23,6 +23,6 @@
 ***/
 
 const char *pa_utf8_valid(const char *str);
-const char *pa_utf8_filter(const char *str);
+char *pa_utf8_filter(const char *str);
 
 #endif