--- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -104,6 +104,12 @@ int gettimeofday(struct timeval *tv, str /***************/ #endif /* WIN32 */ +#if defined(FS_STABLE_ICONV_INBUF_CONST) +#define ICONV_INBUF_TYPE const char ** +#else +#define ICONV_INBUF_TYPE char ** +#endif + int gsmopen_serial_init(private_t *tech_pvt, int controldevice_speed) { if (!tech_pvt) @@ -2521,11 +2527,7 @@ int ucs2_to_utf8(private_t *tech_pvt, ch DEBUGA_GSMOPEN("1 ciao in=%s, inleft=%d, out=%s, outleft=%d, converted=%s, utf8_out=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out); -#ifdef WIN32 - iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#else // WIN32 - iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#endif // WIN32 + iconv_res = iconv(iconv_format, (ICONV_INBUF_TYPE)&inbuf, &inbytesleft, &outbuf, &outbytesleft); if (iconv_res == (size_t) -1) { DEBUGA_GSMOPEN("2 ciao in=%s, inleft=%d, out=%s, outleft=%d, converted=%s, utf8_out=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out); @@ -2560,11 +2562,7 @@ int utf8_to_iso_8859_1(private_t *tech_p DEBUGA_GSMOPEN("in=%s, inleft=%d, out=%s, outleft=%d, utf8_in=%s, iso_8859_1_out=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_in, iso_8859_1_out); -#ifdef WIN32 - iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#else // WIN32 - iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#endif // WIN32 + iconv_res = iconv(iconv_format, (ICONV_INBUF_TYPE)&inbuf, &inbytesleft, &outbuf, &outbytesleft); if (iconv_res == (size_t) -1) { DEBUGA_GSMOPEN("cannot translate in iso_8859_1 error: %s (errno: %d)\n", GSMOPEN_P_LOG, strerror(errno), errno); return -1; @@ -2597,11 +2595,7 @@ int iso_8859_1_to_utf8(private_t *tech_p } inbytesleft = strlen(iso_8859_1_in) * 2; -#ifdef WIN32 - iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#else // WIN32 - iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#endif // WIN32 + iconv_res = iconv(iconv_format, (ICONV_INBUF_TYPE)&inbuf, &inbytesleft, &outbuf, &outbytesleft); if (iconv_res == (size_t) -1) { DEBUGA_GSMOPEN("ciao in=%s, inleft=%d, out=%s, outleft=%d, utf8_out=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_out); @@ -2642,11 +2636,7 @@ int utf8_to_ucs2(private_t *tech_pvt, ch DEBUGA_GSMOPEN("in=%s, inleft=%d, out=%s, outleft=%d, utf8_in=%s, converted=%s\n", GSMOPEN_P_LOG, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, utf8_in, converted); -#ifdef WIN32 - iconv_res = iconv(iconv_format, (const char **) &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#else // WIN32 - iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft); -#endif // WIN32 + iconv_res = iconv(iconv_format, (ICONV_INBUF_TYPE)&inbuf, &inbytesleft, &outbuf, &outbytesleft); if (iconv_res == (size_t) -1) { ERRORA("error: %s %d\n", GSMOPEN_P_LOG, strerror(errno), errno); return -1;