You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
2.6 KiB

  1. From 8c025865f7cc57761d2227b897ba3980090391c2 Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Mon, 24 Jun 2019 14:13:34 -0700
  4. Subject: [PATCH] Use AM_ICONV for properly supporting libiconv
  5. AM_ICONV does multiple things like checking the function parameters to
  6. avoid const problems.
  7. ---
  8. configure.ac | 1 +
  9. src/Makefile.am | 2 +-
  10. src/objectcontroller.cpp | 2 +-
  11. 3 files changed, 3 insertions(+), 2 deletions(-)
  12. diff --git a/configure.ac b/configure.ac
  13. index 22f242c..23582cb 100644
  14. --- a/configure.ac
  15. +++ b/configure.ac
  16. @@ -10,6 +10,7 @@ PKG_CONFIG=`which pkg-config`
  17. AC_PROG_CXX
  18. AC_PROG_CC
  19. AC_PROG_RANLIB
  20. +AM_ICONV
  21. AC_CHECK_PTHSEM(2.0.4,yes,yes,no)
  22. AC_CHECK_HEADER(argp.h,,[AC_MSG_ERROR([argp_parse not found])])
  23. AC_SEARCH_LIBS(argp_parse,argp,,[AC_MSG_ERROR([argp_parse not found])])
  24. diff --git a/src/Makefile.am b/src/Makefile.am
  25. index 6a4f493..6e0dc03 100644
  26. --- a/src/Makefile.am
  27. +++ b/src/Makefile.am
  28. @@ -7,5 +7,5 @@ B64_CFLAGS=
  29. B64_LIBS=
  30. endif
  31. AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/ticpp $(B64_CFLAGS) $(PTH_CPPFLAGS) $(LIBCURL_CPPFLAGS) $(LOG4CPP_CFLAGS) $(LUA_CFLAGS) $(MYSQL_CFLAGS) $(ESMTP_CFLAGS)
  32. -linknx_LDADD=$(top_srcdir)/ticpp/libticpp.a $(B64_LIBS) $(PTH_LDFLAGS) $(PTH_LIBS) $(LIBCURL) $(LOG4CPP_LIBS) $(LUA_LIBS) $(MYSQL_LIBS) $(ESMTP_LIBS) -lm
  33. +linknx_LDADD=$(top_srcdir)/ticpp/libticpp.a $(LIBICONV) $(B64_LIBS) $(PTH_LDFLAGS) $(PTH_LIBS) $(LIBCURL) $(LOG4CPP_LIBS) $(LUA_LIBS) $(MYSQL_LIBS) $(ESMTP_LIBS) -lm
  34. linknx_SOURCES=linknx.cpp logger.cpp ruleserver.cpp objectcontroller.cpp eibclient.c threads.cpp timermanager.cpp persistentstorage.cpp xmlserver.cpp smsgateway.cpp emailgateway.cpp knxconnection.cpp services.cpp suncalc.cpp luacondition.cpp ioport.cpp ruleserver.h objectcontroller.h threads.h timermanager.h persistentstorage.h xmlserver.h smsgateway.h emailgateway.h knxconnection.h services.h suncalc.h luacondition.h ioport.h logger.h
  35. diff --git a/src/objectcontroller.cpp b/src/objectcontroller.cpp
  36. index fb2fc3a..7622491 100644
  37. --- a/src/objectcontroller.cpp
  38. +++ b/src/objectcontroller.cpp
  39. @@ -2925,7 +2925,7 @@ std::string StringObjectValue::transcode(const std::string &source, const std::s
  40. iconv_t conversionDescriptor = iconv_open((targetEncoding + "//TRANSLIT").c_str(), sourceEncoding.c_str());
  41. char cSource[source.size()];
  42. memcpy(cSource, source.c_str(), source.size() + 1);
  43. - char *sourceStart = &cSource[0];
  44. + ICONV_CONST char *sourceStart = &cSource[0];
  45. size_t sourceLength = source.size();
  46. const size_t targetLength = source.size() * 5; // Should be pretty enough even in worst cases.
  47. char targetChars[targetLength];