mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 14:13:18 -05:00
Fix utf-16 problems in win32 and unix.
This commit is contained in:
parent
2f83ecb3fc
commit
cab9a1ecd0
@ -382,9 +382,9 @@ static void fmturl(char *buffer, size_t *currlen, size_t maxlen,
|
||||
{
|
||||
int len=0;
|
||||
|
||||
char *current, *dest;
|
||||
char *new_string;
|
||||
int digit1, digit2;
|
||||
unsigned char *current, *dest;
|
||||
unsigned char *new_string;
|
||||
unsigned int digit1, digit2;
|
||||
char *digits = "0123456789abcdef";
|
||||
char *safe = "abcdefghijklmnopqrstuvwxyz"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
@ -295,7 +295,6 @@ int scan_mp3_get_mp3tags(char *file, MP3FILE *pmp3) {
|
||||
int err;
|
||||
int index;
|
||||
int used;
|
||||
int mp3_fd;
|
||||
char *utf8_text;
|
||||
int genre=WINAMP_GENRE_UNKNOWN;
|
||||
int have_utf8;
|
||||
@ -305,13 +304,7 @@ int scan_mp3_get_mp3tags(char *file, MP3FILE *pmp3) {
|
||||
int got_numeric_genre;
|
||||
int rating;
|
||||
|
||||
mp3_fd = open(file,O_RDONLY);
|
||||
if(mp3_fd == -1) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Cannot open %s\n",file);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pid3file=id3_file_fdopen(mp3_fd,ID3_FILE_MODE_READONLY);
|
||||
pid3file=id3_file_open(file,ID3_FILE_MODE_READONLY);
|
||||
if(!pid3file) {
|
||||
DPRINTF(E_WARN,L_SCAN,"Cannot open %s\n",file);
|
||||
return FALSE;
|
||||
|
19
src/util.c
19
src/util.c
@ -87,7 +87,21 @@ int util_utf16toutf8(unsigned char *utf8, int dlen, unsigned char *utf16, int sl
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned char *util_alloc_utf8to16(unsigned char *utf8) {
|
||||
int util_utf16_byte_len(unsigned char *utf16) {
|
||||
unsigned char *src = utf16;
|
||||
int len = 0;
|
||||
|
||||
while(1) {
|
||||
if((src[0] == 0) && (src[1]==0))
|
||||
return len;
|
||||
len += 2;
|
||||
src += 2;
|
||||
}
|
||||
return len; /* ?? */
|
||||
}
|
||||
|
||||
|
||||
unsigned char *util_utf8toutf16_alloc(unsigned char *utf8) {
|
||||
char *utf16;
|
||||
|
||||
utf16 = calloc(1,strlen((char*)utf8) * 4 + 1);
|
||||
@ -99,7 +113,7 @@ unsigned char *util_alloc_utf8to16(unsigned char *utf8) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned char *util_alloc_utf16toutf8(unsigned char *utf16, int slen) {
|
||||
unsigned char *util_utf16toutf8_alloc(unsigned char *utf16, int slen) {
|
||||
char *utf8;
|
||||
|
||||
utf8=calloc(1, slen * 2 + 1);
|
||||
@ -115,6 +129,7 @@ int util_xtoy(unsigned char *dbuffer, int dlen, unsigned char *sbuffer, int slen
|
||||
iconv_t iv;
|
||||
size_t csize;
|
||||
|
||||
memset(dbuffer,0,dlen);
|
||||
iv=iconv_open(to,from);
|
||||
if(iv == (iconv_t)-1) {
|
||||
DPRINTF(E_LOG,L_MISC,"iconv error: iconv_open failed with %d\n",errno);
|
||||
|
@ -46,6 +46,7 @@ extern unsigned char *util_utf16touft8_alloc(unsigned char *utf16, int slen);
|
||||
extern int util_utf8toutf16(unsigned char *utf16, int dlen, unsigned char *utf8, int slen);
|
||||
extern int util_utf16toutf8(unsigned char *utf8, int dlen, unsigned char *utf16, int slen);
|
||||
extern int util_xtoy(unsigned char *dbuffer, int dlen, unsigned char *sbuffer, int slen, char *from, char *to);
|
||||
extern int util_utf16_byte_len(unsigned char *utf16);
|
||||
|
||||
extern void util_hexdump(unsigned char *block, int len);
|
||||
extern char *util_vasprintf(char *fmt, va_list ap);
|
||||
|
@ -63,7 +63,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="zdll.lib libid3tag.lib gnu_regex.lib pthreadVC2.lib ws2_32.lib sqlite3.lib sqlite.lib dnssd.lib libFLAC.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib"
|
||||
AdditionalDependencies="zdll.lib libid3tag.lib gnu_regex.lib pthreadVC2.lib ws2_32.lib sqlite3.lib sqlite.lib dnssd.lib libFLAC.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib iconv.lib"
|
||||
OutputFile="$(OutDir)/mt-daapd.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
@ -144,7 +144,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="zdll.lib libid3tag.lib gnu_regex.lib pthreadVC2.lib ws2_32.lib sqlite3.lib sqlite.lib dnssd.lib libFLAC.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib"
|
||||
AdditionalDependencies="zdll.lib libid3tag.lib gnu_regex.lib pthreadVC2.lib ws2_32.lib sqlite3.lib sqlite.lib dnssd.lib libFLAC.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib iconv.lib"
|
||||
OutputFile="$(OutDir)/mt-daapd.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""
|
||||
|
@ -188,6 +188,8 @@ NoProgramItems:
|
||||
File "${DLL_SOURCE}\avcodec.dll"
|
||||
File "${DLL_SOURCE}\avformat.dll"
|
||||
File "${DLL_SOURCE}\libFLAC.dll"
|
||||
File "${DLL_SOURCE}\iconv.dll"
|
||||
File "${DLL_SOURCE}\charset.dll"
|
||||
|
||||
SetOutPath "$2\plugins"
|
||||
File "${MTD_SOURCE}\rsp.dll"
|
||||
|
Loading…
x
Reference in New Issue
Block a user