Fix crash due to libintl on Windows with Visual Studio

This commit is contained in:
François Grisez 2015-07-29 17:23:01 +02:00
parent db1433aba5
commit 2c63fa85b0
3 changed files with 26 additions and 20 deletions

View file

@ -65,15 +65,6 @@
#endif /*_WIN32_WCE*/
#ifdef ENABLE_NLS
#include <libintl.h>
#ifndef _
#define _(String) gettext(String)
#endif
#else
#define _(something) (something)
#endif
#ifndef PACKAGE_DIR
#define PACKAGE_DIR ""
#endif
@ -714,16 +705,6 @@ linphonec_init(int argc, char **argv)
default:
break;
}
#ifdef ENABLE_NLS
if (NULL == bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR))
perror ("bindtextdomain failed");
#ifndef __ARM__
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
textdomain (GETTEXT_PACKAGE);
#else
printf ("NLS disabled.\n");
#endif
linphonec_parse_cmdline(argc, argv);

View file

@ -66,7 +66,20 @@ extern "C" {
#endif
#ifdef ENABLE_NLS
#ifdef _MSC_VER
// prevent libintl.h from re-defining fprintf and vfprintf
#ifndef fprintf
#define fprintf fprintf
#endif
#ifndef vfprintf
#define vfprintf vfprintf
#endif
#define _GL_STDIO_H
#endif
#include <libintl.h>
#ifndef _
#define _(String) dgettext(GETTEXT_PACKAGE,String)
#endif

View file

@ -31,13 +31,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "ldap/ldapprovider.h"
#ifdef ENABLE_NLS
#ifdef _MSC_VER
// prevent libintl.h from re-defining fprintf and vfprintf
#ifndef fprintf
#define fprintf fprintf
#endif
#ifndef vfprintf
#define vfprintf vfprintf
#endif
#define _GL_STDIO_H
#endif
# include <libintl.h>
# undef _
# define _(String) dgettext (GETTEXT_PACKAGE,String)
#else
# define _(String) (String)
# define ngettext(singular,plural,number) ((number>1) ? (plural) : (singular) )
#endif
#endif // ENABLE_NLS
#undef N_
#define N_(str) (str)