summaryrefslogtreecommitdiffstats
path: root/mp_msg.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-24 02:31:29 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-24 02:31:29 +0000
commit35e90f1556475ee205dee6c253b788ab073133c0 (patch)
treec566ed05c11f4da49b1282534d28c6ce6db2648a /mp_msg.c
parentb7e160dbe9a0a60ee2e6124e71f0a8653d1c7432 (diff)
downloadmpv-35e90f1556475ee205dee6c253b788ab073133c0.tar.bz2
mpv-35e90f1556475ee205dee6c253b788ab073133c0.tar.xz
The fix in mp_msg.c avoids a core dump when iconv_open() fails, the other
just makes it possible to compile if USE_ICONV is undefined. Patch by Bjorn Sandell (biorn _At_ chalmers _Dot_ se). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17932 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mp_msg.c')
-rw-r--r--mp_msg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mp_msg.c b/mp_msg.c
index 8439b141d8..5ab75f062c 100644
--- a/mp_msg.c
+++ b/mp_msg.c
@@ -102,6 +102,10 @@ void mp_msg(int mod, int lev, const char *format, ... ){
msgiconv = iconv_open(mp_msg_charset, MSG_CHARSET);
old_charset = strdup(mp_msg_charset);
}
+ if (msgiconv == (iconv_t)(-1)) {
+ fprintf(stderr,"iconv: conversion from %s to %s unsupported\n"
+ ,mp_msg_charset,MSG_CHARSET);
+ }else{
memset(tmp2, 0, MSGSIZE_MAX);
while (iconv(msgiconv, &in, &inlen, &out, &outlen) == -1) {
if (!inlen || !outlen)
@@ -112,6 +116,7 @@ void mp_msg(int mod, int lev, const char *format, ... ){
strncpy(tmp, tmp2, MSGSIZE_MAX);
tmp[MSGSIZE_MAX-1] = 0;
tmp[MSGSIZE_MAX-2] = '\n';
+ }
}
#endif