Skip to content

Commit

Permalink
apply patches for gcc 7
Browse files Browse the repository at this point in the history
Apply this pull request.
smartdevicelink/sdl_core#1851

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
  • Loading branch information
phongt committed Dec 29, 2017
1 parent 7bd8d28 commit 9406b23
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
From e3eb08f0d75d616a70655a1d7145444876919211 Mon Sep 17 00:00:00 2001
From: asanoaozora <fifitaneki@hotmail.com>
Date: Thu, 9 Nov 2017 15:27:49 +0100
Subject: [PATCH 1/2] fix bugs to allow build with gcc 7.2.0 under Ubuntu 17.10

---
src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/locationinfo.cpp | 4 ++--
src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/loggingevent.cpp | 4 ++--
.../apache-log4cxx-0.10.0/src/main/cpp/objectoutputstream.cpp | 8 ++++----
.../apache-log4cxx-0.10.0/src/test/cpp/xml/domtestcase.cpp | 4 ++--
src/components/application_manager/src/policies/policy_handler.cc | 2 +-
src/components/security_manager/src/ssl_context_impl.cc | 2 +-
6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/locationinfo.cpp b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/locationinfo.cpp
index e74d015..e72b630 100644
--- a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/locationinfo.cpp
+++ b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/locationinfo.cpp
@@ -148,7 +148,7 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
if (lineNumber == -1 && fileName == NA && methodName == NA_METHOD) {
os.writeNull(p);
} else {
- char prolog[] = {
+ unsigned char prolog[] = {
0x72, 0x00, 0x21, 0x6F, 0x72, 0x67, 0x2E,
0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6C,
0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69,
@@ -161,7 +161,7 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67,
0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
0x78, 0x70 };
- os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, prolog, sizeof(prolog), p);
+ os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, (char *)prolog, sizeof(prolog), p);
char* line = p.itoa(lineNumber);
//
// construct Java-like fullInfo (replace "::" with ".")
diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/loggingevent.cpp b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/loggingevent.cpp
index 1faae3f..15e06e6 100644
--- a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/loggingevent.cpp
+++ b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/loggingevent.cpp
@@ -254,7 +254,7 @@ void LoggingEvent::setProperty(const LogString& key, const LogString& value)


void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p) {
- char classDesc[] = {
+ unsigned char classDesc[] = {
0x72, 0x00, 0x21,
0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63,
0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A,
@@ -310,7 +310,7 @@ void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p) {
0x3B, 0x78, 0x70 };

os.writeProlog("org.apache.log4j.spi.LoggingEvent",
- 8, classDesc, sizeof(classDesc), p);
+ 8, (char *) classDesc, sizeof(classDesc), p);
}

