mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 16:25:03 -05:00
Add unicode_fixup_mfi() to check & reencode UTF-8 fields in struct media_file_info
This commit is contained in:
parent
da0c10a392
commit
35d6ac4cfa
34
src/db.c
34
src/db.c
@ -351,6 +351,40 @@ free_mfi(struct media_file_info *mfi, int content_only)
|
|||||||
free(mfi);
|
free(mfi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
unicode_fixup_mfi(struct media_file_info *mfi)
|
||||||
|
{
|
||||||
|
char *ret;
|
||||||
|
char **field;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < (sizeof(mfi_cols_map) / sizeof(mfi_cols_map[0])); i++)
|
||||||
|
{
|
||||||
|
if (mfi_cols_map[i].type != DB_TYPE_STRING)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (mfi_cols_map[i].offset)
|
||||||
|
{
|
||||||
|
case mfi_offsetof(path):
|
||||||
|
case mfi_offsetof(fname):
|
||||||
|
case mfi_offsetof(codectype):
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
field = (char **) ((char *)mfi + mfi_cols_map[i].offset);
|
||||||
|
|
||||||
|
if (!*field)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ret = unicode_fixup_string(*field);
|
||||||
|
if (ret != *field)
|
||||||
|
{
|
||||||
|
free(*field);
|
||||||
|
*field = ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
free_pli(struct playlist_info *pli, int content_only)
|
free_pli(struct playlist_info *pli, int content_only)
|
||||||
{
|
{
|
||||||
|
3
src/db.h
3
src/db.h
@ -268,6 +268,9 @@ free_pi(struct pairing_info *pi, int content_only);
|
|||||||
void
|
void
|
||||||
free_mfi(struct media_file_info *mfi, int content_only);
|
free_mfi(struct media_file_info *mfi, int content_only);
|
||||||
|
|
||||||
|
void
|
||||||
|
unicode_fixup_mfi(struct media_file_info *mfi);
|
||||||
|
|
||||||
void
|
void
|
||||||
free_pli(struct playlist_info *pli, int content_only);
|
free_pli(struct playlist_info *pli, int content_only);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user