* remove "const" from return type of pa_utf8_filter() since it desn't make any sense

* 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
This commit is contained in:
Lennart Poettering 2006-05-16 00:44:47 +00:00
parent 23e74545ad
commit e8cc63d756
2 changed files with 5 additions and 5 deletions

View file

@ -61,7 +61,7 @@ static inline void merge_continuation_char(uint32_t *u_ch, uint8_t ch) {
*u_ch |= ch & 0x3f; *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 val = 0;
uint32_t min = 0; uint32_t min = 0;
const uint8_t *p, *last; const uint8_t *p, *last;
@ -131,7 +131,7 @@ ONE_REMAINING:
error: error:
if (o) { if (o) {
*o = FILTER_CHAR; *o = FILTER_CHAR;
p = last + 1; /* We retry at the next character */ p = last; /* We retry at the next character */
} else } else
goto failure; goto failure;
} }
@ -145,7 +145,7 @@ error:
return output; return output;
} }
return str; return (char*) str;
failure: failure:
return NULL; return NULL;
@ -155,7 +155,7 @@ const char* pa_utf8_valid (const char *str) {
return utf8_validate(str, NULL); return utf8_validate(str, NULL);
} }
const char* pa_utf8_filter (const char *str) { char* pa_utf8_filter (const char *str) {
char *new_str; char *new_str;
new_str = pa_xnew(char, strlen(str) + 1); new_str = pa_xnew(char, strlen(str) + 1);

View file

@ -23,6 +23,6 @@
***/ ***/
const char *pa_utf8_valid(const char *str); const char *pa_utf8_valid(const char *str);
const char *pa_utf8_filter(const char *str); char *pa_utf8_filter(const char *str);
#endif #endif