void LoggingEvent::write(helpers::ObjectOutputStream& os, Pool& p) const {
diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/objectoutputstream.cpp b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/objectoutputstream.cpp
index 7cd696b..83eede1 100644
--- a/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/objectoutputstream.cpp
+++ b/src/3rd_party/apache-log4cxx-0.10.0/src/main/cpp/objectoutputstream.cpp
@@ -36,8 +36,8 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
objectHandle(0x7E0000),
classDescriptions(new ClassDescriptionMap())
{
- char start[] = { 0xAC, 0xED, 0x00, 0x05 };
- ByteBuffer buf(start, sizeof(start));
+ unsigned char start[] = { 0xAC, 0xED, 0x00, 0x05 };
+ ByteBuffer buf((char*)start, sizeof(start));
os->write(buf, p);
}

@@ -81,7 +81,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
//
// TC_OBJECT and the classDesc for java.util.Hashtable
//
- char prolog[] = {
+ unsigned char prolog[] = {
0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
@@ -90,7 +90,7 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49,
0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68,
0x6F, 0x6C, 0x64, 0x78, 0x70 };
- writeProlog("java.util.Hashtable", 1, prolog, sizeof(prolog), p);
+ writeProlog("java.util.Hashtable", 1, (char *) prolog, sizeof(prolog), p);
//
// loadFactor = 0.75, threshold = 5, blockdata start, buckets.size = 7
char data[] = { 0x3F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/test/cpp/xml/domtestcase.cpp b/src/3rd_party/apache-log4cxx-0.10.0/src/test/cpp/xml/domtestcase.cpp
index a500628..1f98e0b 100644
--- a/src/3rd_party/apache-log4cxx-0.10.0/src/test/cpp/xml/domtestcase.cpp
+++ b/src/3rd_party/apache-log4cxx-0.10.0/src/test/cpp/xml/domtestcase.cpp
@@ -190,7 +190,7 @@ public:
DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase3.xml"));
LOG4CXX_INFO(logger, "File name is expected to end with a superscript 3");
#if LOG4CXX_LOGCHAR_IS_UTF8
- const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xC2, 0xB3, 0 };
+ const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, (logchar)0xC2, (logchar)0xB3, 0 };
#else
const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xB3, 0 };
#endif
@@ -209,7 +209,7 @@ public:
DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase4.xml"));
LOG4CXX_INFO(logger, "File name is expected to end with an ideographic 4");
#if LOG4CXX_LOGCHAR_IS_UTF8
- const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xE3, 0x86, 0x95, 0 };
+ const logchar fname[] = { 0x6F, (logchar)0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, (logchar)0xE3, (logchar)0x86, (logchar)0x95, 0 };
#else
const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0x3195, 0 };
#endif
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index e6ebaf3..1045a39 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1768,7 +1768,7 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
void PolicyHandler::OnPTUFinished(const bool ptu_result) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(listeners_lock_);
- HandlersCollection::const_iterator it = listeners_.begin();
+// HandlersCollection::const_iterator it = listeners_.begin();
std::for_each(
listeners_.begin(),
listeners_.end(),
diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc
index 5be5ff8..0b30198 100644
--- a/src/components/security_manager/src/ssl_context_impl.cc
+++ b/src/components/security_manager/src/ssl_context_impl.cc
@@ -280,7 +280,7 @@ bool CryptoManagerImpl::SSLContextImpl::WriteHandshakeData(
if (ret <= 0) {
is_handshake_pending_ = false;
ResetConnection();
- return Handshake_Result_AbnormalFail;
+ return false;
}
}
return true;
--
2.7.4

24 changes: 24 additions & 0 deletions recipes-automotive/sdl-core/sdl-core/0002-remove-unused-code.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 27c2d76e159964b5d1c155e09277fd51eaa6adeb Mon Sep 17 00:00:00 2001
From: asanoaozora <fifitaneki@hotmail.com>
Date: Fri, 10 Nov 2017 08:30:12 +0100
Subject: [PATCH 2/2] remove unused code

---
src/components/application_manager/src/policies/policy_handler.cc | 1 -
1 file changed, 1 deletion(-)

diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 1045a39..a1af8d2 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1768,7 +1768,6 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
void PolicyHandler::OnPTUFinished(const bool ptu_result) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(listeners_lock_);
-// HandlersCollection::const_iterator it = listeners_.begin();
std::for_each(
listeners_.begin(),
listeners_.end(),
--
2.7.4

2 changes: 2 additions & 0 deletions recipes-automotive/sdl-core/sdl-core_4.4.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ SRC_URI_append = " \
file://0005-add-env-for-log4cxx-properties-path.patch \
file://0006-Install-the-configure-file-to-sysconf-dir.patch \
file://0007-Add-standard-usr-lib-path-to-rpath.patch \
file://0001-fix-bugs-to-allow-build-with-gcc-7.2.0-under-Ubuntu-.patch \
file://0002-remove-unused-code.patch \
file://smartdevicelink.service \
"

Expand Down

0 comments on commit 9406b23

Please sign in to comment.