iconv fixes for linux

This commit is contained in:
Ron Pedde 2007-09-04 05:11:43 +00:00
parent 5e69ba1a35
commit 9246bfe59e

View File

@ -6,6 +6,7 @@
# include "config.h" # include "config.h"
#endif #endif
#include <errno.h>
#include <pthread.h> #include <pthread.h>
#ifdef HAVE_STDINT_H #ifdef HAVE_STDINT_H
@ -140,8 +141,11 @@ int util_xtoy(unsigned char *dbuffer, int dlen, unsigned char *sbuffer, int slen
iconv_t iv; iconv_t iv;
size_t csize; size_t csize;
/* type punning warnings */
size_t st_dlen = dlen; size_t st_dlen = dlen;
size_t st_slen = slen; size_t st_slen = slen;
char *st_dbuffer = dbuffer;
ICONV_CONST char *st_sbuffer = sbuffer;
memset(dbuffer,0,dlen); memset(dbuffer,0,dlen);
@ -150,8 +154,8 @@ int util_xtoy(unsigned char *dbuffer, int dlen, unsigned char *sbuffer, int slen
DPRINTF(E_LOG,L_MISC,"iconv error: iconv_open failed with %d\n",errno); DPRINTF(E_LOG,L_MISC,"iconv error: iconv_open failed with %d\n",errno);
} }
csize = iconv(iv,(const char **)&sbuffer,&st_slen, csize = iconv(iv,&st_sbuffer,&st_slen,
(char **)&dbuffer,&st_dlen); &st_dbuffer,&st_dlen);
if(csize == (size_t)-1) { if(csize == (size_t)-1) {
switch(errno) { switch(errno) {
case EILSEQ: case EILSEQ: