From b10a0f789e2f37cd80d9c50eaecd47f6e0957e43 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 27 Dec 2019 14:56:32 +0900 Subject: [PATCH] Fix build error due to toolchain upgrade Change-Id: I5abfecae1d02032730a50a1a10e831ed8632e1ab Signed-off-by: Jihoon Kim --- ism/src/Makefile.am | 1 + ism/src/isf_remote_control.cpp | 2 +- ism/src/ltdl.cpp | 24 +++++++++++++++--------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ism/src/Makefile.am b/ism/src/Makefile.am index 549650e..c58b149 100644 --- a/ism/src/Makefile.am +++ b/ism/src/Makefile.am @@ -106,6 +106,7 @@ libsciminclude_HEADERS = scim.h \ noinst_LTLIBRARIES = libltdlc.la libprivilege_checker.la libprofile.la libisf_pkg.la libltdlc_la_SOURCES = ltdl.cpp +libltdlc_la_CXXFLAGS= -Wno-unused-function libltdlc_la_LIBADD = $(LIBADD_DL) libprivilege_checker_la_SOURCES = privilege_checker.cpp diff --git a/ism/src/isf_remote_control.cpp b/ism/src/isf_remote_control.cpp index bffc1bd..57b3d20 100644 --- a/ism/src/isf_remote_control.cpp +++ b/ism/src/isf_remote_control.cpp @@ -468,7 +468,7 @@ EXAPI int remote_control_send_key_event(remote_control_client *client, remote_co return error_e; } - char key_str[10] = {}; + char key_str[12] = {}; snprintf(key_str, sizeof(key_str), "%d", key); String command = String ("|plain|send_key_event|") + String (key_str) + String ("|"); diff --git a/ism/src/ltdl.cpp b/ism/src/ltdl.cpp index 5aecd6c..6547075 100644 --- a/ism/src/ltdl.cpp +++ b/ism/src/ltdl.cpp @@ -297,7 +297,7 @@ strdup(const char *str) tmp = LT_DLMALLOC (char, 1+ strlen (str)); if (tmp) { - strncpy(tmp, str, 1+ strlen (str)); + strncpy(tmp, str, sizeof(tmp)-1); } } @@ -387,7 +387,7 @@ strrchr(const char *str, int ch) /* NOTE: Neither bcopy nor the memcpy implementation below can reliably handle copying in overlapping areas of memory. Use - memmove (for which there is a fallback implmentation below) + memmove (for which there is a fallback implementation below) if you need that behaviour. */ #if ! HAVE_MEMCPY @@ -403,9 +403,12 @@ memcpy (lt_ptr dest, const lt_ptr src, size_t size) { size_t i = 0; + unsigned char *dest1 = (unsigned char *)dest; + unsigned char *src1 = (unsigned char *)src; + for (i = 0; i < size; ++i) { - dest[i] = src[i]; + dest1[i] = src1[i]; } return dest; @@ -424,15 +427,18 @@ memmove (lt_ptr dest, const lt_ptr src, size_t size) { size_t i; + unsigned char *dest1 = (unsigned char *)dest; + unsigned char *src1 = (unsigned char *)src; + if (dest < src) for (i = 0; i < size; ++i) { - dest[i] = src[i]; + dest1[i] = src1[i]; } else if (dest > src) for (i = size -1; i >= 0; --i) { - dest[i] = src[i]; + dest1[i] = src1[i]; } return dest; @@ -2678,7 +2684,7 @@ find_file_callback ( if ((*pfile = fopen (filename, LT_READTEXT_MODE))) { - char *dirend = strrchr (filename, '/'); + char *dirend = const_cast(strrchr (filename, '/')); if (dirend) *dirend = LT_EOS_CHAR; @@ -3025,7 +3031,7 @@ try_dlopen ( /* If the canonical module name is a path (relative or absolute) then split it into a directory part and a name part. */ - base_name = strrchr (canonical, '/'); + base_name = const_cast(strrchr (canonical, '/')); if (base_name) { size_t dirlen = (1+ base_name) - canonical; @@ -3223,7 +3229,7 @@ try_dlopen ( errors += trim (&dlname, &line[sizeof (STR_LIBRARY_NAMES) - 1]); if (!errors && dlname - && (last_libname = strrchr (dlname, ' ')) != 0) + && (last_libname = const_cast(strrchr (dlname, ' '))) != 0) { last_libname = lt_estrdup (last_libname + 1); if (!last_libname) @@ -3402,7 +3408,7 @@ lt_dlopenext ( assert (filename); len = LT_STRLEN (filename); - ext = strrchr (const_cast(filename), '.'); + ext = const_cast(strrchr (const_cast(filename), '.')); /* If FILENAME already bears a suitable extension, there is no need to try appending additional extensions. */ -- 2.7.4