diff --git a/src/bsd-snprintf.c b/src/bsd-snprintf.c
index 97a3ab23..a5a744d1 100644
--- a/src/bsd-snprintf.c
+++ b/src/bsd-snprintf.c
@@ -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"
diff --git a/src/scan-mp3.c b/src/scan-mp3.c
index eefaf481..6636d25d 100644
--- a/src/scan-mp3.c
+++ b/src/scan-mp3.c
@@ -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;
diff --git a/src/util.c b/src/util.c
index e1635616..5fc62851 100644
--- a/src/util.c
+++ b/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);
diff --git a/src/util.h b/src/util.h
index 4053e096..ff601ac8 100644
--- a/src/util.h
+++ b/src/util.h
@@ -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);
diff --git a/win32/mt-daapd.vcproj b/win32/mt-daapd.vcproj
index cdb40c6b..19d105d7 100644
--- a/win32/mt-daapd.vcproj
+++ b/win32/mt-daapd.vcproj
@@ -63,7 +63,7 @@
/>