diff options
author | Max Kellermann <max@duempel.org> | 2008-08-29 09:39:01 +0200 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-02 00:20:16 -0700 |
commit | 55e297674f35a90ea9f2deeda2267e8520f1f414 (patch) | |
tree | 6bc5c32f51d2dcf1ac77bb9b17eb522da2f1e163 | |
parent | 07c4a01f9fa55b620c9bf87a4e64e45de22b7e5f (diff) | |
download | mpd-55e297674f35a90ea9f2deeda2267e8520f1f414.tar.gz mpd-55e297674f35a90ea9f2deeda2267e8520f1f414.tar.xz mpd-55e297674f35a90ea9f2deeda2267e8520f1f414.zip |
tag: pass length to fix_utf8()
Same as the previous patch, prepare the function fix_utf8() this time.
Diffstat (limited to '')
-rw-r--r-- | src/tag.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -347,17 +347,18 @@ int tag_equal(struct mpd_tag *tag1, struct mpd_tag *tag2) return 1; } -static inline char *fix_utf8(char *str) { +static inline char *fix_utf8(char *str, size_t *length_r) { char *temp; assert(str != NULL); - if (validUtf8String(str, strlen(str))) + if (validUtf8String(str, *length_r)) return str; DEBUG("not valid utf8 in tag: %s\n",str); temp = latin1StrToUtf8Dup(str); free(str); + *length_r = strlen(temp); return temp; } @@ -370,7 +371,7 @@ static void appendToTagItems(struct mpd_tag *tag, enum tag_type type, memcpy(duplicated, value, len); duplicated[len] = '\0'; - duplicated = fix_utf8(duplicated); + duplicated = fix_utf8(duplicated, &len); stripReturnChar(duplicated); tag->numOfItems++; |